akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt64(scanner)
	m := getNextInt64(scanner)

	// (n+x)*2<=(m-x*2) n*2+4*x<=m
	if m >= n*2 {
		n += (m - n*2) / 4
	} else {
		n = m >> 1
	}

	fmt.Fprintln(writer, n)

	writer.Flush()
}


Measured memory_bytes: 640
#include "iostream"
using namespace std;

int main()
{
	for (int i = 1; i < 10; i++)
	{
		for (int j = 1; j < 10; j++)
		{
			cout << i << 'x' << j << '=' << i * j << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define ll long long
using namespace std;

int main() {
    int a, b, c, d, p;
    cin >> a >> b >> c >> d >> p;
    int A = a * p, B;
    if(p <= c)
        B = b;
    else {
        int o = p - c;
        B = b + o * d;
    }

    if(A >= B)
        cout << B << endl;
    else
        cout << A << endl;
}



Measured memory_bytes: 3076
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main implements Runnable {
	public static void main(String[] args) {
		new Main().solve();
	}

	public void run() {
		new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[m];
		int[] b = new int[m];
		ArrayList<Integer>[] g = new ArrayList[n];
		for (int i = 0; i < g.length; ++i)
			g[i] = new ArrayList<>();
		for (int i = 0; i < m; ++i) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			--a[i];
			--b[i];
			g[a[i]].add(b[i]);
			g[b[i]].add(a[i]);
		}
		int[] col = new int[n];
		Arrays.fill(col, -1);
		col[0] = 0;
		boolean f = isBibartite(0, col, g);
		if (!f) {
			System.out.println((long) n * (n - 1) / 2 - m);
		} else {
			long u = 0;
			long v = 0;
			for (int i = 0; i < n; ++i) {
				if (col[i] == 0)
					++u;
				else
					++v;
			}
			System.out.println(u * v - m);
		}
	}

	boolean isBibartite(int cur, int[] col, ArrayList<Integer>[] g) {
		boolean ret = true;
		for (int dst : g[cur]) {
			ret &= col[cur] != col[dst];
			if (col[dst] == -1) {
				col[dst] = col[cur] ^ 1;
				ret &= isBibartite(dst, col, g);
			}
		}
		return ret;
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 107080
#include <bits/stdc++.h>
using namespace std;

int main(){
  string s,t; cin>>s>>t;
  int n=s.size();
  int a[26],b[26];
  for(int i=0;i<26;i++){
    a[i]=0; b[i]=0;
  }
  for(int i=0;i<n;i++){
    int x=s[i]-'a',y=t[i]-'a';
    a[y]++; b[x]++;
    if(a[y]!=b[x]){
      cout<<"No"<<endl;
      return 0;
    }
  }cout<<"Yes"<<endl;
}

Measured memory_bytes: 776
/*suri_kumkaran*/

#include <bits/stdc++.h>

using namespace std;

#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long

typedef long long int64;
typedef vector<int> VI64;
typedef vector<pair<int,int>> VII64;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;

int32_t main()
{
	IOS;
	int T=1;
	//cin>>T;
	while(T--)
	{
		long double l;
		cin>>l;
		l/=3;
		long double ans=l*l*l;
		cout << fixed << setprecision(10)<<ans;
	}

	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

a, b = inpl()
c = a-1
d = b-1
print((d+c-1)//c)

Measured memory_bytes: 3944
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define endl "\n"
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }

typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    cini(n);
    cini(k);
    cinai(h, n);

    int ans=0;
    for(int i=0; i<n; i++) {
        if(h[i]>=k)
            ans++;
    }

    cout<<ans<<endl;

}



Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.C
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var S = ReadText();
            S = S.Replace("eraser", "");
            S = S.Replace("erase", "");
            S = S.Replace("dreamer", "");
            S = S.Replace("dream", "");
            return S == "" ? "YES" : "NO";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 26876
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <map>
using namespace std;

int main(){
    string s;
    int ans=0, count=0;
    cin >> s;
    for(int i=0; i<s.length(); i++){
        if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
            count++;
        }
        else{
            if(ans<count){
                ans=count;
            }
            count=0;
        }
    }
    if(ans<count){
        ans=count;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
try:
    while(True):
        a, b, c, d, e, f = map(int, input().split())
        A = [[e/(a*e-b*d), (-1)*b/(a*e-b*d)],[(-1)*d/(a*e-b*d), a/(a*e-b*d)]]
        Y = [c, f]
        X = [(A[0][0]*Y[0] + A[0][1]*Y[1]), (A[1][0]*Y[0] + A[1][1]*Y[1])]
        for i in range(2):
            print('{:.3f}'.format(X[i]), end="")
            if i == 1:
                print("")
            else:
                print(" ", end="")
except:
    pass


Measured memory_bytes: 5624
<?php
While ($line = fgets(STDIN) ) {
    $a[] = trim($line);
}
$stdin = explode(" ", "0 ".$a[1] );
$ans = array_fill(0, $a[0]+1, 0);

$ans_M = 0;
for($key=$a[0]; $key>0; $key--){
  $sum = 0;
  for($ai=$key; $ai<=$a[0]; $ai+=$key){
    $sum += $ans[$ai];
  }
  if($stdin[$key]==$sum%2){
    $ans[$key]=0;
  }else{
    $ans[$key]=1;
    $ans_M++; 
  }
}

//回答表示
if($ans_M%2 != $stdin[1]){
  echo -1;
}else{
  echo $ans_M,PHP_EOL;
  for($i=1; $i<=$a[0]; $i++){
    if($ans[$i]==1){
      echo $i." ";
    }
  }
}

Measured memory_bytes: 68200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main()
{
    int A, B, C;
    vector<int> Ans;
    cin >> A >> B >> C;
    Ans.push_back(A);
    Ans.push_back(B);
    Ans.push_back(C);
    sort(Ans.begin(), Ans.end());
    bool one = Ans[0] == Ans[1] && Ans[1] == Ans[2];
    bool two = Ans[0] != Ans[1] && Ans[1] != Ans[2] && Ans[2] != Ans[0];
    if (one || two)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 764
#include <bits/stdc++.h>

#define uint        unsigned int
#define ld          long double
#define int         long long
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        400005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int md = 998244353;

/*const int mod = 998244353;
int power(int a,int n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n/2))%mod)%mod;
    return power((a*a)%mod,n/2)%mod;
}
*/


signed main()
{
    showoff;
    int n,m;
    cin >> n >> m;
    vector<int>v(m+5);
    FOR(i,0,m)cin >> v[i];
    sort(v.begin(),v.begin()+m);
    if(n >= m){cout << 0;return 0;}
    vector<int>a;
    FOR(i,0,m-1){
    a.pb(-1*(v[i+1]-v[i]));
    //cout << -1*(v[i+1]-v[i]) << " ";
    }
    int tot = 0;
    sort(a.begin(),a.end());
    FOR(i,n-1,sz(a)){
    tot -= a[i];
    }
    cout << tot;
    return 0;
}
//*->for large size of matrix take int not long long ......


Measured memory_bytes: 2168
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  int n;cin>>n;
  vector<bool> prime(55556, true);
  for(int i=2; i<=int(sqrt(55555));i++){
  	for(int j=i*2;j<=55555;j+=i){
      prime[j]=false;
    }
  }
  int cnt=0;
  for(int i=11;i<=55555;i+=5){
    if(!prime[i])continue;
    cout<<i<<" ";cnt++;
    if(cnt>=n)break;
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
#include <fstream>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ

  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  // ll INF = INT_MAX;
  // ll mod = 1000000007;
  // lld PI = 3.141592653;
 
// const int N = 2e5 + 5;


  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      // ifstream cin("input.txt");

     int n,k;
     cin>>n>>k;
     vector<int> a(n);
     for (int i = 0;i<n;i++) cin>>a[i];
      vector<ll> pref(n);
   
    pref[0] = a[0];
    for (int i = 1;i<n;i++) pref[i] = pref[i-1] + a[i];
       lld ans = lld((k+pref[k-1]))/2;
    for (int i = k;i<n;i++){
      ll sum = pref[i] - pref[i-k];
      ans = max(ans, (lld(k)+sum)/2);
    }
cout<<setprecision(20)<<ans<<"\n";
}

Measured memory_bytes: 5260
def chess(h,w):
  if (h+w) % 2 == 0:
    return '#'
  return '.'

while True:
  H, W = map(int,input().split())
  if H == 0 and W == 0:
    break
  for i in range(H):
    for j in range(W):
      print(chess(i,j), end='')
    print()
  print()


Measured memory_bytes: 7008
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>
inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

int main(){
    //llで入力
    ll a,intb;cin>>a;
    
    //doubleで入力
    double b;cin>>b;

    //bを整数として処理する
    b+=0.005;
    b*=100;
    intb=(int)(b);

    cout<<(a*intb)/100<<endl;
    return 0;
}

Measured memory_bytes: 3708
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC152A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, c;
            string[] str = Console.ReadLine().Split(' ');
            a = int.Parse(str[0]);
            c = int.Parse(str[1]);
            if (a == c)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
s.find_by_order(x) xth element in set
x.order_of_key(x) number of elements <x*/
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) (int)s.size()
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
const int MOD=1e9+7;
void solve()
{
fastio
int n;
cin>>n;
int a[n];
int sum=0;
for(auto &x:a)
{
	cin>>x;
	sum+=x;
}
int sum1=0;
int ans=INT_MAX;
for(int i=0;i<n;i++)
{
	sum1+=a[i];
	ans=min(ans,abs(sum-sum1-sum1));
}
cout<<ans;
}
int main()
{
//code
fastio
int t;
t=1;
while(t--)
{
solve();
cout<<endl;
}
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>

using namespace std;


// Bismilahir Rahmanir Rahim


typedef unsigned int ui;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef short int si;
typedef unsigned short int usi;
typedef pair <int, int> pii;


#define CASE false
#define TEST false
#define BUFFER true
#define TIME false
#define DEBUG true
#define SET_GEN false
#define _ << " " <<
#define __ << "\n"
#define ff first
#define ss second
#define RANGE(a, b) (rand() % (b-a+1) + a)


const double pi = acos(-1.);
const double eps = 1e-7;
const int high = 2e9;
const int inf = 2147483647;
const int _inf = -2147483648;
const lli INF = 1e18;
const int mod = 1e9+7;


void delay(int sec); // DEBUG


void solution(void)
{	
	string s, t;
	
	cin >> s >> t;
	int lens = s.length();
	int lent = t.length();
	
	vector <vector <int>> dp(lens+1, vector <int> (lent+1));
	
	for(int i = 0; i < lens; ++i) {
		for(int j = 0; j < lent; ++j) {
			if (s[i] == t[j]) dp[i+1][j+1] = dp[i][j]+1;
			else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
		}
	}
	
	vector <char> lcs;
	
	int i = lens-1, j = lent-1;
	
	while (i >= 0 && j >= 0) {
		if (s[i] == t[j]) {
			lcs.push_back(s[i]);
			i--;
			j--;
		}
		else if (dp[i][j+1] > dp[i+1][j]) i--;
		else j--;
	}
	
	reverse(lcs.begin(), lcs.end());
	
	i = lcs.size();
	for(int j = 0; j < i; ++j) cout << lcs[j];
	cout << '\n';
	

    return ;
}

int main(int argc, char *arv[])
{
    #if BUFFER
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #endif

    #if SET_GEN
    srand((unsigned int) time(0));
    #endif

    int t = 1;

    #if CASE
    int cnt = 1;
    #endif

    #if TEST
    cin >> t;
    #endif

    #if TIME
    clock_t start_time, end_time;
    double time_elapsed;
    #endif


    while(t--) {

        #if TIME
        start_time = clock();
        #endif

        #if CASE
        cout << "Case " << cnt++ << ": ";
        #endif

        solution();

        #if TIME
        end_time = clock();

        time_elapsed = (double) (end_time - start_time) / CLOCKS_PER_SEC;

        cout << "\nRuntime: " << fixed << setprecision(7) << time_elapsed << "\n";
        #endif
    }


    return 0;
}

void delay(int sec)
{
    int mili_sec = 1000 * sec;

    clock_t start_time = clock();

    while (clock() < start_time + mili_sec);

    return ;
}


Measured memory_bytes: 38460
#include <iostream>
#include <vector>
using namespace std;

class DisjointSet {
public:
  vector<int> rank, p;

  DisjointSet() {}

  DisjointSet(int size) {
    rank.resize(size, 0);
    p.resize(size, 0);
    for ( int i = 0; i < size; i++ ) makeSet(i);
  }

  void makeSet(int x) {
    p[x] = x;;
    rank[x] = 0;
  }

  bool same(int x, int y) {
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y) {
    link(findSet(x), findSet(y));
  }

  void link(int x, int y) {
    if ( rank[x] > rank[y] ) {
      p[y] = x;
    } else {
      p[x] = y;
      if ( rank[x] == rank[y] ) {
        rank[y]++;
      }
    }
  }

  int findSet(int x) {
    if ( x != p[x] ) {
      p[x] = findSet(p[x]);
    }
    return p[x];
  }
};

int main() {
  int n, a, b, q;
  int t;

  cin >> n >> q;
  DisjointSet ds = DisjointSet(n);

  for ( int i = 0; i < q; i++ ) {
    cin >> t >> a >> b;
    if ( t == 0 ) ds.unite(a, b);
    else if ( t == 1 ) {
      if ( ds.same(a, b) ) cout << 1 << endl;
      else cout << 0 << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100010;
int a[MAXN],n,cnt,sum;
int read(){
    int f=1,x=0;
    char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0';ch=getchar();}
    return f*x;
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+n+1);
    for(int i=1;i<=n-1;i++) sum+=a[i];
    cout<<sum+a[n]/2;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio();
    cin.tie(0);
  long long int n;
  cin>>n;
  long long int a[n-1];
  int i;
  int b[n+1];
  memset(b,0,sizeof(b));
  for(i=0;i<n-1;i++)
  {
    cin>>a[i];
    b[a[i]]++;
  }
  for(i=1;i<=n;i++)
  {
      cout<<b[i]<<"\n";
  }


  return 0;
}



Measured memory_bytes: 5932
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
 	ll n;
 	cin>>n;
	ll wt;
	cin>>wt;
	ll w[n],v[n];
	for(ll i=0;i<n;i++)
	cin>>w[i]>>v[i];
	ll dp[wt+1][n+1];
	for(ll i=0;i<n;i++)
	dp[0][i]=0;
	for(ll i=0;i<=wt;i++)
	dp[i][0]=0;
	for(ll i=0;i<=wt;i++)
	{
		for(ll j=1;j<=n;j++)
		{
			if(w[j-1]<=i)
			dp[i][j]=max(dp[i][j-1],dp[i-w[j-1]][j-1]+v[j-1]);	
			else
			dp[i][j]=dp[i][j-1];
		}
	}
	cout<<dp[wt][n];
}



Measured memory_bytes: 79104
d,m=1e9+7,p[10001][200]={1};i,k,x,I;char s[11111];main(j,L){for(scanf("%s%d",s,&d);s[i+=j^=1];)for(x=L=j?9:s[i]-48,k=0;~x;x-=++k/d,k%=d)p[i+1][I=(j|x<L)*d+(k+x)%d]+=p[i][j*d+k],p[i+1][I]%=m;printf("%d",(*p[i]+p[i][d]-1+m)%m);}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  vector<vi> grid(2, vi(n));
  rep(i, 2) rep(j, n) std::cin >> grid[i][j];
  vector<vi> cnt(2, vi(n));
  rep(i, 2) rep(j, n) {
    cnt[i][j] = grid[i][j];
    if (i > 0) chmax(cnt[i][j], cnt[i-1][j] + grid[i][j]);
    if (j > 0) chmax(cnt[i][j], cnt[i][j-1] + grid[i][j]);
  }
  std::cout << cnt[1][n-1] << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

vector<int> v[100010];
bool vis[100010];
int ans, n, m, dist[100010];

int dfs(int u)
{
    vis[u] = 1;
    int sum = 1, maxv = 0;
    for (int i = 0; i < v[u].size(); i++)
    {
        int val;
        if (dist[v[u][i]] == 0)
            val = dfs(v[u][i]);
        else
            val = dist[v[u][i]];
        maxv = max(maxv, val);
    }
    sum += maxv;
    dist[u] = sum;
    return sum;
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= m; i++)
    {
        int x, y;
        cin >> x >> y;
        v[x].push_back(y);
    }
    for (int i = 1; i <= n; i++)
    {
        if (!vis[i])
        {
            ans = max(ans, dfs(i));
        }
    }
    cout << ans - 1 << endl;
    return 0;
}

Measured memory_bytes: 8320
def solve(N,K):
    #方針
    #a mod K == a'(a' != 0)のとき
    #b mod K == c mod K == -a'
    #(b+c) mod K == -2a'
    #これで上手くいく(-2a' mod K == 0)のはKが偶数のときのみ
    if K % 2 != 0:
        return (N // K) ** 3
    else:
        return (N // K) ** 3 + ((N + K // 2) // K) ** 3

def main():
    N,K = map(int,input().split())

    print(solve(N,K))

if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int n,m;
vector<int> bfs(vector<vector<pair<int,int>>> &tree,int from, int to){
  vector<bool> d(n,true);
  queue<pair<int,vector<int>>> que;
  que.push({from,{}});
  d[from]=false;
  while(1){
    auto p=que.front();
    que.pop();
    if(p.first==to) return p.second;
    for(auto q:tree[p.first]){
      if(d[q.first]){
        d[q.first]=false;
        p.second.push_back(q.second);
        que.push({q.first,p.second});
        p.second.pop_back();
      }
    }
  }
  return {};
}
int main(){
  cin >> n;
  vector<vector<pair<int,int>>> tree(n);
  for(int i=0;i<n-1;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    tree[a].push_back({b,i});
    tree[b].push_back({a,i});
  }
  cin >> m;
  vector<pair<int,int>> c(m);
  for(int i=0;i<m;i++){
    cin >> c[i].first >> c[i].second;
    c[i].first--;
    c[i].second--;
  }
  vector<vector<int>> comp(m);
  for(int i=0;i<m;i++) comp[i] = bfs(tree,c[i].first,c[i].second);
  vector<vector<long long>> dp(n,vector<long long> ((1<<m),0));
  dp[0][0]=1;
  for(int i=0;i<n-1;i++){
    long long bit=0;
    for(int j=0;j<m;j++){
      for(auto k:comp[j]){
        if(i==k){
          bit += (1<<j);
          break;
        }
      }
    }
    for(long long j=0;j<(1<<m);j++){
      dp[i+1][j]+=dp[i][j];
      dp[i+1][j|bit]+=dp[i][j];
    }
  }
  cout << dp[n-1][(1<<m)-1] << endl;
}

Measured memory_bytes: 418176
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

import numpy as np
N = ri()
A = np.array(ri_())

print(3 ** N - np.prod(np.where(A % 2 == 0, 2, 1)))

Measured memory_bytes: 27212
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const double PI = acos(-1);
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	double a, b, h, m;
	cin >> a >> b >> h >> m;
	double gosa  = (m/60.0)*30.0;
	double kakudo = (double)abs(30*h+gosa - 6*m);
	double sita = (kakudo / 180.000)*PI;
	double ans = sqrt(a*a+b*b-2*a*b*cos(sita));
	printf("%.15f", ans);
	return 0;
}


Measured memory_bytes: 4140
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int ans = 0;
int N, M, Q;
vector<int> a, b, c, d;
void dfs(vector<int> num, int len) {
    if (len == N) {
        int cand = 0;
        for (int i = 0; i < Q; i++) {
            if (num[b[i]-1] - num[a[i]-1] == c[i]) cand += d[i];
        }
        ans = max(ans, cand);
        return;
    }
    int first = 1;
    if (len >= 1) first = num[len-1];
    for (int i = first; i <= M; i++) {
        vector<int> nnum = num;
        nnum.push_back(i);
        dfs(nnum, len+1);
    }
    return;
}

int main() {
    cin >> N >> M >> Q;
    a.resize(Q);
    b.resize(Q);
    c.resize(Q);
    d.resize(Q);
    for (int i = 0; i < Q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs({}, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
$PI=2*atan2 1,0;
($x1,$y1,$x2,$y2)=glob<>;
($xl,$xr)=sort{$a-$b}$x1,$x2;
($yl,$yr)=sort{$a-$b}$y1,$y2;
<>;
@y=map{s/.* //r}sort{$a-$b}grep{/ /;$xl<=$`&&$`<=$xr&&$yl<=$'&&$'<=$yr}<>;
if($xl==$xr||$yl==$yr){
	print 100*($xr-$xl+$yr-$yl)+@y*10*($PI-2)
}else{
	@y=reverse@y if($x1-$x2)*($y1-$y2)<0;
	@d=-inf;
	for(@y){
		for($l=0,$r=@d;$m=$l+$r>>1,$r-$l>1;){
			${$d[$m]<$_?l:r}=$m;
		}
		$d[$m+1]=$_;
	}
	if($xr-$xl+1==$#d||$yr-$yl+1==$#d){
		print 100*($xr-$xl+$yr-$yl)+($#d-1)*5*($PI-4)+10*($PI-2)
	}else{
		print 100*($xr-$xl+$yr-$yl)+$#d*5*($PI-4)
	}
}


Measured memory_bytes: 57724
#include <bits/stdc++.h>
using namespace std;

int main(){
  int W,H,N;
  cin >> W >> H >> N;
  
  vector<vector<int>> xy(W,vector<int>(H,0));
  vector<int> x(N);
  vector<int> y(N);
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> x.at(i) >> y.at(i) >> a.at(i);
    
    if(a.at(i)==1){
      for(int j=0;j<x.at(i);j++){
        for(int k=0;k<H;k++){
          xy.at(j).at(k) ++;
        }
      }
    }    
    if(a.at(i)==2){
      for(int j=x.at(i);j<W;j++){
        for(int k=0;k<H;k++){
          xy.at(j).at(k) ++;
        }
      }
    }
    if(a.at(i)==3){
      for(int j=0;j<W;j++){
        for(int k=0;k<y.at(i);k++){
          xy.at(j).at(k) ++;
        }
      }
    }    
    if(a.at(i)==4){
      for(int j=0;j<W;j++){
        for(int k=y.at(i);k<H;k++){
          xy.at(j).at(k) ++;
        }
      }
    }
  }
  
  int cnt = 0;
  for(int i=0;i<W;i++){
    for(int j=0;j<H;j++){
      if(xy.at(i).at(j) == 0){
        cnt++;
      }
    }
  }
  
  

  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int N,i,j,t=0;
    cin>>N;
    string s[N];
    for(i=0;i<N;i++){
        cin>>s[i];
    }
    for(i=N-1;i>=1;i--){
        if(s[i][0]!=s[i-1][s[i-1].size()-1]){
            t=1;
            break;
        }
        for(j=i-1;j>=0;j--){
            if(s[i]==s[j]){
                t=1;
                break;
            }
        }
    }
    if(t==1){
        cout<<"No";
    }else{
        cout<<"Yes";
    }
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
/* テンプレートここまで */

int main() {
  int H, W; cin >> H >> W;
  vector<string> grid(H);
  REP(i, H) cin >> grid[i];

  int sharp = 0;
  REP(i, H) REP(j, W){
    if(grid[i][j] == '#') sharp++;
  }

  int d[2] = {1, 0};

  queue<pair<int,int> > q;
  q.push({0,0});

  int sharp_cnt = 0;
  while(!q.empty()){
    auto from = q.front();
    q.pop();
    sharp_cnt++;

    int xx = from.first;
    int yy = from.second;

    if(xx== H-1 && yy == W - 1){
      break;
    }

    int cnt = 0;

    REP(i, 2){
      int x = xx + d[i];
      int y = yy + d[i^1];

      if(x < 0 || x > H-1 || y < 0 || y > W-1 || grid[x][y] == '.'){
        continue;
      }
      q.push({x,y});
      cnt++;
    }

    if(cnt != 1) break;
  }

  if(sharp_cnt == sharp){
    cout << "Possible" << endl;
  }else{
    cout << "Impossible" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
	string A,B;cin>>A>>B;
	A=A+B;
	int G=stoi(A);
	for(int i=1;i<=1000;i++){
		if(i*i==G) {
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
K = int(input())

strN = str(N)
maxD = len(strN)

dp = [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)]
dp[0][0][0] = 1
for d, Nd in enumerate(strN):
    Nd = int(Nd)
    for isLeN in range(2):
        for m in range(K+1):
            x = 0
            if not isLeN and x > Nd: continue
            isLeN2 = isLeN or x < Nd
            dp[d+1][isLeN2][m] += dp[d][isLeN][m]
            for x in range(1, 10):
                if not isLeN and x > Nd: continue
                isLeN2 = isLeN or x < Nd
                m2 = m+1
                if m2 > K: continue
                dp[d+1][isLeN2][m2] += dp[d][isLeN][m]
#    print(d+1, Nd, dp[d+1])

#print(dp[-1])
print(dp[-1][0][K]+dp[-1][1][K])


Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
  int n,count[100002]={0};
  long long a[100005],ans=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%lld",&a[i]);
    if(a[i]>n){
      ans++;
    }else{
      count[a[i]]++;
    }
  }

  for(int i=1;i<=n;i++){
    if(count[i]<i){
      ans+=count[i];
         }else{
      ans+=count[i]-i;
    }
  }
  printf("%lld",ans);

    return 0;
}


Measured memory_bytes: 2904
#include<bits/stdc++.h>
 
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define cin_pl(n,x) rep(i,n){cin>>x[i];}
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > matrix;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef greater<int> gi;
typedef vector<unsigned> vu;


ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
bool is_prime(const unsigned n){
    switch(n){
        case 0:
        case 1: return false;
        case 2: return true;
    }
 
 
    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }
 
    return true;
}

int main()
{
    int a,b;
    cin>>a>>b;
    b%a==0?cout<<a+b:cout<<abs(a-b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

const char a[] = {'(', '['};
const char b[] = {')', ']'};

int main () {
    string str;
    while (getline(cin, str), str.size() > 1) {
        stack<char> s;
        bool ans = true;
        for (int i = 0; i < str.size(); i++) {
            if ('a' > str[i] || str[i] > 'z') {
                if (str[i] == a[0] || str[i] == a[1]) {
                    s.push(str[i]);
                } else if (str[i] == b[0] || str[i] == b[1]) {
                    if (s.empty()) {
                        ans = false; break;
                    } else if (str[i] == b[0] && s.top() == a[0]) {
                        s.pop();
                    } else if (str[i] == b[1] && s.top() == a[1]) {
                        s.pop();
                    } else {
                        ans = false; break;
                    }
                }
            }
        }
        if (s.size() != 0) ans = false;

        cout << (ans ? "yes" : "no") << endl;
    }

    return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
    using namespace std;
     
    #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
    #define int long long
    #define ppi pair<int, int>
    #define endl "\n"
    #define nl cout << "\n"
    #define deb(x) cout << #x << " " << x << endl;
     
    const int N = 1010;
    const int mod = 1e9 + 7;
    int H, W;
    char grid[N][N];
     
    // dp[i][j] = #Ways to reach from (i, j) to (H, W)
    int dp[N][N];
     
    int Top_Down(int x = 1, int y = 1) {
        // Base Case
        if(x == H && y == W) return (dp[x][y] = 1);
        // Choice
        if(dp[x][y] != -1) return dp[x][y];
        int ways = 0;
        if(x <= H && grid[x+1][y] == '.') ways += Top_Down(x+1, y)%(mod);
        if(y <= W && grid[x][y+1] == '.') ways += Top_Down(x, y+1)%(mod);
        return (dp[x][y]=ways%(mod));
    }
     
    int32_t main() {
        IOS;
        memset(dp, -1, sizeof(dp));
        cin >> H >> W;
        for(int i = 1; i <= H; ++i) 
            for(int j = 1; j <= W; ++j) {
                cin >> grid[i][j];
            }
        for(int i = 1; i <= H; ++i){
            for(int j = 1; j <= W; ++j)
                if((i == H and j == W) and grid[i][j]=='.') dp[i][j] = 1;
        }
        cout << Top_Down()%(mod) << endl;
    }

Measured memory_bytes: 12696
#include <bits/stdc++.h>

using namespace std;

int main(){
    int K;
    cin >> K;
    int ans = 0;
    for(int a=1;a<=K;a++){
        for(int b=1;b<=K;b++){
            for(int c=1;c<=K;c++){
                ans += __gcd(a, __gcd(b, c));
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,a,b;
int main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	if(a>b)swap(a,b);
	if((b-a)%2==0)printf("%lld\n",(b-a)/2);
	else printf("%lld\n",min((a+b-1)/2,(2*n-a-b+1)/2));
	return 0;
 } 

Measured memory_bytes: 128
import sys

ans=[]    
def sumint(lp,ttl):
    if (ttl > lp*9) | (ttl < 0):
        return 0
    elif lp == 1:
        return 1
    else:
        a = 0
        for n in range(0,10) :
            a += sumint(lp - 1,ttl - n)
        return a

for i in sys.stdin:
    ans.append(sumint(4,int(i)))
print('\n'.join(map(str,ans)))

Measured memory_bytes: 7732
fn main() {
    proconio::input! {
        s: proconio::marker::Chars,
    }
    let mut max = 0;
    let mut count = 0;
    for c in s {
        if c == 'R' {
            count += 1;
            if max < count {
                max = count;
            }
        } else {
            count = 0;
        }
    }
    println!("{}", max);
}


Measured memory_bytes: 2160
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define pob(x) pop_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin()+n)
// #define int long long
#define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const int INF = -1;
ll dp[100005][13];

signed main(void) {
	int N;
	cin >> N;

	vector<int> A;
	vector<int> B;
	vector<int> C;

	rep(i, N) {
		int tmp;
		cin >> tmp;
		tmp--;
		A.pb(tmp);
	}

	rep(i, N) {
		int tmp;
		cin >> tmp;
		B.pb(tmp);
	}

	rep(i, N-1) {
		int tmp;
		cin >> tmp;
		C.pb(tmp);
	}

	ll ans = 0;
	rep(i, N) {
		ans += B[A[i]];
		if (i != 0) {
			if (A[i-1]+1 == A[i]) {
				ans += C[A[i-1]];
			}
		}
		// cout << ans << endl;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Char
import Data.Int
import Data.Foldable
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Debug.Trace

solve :: Int -> Int -> Double
solve !n !k = (/ fromIntegral n) $ sum (map (\i -> 1 / (2 ^ funcM i)) [1 .. n])
  where funcM i = head $ dropWhile (\t -> i * 2 ^ t < k) [0 ..]

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  (n, k) <-
    (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 readInt <$> B.getLine
  print $ solve n k


Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 200000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, R;
    int d[200][200];
    cin >> N >> M >> R;
    int r[R];
    rep(i, R) {
        cin >> r[i];
        r[i]--;
    }
    rep(i, 200) {
        rep(j, 200) {
            if (i != j) d[i][j] = INF;
        }
    }
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        d[a][b] = c;
        d[b][a] = c;
    }
    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    sort(r, r+R);
    int d_m = INF;
    do {
        int tmp = 0;
        rep(i, R-1) {
            //dump(tmp);
            tmp += d[r[i]][r[i+1]];
        }
        d_m = min(d_m, tmp);
    }while(next_permutation(r, r + R));
    cout << d_m << endl;


    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
import java.math.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		//int a = sc.nextInt();
		// スペース区切りの整数の入力
		//int b = sc.nextInt();
		//int c = sc.nextInt();
		// 文字列の入力
		//String s = sc.next();
		//1文字ずつ
		//s.atChar(i);
		// 出力
		//System.out.println("");
		
		int N=sc.nextInt();
		//int B=sc.nextInt();
		int[] a=new int[N];
		int dif=-1;
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i-1<N;i++){
			for(int j=i+1;j<N;j++){
				int newdif=Math.abs(a[i]-a[j]);
				if(newdif>dif){
					dif=newdif;
				}
			}
		}
		System.out.println(dif);
			
		}
		
	
	
}

Measured memory_bytes: 23764
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s; cin>>s;
    int n = s.size();

    string pre = "", cur = "";
    int ans = 0;
    for(int i=0; i<n; i++){
        cur += s[i];
        if(cur != pre){
            ans++;
            pre = cur;
            cur = "";
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <sstream>
#include <map>

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    int out = 0;
    for(int i = 0; i < s.length(); i++) {
        if(s[i] != t[i])
            out++;
    }
    cout << out;


}

Measured memory_bytes: 3884
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll Z=0;
string s;
cin>>s;
ll rui=0;
ll a=0;
ll f=0;
ll s1=s.size();
ll b[s1+1]={};
ll c[s1+1]={};
for (ll i=1;i<=s1;i++){
if(s.at(i-1)=='1'){
a++;}
else{
a--;}
b[i]=a;
c[i]=a;
Z=max(Z,a);}
for (ll i=s1-1;i>0;i--){
b[i]=max(b[i],b[i+1]);}
for (ll i=1;i<=s1;i++){
if(s.at(i-1)=='1'){
rui++;}
else if(s.at(i-1)=='0'){
rui--;}
else{
if(rui-c[i-1]+b[i]+2<=Z){
rui++;}
else{
rui--;}}
f=min(f,rui);}
ll Z1=Z+1;
ll f1=0;
rui=0;
for (ll i=1;i<=s1;i++){
if(s.at(i-1)=='1'){
rui++;}
else if(s.at(i-1)=='0'){
rui--;}
else{
if(rui+b[i]-c[i-1]+2<=Z1){
rui++;}
else{
rui--;}}
f1=min(f1,rui);}
ll ans=min(Z-f,Z1-f1);
cout<<ans<<endl;}


Measured memory_bytes: 20084
def main():
    while True:
        
        head_d = input()
        head_d = head_d.split(" ")
        for i in range(len(head_d)):
            head_d[i] = int(head_d[i])
        if head_d == [0, 0, 0]:
            return

        s_num = head_d[0]
        n_min = head_d[1]
        n_max = head_d[2]
        s_dat = []

        for i in range(s_num):
            s_dat.append(int(input()))

        answer = showpnum(n_min, n_max, s_dat)
        print(answer)


def showpnum(n_min, n_max, s_dat):
    max_dist = 0
    for i in range(n_max - n_min + 1):
        i = i + n_min - 1
        dist = s_dat[i] - s_dat[i + 1]
        if dist >= max_dist:
            max_dist = dist
            pnum = i + 1

    return pnum
    
main()



Measured memory_bytes: 5616
#include<stdio.h>
int main()
{
    int tall[100000],i,count=0,K,N;
    scanf("%d %d",&N,&K);
    for(i=0;i<N;i++)
    {
        scanf("%d",&tall[i]);
    }
    for(i=0;i<N;i++)
    {
        if(tall[i]>=K)
        {
            count++;
        }
    }
    printf("%d",count);
    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;


int main() {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    string ans = "No";
    while(A>0 && C>0){
        if(B>=C){
            ans = "Yes";
            break;
        }
        else if(D>=A){
            break;
        }
        else{
            C-=B;
            A-=D;
        }
    }   
    cout << ans << endl;     
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>

int main(){
    constexpr long long mod=998244353;
    int N,S;std::cin>>N>>S;
    using ll = long long;
    std::vector<std::vector<std::vector<ll>>> dp(N+1,std::vector<std::vector<ll>>(S+1,std::vector<ll>(3)));
    std::vector<int> A(N);
    for(int i=0;i<N;++i) std::cin>>A[i];
    dp[0][0][0]=1;
    for(int i=0;i<N;++i) for(int s=0;s<=S;++s){
        dp[i+1][s][0]=dp[i][s][0];
        dp[i+1][s][1]=dp[i][s][1];
        dp[i+1][s][2]=dp[i][s][2];
        if(s>=A[i]){
            dp[i+1][s][1]+=(i+1)*dp[i][s-A[i]][0]+dp[i][s-A[i]][1];
            dp[i+1][s][2]+=(N-i)*dp[i][s-A[i]][1]+(N-i)*(i+1)*dp[i][s-A[i]][0];
        }
        for(int j=0;j<3;++j) dp[i+1][s][j]%=mod;
    }
    std::cout<<dp[N][S][2]<<std::endl;
}

Measured memory_bytes: 493056
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;

typedef pair<int, int> P;

const int inf = 1e9;

struct E{
    int to, cost;
};

int n, m, c, s, g;
int d[20][100][100];
int k[20];
int p[20][51];
int q[20][50];
vector<E> gr[100];
int dd[100];

void calc_d(){
    rep(a, c){
        rep(k, n){
            rep(i, n){
                rep(j, n){
                    d[a][i][j] = min(d[a][i][k] + d[a][k][j], d[a][i][j]);
                }
            }
        }
    }
}

int cost(int i, int d){
    int s = 0;
    rep(j, k[i]){
        s += q[i][j] * max(min(d, p[i][j + 1]) - p[i][j], 0);
    }
    return s;
}

void calc_gr(){
    rep(i, c){
        rep(j, n){
            rep(k, n){
                if(d[i][j][k] != inf){
                    E e = {k, cost(i, d[i][j][k])};
                    gr[j].push_back(e);
                }
            }
        }
    }
}

int dijkstra(){
    fill_n(dd, n, inf);

    priority_queue<P, vector<P>, greater<P>> q;
    dd[s] = 0;
    q.push(P(0, s));
    while(!q.empty()){
        P v = q.top();
        q.pop();
        if(v.first > dd[v.second]){
            continue;
        }
        for(E& e: gr[v.second]){
            if(dd[e.to] > v.first + e.cost){
                dd[e.to] = v.first + e.cost;
                q.push(P(dd[e.to], e.to));
            }
        }
    }

    return dd[g] != inf ? dd[g] : -1;
}

int main(){
    while(1){
        cin >> n >> m >> c >> s >> g;
        if(n == 0){
            break;
        }
        --s;
        --g;
        rep(i, c){
            rep(j, n){
                fill_n(d[i][j], n, inf);
                d[i][j][j] = 0;
            }
        }
        rep(i, m){
            int x, y, a, c;
            cin >> x >> y >> a >> c;
            a = min(a, d[c - 1][x - 1][y - 1]);
            d[c - 1][x - 1][y - 1] = a;
            d[c - 1][y - 1][x - 1] = a;
        }
        rep(i, c){
            cin >> k[i];
        }
        rep(i, c){
            p[i][0] = 0;
            rep(j, k[i] - 1){
                cin >> p[i][j + 1];
            }
            p[i][k[i]] = inf;
            rep(j, k[i]){
                cin >> q[i][j];
            }
        }

        calc_d();
        calc_gr();

        cout << dijkstra() << endl;

        rep(i, 100){
            gr[i].clear();
        }
    }
    return 0;
}

Measured memory_bytes: 5424
#include <bits/stdc++.h>
#define X first
#define Y second
#define LL long long
#define MP make_pair
#define PB push_back
#define SZ(a) (int)(a.size())
const int INF = 1000 * 1000 * 1000 + 47;
using namespace std;
int n;
int h [1000005];
int cnt = 0;
int ans = 0;
int main() 
{
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> h[i];
	}
	h[n] = INF;
	for(int i = n - 1; i >= 0; i--)
	{
		cnt = 1 + (h[i] >= h[i + 1]) * cnt;
		ans = max(ans , cnt);
	}
	cout << ans - 1;
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <list>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;//print
typedef long long ll;
using namespace std;


int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    ll x,t;
    cin >> x>> t;
    ll ans = x-t;
    if(ans>0){
        P(ans);
    }else{
        P(0);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define puts(i) cout<<i
int main(){
	int n;
	cin>>n;
	int b[n-1];
	ll sum=0;
	rep(i,n-1){
		cin>>b[i];
		if(i>0){
			sum+=min(b[i],b[i-1]);
		}else{
			sum+=b[i];
		}
	}
	sum+=b[n-2];
	puts(sum);
}


Measured memory_bytes: 256