akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s,t; cin>>s>>t;
	reverse (s.begin(),s.end());
	cout<<((s==t)?"YES":"NO")<<endl;
	return 0;
}


Measured memory_bytes: 256
#import math
#import bisect
#import numpy as np
import sys
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float('INF')

def main():
    a, b, c, x, y = list(map(int,input().split()))

    cm = 2 * max(x, y)
    ans = INF

    for cbuy in range(cm+1):
        xbuy = max(0, x - (cbuy//2))
        ybuy = max(0, y - (cbuy//2))
        price = xbuy * a + ybuy * b + cbuy * c
        ans = min(ans, price)

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 39792
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(void) {
	vector<ll> v;
	rep(i,0,3){
		ll a;
		cin>>a;
		v.pb(a);
	}
	sort(all(v));
	cout << v[2]-v[0] << endl;
	return 0;
}

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

using namespace std;

int main() {
	int n;
	string tmp;
	vector<string> v;
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> tmp;
		v.push_back(tmp);
	}
	sort(v.begin(), v.end());
	int cnt = 1;
	for (int i = 0;i < n - 1;i++) {
		if (v[i] != v[i + 1])cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 9156
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#include<bits/stdc++.h>
using namespace std;
int calc(int d,int r){
  return d*(100+r)/100;
}

int main(){
  int x,y,s;
  while(cin >> x >> y >> s && x){
    int ans = 0;
    REP(i,1,s){
      REP(j,1,s){
        if(calc(i,x)+calc(j,x)==s){
          int yi=calc(i,y);
          int yj=calc(j,y);
          ans = max(yi+yj,ans);
        }
      }
    }
    cout << ans << endl;
  }

}



Measured memory_bytes: 3088
#include<stdio.h>
#include<math.h>
int main()
{
	double n,i=1.0;

	scanf("%lf",&n);

	while(1){
		if(pow(i,2.0)>n){
			printf("%.0f",pow(i-1,2));
			return 0;
		}
		i++;
	}
}

Measured memory_bytes: 128
def Single_Source_Shortest_Path(adj_mat, cost, parent):
    N = len(cost)
    color = ["W" for n in range(N)]
    parent[0] = -1
    cost[0] = 0

    while True:
        mincost = 1000000

        for i in range(N):
            if color[i] != "B" and cost[i] < mincost:
                u = i
                mincost = cost[u]

        if mincost == 1000000:
            break

        color[u] = "B"

        for v in range(N):
            if color[v] != "B" and adj_mat[u][v] >= 0:
                if cost[v] > cost[u] + adj_mat[u][v]:
                    cost[v] = cost[u] + adj_mat[u][v]
                    parent[v] = u
                    color[v] = "G"

def Main():
    N = int(input())
    cost = [1000000 for n in range(N)]
    color = ["W" for n in range(N)]
    adj_mat = [[ -1 for n in range(N)] for n in range(N)]
    parent = [-1 for n in range(N)]

    for n in range(N):
        u, K, *p = map(int, input().split())

        for k in range(K):
            v, c = p[2*k], p[2*k + 1]
            adj_mat[u][v] = c

    Single_Source_Shortest_Path(adj_mat, cost, parent)

    for i in range(N):
        print("{} {}".format(i, cost[i]))

Main()


Measured memory_bytes: 5784
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int h[100005], dp[100005], n, k;

int go(int idx){
    //cout << idx << endl;
    if(idx == n-1)return 0;
    if(dp[idx] != -1)return dp[idx];
    int ans = 1e9 + 7;
    for(int j = 1; j <= k; j++){
        if(idx + j < n){
            ans = min(ans, go(idx+j) + abs(h[idx]-h[idx+j]));
        }
    }
    return dp[idx] = ans;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    /*
    for(int i = 1; i < n; i++){
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        for(int j = 2; j <= k && (i-j) >= 0; j++){
            dp[i] = min(dp[i], dp[i-j] + abs(h[i-j] - h[j]));
        }
    }
    cout << dp[n-1] << endl;*/
    memset(dp, -1, sizeof dp);
    cout << go(0) << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <numeric>
#include <algorithm>


using namespace std;

int main(){
  size_t N;
  cin >> N;

  string S;
  cin >> S;

  size_t ans = 1;
  for(size_t i = 1; i < N; ++i){
    if(S.at(i) != S.at(i - 1)) ++ans;
  }

  cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int X, A, B;
  cin >> X >> A >> B;
  if (B <= A) {
    cout << "delicious" << endl;
  }
  else if (B <= A + X) {
    cout << "safe" << endl;
  }
  else {
    cout << "dangerous" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int y=(s[5]-'0')*10+s[6]-'0';
	if(y<=4){
		cout<<"Heisei"<<endl;
	}else{
		cout<<"TBD"<<endl;
	}
	return 0;
}


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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i = (a); i >= (b); i--)
#define FORR(i,a,b) for (int i = (a); i > (b); i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    int n;
    cin >> n;

    if(n<15){
    	cout << n*800 << endl;
    	return 0;
    }

    int tmp=n/15,cc=n*800;

    while(tmp){
    	cc-=200;
    	tmp--;
    }

    cout << cc << endl;

    return 0;
}


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

typedef complex<int> P;

int main() {
  int n;
  P p[51][11];
  int m[51];

  while(cin>>n,n){
    for(int i=0;i<=n;i++){
      cin>>m[i];
      for(int j=0;j<m[i];j++)
        cin>>p[i][j].real()>>p[i][j].imag();
    }
    for(int i=1;i<=n;i++){
      if(m[0]!=m[i]) continue;
      bool success;
      int ox1,oy1,ox2,oy2;
      for(int k=0;k<4;k++){
        for(int j=0;j<m[0];j++)
          p[0][j]*=P(0,1);
        success=true;
        ox1=p[0][0].real(); oy1=p[0][0].imag();
        ox2=p[i][0].real(); oy2=p[i][0].imag();
        for(int j=0;j<m[0];j++){
          if(p[0][j].real()-ox1!=p[i][j].real()-ox2){
	    success=false; break;
	  }
          if(p[0][j].imag()-oy1!=p[i][j].imag()-oy2){
	    success=false; break;
	  }
        }
        if(success){
	  cout<<i<<endl; break;
	}
        success=true;
        ox1=p[0][m[0]-1].real(); oy1=p[0][m[0]-1].imag();
        ox2=p[i][0].real(); oy2=p[i][0].imag();
        for(int j=0;j<m[0];j++){
          if(p[0][m[0]-1-j].real()-ox1!=p[i][j].real()-ox2){
	    success=false; break;
	  }
          if(p[0][m[0]-1-j].imag()-oy1!=p[i][j].imag()-oy2){
	    success=false; break;
	  }
        }
        if(success){
	  cout<<i<<endl; break;
	}
      }
    }
    cout<<"+++++"<<endl;
  }
}


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

#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;
using ll = long long;
int mod = 1000000007;

int main(void){
    int N; string S; cin >> N >> S;
    int lenS = S.length();
    rep(i, lenS){
        S[i] += N;
        if(S[i] > 'Z') S[i] -= 26;
    }
    cout << S << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<deque<int>> a(n);
    for(int i=0; i<n; ++i){
        for(int j=0;j<n-1;++j){
            int input; cin >> input;
            a[i].push_back(input);
            a[i][j]--;
        }
    }

    deque<int> q;
    for(int i=0; i<n;++i){
        q.push_back(i);
    }

    vector<int> days(n, 0);
    vector<int> match(n, -1);

    while (!q.empty()){
        int x = q.front(); q.pop_front();
        
        if(a[x].empty()){
            continue;
        }

        int y = a[x].front(); a[x].pop_front();
        if(x == match[y]){
            days[x] = days[y] = max(days[x], days[y]) + 1;
            match[x] = match[y] = -1;
            q.push_back(x); q.push_back(y);
       }else{
           match[x] = y;
       }
    }

    for(int i=0; i<n; ++i){
        if(!a[i].empty()){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << *max_element(days.begin(), days.end()) << endl;
}


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

long long GCD(long long x, long long y) {
    if ( y == 0) return x;
    else return GCD(y, x % y);
}

long long solve(int N, long long M, vector<long long> a) {
    // 2 で割れるだけ割る (割れる回数が異なったらダメ)
    bool same = true;
    while (a[0] % 2 == 0) {
        for (int i = 0; i < N; ++i) {
            if (a[i] % 2 != 0) return 0;
            a[i] /= 2;
        }
        M /= 2;
    }
    for (int i = 0; i < N; ++i) if (a[i] % 2 == 0) return 0;

    // lcm
    long long lcm = 1;
    for (int i = 0; i < N; ++i) {
        long long g = GCD(lcm, a[i]);
        lcm = lcm / g * a[i];
        if (lcm > M) return 0;
    }
    return (M / lcm + 1) / 2;
}

int main() {
    int N; long long M;
    cin >> N >> M;
    vector<long long> a(N);

    // あらかじめ a は一回 2 で割っておく
    for (int i = 0; i < N; ++i) cin >> a[i], a[i] /= 2;
    cout << solve(N, M, a) << endl;
}

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

struct base{
	long long arr[63]; base(){memset(arr , 0 , sizeof(arr));}
	bool ins(long long val){
		for(int i = 60 ; ~i ; --i)
			if(val >> i & 1)
				if(arr[i]) val ^= arr[i];
				else{arr[i] = val; return 1;}
		return 0;
	}
	bool find(long long val){
		for(int i = 60 ; ~i ; --i)
			if(val >> i & 1)
				if(arr[i]) val ^= arr[i];
				else return 0;
		return 1;
	}
};

int main(){
	int T , N;
	for(cin >> T ; T ; --T){
		cin >> N; long long A[203]; string str;
		for(int i = 0 ; i < N ; ++i) cin >> A[i];
		cin >> str; bool flg = 0 , win = 0; base now;
		for(int i = N - 1 ; ~i ; --i)
			if(str[i] == '1') win |= !now.find(A[i]);
			else flg |= !now.ins(A[i]);
		cout << win << endl;
	}
	return 0;
}


Measured memory_bytes: 3556
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = "xabcdefghij"
    var ansList1 = mutableListOf<Pair<String, Int>>()
    ansList1.add(Pair("a", 1))
    for (i in 2..n) {
        val ansList2 = mutableListOf<Pair<String, Int>>()
        for (ans in ansList1) {
            for (j in 1..i) {
                if (ans.second + 1 == j) {
                    ansList2.add(Pair(ans.first + s[j], ans.second + 1))
                } else if (ans.second >= j) {
                    ansList2.add(Pair(ans.first + s[j], ans.second))
                }else{
                    break
                }
            }
        }
        ansList1 = ansList2
    }
    ansList1.forEach { println(it.first) }
}

Measured memory_bytes: 65356
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;

int h, w, f[MAXN][MAXN]; char g[MAXN][MAXN];

int main(){
	int i, j;
	scanf("%d%d", &h, &w);
	for(i = 1; i <= h; ++ i)
		scanf("%s", g[i] + 1);
	for(i = 0; i <= h; ++ i)
		f[i][0] = 500;
	for(i = 0; i <= w; ++ i)
		f[0][i] = 500;
	f[1][0] = f[0][1] = 0;
	g[1][0] = g[0][1] = '.';
	f[1][1] = g[1][1] == '#';
	for(i = 1; i <= h; ++ i)
		for(j = 1; j <= w; ++ j)
			f[i][j] = min(f[i - 1][j] + int(g[i - 1][j] == '.' && g[i][j] == '#'), f[i][j - 1] + int(g[i][j - 1] == '.' && g[i][j] == '#'));
	printf("%d\n", f[h][w]);
	return 0;
}

Measured memory_bytes: 256
Q, H, S, D = map(int, input().split())
N = int(input())

# Q,H を 1Lあたりの費用に変換する

Q *= 4
H *= 2

one_litter = min(Q, H, S)  # 1L はこれを使う

if 2 * one_litter < D:  # 2Lをサイズのほうが高いときは1Lですべて買う
    ans = N * one_litter
else:  # 偶数を2Lサイズで買い、余りを1Lサイズで買う
    ans = N // 2 * D + (N % 2) * one_litter

print(ans)



Measured memory_bytes: 9172
import java.util.Scanner;
import java.util.Arrays;

class Main{
       public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	Dice dice1 = new Dice();
    	Dice dice2 = new Dice();
    	for(int i = 0; i < 6; i++){
    		dice1.inputSurface(i , scan.nextInt());
    	}
    	for(int i = 0; i < 6; i++){
    		dice2.inputSurface(i , scan.nextInt());
    	}
    	
    	int top = dice2.getSurface(0);
    	int front = dice2.getSurface(1);
    	int i;
    	
    	for(i = 0; i < 6; i++){
    		if(dice1.getSurface(i) == top){
    			dice1.setTop(top);
    			
    			for(i = 1; i < 5; i++){
    				if(dice1.getSurface(i) == front){
    					dice1.setFront(front);
    					if(Arrays.equals(dice1.getSurfaceAll(), dice2.getSurfaceAll())){
    						System.out.println("Yes");
    						return;
    					}
    				}
    			}
    			break;
    		}
    	}
    	System.out.println("No");
     }
}

/*
????????????:Dice
?????? ?????????????????¢?????????????????????
	 ?????¢???????????????
*/
class Dice{
	private int[] surface = new int[6];
	
	public void inputSurface(int c, int x){
		surface[c] = x;
	}
	
	public void spin(char order){
		int buf;
		//???????????????????????¢?????£????????????surface?????\????????????
		switch(order){
			case 'N':{
				buf = surface[0];
				surface[0] = surface[1];
				surface[1] = surface[5];
				surface[5] = surface[4];
				surface[4] = buf;
				break;
			}
			case 'E':{
    			buf = surface[0];
    			surface[0] = surface[3];
    			surface[3] = surface[5];
    			surface[5] = surface[2];
    			surface[2] = buf;
    			break;
			}
			case 'W':{
				buf = surface[0];
    			surface[0] = surface[2];
    			surface[2] = surface[5];
    			surface[5] = surface[3];
    			surface[3] = buf;
    			break;
			}
			case 'S':{
				buf = surface[0];
    			surface[0] = surface[4];
    			surface[4] = surface[5];
    			surface[5] = surface[1];
    			surface[1] = buf;
    			break;
			}
		}
	}
	
	public void setTop(int top){
		if(top == surface[1]){
			this.spin('N');
		}else if(top == surface[2]){
			this.spin('W');
		}else if(top == surface[3]){
			this.spin('E');
		}else if(top == surface[4]){
			this.spin('S');
		}else if(top == surface[5]){
			this.spin('N');
			this.spin('N');
		}
	}
	
	public void setFront(int front){
		int temp;
		if(front == surface[2]){
			temp = surface[1];
			surface[1] = surface[2];
			surface[2] = surface[4];
			surface[4] = surface[3];
			surface[3] = temp;
		}else if(front == surface[3]){
			temp = surface[1];
			surface[1] = surface[3];
			surface[3] = surface[4];
			surface[4] = surface[2];
			surface[2] = temp;
		}else if(front == surface[4]){
			temp = surface[1];
			surface[1] = surface[4];
			surface[4] = temp;
			temp = surface[2];
			surface[2] = surface[3];
			surface[3] = temp;
		}
	}
	
	public int getSurface(int num){
		return surface[num];
	}
	
	public int[] getSurfaceAll(){
		return surface;
	}
}

Measured memory_bytes: 26264
/*  TAHMID RAHMAN
    DAMIAN FOREVER
     MATH LOVER
    NEVER GIVE UP
*/
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define pb push_back
#define fi first
#define se second
#define in insert
#define mp make_pair
#define GCD(a,b) __gcd(a,b);
#define endl "\n"
#define FRU freopen("out.txt","w",stdout)
#define FRO freopen("in.txt","r",stdin)
#define INFLL 9223372036854775807
#define debug 0
#define MAXN   100001
#define ar array
const int mxN=2e5;
const int MOD=1e9+7;
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
//Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
int main()
{
    fastio;
    ll x;
    cin>>x;
    if(x>=30)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	while((N-1)&N) N--;
	cout<<N<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

int main () {
  int n;
  cin >>n;
  int cnt =0;
  for (int i=0;i<n;i++){
    for (int j=0;j<n;j++){
      if(n == (4*i)+(7*j)){
        cnt =1 ;
        break;
      }
    }
  }
  if(cnt ==1){
    cout <<"Yes"<<endl;
  }else {
    cout <<"No"<<endl;
  }
}


Measured memory_bytes: 256
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
#sort = sorted(a)[::-1] 降順
#if l[i] == l[j]: continue
n = int(input())
a = list(map(int, input().split()))
ans = 0
min = 0
new_list = list(reversed(a))

for i in range(len(new_list) - 1):
    min += new_list[i]
    ans +=  min * new_list[i+1]


print(ans % 1000000007)


Measured memory_bytes: 31432
#include <stdio.h>

int main(){
  int a,b,x,y,i,p;
  scanf("%d%d",&a,&b);
  if(a<b){x=b;y=a;}
  else {x=a;y=b;}  
 while(y !=0){ 
    p=x%y;
     if(p==0)break;
    x=y;
    y=p;
   
    
  }
  printf("%d\n",y);
  return 0;
}



Measured memory_bytes: 2104
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int x, y, a, b = 1;
        Scanner sc = new Scanner(System.in);
        x = sc.nextInt();
        y = sc.nextInt();
        if(x > y){
            a = x;
            x = y;
            y = a;
        }
        while(b != 0){
            b = y % x;
            a = (y - b) / x;
            y = x;
            x = b;
        }
        System.out.println(y);
        sc.close();
    }
}



Measured memory_bytes: 26244
#include<bits/stdc++.h>
#include <scoped_allocator>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector < pair<ll, ll > > vp1;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/

int main() {
	ll x, y;
	cin >> x >> y;
	if ((abs(x - y)) <= 1) {
		cout << "Brown";
	} else {
		cout << "Alice";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int x[maxn];

void solve(long long N, long long M, std::vector<long long> H, std::vector<long long> A, std::vector<long long> B)
{
    for (int i = 0; i < M; i++)
    {
        if (H[A[i] - 1] <= H[B[i] - 1])
            x[A[i]] = 1;
        if (H[A[i] - 1] >= H[B[i] - 1])
            x[B[i]] = 1;
    }
    int ans = 0;
    for (int i = 1; i <= N; i++)
    {
        if (x[i] == 0)
            ans++;
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> H(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &H[i]);
    }
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for (int i = 0; i < M; i++)
    {
        scanf("%lld", &A[i]);
        scanf("%lld", &B[i]);
    }
    solve(N, M, std::move(H), std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 5900
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
# include <stdio.h>
#include <bits/stdc++.h>

const int maxn = 3e5 + 111;

using namespace std;        

const int mod = 1e9 + 7;



string s;
int ans = 1e9;
int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    for(int i = 0; i + 3 - 1 < s.size(); i++){
        int x = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + s[i + 2] - '0';
        ans = min(ans, abs(753- x));
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <numeric>
std::vector<int> read();
std::vector<std::vector<std::string>> make_rectangle(int, int);
std::vector<std::vector<std::string>> make_frame(int, int);
void draw(std::vector<std::vector<std::string>>);

int main()
{
	std::vector<int> height;
	std::vector<int> width;
	std::vector<int> input;
	int count = 0;

	while (true)
	{
		input = read();

		if (input[0] == 0 && input[1] == 0)	break;

		height.emplace_back(input[0]);
		width.emplace_back(input[1]);

		++count;
	}

	for (int i = 0; i < count; i++)
	{
		std::vector<std::vector<std::string>> rectangle = make_frame(height[i], width[i]);
		draw(rectangle);
	}

	return 0;
}

std::vector<int> read()
{
	std::vector<int> input(2);
	std::cin >> input[0] >> input[1];

	return input;
}

std::vector<std::vector<std::string>> make_rectangle(int height, int width)
{
	std::vector<std::vector<std::string>> rectangle(height, std::vector<std::string>(width));

	for (int i = 0; i < height; i++)
	{
		for (int j = 0; j < width; j++)
		{
			rectangle[i][j] = "#";
		}
	}

	return rectangle;
}

std::vector<std::vector<std::string>> make_frame(int height, int width)
{
	std::vector<std::vector<std::string>> rectangle(height, std::vector<std::string>(width));

	for (int i = 0; i < width; ++i)
	{
		rectangle[0][i] = "#";
		rectangle[height - 1][i] = "#";
	}

	for (int i = 1; i < height-1; ++i)
	{
		rectangle[i][0] = "#";
		rectangle[i][width - 1] = "#";

		for (int j = 1; j < width-1; ++j)
		{
			rectangle[i][j] = ".";
		}
	}

	return rectangle;
}

void draw(std::vector<std::vector<std::string>> rectangle)
{
	for (auto line : rectangle)
	{
		for (auto point : line)
		{
			std::cout << point;
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
}



Measured memory_bytes: 4156
using System;
using System.Linq;
using System.Collections.Generic;

class Cmondai {
    static void Main()
    {
        var num=Int32.Parse(Console.ReadLine());
        var line = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var narabi = line.OrderByDescending(x => x).Distinct().ToList();
        narabi.Add(0);
        var maxNarabiIndex = narabi.Count() - 1;
        var ans = 0;
        for (var i=0;i<maxNarabiIndex; ++i)
        {
            var count = 1;
            var prevIndex = -1;
            for (var j=0;j<num;++j)
            {
                if (narabi[i] <= line[j])
                {
                    line[j] = narabi[i + 1];
                    if (prevIndex!=-1 && prevIndex != j - 1)
                    {
                        count++;
                    }
                    prevIndex = j;
                }
            }
            ans += (narabi[i] - narabi[i + 1]) * count;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13524
import std.stdio, std.string, std.conv;
import std.math;

void main() {
    auto input = getStdin!(string[])[1..$];
 	input[0].split(" ").to!(int[]).reverse.to!(string[]).join(" ").writeln;
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}

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

int main(int argc, char const *argv[])
{
    string str;
    getline(cin, str);

    stack<int> st;
    stack<pair<int, int>> st2;

    int p = 0, s = 0;

    for (size_t i = 0; i < str.length(); i++) {
        // cout << i << endl;
        if (str[i] == '\\') {
            st.push(i);
        } else if (str[i] == '/') {
            if (st.empty() == false) {
                p = st.top();
                s = i - p;

                while (st2.empty() == false && st.top() < st2.top().first) {
                    s += st2.top().second;
                    st2.pop();
                }

                st2.push(make_pair(p, s));
                st.pop();
            }
        }
    }

    int a = 0, k = st2.size();
    vector<int> l(k, 0);
    int i = 0;
    while (st2.empty() == false)
    {
        l[i++] = st2.top().second;
        a += st2.top().second;
        st2.pop();
    }

    reverse(l.begin(), l.end());

    cout << a << endl;
    cout << k;
    for (int i = 0; i < k; i++) {
        cout << " " << l[i];
    }
    cout << endl;
}


Measured memory_bytes: 3264
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  lvector p(n,0);rep(i,n) cin>>p[i];
  sort(p.begin(),p.end());p[n-1]/=2;
  ll ans=accumulate(p.begin(),p.end(),0);
  print(ans);
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<long long> x;
  vector<long long> y;
  for (int i = 0; i < n; i++) {
    long long k;
    scanf("%lld", &k);
    x.push_back(k);
    y.push_back(k);
  }
  sort(x.begin(), x.end());

  long long u = x[n/2 - 1] + x[n/2];
  for (int i = 0; i < n; i++){
    if (y[i] <= x[n/2 - 1]) {
      printf("%lld\n", x[n/2]);
    } else {
      printf("%lld\n", x[n/2-1]);
    }
  }
  return 0;
}

Measured memory_bytes: 5476
def extended_gcd(a, b):
    c0, c1 = a, b
    a0, a1 = 1, 0
    b0, b1 = 0, 1

    while c1 != 0:
        q, m = divmod(c0, c1)
        c0, c1 = c1, m
        a0, a1 = a1, a0 - q*a1
        b0, b1 = b1, b0 - q*b1
    return a0, b0, c0


def mod_inverse(a, n):
    s, _, g = extended_gcd(a, n)
    if g != 1:
        raise Exception('The inverse does not exist.')
    return s % n

def comb(n, k):
    c = 1
    k = min(k, n-k)
    for i in range(k):
        c *= n-i
        c *= mod_inverse(i+1, MOD)
        c %= MOD
    return c

n,a,b=map(int, input().split())
MOD = 1000000007
ans = pow(2, n, MOD)
ans -= comb(n, a)
while ans < 0:
    ans += MOD
ans -= comb(n, b)
while ans < 0:
    ans += MOD
print(ans-1)


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=2e3,MAX_A=2e3;

int N,A[MAX_N];

int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	int s=0;
	REP(i,N){
		s+=A[i];
	}
	bitset<MAX_N*MAX_A+1> bs(1);
	REP(i,N){
		bs|=bs<<A[i];
	}
	FOR(i,(s+1)/2,N*MAX_A+1){
		if (bs[i]){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<int> vi;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define md 998244353

void show(vi x){
  rep(i,x.size())cout<<x[i];
  cout<<endl;
  cout<<endl;
}

vi mod(const vi& a,const vi& b){
  vi crt=a;
  while(crt.size()>=b.size()){
    vi nxt;
    bool mada=true;
    rep(j,b.size()){
      if(!mada){
        nxt.push_back(crt[j]^b[j]);
      }else{
        if(crt[j]^b[j]){
          nxt.push_back(1); mada=false;
        }
      }
    }
    repl(j,b.size(),crt.size()){
      if(!mada){
        nxt.push_back(crt[j]);
      }else{
        if(crt[j]){
          nxt.push_back(1); mada=false;
        }
      }
    }
    crt=nxt;
  }
  return crt;
}

vi mgcd(vi a,vi b){
  if(b.size()==0) return a;
  else return mgcd(b,mod(a,b));
}

ll N;
vi X;
vi A[6];
ll dp[4001][2];

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

  cin>>N;
  {
    string s;
    cin>>s;
    rep(j,s.size())X.push_back(s[j]-'0');
  }
  rep(i,N){
    string s;
    cin>>s;
    rep(j,s.size())A[i].push_back(s[j]-'0');
  }

  vi g=A[0];
  repl(i,1,N){
    g=mgcd(g,A[i]);
  }

  ll d=g.size();
  ll m=X.size()-d+1;
  dp[0][0]=1;
  rep(i,m)rep(j,2){
    rep(nxt,(j==0?X[i]+1:2)){
      (dp[i+1][!(j==0&&nxt==X[i])]+=dp[i][j])%=md;
    }
  }
  ll res=dp[m][1];

  vi Y;
  rep(i,X.size()){
    if(i<m) Y.push_back(X[i]);
    else Y.push_back(0);
  }

  vi r=mod(Y,g);

  rep(i,r.size()){
    Y[Y.size()-1-i]^=r[r.size()-1-i];
  }

  if(Y<=X) cout<<(res+1)%md<<endl;
  else cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 33024
#include "bits/stdc++.h"
using namespace std;

long long COUNT = 0;

template<typename T>
void insertionSort(vector<T> &A, long long N, long long G) {
	for (long long i = G; i < N; i++) {
		T V = A[i];
		long long j = i - G;
		while (j >= 0 && A[j] > V) {
			A[j + G] = A[j];
			j -= G;
			COUNT++;
		}
		A[j + G] = V;
	}
}

template <typename T>
void shellSort(vector<T> &A, long long N) {
	COUNT = 0;
	vector<long long> G = { 1 };
	long long Cur = 4;
	while (Cur < N) {
		G.push_back(Cur);
		Cur = Cur * 3 + 1;
	}
	reverse(G.begin(), G.end());
	long long M = G.size();
	cout << M << endl;
	for (int i = 0; i < M; i++) {
		cout << G[i];
		if (i != M - 1) cout << " ";
		else cout << endl;
	}
	for (int i = 0; i < M; i++) {
		insertionSort(A, N, G[i]);
	}
	cout << COUNT << endl;
	for (int i = 0; i < N; i++) cout << A[i] << endl;
}

int main() {
	long long N;
	vector<long long> A;
	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	shellSort(A, N);
}


Measured memory_bytes: 10740
#include <iostream>

using namespace std;

int main()
{
int N,AC=0,WA=0,TLE=0,RE=0;
cin>>N;
string s[100000];
for(int i=0;i<N;i++){
    cin>>s[i];
}
for( int i=0;i<N;i++){
    if(s[i]=="AC"){
        AC++;
    }
}

for(int i=0;i<N;i++){
    if(s[i]=="WA"){
         WA++;
    }
}

for(int i=0;i<N;i++){
    if(s[i]=="TLE"){
         TLE++;
    }
}

for(int i=0;i<N;i++){
    if(s[i]=="RE"){
         RE++;
    }
}

cout<<"AC x "<<AC<<endl<<"WA x "<<WA<<endl<<"TLE x "<<TLE<<endl<<"RE x "<<RE;

    return 0;
}


Measured memory_bytes: 6728
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();

    StringBuilder sb = new StringBuilder();

    if (N == 0) {
      sb.append('0');
    }

    while (N != 0) {
      int i = N % -2;
      sb.append(i == 0 ? '0' : '1');
      if (i != 0) N -= 1;
      N /= -2;
    }

    sb.reverse();
    System.out.println(sb.toString());
  }
}


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

using namespace std;

const int MAXN = 1010;
const int INF = 1000000000;

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

int h, w;
string g[MAXN];

bool isOut(int x, int y) { 
    return x < 0 || y < 0 || x >= h || y >= w || g[x][y] == '#'; 
}

void solver() {
    cin >> h >> w;

    int sx, sy;
    cin >> sx >> sy; 
    --sx; --sy;

    int ex, ey;
    cin >> ex >> ey; 
    --ex; --ey;

    for(int i = 0; i < h; ++i) 
        cin >> g[i];

    deque< pair<int,int> > Q;
    Q.push_front({sx, sy});    

    vector< vector<int> > dist(h, vector<int>(w, INF));

    dist[sx][sy] = 0;

    while(!Q.empty()) {
        auto it = Q.begin();

        int x = it->first;
        int y = it->second;

        Q.pop_front();

        //cout << "x = " << x << " y = " << y << ' ' << "dist = " << dist[x][y] << '\n';

        if (x == ex && y == ey) break;

        for(int i = 0; i < 4; ++i) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            
            if (isOut(nx, ny)) 
                continue;

            if (dist[nx][ny] > dist[x][y]) {
                dist[nx][ny] = dist[x][y];
                Q.push_front({nx, ny});
            }
        }

        for(int xx = x - 2; xx <= x + 2; ++xx) {
            for(int yy = y - 2; yy <= y + 2; ++yy) {
                if (isOut(xx, yy)) continue;
                if (xx == x && yy == y) continue;
                if (dist[xx][yy] > dist[x][y] + 1) {
                    dist[xx][yy] = dist[x][y] + 1;
                    Q.push_back({xx, yy});
                }
            }
        }

    }

    cout << (dist[ex][ey] >= INF ? -1 : dist[ex][ey]) << '\n';

}

int main() {

    ios_base :: sync_with_stdio(0); cin.tie(NULL);

    int t = 1;
    //cin >> t;
    
    while(t--)
        solver();

    return 0;
}

Measured memory_bytes: 8636
N=int(input())
des=[list(map(int,input().split())) for _ in range(N)]
des.insert(0,[0,0,0])
for i in range(N):
    time=des[i+1][0]-des[i][0]
    d_x=abs(des[i+1][1]-des[i][1])
    d_y=abs(des[i+1][2]-des[i][2])
    if (time-(d_x+d_y))%2!=0 or time<(d_x+d_y):
        print("No")
        exit()
print("Yes")

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

//library----------------------------------------------


int main(){
    int N,ans=0;
    scanf("%d",&N);
    RepS(i,1,N){
        if(0<=i&&i<=9) ans++;
        else if(100<=i&&i<=999) ans++;
        else if(10000<=i&&i<=99999) ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define ZERO(a) memset(a,0,sizeof(a))
using namespace std;
typedef signed long long ll;

void solve(){
 char c;
 int cnt[26];
 ZERO(cnt);
 while(cin>>c){
  c=tolower(c);
  cnt[c-'a']++;
 }
 FOR(i,26){
  char cc='a'+i;
  cout<<cc<<" : "<<cnt[i]<<endl;
 }
}

int main(){
 solve();
 return 0;
}

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

int main()
{
    int a[3];
    for(int i = 0; i < 3; ++i)
    {
        cin >> a[i];
    }
    
    sort(a, a + 3);
    
    int ans = a[0] + a[1];
    
    cout << ans << endl;
    return 0;
    
}


Measured memory_bytes: 256
#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

//#define int long long
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
//typedef vector<vector<int>> mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

vector<int> G[1002];
bool used[1002];
int match[1002];

bool dfs(int v)
{
	used[v] = true;
	rep(i, 0, SZ(G[v]))
	{
		int u = G[v][i], w = match[u];
		if (w < 0 || !used[w] && dfs(w))
		{
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

int bipartite_matching(int V)
{
	int res = 0;
	memset(match, -1, sizeof(match));
	rep(i, 0, V)
	{
		if (match[i] < 0)
		{
			memset(used, 0, sizeof(used));
			if (dfs(i))
			{
				res++;
			}
		}
	}
	return res;
}

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

	int X, Y,E, x, y;
	cin >> X >> Y >> E;
	rep(i, 0, E)
	{
		cin >> x >> y;
		G[x].push_back(X + y);
		G[X + y].push_back(x);
	}

	cout << bipartite_matching(X + Y) << endl;

	return 0;
}


Measured memory_bytes: 3304
#include<bits/stdc++.h>
using namespace std;
int x[503][503],n,m;
vector<int>a,b,c,d;
int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			cin>>x[i][j];
	for(int i=0;i<n;i++)
		for(int j=0;j<m-1;j++)
			if(x[i][j]%2==1)
				x[i][j]--,x[i][j+1]++,a.push_back(i+1),b.push_back(j+1),c.push_back(i+1),d.push_back(j+2);
	for(int i=0;i<n-1;i++)
		if(x[i][m-1]%2==1)
			x[i][m-1]--,x[i+1][m-1]++,a.push_back(i+1),b.push_back(m),c.push_back(i+2),d.push_back(m);
	cout<<b.size()<<endl;
	for(int i=0;i<a.size();i++)
		cout<<a[i]<<' '<<b[i]<<' '<<c[i]<<' '<<d[i]<<endl;
}

Measured memory_bytes: 5220
#include <stdio.h>

int main()
{
	int mid, term, reexam;
	char grade;
	for (;;) {	
		scanf("%d %d %d", &mid, &term, &reexam);
		if (mid == -1 && term == -1 && reexam == -1) {
			return 0;
		} else if (mid == -1 | term == -1) {
			grade = 'F';
		} else if (mid + term >= 80) {
			grade = 'A';
		} else if (mid + term >= 65) {
			grade = 'B';
		} else if (mid + term >= 50) {
			grade = 'C';
		} else if (mid + term >= 30) {
			if (reexam >= 50) {
				grade = 'C';
			} else {
				grade = 'D';
			}
		} else {
			grade = 'F';
		}
		printf("%c\n", grade);
	}
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n;
	cin >> n;
	vector<string> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	map<string, int> cnt;
	int mx = 0;
	for (int i = 0; i < n; ++i) {
		++cnt[a[i]];
		mx = max(mx, cnt[a[i]]);
	}
	set<string> st;
	for (int i = 0; i < n; ++i) {
		if (cnt[a[i]] == mx) {
			st.insert(a[i]);
		}
	}
	for (auto x : st) {
		cout << x << '\n';
	}
	cout << '\n';
 	return 0; 
}


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


int main(){
  int n;
  cin>>n;
  int k[10];
  k[0]=1;
  for(int i=1;i<=n-1;i++){
    k[i]=k[i-1]*i;
  }
  vector<int> p(n+1,0),q(n+1,0);
  vector<int> pp(n+1,1),qq(n+1,1);
  int a=1,b=1;
  for(int i=1;i<=n;i++) {
    int x;
    cin>>x;
    p[i]=x;
    for(int j=x+1;j<=n;j++){
       pp[j]++;
    }
    int aa=a;
    a+=(x-pp[x])*k[n-i];
  }
  for(int i=1;i<=n;i++) {
    int x;
    cin>>x;
    q[i]=x;
    for(int j=x+1;j<=n;j++){
       qq[j]++;
    }
    b+=(x-qq[x])*k[n-i];
  }
  cout<<abs(a-b)<<endl;
}
  

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int sx = Integer.parseInt(sc.next());
        int sy = Integer.parseInt(sc.next());
        int tx = Integer.parseInt(sc.next());
        int ty = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int w = tx - sx;
        int h = ty - sy;

        StringBuilder sb = new StringBuilder();
        sb.append(repeatStr("U", h));
        sb.append(repeatStr("R", w));
        sb.append(repeatStr("D", h));
        sb.append(repeatStr("L", w));
        sb.append("L");
        sb.append(repeatStr("U", h + 1));
        sb.append(repeatStr("R", w + 1));
        sb.append("DR");
        sb.append(repeatStr("D", h + 1));
        sb.append(repeatStr("L", w + 1));
        sb.append("U");

        String result = sb.toString();

        // 出力
        System.out.println(result);
    }

    public static String repeatStr(String s, int n) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(s);
        }
        return sb.toString();
    }
}


Measured memory_bytes: 36276
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  if(A <= 5)
    cout << 0 << endl;
  else if(A >= 6 && A <= 12)
    cout << B/2 << endl;
  else
    cout << B << endl;
}


Measured memory_bytes: 256
//Sumit
#include<iostream>
using namespace std;
const int mod = 1e9+7;
typedef long long LL;
const int maxn = 23000000;
short dig[maxn+1];
inline void add(int &x, int y)
{
    x+=y;
    if(x>=mod) x-=mod;
}
int qmod(LL a, int b)
{
    LL res = 1;
    for(;b;b>>=1)
    {
        if(b&1) res=res*a%mod;
        a=a*a%mod;
    }
    return (int)res;
}
int main()
{
int t=4;
t++;
    for(int i=1; i<=maxn; ++i) dig[i] = dig[i/10]+1;
    int n, ans=0;
    scanf("%d",&n);
    for(int i=1, j=1, s=0; i<1e7; ++i)
    {
        while(s<n) s+=dig[j],++j;
        if(s==n) add(ans, 1);
        s -= dig[i];
    }
    for(int i=1; i<=n/8; ++i)
    {
        if(n%i==0) add(ans, ((qmod(10,n/i)-qmod(10,n/i-1)-i+1)%mod+mod)%mod);
        else add(ans, 1);
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 45312
import numpy as np
import bisect
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort()
B.sort()
C.sort()

ans=0
len_C = len(C)
for b in B:
    a = bisect.bisect_left(A,b)
    c = len_C - bisect.bisect_right(C,b)
    ans += a*c

print(int(ans))

Measured memory_bytes: 41316
import java.util.*;
public class Main{
    int max =(1<<27);
    int[][] M = new int[101][101];
    int [] d = new int[101];
    int[] flg = new int[101];
    int a,n,m,c,e,k,min,z;
    public void compute(){
	Scanner scan = new Scanner(System.in);

	while(true){
	    for(int i=0;i<101;i++){
		for(int j=0;j<101;j++){
		    M[i][j]=max;
		}
		d[i]=max;
		flg[i]=0;
	    }
	    n=scan.nextInt();
	    k=scan.nextInt();
	    if(n==0&&k==0)break;
	    for(int i=0;i<k;i++){
		a=scan.nextInt();
		if(a==0){
		    c=scan.nextInt();
		    e=scan.nextInt();
		    for(int j=1;j<=n;j++){
			d[j]=max;
			flg[j]=0;
			
		    }
		    d[c]=0;
		    while(true){
			min=max;
			for(int j=1;j<=n;j++){
			    if(d[j]<min&&flg[j]==0){
				min=d[j];
				m=j;
			    }
			}
			if(min==max)break;
			flg[m]=1;
			for(int j=1;j<=n;j++){
			    if(d[j]>d[m]+M[m][j]&&max>M[m][j]){
				d[j]=d[m]+M[m][j];
			    }
			}
		    }
		    if(d[e]==max){
			System.out.println(-1);
		    }else{
			System.out.println(d[e]);
		    }
		    
		}else{
		    c=scan.nextInt();
		    e=scan.nextInt();
		    z=scan.nextInt();
		    if(M[c][e]>z){
			M[c][e]=z;
			M[e][c]=z;
		    }
		}
	    }
		
	}
    }
    public static void main(String[] args){
	Main p = new Main();
	p.compute();
    }
}

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

int main()
{
  int n,x;
  

  while(1)
  {
    int count = 0;
    cin >> n >> x;
    // cout << n << x << endl;
    if(n == 0 && x == 0) 
    {
      break;
    }
    int i = 1;
   
    while(i < n)
    {
      int j = i + 1;
      while(j < n)
      {
        int k = j + 1;
        while(k <= n)
        {
          	if(i + j + k == x)
            {
              //cout << i << j << k << endl;
              count++;
            }
        	k++;
        }
        j++;
      }
      i++;
    }
    cout << count << endl;
  }
}


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

using namespace std;

typedef long long int ll;


int main(void)
{
        string s;
        cin>>s;
        int ans=0;
        for(int i=0;i<s.length();i++)
        {
            ans=(ans+ ((int)(s[i])-48))%9;
        }
        if(ans==0)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
}

Measured memory_bytes: 3760
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, x, y int
	fmt.Scanf("%d %d %d %d %d", &a, &b, &c, &x, &y)
	sum := (a * x) + (b * y)
	if x == y {
		tmp := (c * x * 2)
		if sum > tmp {
			sum = tmp
		}
	} else {
		diff := x - y
		v1 := 0
		v2 := 0
		if diff > 0 {
			v1 = (c * (x * 2))
			v2 = (c * (y * 2)) + (a * diff)
		} else {
			v1 = (c * (y * 2))
			v2 = (c * (x * 2)) + (b * int(math.Abs(float64(diff))))
		}
		if sum > v1 {
			sum = v1
		}
		if sum > v2 {
			sum = v2
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 1836
n,m,l = map(int,input().split())
 
A = [list(map(int,input().split())) for i in range(n)]
B = [list(map(int,input().split())) for i in range(m)]
ans = [[0]*l for i in range(n)]
 
 
for x in range(n):
    for y in range(l):
        for z in range(m):
            ans[x][y] += B[z][y]*A[x][z]
 
for row in range(n):
    print("%d"%ans[row][0],end = "")
    for col in range(1,l):
        print(" %d"%(ans[row][col]),end = "")
    print()


Measured memory_bytes: 7056
K, N = map(int, input().split())
A = list(map(int, input().split()))

D = []
for i in range(N-1):
    D.append(A[i+1] - A[i])

D.append(A[0] + K - A[N-1])
D.sort(reverse = True)
D[0] = 0
print(sum(D))

Measured memory_bytes: 25840
n, k = [int(x) for x in raw_input().split()]
x = [int(x) for x in raw_input().split()]
ans = 10000000000000000000
for i in xrange(0, n - k + 1):
    l = x[i]
    r = x[i + k - 1]
    ans = min(ans, max(abs(l), abs(r)) if l * r > 0 else min(abs(l), abs(r)) + r - l)

print ans


Measured memory_bytes: 11856