akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int A, B, K, ans = 0;
    cin >> K;
    cin >> A >> B;
    for(int i = A; i < B + 1; ++i){
        if(i % K == 0){
            ans++;
            break;
        }
    }
    if(ans == 1) cout << "OK" << endl;
    else cout << "NG" <<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    string s[n+1];
    s[n] = "zzzzzzzzzzz";
    for(int i=0; i<n; i++){
        cin >> s[i];
        sort(s[i].begin(),s[i].end());
    }
    sort(s,s+n);
    long long ans=0;
    for(int i=0; i<n; i++){
        auto p = upper_bound(s,s+n,s[i]);
        ans += (long long)(p-(s+i)-1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    int d=n%10;
    string ans;
    if(3==d){
        ans="bon";
    }else if(0==d||1==d||6==d||8==d){
        ans="pon";
    }else{
        ans="hon";
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
import sys
def v():
    N=int(sys.stdin.readline())
    P=[]
    pt,pa=tuple(map(int,sys.stdin.readline().split()))
    res=pt+pa
    for _ in [0]*(N-1):
        xt,xa=tuple(map(int,sys.stdin.readline().split()))
        xs=xt+xa
        kt=pt//xt if pt%xt ==0 else pt//xt+1
        ka=pa//xa if pa%xa ==0 else pa//xa+1
        k=max([kt,ka])
        pt,pa=k*xt,k*xa
        res=pt+pa
    print(res)
if __name__=='__main__':v()


Measured memory_bytes: 3064
import java.util.*;
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int mod = 1000000007;
      int h = sc.nextInt();
      int w = sc.nextInt();
      char ch[][] = new char[h][w];
      for(int i=0 ; i<h ; i++){
        String s = sc.next();
      	for(int j=0 ; j<w ; j++){
        	ch[i][j] = s.charAt(j);
        }
      }
      
      long dp[][] = new long[h+1][w+1];
      dp[h-1][w-1] = 1;
      for(int i = h-1 ; i >= 0 ; i--){
      	for(int j = w-1 ; j >=0 ; j--){
        	if(i==h-1 && j==w-1)
            	continue;
          	else if(ch[i][j]=='#')
          		dp[i][j] = 0;
          	else
              	dp[i][j] = (dp[i+1][j] + dp[i][j+1])%mod;
          }
      }
      System.out.println(dp[0][0]);
    }
}


Measured memory_bytes: 44784
#include <stdio.h>

int main(void){
	int num, sum[30], first, second;
	char ch[101];

	while(1){
		scanf("%d", &num);
		if(num == 0) break;
		for(int i=0; i<num; i++){
			scanf(" %c", &ch[i]);
			ch[i] -= 'A';
		}

		for(int i=0; i<30; i++){
			sum[i] =0;
		}
		first = ch[0];
		second = 29;
		for(int i=0; i<num; i++){
			sum[ch[i]]++;
			if(sum[ch[i]] > sum[first]){
				second = first;
				first = ch[i];
			} else if(sum[second] < sum[ch[i]] && ch[i] != first){
				second = int(ch[i]);
			}
			if(sum[first] > sum[second] + num - i-1){
				printf("%c %d\n", first+'A', i+1);
				goto END;
			}
		}
		printf("TIE\n");
END:;
	}//endwhile

	return 0;
}


Measured memory_bytes: 2588
#include <stdio.h>

#define N 100

int main() {
	static char s[N + 1];
	int n, i, x, max;

	scanf("%d%s", &n, s);
	max = x = 0;
	for (i = 0; i < n; i++)
		max = max < (x = s[i] == 'I' ? x + 1 : x - 1) ? x : max;
	printf("%d\n", max);
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#define N 10000000
#define LL long long
using namespace std;

int p[N>>3],f[N+5],mn[N+5];
bool vis[N+5];
int n;
int main()
{
	int i,j;
	for(i=2;i<=N;i++)
	{
		if(!vis[i])
		{
			mn[i]=1;
			f[i]=2;
			p[++p[0]]=i;
		}
		int t;
		for(j=1;(t=i*p[j])<=N;j++)
		{
			vis[t]=1;
			if(i%p[j]==0)
			{
				mn[t]=mn[i]+1;
				f[t]=f[i]/mn[t]*(mn[t]+1);
				break;
			}
			else
			{
				mn[t]=1;
				f[t]=f[i]*2;
			}
		}
	}
	LL ans=0;
	scanf("%d",&n);
	f[1]=1;
	for(i=1;i<=n;i++)
		ans+=1ll*i*f[i];
	printf("%lld",ans);
	return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(true){
        int l[10];
        if(!(cin>>l[0])) break;
        cin.ignore();
        for(int i=1; i<10; i++){
            cin>>l[i];
            cin.ignore();
        }
        int sum=0;
        for(int i=0; i<10; i++) sum+=l[i];
        int v1, v2;
        cin>>v1;
        cin.ignore();
        cin>>v2;
        double point=(double)sum*v1/(v1+v2);
        int pt=ceil(point);
        int ll=0;
        for(int i=0; i<10; i++){
            ll+=l[i];
            if(pt<=ll){
                cout<<i+1<<'\n';
                break;  
            } 
        }
    }
    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
struct hito{
	long long sum; 
	long long H; 
	long long P; 
}; 
bool cmp(const hito &a, const hito &b){
    return a.sum < b.sum;
}
int main(){
	int N; cin >> N; 
	long long INF = 1e18; 
	hito A[5010] = {}; 
	for(int i = 1; i <= N; i++){
		cin >> A[i].H >> A[i].P; 
		A[i].sum = A[i].H + A[i].P; 
	}
	sort(A+1, A+N+1, cmp); 
	long long dp[5010][5010] = {}; // dp[i人目まで見て][j人のときの最小の高さ] 
	for(int i = 0; i <= N; i++){
		for(int j = 1; j <= N+1; j++){
			dp[i][j] = INF; 
		}
	}
	for(int i = 1; i <= N; i++){
		for(int j = 1; j <= N; j++){
			if(A[i].H >= dp[i-1][j-1]) dp[i][j] = min(dp[i-1][j], dp[i-1][j-1] + A[i].P); 
			else dp[i][j] = dp[i-1][j]; 
		}
	}
	for(int i = 1; i <= N+1; i++){
		if(dp[N][i] == INF){
			cout << i-1 << endl; return 0; 
		}
	}
}

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

int main()
{
    ll n;
    ll a[100005];
    ll two = 0;
    ll four = 0;

    cin >> n;
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (ll i = 0; i < n; i++) {
        if (a[i] % 4 == 0) {
            a[i] = -1;
            four++;
        }
    }

    for (ll i = 0; i < n; i++) {
        if (a[i] != -1 && a[i] % 2 == 0) {
            two++;
        }
    }

    
    if ((two == 0 ? 0 : two - 1) + (four * 2) >= n - 1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int64 M,D;
    int64 ans=0;
    cin>>M>>D;
    for(int64 i=1;i<=M;i++){
        for(int64 j=1;j<=D;j++){
            if((j/10)>=2&&(j%10)>=2&&(j/10)*(j%10)==i){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;


int main(){
long long N,K;
cin>>N>>K;
long long limit=((N-1)*(N-2))/2;
bool linked[101][101]={};
if(K> ((N-1)*(N-2))/2){
    cout<<"-1"<<endl;
}

else{
    cout<<(N-1)+(limit-K)<<endl;
    rep(i,N-1){
     cout<<i+2<<" "<<'1'<<endl; 
     linked[i+2][1]=linked[1][i+2]=true;  
    }
    int i=1;
    int cnt=0;
    while(1)
    {
            for(int k=1;k<=N;k++)
            {
                if(i==k)continue;
                if(!linked[i][k])
                {
                    cout<<i<<" "<<k<<endl;
                    linked[i][k]=linked[k][i]=true;
                    cnt++;
                    if(cnt==limit-K)break;
                }
            }
            i++;
            if(cnt==limit-K)break;
    }

}
 return 0;
}
/*
5 3


5
4 3
1 2
3 1
4 5
2 3


5 8

-1

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

#define in2(N,s,t) rep(i,N){in(s[i] , t[i]);}
#define in3(N,s,t,u) rep(i,N){in(s[i] , t[i] , u[i]);}
using vd = V<double>; using vs = V<string>; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;

using P = pair<int,int>; using vp = V<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
//////////////////

void solve(){
  ini(N);
  vi a(N); in(a);
  int idx = 0;
  int ans = 0;
  while (idx < N)
  {
    trc(idx);
    ans++;
    int a_min = a[idx] , a_max = a[idx];
    int p = 0 , n = 0;
    while(idx != N){
      if(a_min < a[idx]) p = 1;
      if(a_max > a[idx]) n = 1;
      amax(a_max , a[idx]);
      amin(a_min , a[idx]);
      if(p * n == 1) break;
      idx++;
    }
  }
  out(ans);
  

}

Measured memory_bytes: 640
/*************************************************\
           In the name of almighty ALLAH
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

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

#define     ikarus_101  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef     long long             ll;
typedef     long double           ld;
typedef     unsigned long long    ull;
typedef     vector<ll>            vll;
typedef     pair<ll,ll>           pll;
typedef     vector<pll>           vpl;
typedef     map<ll,ll>            mll;
typedef     multiset<ll>          msl;
typedef     multimap<ll,ll>       Mll;
using pqboro=priority_queue<ll,vll,less<ll>>;
using pqchoto=priority_queue<ll,vll,greater<ll>>;

#define    all(str)       str.begin(),str.end()
#define    sajo(str)      sort(str.begin(),str.end())
#define    rev(str)       reverse(str.begin(),str.end())
#define    usajo(str)     sort(str.rbegin(),str.rend())
#define    vin(a)         for(auto &it : a) cin>>it
#define    vout(a)        for(auto it:a) cout<<it<<' ';cout<<nn
#define    vmax(a)        *max_element(all(a))
#define    vmin(a)        *min_element(all(a))
#define    pb             push_back
#define    eb             emplace_back
#define    mkp(x,y)       make_pair(x,y)
#define    F              first
#define    S              second
#define    yes            cout<<"Yes"<<nn
#define    no             cout<<"No"<<nn
#define    nn             "\n" ///endl
#define    rep(i,n)       for (i=0;i<n;++i )
#define    rep1(i,n)      for (i=1;i<=n;++i )

#define    min3(a,b,c)    min(a,min(b,c))
#define    max3(a,b,c)    max(a,max(b,c))
#define    sqr(x)         ((x)*(x))
#define    pi             2*acos(0.0)
#define    gcd(a,b)       __gcd(a,b)
#define    lcm(a,b)       (a/gcd(a,b))*b
#define    mem(a,b)       memset(a,b,sizeof (a))
#define    dec(x)         cout<<fixed<<setprecision(x)
#define    none(n)         __builtin_popcountll(n)

template < typename T > string toString ( T Number ) { stringstream ss ; ss << Number ; return ss.str() ; }
template < typename T > ll toll ( T str ) { stringstream ss ; ss << str ; ll num ; ss >> num ; return num ; }
ll power(ll n , ll k) { if(k == 0) return 1 ; if(k&1) return n*sqr(power(n,k/2)) ; else return sqr(power(n,k/2)); }

const   int  N   =   2e5+7;
const   int  M   =   1e9+7;
const   ll  inf  =   0x7f7f7f7f7f7f7f7f;
const   int dx[] =   {+1,+2,+2,+1,-1,-2,-2,-1};
const   int dy[] =   {-2,-1,+1,+2,+2,+1,-1,-2};

int main() {ikarus_101

    ll n,m,i,j,k,x;



    string s ;
    cin>>n>>s;
    string t=s.substr(0,n/2);
    string tt=s.substr(n/2,string::npos);
    if(n > 1 and t == tt)
        yes;
    else
        no;





    return 0;
}


Measured memory_bytes: 3576
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N;
	cin >> N;
	int maxnum = 0, sum = 0;
	rep(i, N)
	{
		int num;
		cin >> num;
		sum += num;
		maxnum = max(maxnum, num);
	}
	cout << sum - maxnum / 2;
}

Measured memory_bytes: 256
a, b, c, x, y = gets.split.map(&:to_i)

if a + b < 2 * c
  puts a * x + b * y
elsif x > y
  puts 2 * c * y + [a, 2 * c].min * (x - y)
else
  puts 2 * c * x + [b, 2 * c].min * (y - x)
end

Measured memory_bytes: 1788
#include<stdio.h>

typedef struct{
  int p;
  int l;
  int r;
}Node;

Node node[25];

void preorder(int p){
  if(p != -1){
    printf(" %d" ,p);
    preorder(node[p].l);
    preorder(node[p].r);
  }
}

void inorder(int p){
  if(p != -1){
    inorder(node[p].l);
    printf(" %d" ,p);
    inorder(node[p].r);
  }
}

void postorder(int p){
  if(p != -1){
    postorder(node[p].l);
    postorder(node[p].r);
    printf(" %d" ,p);
  }
}

int main(){
  int n,i,id;
  int p,l,r;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    node[i].p=node[i].l=node[i].r=-1;
  }

  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&l,&r);
    if(l!=-1){
      node[id].l=l;
      node[l].p=id;
    }
    if(r!=-1){
      node[id].r=r;
      node[r].p=id;
    }
  }

  for(i=0;i<n;i++){
    if(node[i].p==-1){
      p=i;
      break;
    }
  }

  printf("Preorder\n");
  preorder(p);
  printf("\nInorder\n");
  inorder(p);
  printf("\nPostorder\n");
  postorder(p);
  printf("\n");

  return 0;
}

Measured memory_bytes: 616
#include<iostream>
#include<algorithm>
using namespace std;
 
int main() {
  int N;
  cin >> N;

  for (int i = 0; i < N; i++) {
    int array[3];
    cin >> array[0] >> array[1] >> array[2];
    sort(array, array+3);
    cout << ((array[0]*array[0]+array[1]*array[1] == array[2]*array[2]) ? "YES" : "NO") << endl;
  }

  return 0;
}

Measured memory_bytes: 1172
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program{
    static void Main(){

        int n = int.Parse(Console.ReadLine());
        int[] S = Console.ReadLine().Split(' ')
                                    .Select(val => int.Parse(val))
                                    .ToArray();
        
        Sort.MergeSort(ref S, 0, n);
        for (int i = 0; i < n; i++)
        {
            if(i != 0) Console.Write(" ");
            Console.Write(S[i]);
        }
        Console.WriteLine("\n{0}", Sort.cnt);
    }

    
}

class Sort{
    public static int cnt = 0;

    public static void Merge(ref int[] A, int left, int mid, int right){
        //Console.Error.WriteLine("left: {0}, mid: {1}, right: {2}", left, mid, right);
        int n1 = mid - left;
        int n2 = right - mid;
        //Console.Error.WriteLine("n1:{0}, n2:{1}", n1, n2);
        int[] L = new int[n1 + 1];
        Array.Copy(A, left, L, 0, n1);
        L[n1] = int.MaxValue;
        //Console.Error.WriteLine("L: {0}", string.Join(" ", L));
        int[] R = new int[n2 + 1];
        Array.Copy(A, mid, R, 0, n2);
        R[n2] = int.MaxValue;
        //Console.Error.WriteLine("R: {0}", string.Join(" ", R));
        int i = 0, j = 0;
        for (int k = left; k < right; k++)
        {
            cnt++;
            //Console.Error.WriteLine("L[i]:{0}, R[j]: {1}", L[i], R[j]);
            if(L[i] <= R[j]){
                A[k] = L[i];
                i++;
            }
            else{
                A[k] = R[j];
                j++;
            }
            //Console.Error.WriteLine("A[{0}] = {1}", k, A[k]);
        }
        //Console.Error.WriteLine(string.Join(" ", A));
    }

    public static void MergeSort(ref int[] A, int left, int right){
        if(left + 1 < right){
            int mid = (left + right) / 2;
            MergeSort(ref A, left, mid);
            MergeSort(ref A, mid, right);
            Merge(ref A, left, mid, right);
        }
    }
}

Measured memory_bytes: 87612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b,c,ct=0;
    cin>>a>>b>>c;
    if(a*c<=b) cout<<c<<endl;
    else
    {
        for(int i=1;i<=c;i++)
        {
            if(a*i<=b) ct++;
        }
        cout<<ct<<endl;
    }
    return 0;
}



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

using namespace std;

int n;
bool u[20];
map<long long, int> m;
vector<int> v;
long long cur = 1, x[20][20];

long long ma(int a, int b, long long c) {
	if (b == n)
		cur = max(cur, c);
	b++;
	for (int i = 0; i < n; i++)
		if (!u[i]) {
			u[i] = 1;
			ma(i, b, c + x[a][i]);
			u[i] = 0;
		}
	return 1;
}

bool check(int a, int b, long long c) {
	// printf("check(a=%d b=%d c=%lld)\n", a, b, c);
	if (b == n)
		return ++m[c] <= 2 || !printf("c=%lld\n", c);
	b++;
	for (int i = 0; i < n; i++)
		if (!u[i]) {
			u[i] = 1;
			bool ret = check(i, b, c + x[a][i]);
			u[i] = 0;
			if (!ret)
				return 0;
		}
	return 1;
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		for (int j = 1; ; j++) {
			bool ok = 1;
			set<int> s;
			v.push_back(j);
			for (int k : v)
				if (!s.insert(k).second)
					ok = 0;
			for (int k = 0; k < v.size(); k++)
				for (int l = k + 1; l < v.size(); l++)
					if (!s.insert(v[k] + v[l]).second)
						ok = 0;
			if (ok)
				break;
			else
				v.pop_back();
		}
	// printf("v="); for (int i : v) printf("%d ", i); puts("");
	x[0][1] = x[1][0] = 1;
	cur = 1;
	for (int i = 2; i < n; i++) {
		cur++;
		for (int j = 0; j < i; j++)
			x[i][j] = x[j][i] = cur * v[j];
		if (i == n - 1)
			break;
		for (int j = 0; j <= i; j++) {
			u[j] = 1;
			ma(j, 1, 0);
			u[j] = 0;
		}
	}
	/*
	printf("cur=%lld\n", cur);
	bool ok = 1;
	for (int i = 0; i < n && ok; i++) {
		u[i] = 1;
		ok &= check(i, 1, 0);
		u[i] = 0;
	}
	printf("ok=%d\n", ok);
	*/
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			printf("%lld%c", x[i][j], " \n"[j == n - 1]);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b)
{
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}


int h[110];

int main(){
  int D;
  cin >> D;
  cout << "Christmas ";
  rep(i,25-D) cout << "Eve " ;
}


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

#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 FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
struct UnionFind {
	vector<int> par;
	vector<int> sizes;

	UnionFind(int n) {
		par.resize(n);
		sizes.resize(n);
		REP(i, n) {
			par[i] = i;
			sizes[i] = 0;
		}
	}

	int root(int a) {
		return par[a] == a ? a : par[a] = root(par[a]);
	}

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

	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y)return;
		if (sizes[x] < sizes[y]) swap(x, y);

		par[y] = x;
		sizes[x] += sizes[y];
	}
	int size(int x) {
		return sizes[root(x)];
	}
};
struct e {
	ll a, b, c;
	bool operator <(const e &f) const{
		return this->c < f.c;
	}

};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vvi v(n, vi(n));
	REP(i, n)REP(j, n)cin >> v[i][j];
	ll ans = 0;
	bool f = true;
	REP(k, n) {
		REP(i, n) {
			REP(j, n) {
				if (v[i][j] > v[i][k] + v[k][j])f = 0;


			}

		}
	}

	if(!f) cout << -1 << endl;
	else {
		ll ans = 0;
		REP(i, n) {
			FOR(j, i + 1, n) {
				int f = 1;
				REP(k, n) {
					if (k == i || k == j)continue;
					if (v[i][j] >= v[i][k] + v[k][j])f = 0;
				}
				if (f) {
					//cout << i << " " << j << endl;
					ans += v[i][j];
				}
			}
		}
		
		cout << ans << endl;
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  string s;
  ll k;
  cin >> s >> k;

  int x = 1;
  int y = 1;
  rep(i, s.size()){
    if(s[i] != '1'){
      x = i;
      y = s[i] - '0';
      break;
    }
  }

  cout << (k-1 < x ? 1 : y) << endl;

  return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n && n){
    vvl(v,21,21,0);
    ll a,b;
    rep(i,n){
      cin >> a >> b;
      v[a][b] = 1;
    }
    ll m,l,x=10,y=10;
    cin >> m;
    string s;
    rep(i,m){
      cin >> s >> l;
      if(s == "N"){
        rep(j,l){
          ++y;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else if(s == "W"){
        rep(j,l){
          --x;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else if(s == "E"){
        rep(j,l){
          ++x;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else if(s == "S"){
        rep(j,l){
          --y;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
    }
    if(n != 0) cout << "No"<<endl;
    else cout << "Yes" << endl;
  }
  return 0;
}

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

int main(){
    int n,a[100];
    cin >> n ;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=n-1;i>=0;i--){
        if(i !=n-1)
            cout << " ";
            cout << a[i];
            }
            cout << endl;
            return 0;
}


Measured memory_bytes: 3092
n=int(input())
a=list(map(int,input().split()))
a.sort()

dp = [[[0 for _ in range(301)]for __ in range(301)]for ___ in range(301)]

for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            cnt = i + j + k
            if cnt == 0 or cnt > n :continue
            if i == 0 and j ==0 and k ==1:
                dp[i][j][k] = 1
                continue
            if k > 0:
                dp[i][j][k] += (1+dp[i][j][k-1] * cnt/(cnt-1))*k/cnt
            if j > 0:
                dp[i][j][k] += (1+dp[i][j-1][k+1])*j/cnt
            if i > 0:
                dp[i][j][k] += (1+dp[i-1][j+1][k])*i/cnt 
            
print(dp[a.count(3)][a.count(2)][a.count(1)])

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

using namespace std;
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
  
signed main() {
  vector<bool> A(100100,true);
  for(int i=2;i<=100010;i++){
    int up=sqrt(i)+1;
    for(int j=2;j<up;j++){
      if(i%j==0){
         A[i]=false;
        break;
      }
    }
  }

  vector<int> B(50050);
  for(int i=3;i<=100010;i+=2){
    B[i/2]=B[(i-2)/2];
    if(A[i]&&A[(i+1)/2]){
      B[i/2]++;
    }
  }
  int q;
    scanf("%d",&q);
  for(int i=0;i<q;i++){
    int l,r;
      scanf("%d%d",&l,&r);
    if(l==1){
      l+=2;
    }
    cout<<B[r/2]-B[(l-2)/2]<<endl;
  }
}


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll MOD = 1000000000+7;

class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        string S; cin >> S;

        int arr = 0;
        ll num_pair = 1;
        rep(i, N * 2) {
            if(S[i] == 'W') {
                if(arr % 2 == 0) {
                    num_pair *= arr;
                    num_pair %= MOD;
                    arr--;
                } else arr++;
            } else {
                if(arr % 2 == 1) {
                    num_pair *= arr;
                    num_pair %= MOD;
                    arr--;
                } else arr++;
            }
            if(arr < 0) break;
        }
        if(arr != 0) num_pair = 0;
        ll ans = 1;
        rep(i, N) ans = (ans * (i + 1)) % MOD;
        cout << (ans * num_pair) % MOD << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include<stdio.h>
#include <functional>
#include<algorithm>
#define PI 3.14159265
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define SZ(x) ((int)(x).size())

using namespace std;

int main() {
	int n,m;
	ll x[1000], y[1000], z[1000];
	vector<ll> a1, a2, a3, a4, a5, a6, a7, a8, a;
	REP(i, 8) {
		a.push_back(0);
	}
	cin >> n >> m;
	REP(i, n) {
		cin >> x[i] >> y[i] >> z[i];
		a1.push_back ( x[i] + y[i] + z[i]);
		a2.push_back(x[i] + y[i] - z[i]);
		a3.push_back(x[i] - y[i] + z[i]);
		a4.push_back(x[i] - y[i] - z[i]);
		a5.push_back(-x[i] + y[i] + z[i]);
		a6.push_back(-x[i] + y[i] - z[i]);
		a7.push_back(-x[i] - y[i] + z[i]);
		a8.push_back(-x[i] - y[i] - z[i]);
	}
	sort(a1.begin(), a1.end(),greater<ll>());
	sort(a2.begin(), a2.end(), greater<ll>());
	sort(a3.begin(), a3.end(), greater<ll>());
	sort(a4.begin(), a4.end(), greater<ll>());
	sort(a5.begin(), a5.end(), greater<ll>());
	sort(a6.begin(), a6.end(), greater<ll>());
	sort(a7.begin(), a7.end(), greater<ll>());
	sort(a8.begin(), a8.end(), greater<ll>());
	
	REP(i, m) {
		a[0] += a1[i];
		a[1] += a2[i];
		a[2] += a3[i];
		a[3] += a4[i];
		a[4] += a5[i];
		a[5] += a6[i];
		a[6] += a7[i];
		a[7] += a8[i];

	}
	sort(a.begin(), a.end(), greater<ll>());
	cout << a[0] << endl;

}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

bool isprime(int x){
    for (int d = 2; d * d <= x; d++){
        if (x % d == 0) return false;
    }
    return true;
}

int main() {
    int x;
    cin >> x;
    while (!isprime(x)) x++;
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e18 + 0;
//const int mod = 1e9 + 7;
const int mod = 998244353;

const int N = 3e3 + 5;
const int mex = 1e5 + 0;

int fact[mex+5], inv[mex+5];

int toPower(int a, int p){
    int res = 1;
    while (p){
        if (p & 1) res = ll(res) * a % mod;
        p >>= 1; a = ll(a) * a % mod;
    }
    return res;
}

int Inv(int x){ 
    return toPower(x, mod - 2); 
}

int add(int a, int b) {
    a %= mod; b %= mod;
    return ((a + b) % mod);
}

int sub(int a, int b) {
    a %= mod; b %= mod;
    return  ((a - b + mod) % mod);
}

int mul(int a, int b) {
    a %= mod; b %= mod;
    return ((a * b) % mod);
}

void initialize(){
    inv[0] = Inv(fact[0]);fact[0] = inv[0] = 1;
    
    for(int i = 1; i <= mex; i++){
        fact[i] = (ll(i) * fact[i - 1]) % mod;
        inv[i] = Inv(fact[i]);
    }
}

int C(int n, int k){
    if (n < 0 || k < 0 || k > n) return 0;
    return ll(fact[n]) * inv[k] % mod * inv[n - k] % mod;                 
}

int dp[N][N], n, s, Data[N], ans[N][N];
int pre[N];

int go(int ind, int sum) {
   if(sum > s) {
     return 1;
   }
   if(ind > n) {
    return 0;
   }
   int &x = dp[ind][sum];
   if(x != -1) return x;
   int temp = 0;
   temp = 1 + go(ind + 1, sum + Data[ind]);
   int temp2 = go(ind+1, sum);
 
  
   ans[ind][sum] += pre[n-temp];
   if(temp2) ans[ind][sum] += pre[n-temp2];
   cout << ans[ind][sum] << '\n';
   return x;
}

void solve() {
   memset(dp, -1, sizeof(dp));
    int n, x, y;
    cin >> n;
    vector <int> A(n), B(n);
    for(int i = 0; i < n; i++) {
        cin >> A[i] >> B[i];
    }
    sort(all(A));
    sort(all(B));
    int ans;
    if((n&1)) {
        ans = B[n/2] - A[n/2]+1;
      }
    else {
        ans = B[n/2]+ B[n/2-1] - A[n/2] - A[n/2 -1]+1;
    }
    ans = max(ans, 1ll);
    cout << ans << '\n';
}

signed main() {   
   ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
    initialize();
   int t = 1;  //cin >> t;
   for(int i = 1; i <= t; i++) {
      solve();
  }
}    


Measured memory_bytes: 78440
#include <iostream>
using namespace std;
int main(void){
    long long N,i,sum=0;
    cin>>N;
    long long A[N],B[N];
    for(i=0;i<N;i++){
        cin>>A[i]>>B[i];
    }
    for(i=N-1;i>-1;i--){
        sum+=(B[i]-(A[i]+sum)%B[i])%B[i];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		
		//距離
		int d = scanner.nextInt();
		
		if (Math.abs(a - c) <= d) {
			System.out.println("Yes");
		}else if (Math.abs(a - b) <= d && Math.abs(b - c) <= d) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		scanner.close();

	}

}


Measured memory_bytes: 21844
def slope(x1, y1, x2, y2)
  return (y2 - y1).round(6)/(x2 - x1).round(6)
end

result = []

gets.to_i.times{
  xa, ya, xb, yb, xc, yc, xd, yd = gets.split.map(&:to_f)
  ab = slope(xa, ya, xb, yb)
  cd = slope(xc, yc, xd, yd)
  result << ((ab == cd) ? "YES" : "NO")
}

result.each{|r|
  puts r
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] s = br.readLine().split(" ");
		int n = Integer.parseInt(s[0]);
		int k = Integer.parseInt(s[1]);
		s = br.readLine().split(" ");
		int[] arr = new int[n];

		for (int i = 0; i < n; i++)
			arr[i] = Integer.parseInt(s[i]);

		Arrays.sort(arr);
		int min = arr[0];

		boolean[] dp = new boolean[k + 1];

		for (int i = 1; i <= k; i++) {
			for (int j = 0; j < n && arr[j] <= i; j++) {
				if (!dp[i - arr[j]]) {
					dp[i] = true;
					break;
				}
//				if (i-arr[j] < min && i-arr[j] >= 0)
//					dp[i] = true;
			}			
		}
		if (dp[k])
			System.out.println("First");
		else
			System.out.println("Second");
	}

}


Measured memory_bytes: 23636
S = input().strip()
a, b = int(S[:2]), int(S[2:])
a, b = 1 <= a <= 12, 1 <= b <= 12
if a and b:
  print('AMBIGUOUS')
elif a and not b:
  print('MMYY')
elif not a and b:
  print('YYMM')
else:
  print('NA')

Measured memory_bytes: 3060
//設定言語check
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;

int main(){
  int N, ans = 0 ;
  string let ;
  int res[4] = {} ;
  cin >> N ;
  for(int i=0;i<N;i++){
    cin >> let ;
    if(let == "AC"){
      res[0]++ ;
    }
    else if(let == "WA"){
      res[1]++ ;
    }
    else if(let == "TLE"){
      res[2]++ ;
    }
    else{
      res[3]++ ;
    }
  }
  cout << "AC x " << res[0] << endl ;
  cout << "WA x " << res[1] << endl ;
  cout << "TLE x " << res[2] << endl ;
  cout << "RE x " << res[3] << endl ;
  return 0 ;
}  

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

int main(){
	int N;
	cin>>N;
	pair<pair<string,int>,int>p[110];
	for(int i=0;i<N;i++){
		string s;
		int t;
		cin>>s>>t;
		p[i].first.first=s;
		p[i].first.second=-t;
		p[i].second=i+1;
	}
	sort(p,p+N);
	for(int i=0;i<N;i++){
		cout<<p[i].second<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 1000

int main() {
	int i,j,k,n,a[N],v;

	scanf("%d", &n);

	for (i = 0;i < n; i++) {
		scanf("%d", &a[i]);
	}

	for (k = 0; k < n; k++) {
		printf("%d", a[k]);
		if (k < n - 1)
			putchar(' ');
	}
	printf("\n");

	for (i = 1;i < n; i++) {
		v = a[i];
		j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
		for (k = 0; k < n; k++) {
			printf("%d", a[k]);
			if (k < n - 1)
				putchar(' ');
		}
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K, X;
  cin >> K >> X;
  REP(i,2*K-1) {
    cout << (X-K)+i+1 <<" ";
  }
}

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

int main() {
	ll n, m;
	cin >> n >> m;
	if (2 * n > m) {
		cout << m / 2 << endl;
	}
	else {
		m += 2 * n;
		cout << m / 4 << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main() {
	int n, m;
	int a[1000], b[1000], c[1000];
	cin >> n >> m;
	REP(i, n) cin >> a[i];
	REP(i, m) cin >> b[i];

	memset(c, 0, sizeof(c));
	REP(i, m) {
		int j;
		for (j = 0; a[j] > b[i]; j++);
		c[j]++;
	}

	int max = 0;
	FOR(i, 1, n) if (c[i] > c[max])	max = i;

	cout << max+1 << endl;
	
	return 0;
}

Measured memory_bytes: 1172
n = int(input())
p = list(map(int, input().split()))

count = 0
for a in range(1, n-1):
    if p[a-1] > p[a] and p[a+1] < p[a]:
        #print(p[a-1], p[a], p[a+1])
        count += 1
    if p[a-1] < p[a] and p[a+1] > p[a]:
        #print(p[a-1], p[a], p[a+1])
        count += 1

print(count)


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		string S = GetString();
		long K = GetLong();

		long N = (long)S.Length;
		if(S.Count(x => x == S[0]) == N)
		{
			Console.WriteLine((N * K) / 2);
			return;
		}

		long c = f(S);
		long cc = f(S + S);
		long d = cc - c;
		Console.WriteLine(c + d * (K - 1));
	}

	private long f(string S)
	{
		long res = 0;
		long cnt = 1;
		for(int i = 1; i < S.Length; i++)
		{
			if(S[i] == S[i - 1])
			{
				cnt++;
			}
			else
			{
				res += cnt / 2;
				cnt = 1;
			}
		}
		res += cnt / 2;

		return res;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 13268
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <algorithm>
using namespace std;
constexpr int64_t INF = 1000000000;

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

  int32_t N, K;
  cin >> N >> K;
  vector<int> H(N,0);
  for (auto& h : H){
    cin >> h;
  }
  sort(H.begin(), H.end(), std::greater<int>());
  int64_t sum = 0;
  for (int i = K; i < N; i++) {
    sum += H[i];
  }
  cout << sum << endl;



  return 0;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;

int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対グラフ

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

string s;
int main(){
    cin >>s;
    int n = s.size();
    int a=0,b=0;
    rep(i,n){
        if(i%2==0){
            if(s[i]=='0'){
                a++;
            }
        }else{
            if(s[i]=='1'){
                a++;
            }
        }
    }
    rep(i,n){
        if(i%2==0){
            if(s[i]=='1'){
                b++;
            }
        }else{
            if(s[i]=='0'){
                b++;
            }
        }
    }
    cout<<min(a,b)<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>

int main(void){
	int i, n, sum;
	while(1){
		scanf("%d",&n);
		if(!n)
			break;
		sum = 0;
		for(i = 1;i <= sqrt((double)n);i++){
			if(n % i == 0 && n != 1){
				sum += i;
				if(i != 1 && i != n / i)
					sum += n / i;
			}
		}
		if(sum == n)
			printf("perfect number\n");
		else if(sum < n)
			printf("deficient number\n");
		else
			printf("abundant number\n");
	}
	return 0;
}

Measured memory_bytes: 1012
#!/usr/bin python3
# -*- coding: utf-8 -*-

H, W = map(int,input().split())

INF = -1
Gmap = [list(input()) for _ in range(H)]
Seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
init_q =[]

from collections import deque

def bfs(sth, stw):
    black = 1
    white = 0
    next_q = deque([])
    next_q.append((sth, stw))
    while len(next_q)!=0:
        #キュー取り出し(先頭)
        h, w = next_q.popleft()
        Seen[h][w] = 0
        for d in direc:
            hs, ws = h + d[0], w + d[1]
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[h][w]=='#' and Gmap[hs][ws]=='.' and Seen[hs][ws]==INF:
                Seen[hs][ws]=0
                next_q.append((hs, ws))
                white +=1
            if Gmap[h][w]=='.' and Gmap[hs][ws]=='#' and Seen[hs][ws]==INF:
                Seen[hs][ws]=0
                next_q.append((hs, ws))
                black +=1
#        print(black,white)
    return black * white

#複数
ret = 0
for sth in range(H):
    for stw in range(W):
        if Gmap[sth][stw]=='#' and Seen[sth][stw]==INF:
            x = bfs(sth, stw)
#                print(sth,stw ,x)
            ret += x
print(ret)


Measured memory_bytes: 11824
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    char c;
    cin>>c;
    if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o')cout<<"vowel"<<endl;
    else cout<<"consonant"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
const ll mod = 1e9 + 7;
int main()
{
    // AGC023-A, 1028, 
    int n; cin >> n;
    vector<ll> a(n), sum(n);
    rep(i, n) {
        cin >> a[i];
        if (i == 0) sum[i] = a[i];
        else sum[i] = sum[i - 1] + a[i];
    }
    map<ll, int> mp;
    rep(i, n) mp[sum[i]]++;
    ll ans = 0;
    for (auto a : mp) {
        ll num = a.second;
        ans += (num * (num - ll(1))) / ll(2);
        if (a.first == 0) ans += num;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 18592
#include <bits/stdc++.h>
#define ll long long
#define maxn 100001
using namespace std;
ll a[maxn], id[maxn], n;
map<ll, ll> trace, b;
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        if (b[a[i]] == 0)
            b[a[i]] = i;
        trace[a[i]]++;
    }
    trace[0] = 0;

    ll pos = n + 1, x = 0, y = 0;
    for (auto i = trace.end(); i != trace.begin(); i--)
    {

        if (i != trace.end())
        {

            id[pos] += (x - i->first) * y;
            x = i->first;
            pos = min(b[x], pos);
            y += i->second;
        }
    }
    id[pos] += (x - 0) * y;
    for (int i = 1; i <= n; i++)
        cout << id[i] << endl;
}
/*
10
1 2 1 3 2 4 2 5 8 1
*/

Measured memory_bytes: 15104
#include<ios>
#include<iostream>
using namespace std;
int n,a[11][11];
main()
{
    while(cin>>n,n)
    {
        for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>a[i][j];
        for(int i=0;i<n;i++)
        {
            int sum=0;
            for(int j=0;j<n;j++)sum+=a[i][j];
            a[i][n]=sum;
        }
        for(int j=0;j<=n;j++)
        {
            int sum=0;
            for(int i=0;i<n;i++)sum+=a[i][j];
            a[n][j]=sum;
        }
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)printf("%5d",a[i][j]);
            puts("");
        }
    }
}


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

int main(void){
  int n;
  vector<int> v;
  int ans;
  
  cin >> n;
  for (int i=0; i<n; i++){
    int t; cin >> t;
    v.push_back(t);
  }
  sort(v.begin(), v.end());
  ans = 1;
  for (int i=0; i<n-1; i++){
    if (v[i]==v[i+1]) ans = 0;
  }
  cout << (ans?"YES":"NO") << endl;
  return 0;
}


Measured memory_bytes: 1400