akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<ll> Size;
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1);
        for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        Size[x] += Size[y];
        return true;
    }

    ll size(int x){
        return Size[root(x)];
    }
};

//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    UnionFind uni(100050);
    for(int i = 1; i <= M; i++) {
        int X, Y, Z;
        cin >> X >> Y >> Z;
        uni.merge(X, Y);
    }
    int ans = 0;
    for(int i = 1; i <= N; i++) {
        if(uni.root(i) == i) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
//#define uint __int128_t
 
#define pb emplace_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int N;
string s;
int dp[5050][5050];

ll mod_pow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % MOD;
		x = x * x % MOD;
		n >>= 1;
	}
	return res;
}

int mod_inv(int x)
{
	return mod_pow(x, MOD - 2);
}
 
signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>N>>s;
    dp[0][0]=1;
    rep(i,0,N){
        rep(j,0,N){
            if(dp[i][j]==0)continue;
            (dp[i+1][j+1]+=2*dp[i][j])%=MOD;
            (dp[i+1][max(0ll,j-1)]+=dp[i][j])%=MOD;
        }
    }
    cout<<dp[N][(int)s.size()]*mod_inv(mod_pow(2,(int)s.size()))%MOD<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 197120
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    std::string S, T;
    char ch;
    std::cin >> S >> T;
    if (S == T)
    {
        std::cout << "Yes" << std::endl;
        return 0;
    }

    for (int i = 0; i < S.size(); i++)
    {
        ch = S[S.size() - 1];
        S = ch + S.substr(0, S.size() - 1);
        if (S == T)
        {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    std::cout << "No" << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define REP(i, n) for(long long i = 0; i < (n); ++i)

template <typename T> void chmax (T& a, T b) { if (a < b) a = b; }

int main () {
  int K, S;
  std::cin >> K >> S;
  int result = 0;
  REP(X, K + 1) {
      REP(Y, K + 1) {
          int Z = S - X - Y;
          if (Z >= 0 && Z <= K) ++result;
      }
  }
  std::cout << result << std::endl;
  return 0;
}

Measured memory_bytes: 3632
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
using ll = long long;
using st = string;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using pll = pair<ll, ll>;
using pcc = pair<char, char>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
const vl dx = {1,0,-1,0,1,0,-1,0};
const vl dy = {0,1,0,-1,0,1,0,-1};
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rrep(i,n) for(ll i = (ll) n - 1; i >= 0;i--)
#define REP(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define RREP(i,x,n) for(ll i = (ll) n - 1; i >= x; i--)
#define each(i,A) for(ll i: (vl) A)
#define all(A) A.begin(), A.end()
#define Size(A) ll(A.size())
//入力
template<typename T> T input() {T x; cin >> x; return x;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
//余り切り上げ
ll ceil(ll a,ll b) {return (a + b - 1) / b;}
//最大値・最小値
template <typename T> bool chmax(T &a, const T& b) {if(a < b) {a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b) {if(a > b) {a = b; return true;} return false;}
//最大公約数
ll gcd(ll a,ll b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
//最小公倍数
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//n乗の余り
ll modpow(ll x,ll n,ll mod){ll res=1;for(ll i=0;i<n;i++){res=res*x%mod;}return res;}
ll MODpow(ll x,ll n){ll res=1;for(ll i=0;i<n;i++){res=res*x%MOD;}return res;}


/*--------------------------------------------------------------------------*/

//main関数
int main() {
    ll k; cin >> k;
    st s = "";
    rep(i,k) s += "ACL";
    cout << s << endl;
}


Measured memory_bytes: 3628
n,k=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
for j in range(1,n):
	for i in range(j):
		if a[i]>a[j]:
			cnt+=1
b=[0]*n
import bisect
a.sort()
for i in range(n):
	b[i]=n-bisect.bisect_right(a,a[i])
x=(k*(k-1)//2)%(10**9+7)
ans=cnt*k+x*sum(b)
print(ans%(10**9+7))




Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define inf (int)1e9+7
#define eb emplace_back
#define eps 1e-10

int main() {
    int n, k;
    while (cin >> n >> k && n) {
        int table[100007] = {0};
        rep(i, k) {int tmp; cin >> tmp; table[tmp] = 1;}
        if (table[0] == 0) {
            int ans = 0;
            int c = 0;
            rrep(i, 1, 100007) {
                if (table[i]) c++;
                else {chmax(ans, c); c = 0;}
            }
            chmax(ans, c);
            cout << ans << endl;
            continue;
        }
        vector<int> v;
        rrep(i, 1, 100007) {
            if (table[i] && table[i - 1]) table[i] += table[i - 1];
            if (table[i - 1] && !table[i]) v.eb(table[i - 1]);
            if (table[i - 1] && !table[i] && table[i + 1]) v.eb(1);
        }
        int ans = 0;
        rrep(i, 2, v.size()) chmax(ans, v[i - 2] + v[i - 1] + v[i]);
        cout << ans << endl;
    }
}



Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N, A, B;
    cin >> N >> A >> B;

    int ans = 0;
    for(int i = 1; i <= N; i++) {
        int sum = 0, num = i;
        while (0 < num) {
            sum += num % 10;
            num = num / 10;
        }
        if(A <= sum && sum <= B) {
            ans += i;
        }
    }

    cout << ans << endl;
    return 0;
}

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

int main() {
  long long N,K;
  cin>>N>>K;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  long long int x=0,y=0,z=0;
  long long int V=0;
  
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      if(vec.at(i)==vec.at(j)){
        z++;
      }
      if(vec.at(i)>vec.at(j)){
        x++;
      }
    }
  }
  y=(N*(N-1))/2-z-x;
  
  
  V+=(x*((((K+1)*K)/2)%1000000007))%1000000007;
  
  V+=(y*((((K-1)*K)/2)%1000000007))%1000000007;

  V=V%1000000007;
  cout<<V<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#define inf 2000000000000000000
#define NMAX 400

using namespace std;

long long n, dp[NMAX+10][NMAX+10], val[NMAX+10][NMAX+10], v[NMAX+10], sp[NMAX+10];

int main()
{
    cin >> n;
    for(int i=1; i<=n; i++) cin >> v[i], sp[i] = sp[i-1] + v[i];
    for(int i=1; i<=n; i++)
        for(int j=i; j<=n; j++) val[i][j] = sp[j] - sp[i-1];
    for(int len=1; len<n; len++)
        for(int st=1; st<=n-len+1; st++)
            {   int dr = st + len;
                dp[st][dr] = inf;
                for(int mij=st; mij<dr; mij++) dp[st][dr] = min(dp[st][dr], dp[st][mij] + dp[mij+1][dr] + val[st][mij] + val[mij+1][dr]);
            }
    cout << dp[1][n] << '\n';
    return 0;
}


Measured memory_bytes: 2816
import sys
from math import sqrt, gcd, ceil, log
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))

def main():
	n = int(input())
	print(8 - (n-400)//200)






if __name__ == "__main__":
	main()

Measured memory_bytes: 9376
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;

const int N=1e7;

ll v[N+10];

ll a[N+10];


bool compare(string  &a, string &b)
{
     string f=a+b,c=b+a;

     return f<c;
}

int main()
{
    ll a,b,c,sum=0;

    cin>>a>>b>>c;

    vector<ll>v;

    for(ll i=1;i<=10;i++)
    {
    sum=(a*c)-b;
    v.push_back(sum);
    c=sum;
    }
    for(auto i:v)
    {
        cout<<i<<endl;
    }



}








Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#define MAX_N 1000
#define MAX_E 10000

using namespace std;

int N,E;
int par[MAX_N+1],rank[MAX_N+1];

struct edge{
  int from,to,cost;
};

bool cmp(const edge& e1,const edge& e2){
  return e1.cost < e2.cost;
}

void init(int n){
  for(int i = 0 ; i < n ; i++){
    par[i] = i;
    rank[i] = 0;
  }
}

int find(int x){
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);

  if(x == y) return;
  if (rank[x] < rank[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (rank[x] == rank[y]) {
      rank[x]++;
    }
  }
}

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

edge es[MAX_E+1];

void kruskal(vector<int> &v){
  sort(es ,es + E ,cmp);
  init(N);

  for(int i = 0 ; i < E ; i++){
    edge e = es[i];
    if (!same(e.from,e.to)) {
      unite(e.from,e.to);
      v.push_back(e.cost);
    }
  }

}


int main(){
  int a,b,c;
  while(cin >> N >> E , N | E){
    for(int i = 0 ; i < E ; i++){
      cin >> a >> b >> c;
 
      es[i].from = --a;
      es[i].to = --b;
      es[i].cost = c;
    }

    vector<int> v;
    kruskal(v);

    int size = (int)v.size();
    cout << v[size/2] << endl;
  }

  return 0;
}

Measured memory_bytes: 1356
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;
int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int a, int b) {
	return (a) > (b) ? (a) : (b);
}

int main() {
	int n;
	scanf("%d", &n);

	PRINTD(n / 3);
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll mod = 1e9+7;
const int INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

ll mi(ll x, ll y){
    if(x<y)return x;
    return y;
}
int main(void){
    ll l, r; cin >> l >> r;
    if(r/2019 - l/2019 > 0 || l%2019 == 0){
        cout << "0" << endl;
    }else{
        ll ans = INF;
        for(ll i = l;i < r;i++)for(ll j = i+1;j <= r;j++){
            ans = mi(ans, (i*j)%2019);
        }
        cout << ans << endl;
    }
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
   int num[3],k,i,j,max,maxP;
   for(i=0;i<3;i++) scanf("%d",&num[i]);
   scanf("%d",&k);

   for(i=0;i<k;i++){
      max=num[0]; maxP=0;
      for(j=1;j<3;j++)
         if (max<num[j]){max=num[j]; maxP=j;}

      num[maxP]*=2;
   }

   printf("%d\n",num[0]+num[1]+num[2]);
   return 0;
}


Measured memory_bytes: 128
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug (fprintf(stderr,"orzyrt\n"),fflush(stderr))
	#define debug(__a...) (fprintf(stderr,__a),fflush(stderr))
	#define setfile(__a) ('orzyrt')
	#define Compile(__a) system("g++ "__a".cpp -lm -o "__a)
#else
	#define Debug ('orzyrt')
	#define debug(__a...) ('orzyrt')
	#define setfile(__a) freopen(__a".in","r",stdin);freopen(__a".out","w",stdout)
	#define Compile(__a) ('orzyrt')
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline void cmin(R TT &a,R TT b){(b<a)&&(a=b);}
template<class TT>inline void cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

namespace Night{
	const int maxn = 333<<1;
	const int mod = 1e9+7;
	int n,m;
	int lnk[maxn];
	int f[maxn][maxn],c[maxn][maxn],g[maxn];
	int main(){
		read(n);read(m);
		for(R int i=1,u,v;i<=m;++i){
			read(u);read(v);
			lnk[u]=v;
			lnk[v]=u;
		}
		n<<=1;
		*g=1;
		for(R int i=2;i<=n;i+=2)g[i]=1ll*g[i-2]*(i-1)%mod;
		for(R int i=1;i<=n;++i){
			for(R int j=i;j<=n;++j){
				c[i][j]=c[i][j-1]+!lnk[j];
			}
		}
		R int ans=0;
		for(R int i=1;i<=n;++i){
			for(R int j=i;j<=n;++j){
				for(R int k=i;k<=j;++k){
					if(lnk[k]&&(lnk[k]<i||lnk[k]>j))goto loop;
				}
				f[i][j]=g[c[i][j]];
				for(R int k=i+1;k<j;++k){
					f[i][j]=(f[i][j]-1ll*f[i][k]*g[c[k+1][j]]%mod)%mod;
				}
				ans=(ans+1ll*f[i][j]*g[n-m*2-c[i][j]]%mod)%mod;
				loop:;
			}
		}
		cout<<(ans+mod)%mod;
		return 0;
	}
}
int main(){
	return Night::main();
}


Measured memory_bytes: 3328
#include<iostream>
using namespace std;
#include<vector>
#include<string>
 
int main(){
  string s = "aioeu";
  string c;
  cin >> c;
  if(s.find(c) != string::npos){
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
dp = [0 for i in range(n+1)]
maxn = n**0.5
maxn = int(maxn)+1
for x in range(1,maxn):
    for y in range(1,maxn):
        for z in range(1,maxn):
            p = x*x + y*y + z*z + x*y + y*z +z*x
            if p<=n:
                dp[p]+=1
for i in dp[1::]:
    print(i)

Measured memory_bytes: 9396
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int t = Integer.parseInt(bf.readLine());
 		out.println((((1000-t)%1000)+1000)%1000);
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 25436
#include<bits/stdc++.h>
#define INF 1000000009
#define INFL 1000000000000000018
#define mod 10007
#define pb push_back
#define MAXN 505
#define ff first
#define sf second.first
#define ss second.second
using namespace std;
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef vector<int> VE;
typedef map<int, int> MAP;

int n, k, x[200000], ans = INF, l, r;

signed main()
{
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    for(int i = 0; i < n - k + 1; i++){
        int l = i;
        int r = i + k - 1;
        int res1 = abs(x[r] - x[l]) + abs(x[l]);
        int res2 = abs(x[l] - x[r]) + abs(x[r]);
        ans = min(ans, min(res1, res2));
    }
    cout << ans << endl;


    return 0;
}



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

int main(){
    int N;
    cin >> N;
    if(65<=N&&N<=90){
        cout << "1" << endl;
    }
    else if(97<=N&&N<=122){
        cout << "2" << endl;
    }else{
        cout << "0" << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
using namespace __gnu_pbds;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;*/

int n;
int req[200010];
int a[200010];
int cnt;

int main()
{
    cin.tie(0); ios_base::sync_with_stdio(false);
    //freopen("connect_the_dots.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> n;
    Forn(i, n)
    {
        int x;
        cin >> x;
        req[i] = x;
    }
    for(int i=n; i>=1; i--)
    {
        int sum = 0;
        for(int j = i*2; j<=n; j+=i) sum += a[j];
        if(sum%2 != req[i])
        {
            a[i] = 1;
            cnt++;
        }
    }
    cout << cnt << endl;
    Forn(i, n) if(a[i]) cout << i << " ";
    cout << endl;
}



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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}
int GCD(long long a, long long b)
{
    if(b == 0) return a;
    GCD(b,a%b);
}
int main(){
    init();
    int n; cin >> n;
    n += 1;
    long long  arr[n];
    for(int i = 0;i<n;i++)
        cin >> arr[i];
    sort(arr,arr+n);
    long long MC = arr[1]-arr[0];
    for(int i = 2;i<n;i++)
    {
        MC = GCD(MC,arr[i]-arr[0]);
        if(MC == 1)
        {
            cout << 1;
            return 0;
        }
    }
    cout << MC;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
 
int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	double s,s1,s2,s3;
	double ab,bc,ca,ap,bp,cp;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
	ab=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
	bc=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
	ca=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
	ap=sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
	bp=sqrt((x2-xp)*(x2-xp)+(y2-yp)*(y2-yp));
	cp=sqrt((x3-xp)*(x3-xp)+(y3-yp)*(y3-yp));
	s=sqrt(((ab+bc+ca)*(-ab+bc+ca)*(ab-bc+ca)*(ab+bc-ca))/16);
	s1=sqrt(((ap+ab+bp)*(-ap+ab+bp)*(ap-ab+bp)*(ap+ab-bp))/16);
	s2=sqrt(((bp+bc+cp)*(-bp+bc+cp)*(bp-bc+cp)*(bp+bc-cp))/16);
	s3=sqrt(((cp+ca+ap)*(-cp+ca+ap)*(cp-ca+ap)*(cp+ca-ap))/16);
	if(fabs(s-s1-s2-s3)<0.1)puts("YES");
	else puts("NO");
	}
	return 0;
}

Measured memory_bytes: 612
import java.util.*;

public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[100000];
    for(int i=0;i<n;i++) a[i] = sc.nextInt();
    for (int i=n-1;i>0;i--) System.out.print(a[i]+" ");
    System.out.println(a[0]);
}
}


Measured memory_bytes: 26636
#include <bits/stdc++.h>
        using namespace std;
        #define ll long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18
 
        int main() {
 
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        ll n;
        cin>>n;
        vector<ll> v(n),c(n+1,0);
        for(ll i=0;i<n;i++){
            cin>>v[i];
            c[v[i]]++;
        }
        ll ans=0;
        for(ll i=1;i<=n;i++){
            // cout<<c[i]<<" ";
            ans+= (c[i]*(c[i]-1)/2);
        }
        // cout<<ans<<" ";
        for(ll i=0;i<n;i++){
            ll t = c[v[i]]*(c[v[i]]-1)/2 - (c[v[i]]-1)*(c[v[i]]-2)/2;
            cout<<ans-t<<"\n";
        }



        return 0;
        }

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  bool res = true;
  for (int i = 0; i < n; i++) {
    if (a.at(i) % 2 == 0) {
      if (a.at(i) % 3 != 0 && a.at(i) % 5 != 0) {
        res = false;
      }
    }
  }
  if (res) {
    cout << "APPROVED" << endl;
  }
  else {
    cout << "DENIED" << endl;
  }
}


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

int n,a[100010],b[100010];

int main()
{
	long long cnt=0;
	cin>>n;
	for(int i=0;i<=n;i++)
		cin>>b[i];
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=n-1;i>=0;i--)
	{
		if(a[i]>b[i+1])
		{
			cnt+=b[i+1];
			a[i]-=b[i+1];
			b[i+1]=0;
			if(a[i]>b[i])
				cnt+=b[i],b[i]=0;
			else
				cnt+=a[i],b[i]-=a[i];
		}
		else
			cnt+=a[i],b[i+1]-=a[i];
	}
	cout<<cnt;
} 

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

#define DeltaCube23 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define minimum(a) *min_element(a.begin(), a.end())
#define maximum(a) *max_element(a.begin(), a.end())
#define MOD 1000000007
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i >= (b); i--)

typedef long long int lli;

using namespace std;

const int mx=2e6+5;

int main()
{
    DeltaCube23
	int t=1;
	//cin>>t;
	while(t--)
	{
	    string s;
	    cin>>s;
	    int a=0,b=0;
	    forf(i,0,3)
	    {
	        if(s[i]=='R')
	        a++;
	        else
	        {
	            b=max(b,a);
	            a=0;
	        }
	    }
	    b=max(b,a);
	    cout<<b<<"\n";
	    
	}
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#define N 1000000
using namespace std;

int main() {
    bool is_prime[N];
    is_prime[0]=is_prime[1]=false;
    for (int i=2; i<N; i++) {
        is_prime[i]=true;
    }
    for (int i=2; i*i<N; i++) {
        if (is_prime[i]) {
            for (int j=i*i; j<N; j+=i) {
                is_prime[j]=false;
            }
        }
    }
    int n[N];
    int count=0;
    for (int i=0; i<N; i++) {
        if (is_prime[i]) {
            count++;
        }
        n[i]=count;
    }
    while (true) {
        int x;
        cin >> x;
        if (cin.eof()) {
            break;
        }
        cout << n[x] << endl;
    }
    return 0;
}

Measured memory_bytes: 7932
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef long double ld;

ll inv(ll a, ll b){
    return (a > 1 ? b - inv(b%a, a)*b/a : 1);
}

#define rc(s) return cout << s, 0
#define fi first
#define se second
#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))

const ld e = 2.71828182845904523536028747;
const ld PI = 3.14159265359;
const ll inf = (1LL<<62);
const int iinf = (1<<30);

int t, mx;
bool u[300];
string s;

int main(){
    u['A'] = u['C'] = u['G'] = u['T'] = 1;
    cin >> s;
    for (int i=0; i<s.length(); i++){
        if (u[s[i]]) t++;
        else t = 0;
        mx = smax(mx, t);
    }
    cout << mx;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >>a;
  if(a <1200){
    cout <<"ABC" <<endl;
  }
  else if(a <2800 ){
    cout <<"ARC" <<endl;
  }
  else{
    cout <<"AGC" <<endl;
  }
}


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

int main() {
  int N, k;
  cin >> N >> k;

  string s;
  cin >> s;

  int h = 0;
  int blocks = 0;
  for (int i = 1; i < N; i++) {
	if (s[i] != s[i-1]) {
	  blocks++;
	}

	if (s[i-1] == s[i])
	  h++;
  }
  blocks = min(blocks, k);
  int ans = min(blocks*2 + h, N-1);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define pb push_back
#define sx 200007
int vis[sx];
int main()
{
    string s,t;
    cin>>s>>t;
    int len1=s.size();
    int len2=t.size();
    len1=len1-len2;
    int maxi=0;
    for(int i=0;i<=len1;i++)
    {
        //int mem=i;
        int cnt=0;
        for(int j=0;j<len2;j++)
        {
            if(s[i+j]==t[j])
                cnt++;
        }
        maxi=max(maxi,cnt);
    }
    int ans=t.size()-maxi;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3540
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
ll N,K;
ll a,b;
ll c[100001]={};
int main() {
    cin>>N>>K;
    for(int i=0;i<N;i++){
    	cin>>a>>b;
    	c[a]+=b;

    }
    ll R=0;
    for(int i=1;i<100001;i++){
    	R+=c[i];
    	if(R>=K){
    		cout<<i<<endl;
        	break;
    	}
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n, m;
    cin >> n >> m;

    vector<ll> A(n);
    rep(i, n) cin >> A[i];
    
    vector<ll> S(n + 1);
    rep(i, n) {
        S[i+1] = (S[i] + A[i]) % m;
    }

    unordered_map<ll,ll> cnt;
    rep(i, n) {
        cnt[S[i]] = 0;
    }

    ll res = 0;
    for (int r = 0; r <= n; r++) {
        ll sr = S[r];
        ll sl = sr;
        res += cnt[sr];
        cnt[sr]++;
    }

    put(res);
}
signed main(){ Main();return 0;}

Measured memory_bytes: 8244
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

template <typename T>
struct Graph {
  int N;
  vector<vector<pair<int, T>>> node;
  vector<T> d;
  Graph(int n, T init=INF) {
    N = n;
    node.resize(N);
    d.assign(N, init);
  }
  void add_edge(int s, int t, T cost=1) {
    node[s].push_back(pair<int, T>(t, cost));
  }
  vector<T> dijkstra(int s, T init=INF) {
    d.assign(N, init);
    d[s] = 0;
    priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>> > pq;
    pq.push(pair<T, int>(0, s));
    while (!pq.empty()) {
      pair<T, int> p = pq.top(); pq.pop();
      int pos = p.second;
      for (auto e : node[pos]) {
        if (d[pos] + e.second < d[e.first]) {
          d[e.first] = d[pos] + e.second;
          pq.push(pair<T, int>(d[e.first], e.first));
        }
      }
    }
    return d;
  }
};

int main(){
  int n,x,y;
  cin>>n>>x>>y;
  x--;y--;
  Graph<int>g(n);
  rep(i,n-1){
    g.add_edge(i,i+1);
    g.add_edge(i+1,i);
  }
  g.add_edge(x,y);
  g.add_edge(y,x);
  vector<int>cnt(n);
  rep(i,n){
    vector<int>d=g.dijkstra(i);
    rep(j,n)cnt[d[j]]++;
  }
  rep2(i,1,n){
    cout<<cnt[i]/2<<endl;
  }
  return(0);
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
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;}
//end



int main(){
   int n; cin>>n;
   vector<int> a(n); rep(i,0,n)cin>>a[i];
   map<ll,int> mp; ll res=0;
   rep(i,0,n){
      res+=mp[i-a[i]]; mp[i+a[i]]++;
   } cout<<res<<endl;
   return 0;
}

Measured memory_bytes: 26660
def main():
    h,w = map(int,input().split())
    #奇数の段は1,3,5...の奇数列目に
    #偶数の段は2,4,6...の偶数列目に移動可能
    gusuu_dan = h//2
    kisuu_dan = h - gusuu_dan

    gusuu_retsu = w//2
    kisuu_retsu = w - gusuu_retsu
    answer = kisuu_dan * kisuu_retsu + gusuu_dan * gusuu_retsu

    #しまった！　１列だけのときは移動できない！

    if h == 1 or w == 1:
        answer = 1
    print(answer)






if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
require('fs').readFileSync('/dev/stdin','utf8').trim().split("\n").map(l=>{[m,f,r]=l.split(" ").map(Number)
if(m<0&&f<0&&r<0)return
a=m+f
console.log(m<0||f<0||a<30?"F":a>=80?"A":a>=65?"B":a>=50||r>=50?"C":"D")})



Measured memory_bytes: 15352
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FOREACH(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define SIZE(v) ((int)(v).size())
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ll long long
#define llint long long
#define pii pair<int, int>
#define UNVISITED -1


template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}
 
template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
 
class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif


int main() {
    ll N; scanf("%lld", &N);
    ll ans = 0;
    for(ll i = 1; i <= N; i++) {
        for(ll j = i; i*j < N; j++) {
            ans++;
            if(i != j) ans++;
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
int main(void){
    string S;
    int counter=0;
    cin>>S;

    for(int i=0;i<3;i++){
        if(S[i]=='R'){
            counter++;
            for(int j=1;j<3;j++){
                if(S[i+j]=='R'){
                    counter++;
                    if(j==2){
                        cout<<counter<<endl;
                        return 0;
                    }
                }else{
                    cout<<counter<<endl;
                    return 0;
                }
            }
        }
    }

    cout<<counter<<endl;


    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long  i = 0; i < (long long)(n); i++)






int main() {
	
	int a, b;
	cin >> a >> b;

	cout << (a-1)/b+1<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
string S;
int M;

bool valid(int b, int e){
	string s = S.substr(b, e);
	for(int i = 0; i < s.length(); i++)
		if(s[i] != 'A' && s[i] != 'C' && s[i] != 'G' && s[i] != 'T') return false;
	return true;
}

int main(void){
	//IO("test.in", "test.out");
	cin >> S;
	for(int i = 0; i < S.length(); i++)
		for(int j = 1; j <= S.length() - i; j++)
			if(valid(i, j) && j > M) M = j;
	printf("%d\n", M);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<math.h>
using namespace std;
int main()
{
    long long int a,b,c,d,e=0,f,i,j;
    cin>>a>>b>>c;
    if(a<b+c)
    {
        cout<<(b+c)-a<<endl;
    }
    else
    {
        cout<<0<<endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#define MAXN 515
#define MAXL 100005

using namespace std;
int dp[MAXN][MAXL];
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n + 1), w(n + 1);
  for (int i = 1; i <= n; ++i)
    scanf("%d%d", &v[i], &w[i]);
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i < min(n + 1, 1 << 9); ++i) {
    int p = i / 2;
    for (int j = 1; j < MAXL; ++j)
      dp[i][j] = max(dp[p][j], j >= w[i] ? dp[p][j - w[i]] + v[i] : 0);
  }
  int q;
  scanf("%d", &q);
  string ans;
  for (int i = 0; i < q; ++i) {
    int vi, l;
    scanf("%d%d", &vi, &l);
    if (vi < (1 << 9)) {
      ans += to_string(dp[vi][l]) + "\n";
      continue;
    }
    vector<int> path;
    while (vi >= (1 << 9)) {
      path.emplace_back(vi);
      vi >>= 1;
    }
    int best = 0;
    int m = path.size();
    for (int j = 0; j < (1 << m); ++j) {
      int vs = 0, ws = 0;
      for (int k = 0; k < m; ++k)
        if (j & (1 << k)) {
          vs += v[path[k]];
          ws += w[path[k]];
        }
      if (ws > l)
        continue;
      best = max(best, vs + dp[vi][l - ws]);
    }
    ans += to_string(best) + "\n";
  }
  printf("%s", ans.c_str());
}

Measured memory_bytes: 207132
N = int(input())
H = list(map(int, input().split()))
judge = ""
for i in range(N-1):
    if H[i] >= H[i+1]:
        judge += "T"
    else:
        judge += "F"
judge_list = judge.split("F")
judge_listInt = map(lambda x: len(x), judge_list)
print(max(judge_listInt))

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


int main(void){
    string s;
    cin >> s;
    vector<int>a;
    vector<char>b;
    int cnt=1;
    ll ans = 0;
    for(int i=0;i<s.length();i++){
        if(s[i]==s[i+1]){
            cnt++;
        }
        else{
            a.push_back(cnt);
            b.push_back(s[i]);
            cnt = 1;
        }
    }
    cnt = 0;
    rep(i,a[0]){
        ans +=  i+1;
    }
    for(int i=1;i<a.size();i++){
        if(b[i]=='<'){
            rep(j,a[i]){
                ans += j+1;
            }
        }
        else{
            if(a[i]>a[i-1]){
                ans +=a[i]-a[i-1];
            }
            rep(j,a[i]){
                ans+=j;
            }
        }
    }
    
    cout << ans << endl;
    
    
    
    return 0;
}











































Measured memory_bytes: 2172
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

class Triangle {
public:
  ll x0, x1, x2;
  ll y0, y1, y2;
  ll s;

  Triangle(ll _x0, ll _y0, ll _x1, ll _y1, ll _x2, ll _y2, ll _s) {
    x0 = _x0; x1 = _x1; x2 = _x2;
    y0 = _y0; y1 = _y1; y2 = _y2;
    s = _s;
  }

  ll area2() {
    return abs((x0-x2)*(y1-y2) - (x1-x2)*(y0-y2));
  }

  ll diff() {
    return y2*y2 - s;
  }

  void out() {
    printf("%ld %ld %ld %ld %ld %ld\n", x0, y0, x1, y1, x2, y2);
  }
};

int main() {
  ll s; cin >> s;
  Triangle t(0,0,1,0,0,1, s);
  while (t.diff() < 0) {
    t.x1++; t.y2++;
  }
  if (t.diff() == 0)  {
    t.out();
    return 0;
  }
  t.y1 = 1; t.x2 = 1;
  ll n = t.x1, d = t.diff() - 1;
  if (d >= n) {
    t.x1--;
    d %= n;
  }
  t.y1 += d;
  t.out();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;

int main()
{
    ll n,m,i,a,b,k,t;
    char c;
    cin>>c;
    c++;
    cout<<c;
}

Measured memory_bytes: 3612
#include <stdio.h>

int main(){
    int k,a,b;
    scanf("%d",&k);
    scanf("%d %d",&a,&b);

    for(int i=a;i<=b;i++){
        if(i%k==0){
            printf("OK");
            return 0;
        }
    }
    printf("NG");
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
	using namespace std;
	#define IOS ios::sync_with_stdio(false), cin.tie(0)
	#define REP(i, n) for (int i = 0; i < n; i++)
	#define FOR(i, a, b) for (int i = a; i < b; i++)
	#define ALL(x) (x).begin(), (x).end()
	#define dump(x) cout << (x) << endl
	#define LMAX 9223372036854775807LL
	#define LMIN -9223372036854775807LL

	using ll = long long;
	template<typename T>
	using vec = vector<T>;
	using P = pair<ll, ll>;

	template <typename A, size_t N, typename T>
	void Fill(A (&array)[N], const T &val){
		fill((T *)array, (T *)(array + N), val);
	}
	
	const ll INF = 1e18;
	const ll mod = 1e9 + 7;

	//int dx[4] = {1,0,-1,0};
	//int dy[4] = {0,1,0,-1};
	//ll pas[51][52];
	
	ll calc(ll n, ll b,ll sum){
		if(n < b)return sum + n % b;
		else return calc(n / b, b, sum + n % b);
	}

	signed main(){
		IOS;
		ll h,w;
		cin >> h >> w;
		vec<vec<bool>> a(h,vec<bool>(w));
		REP(i,h)REP(j,w){
			int x;
			cin >> x;
			a[i][j] = x % 2;
		}
		vec<P> xy,xy2;
		REP(i,h){
			bool unko = false;
			REP(j,w - 1){
				if(a[i][j]){
					if(unko){
						unko = false;
					}
					else{
						unko = true;
						xy.push_back(P(i + 1,j + 1));
						xy2.push_back(P(i + 1,j + 2));
						if(j == w - 2)a[i][w - 1] = !a[i][w - 1];
					}
				}
				else if(unko){
					xy.push_back(P(i + 1,j + 1));
					xy2.push_back(P(i + 1,j + 2));
					if(j == w - 2)a[i][w - 1] = !a[i][w - 1];					
				}
			}
		}
		bool unko2 = false;
		REP(i,h - 1){
			if(a[i][w - 1]){
				if(unko2){
					unko2 = false;
				}
				else{
					unko2 = true;
					xy.push_back(P(i + 1,w));
					xy2.push_back(P(i + 2,w));
				}
			}
			else if(unko2){
				xy.push_back(P(i + 1,w));
				xy2.push_back(P(i + 2,w));
			}
		}
		dump(xy.size());
		REP(i,xy.size()){
			cout << xy[i].first << ' ' << xy[i].second << ' ' << xy2[i].first << ' ' << xy2[i].second << endl; 
		}
	}

Measured memory_bytes: 6372
object Main extends App {
  var N = readInt
  var get = readLine.split(" ")
  var cost = readLine.split(" ")
  var sum = 0
  for(i <- 0 until N){
    if(get(i).toInt - cost(i).toInt > 0)
	    sum = sum + get(i).toInt - cost(i).toInt
  }
  
  println(sum.toInt)
}

Measured memory_bytes: 27084
sx, sy, tx, ty = map(int, input().split())
ans = ''
# go
for _ in range(tx - sx):
    ans += 'R'
for _ in range(ty - sy):
    ans += 'U'
# back
for _ in range(tx - sx):
    ans += 'L'
for _ in range(ty - sy):
    ans += 'D'
# go
ans += 'D'
for _ in range(tx - sx + 1):
    ans += 'R'
for _ in range(ty - sy + 1):
    ans += 'U'
ans += 'L'
# back
ans += 'U'
for _ in range(tx - sx + 1):
    ans += 'L'
for _ in range(ty - sy + 1):
    ans += 'D'
ans += 'R'
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<vector>
#define R register
#define next mlgvegetable
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
inline ll read();
inline void write(ll x);
inline void writeln(ll x);
inline void writesp(ll x);
ll n,m;
int main(){
	n=read();m=read();
	writeln(n*m);
	
}
inline ll read(){
	ll x=0,t=1;char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*t;
}
inline void write(ll x){
	if(x<0){putchar('-');x=-x;}
	if(x<=9){putchar(x+'0');return;}
	write(x/10);putchar(x%10+'0');
}
inline void writesp(ll x){
	write(x);putchar(' ');
}
inline void writeln(ll x){
	write(x);putchar('\n');
}

Measured memory_bytes: 3000
n,m=map(int,input().split())
h=list(map(int,input().split()))
lower=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    if h[a-1] <= h[b-1]:
        lower[a-1] += 1
    if h[a-1] >= h[b-1]:
        lower[b-1] += 1
print(lower.count(0))


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

long n, x, y, _min, sum = 0;

int main(){
    cin >> n;
    vector<int> a(n,0);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum = sum + a[i];
    }
    x = 0;
    y = sum;
    for(int j = 0; j < n - 1; j++){
        x = x + a[j];
        y = y - a[j];
        if(j == 0){
            _min = abs(x - y);
        }
        if(_min > abs(x - y)){
            _min = abs(x - y);
        }
    }
    cout << _min << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s;cin >> s;
  rep(i,s.length()) s[i] = 'x';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        long[] arr = new long[n];
        for(int i = 0; i < n; ++i){
            arr[i] = Long.parseLong(br.readLine());
        }
        if(n==1){
            System.out.println(arr[0]);
            return;
        }
        int twos = 0;
        int minustwos = 0;
        int ones = 0;
        int minusones = 0;
        Arrays.sort(arr);
        long ans = 0;
        if(n%2==1){
            // case 1 end downs
            minusones = 2;
            twos = n/2;
            minustwos = (n-2)/2;
            long res = 0;
            int start = 0;
            while(minustwos-- > 0)
                res += -2*arr[start++];
            while(minusones-- > 0)
                res += -1*arr[start++];
            while(twos-- > 0)
                res += 2*arr[start++];
            ans = Math.max(ans, res);
            
            // case 1 end ups
            ones = 2;
            minustwos = n/2;
            twos = (n-2)/2;
            res = 0;
            start = 0;
            while(minustwos-- > 0)
                res += -2*arr[start++];
            while(ones-- > 0)
                res += arr[start++];
            while(twos-- > 0)
                res += 2*arr[start++];
            ans = Math.max(ans, res);
        }
        else {
            ones = 1;
            minusones = 1;
            twos = (n-2)/2;
            minustwos = (n-2)/2;
            // TODO : assin and calc
            long res = 0;
            int start = 0;
            while(minustwos-- > 0)
                res += -2*arr[start++];
            while(minusones-- > 0)
                res += -1*arr[start++];
            while(ones-- > 0)
                res += arr[start++];
            while(twos-- > 0)
                res += 2*arr[start++];
            ans = Math.max(ans, res);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 42796