akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int N, K;
int C[101];
int dp[101][4][4];

int solve(int n, int b1, int b2)
{
  if(n == N) return 1;
  int &ret = dp[n][b1][b2];
  if(~ret) return ret;
  if(~C[n] && (b1 != C[n] || b2 != C[n])) return ret = solve(n + 1, C[n], b1) % 10000;
  else if(~C[n]) return ret = 0;
  ret = 0;
  for(int i = 0; i < 3; i++){
    if(b1 == i && b2 == i) continue;
    ret = (ret + solve(n + 1, i, b1)) % 10000;
  }
  return ret % 10000;
}

int main()
{
  cin >> N >> K;
  memset(C, -1, sizeof(C));
  for(int i = 0; i < K; i++){
    int A, B;
    cin >> A >> B;
    A--, B--;
    C[A] = B;
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(0, 3, 3) % 10000 << endl;
  return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()


int main() {
  int n,k;
  cin >> n >> k;
  if((n & 1) + n / 2 >= k) { cout << "YES" << endl; }
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
bool comp(int a,int b){
return a>b;
}
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main()
{
	fast;
    ll x,y;
    cin>>x>>y;
    if(x*2<=y && y<=x*4 && y%2==0)
    cout<<"Yes";
    else
    cout<<"No";

}



Measured memory_bytes: 3668
A,B,C,D = map(int,input().split())
ans = ""
ans += (C-A) * "R" + (D-B) * "U"
ans += (C-A) * "L" + (D-B) * "D"
ans += "L" + (D-B+1) * "U" + (C-A+1) * "R"+ "D"
ans += "R" + (D-B+1) * "D" + (C-A+1) * "L"+ "U"
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, K;
    cin >> N >> K;
    ll ans = 0;
    if (K % 2 == 0) {
        ll c = (N + K / 2) / K;
        ans += c * c * c;
    }
    ll c = N / K;
    ans += c * c * c;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=1e6+5,M=2e6+5,MOD=1e9+7,OO=1e9;

string get(int x){
	string ret = to_string(x);
	while(sz(ret)<6)ret='0'+ret;
	return ret;
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();
	
	int m,n;

	scanf("%d %d",&m,&n);
	std::vector<vector<pair<int,int>>> g(m+1);
	for(int i=0,x,y;i<n;i++){
		scanf("%d %d",&x,&y);
		g[x].pb({y,i});
	}
	std::vector<string> ans(n);

	for(int i=1;i<=m;i++){
		sort(all(g[i]));
		string curr = get(i);
		int cnt = 0;
		for(auto p : g[i]){
			cnt++;
			ans[p.second] = curr + get(cnt);
		}	
	}

	for(auto x : ans)printf("%s\n",x.c_str() );
}		



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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> using V = vector<T>;
using P = pair<int, int>;

/*
 */

signed main(){
  int s, w;
  cin >> s >> w;

  cout << (w >= s ? "unsafe" : "safe") << endl;
  return 0;
}


Measured memory_bytes: 3636
s = [1,1,1,2,1,
    2,1,5,2,2,
    1,5,1,2,1,
    14,1,5,1,5,
    2,2,1,15,2,
    2,5,4,1,4,1,
    51]

k = int(input())

print(s[k-1])

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm> 
using namespace std;
int main(){
  int n,y;
  cin>>n>>y;
  for(int i=0;i<=y/1000;i++){
    for(int j=0;j<=y/5000;j++){
      int k=n-i-j;
      if(k>=0){
        if((i*1000+j*5000+k*10000)==y){
          cout<<k<<' '<<j<<' '<<i<<endl;
          return 0;
        }
      } 
    }  
  }
  cout<<"-1 -1 -1"<<endl;
  return 0;
}

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

public class Main{



    public static void main(String[] args) {
        FastReader in = new FastReader();
        TreeSet<Long> shrines = new TreeSet<Long>(), temples = new TreeSet<Long>();
        int a = in.nextInt(), b = in.nextInt(), q = in.nextInt();
        for (int l = 0; l < a; ++l){
            shrines.add(in.nextLong());
        }
        for (int l = 0; l < b; ++l){
            temples.add(in.nextLong());
        }
        for (int l = 0; l < q; ++ l){
            long x = in.nextLong();
            Long lshrine = shrines.floor(x);
            lshrine = (lshrine == null?(1L<<60):x - lshrine);
            Long rshrine = shrines.ceiling(x);
            rshrine = (rshrine == null?(1L<<60):rshrine - x);
            Long ltemple = temples.floor(x);
            ltemple = (ltemple == null?(1L<<60):x - ltemple);
            Long rtemple = temples.ceiling(x);
            rtemple = (rtemple == null?(1L<<60):rtemple - x);
            //System.out.println(lshrine + " " + rshrine + " " + ltemple + " " + rtemple);
            System.out.println(Math.min(Math.min(Math.max(lshrine, ltemple), Math.max(rshrine, rtemple)),
                               Math.min(Math.min(lshrine*2+rtemple, ltemple*2+rshrine),
                               Math.min(lshrine+2*rtemple, ltemple+2*rshrine))));
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 84160
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define maxn 200010
const long long INF=1e18;
template <typename T>inline T read()
{
    register T sum=0;
    register char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
int n,m,A,B,x[maxn];
long long f[maxn],tag[maxn<<2],val[maxn<<2][3];
void Effect(int k,int v)
{
	for(int i:{0,1,2})
		val[k][i]+=v;
	tag[k]+=v;
}
void down(int k)
{
	if(tag[k])
	{
		Effect(k<<1,tag[k]);
		Effect(k<<1|1,tag[k]);
		tag[k]=0;
	}
}
void update(int k)
{
	for(int i:{0,1,2})
		val[k][i]=min(val[k<<1][i],val[k<<1|1][i]);
}
void build(int k,int l,int r)
{
	if(l==r)
	{
		val[k][0]=f[l];
		val[k][1]=f[l]+l;
		val[k][2]=f[l]-l;
		return ;
	}
	int mid=(l+r)>>1;
	build(k<<1,l,mid);
	build(k<<1|1,mid+1,r);
	update(k);
}
void change(int k,int l,int r,int x,long long y)
{
	if(l==r)
	{
		if(y<val[k][0])
		{
			val[k][0]=y;
			val[k][1]=y+l;
			val[k][2]=y-l;
		}
		return ;
	}
	down(k);
	int mid=(l+r)>>1;
	if(x<=mid)change(k<<1,l,mid,x,y);
	else change(k<<1|1,mid+1,r,x,y);
	update(k);
}
long long query(int k,int l,int r,int x,int y,int op)
{
	if(l>=x&&r<=y)
		return val[k][op];
	down(k);
	int mid=(l+r)>>1;
	long long res=INF;
	if(x<=mid)res=min(res,query(k<<1,l,mid,x,y,op));
	if(y>mid)res=min(res,query(k<<1|1,mid+1,r,x,y,op));
	return res;
}
signed main()
{
	read(n,m,A,B);
	for(int i=1;i<=m;i++)
		read(x[i]);
	memset(f+1,0x7f,sizeof(long long)*n);
	f[A]=min(f[A],1ll*abs(B-x[1]));
	f[B]=min(f[B],1ll*abs(A-x[1]));
	build(1,1,n);
	for(int i=2;i<=m;i++)
	{
		long long v=query(1,1,n,1,x[i],2)+x[i];
		if(x[i]<n)v=min(v,query(1,1,n,x[i]+1,n,1)-x[i]);
		Effect(1,abs(x[i]-x[i-1]));
		change(1,1,n,x[i-1],v);
	}
	printf("%lld\n",val[1][0]);
    return 0;
}


Measured memory_bytes: 24320
#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int,int>>> G;
vector<int> col;

void dfs(int v,int ncol) {
  col[v] = ncol;
  for (pair<int,int> next : G[v]) {
    if(col[next.first]!=-1) continue;
    dfs(next.first,(next.second%2 ? 1-ncol : ncol));
  }
}

int main() {
  int n;cin >> n;
  G.resize(n+1);
  for (int i=0;i<n-1;i++) {
    int a,b,c;
    cin >> a >> b >> c;
    G[a].push_back(make_pair(b,c));
    G[b].push_back(make_pair(a,c));
  }
  col.assign(n+1, -1);
  dfs(1,0);
  for(int i=1;i<=n;i++) cout << col[i] << endl;
}


Measured memory_bytes: 8192
n=int(input())
A=[0]+list(map(int,input().split()))+[0]
cost=sum(abs(A[i+1]-A[i]) for i in range(n+1))
for i in range(1,n+1):
    print(cost-abs(A[i+1]-A[i])-abs(A[i]-A[i-1])+abs(A[i+1]-A[i-1]))

Measured memory_bytes: 14048
N, M = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())
c = [0] * M
d = [0] * M
for j in range(M):
    c[j], d[j] = map(int, input().split())

point = [0] * N

for i in range(N):
    tmp = 300000000
    for j in range(M):
        l = abs(c[j] - a[i]) + abs(d[j] - b[i])
        if tmp > l:
            point[i] = j + 1
            tmp = l
    print(point[i])


Measured memory_bytes: 3064
#!/usr/bin/python3

M = 998244353

n = int(input())
r = []
for i in range(n):
    (x, d) = map(int, input().split())
    r.append((x, x + d))

r.sort()
cls = []
dp = {}
dp[n] = 1
for i in range(n - 1, -1, -1):
    ne = i + 1
    #make cluster
    while cls:
        (ci, cne) = cls[-1]
        if r[ci][0] < r[i][1]:
            cls.pop()
            ne = cne
        else:
            break;
    cls.append((i, ne))
        
    dp[i] = (dp[i + 1] + dp[ne]) % M

print(dp[0])


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

int pow(int x){
	int i,ans=1;
	for(i=1;i<=x;i++) ans=ans*2;
	return ans;
}

int main() {
	// your code goes here
	int m,n,i,j,h,k[20],s[20][20],p[20],on[20],ans=0;
	cin >> n >> m;
	for(i=0;i<m;i++) {
		cin >> k[i];
		for(j=0;j<k[i];j++) {
			cin >> s[i][j];
		}
	}
	for(i=0;i<m;i++) cin >> p[i];
	for(i=0;i<pow(n);i++){
		int copy=i;
		for(j=1;j<=n;j++){
			on[j]=copy%2;
			copy=(copy-copy%2)/2;
		}
		int flag=0;
		for(j=0;j<m;j++){
			int sum=0;
			for(h=0;h<k[j];h++){
				sum+=on[s[j][h]];
			}
			if((abs(sum-p[j]))%2==1) {
				flag=1;
				break;
			}
		}
		if(flag==0) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())

C = sorted(list([a, b, c]))

d1 = C[2] - C[0]
d2 = C[2] - C[1]

if (d1 - d2) % 2 == 0:
    print(d2 + (d1 - d2)//2)
else:
    print(d2 + (d1 - d2)//2 + 2)

Measured memory_bytes: 38256
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    l,r,d=map(int,input().split())
    count=0
    for i in range(l,r+1):
        if i%d==0:
            count+=1
    print(count)





if __name__ == "__main__":

    main()


Measured memory_bytes: 72660
#include <iostream>
#include <algorithm>
using namespace std;
 
int n, p, k, w[100010];
 
bool judge(int p) {
    int j=1, now = 0;
 
    // while (i<n) {
 
    //     while (sum[j] <= p) {
    //         sum[j] += w[i];
    //         i++;
    //     }
    //     j++;
 
    //     if (j > k) return false;
    // }
	for(int i = 0; i < n; i++){
		if(now + w[i] <= p){
			now += w[i];
		}else if(w[i] <= p){
			now = w[i];
			j++;
		}else{
			return false;
		}
	}
 
    return j <= k;
}
 
// int max_min(int p) {
//     int sum[100010], i = 0, j = 0;
 
//     while (i<n) {
 
//         while (sum[j] <= p) {
//             sum[j] += w[i];
//             i++;
//         }
         
//         if (Max < sum[j]) {
//             Max = sum[j];
//         }
 
//             j++;
//     }
//     return Max;
// }
 
void binary_search(int k) {
    int l = 0, r = 1e9 + 1;
 
    while (r - l >= 1) {
        int m = (l + r) / 2;
 
        // if (!judge(m) && judge(m+1)) return m;
		// cout << m << endl;
    	if (judge(m)) {
            r = m;
        }else{
			l = m + 1;
		}
    }
	cout << r << endl;
}
 
int main() {
 
    cin >> n >> k;
 
    for (int i = 0; i < n; i++) {
        cin >> w[i];
    }
 
    binary_search(k);
 
    // s = max_min(P);
 
    // cout << P << endl;
 
}

Measured memory_bytes: 3492
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e8;
const int N = 1e5 + 5;
const ll OO = 1e16;
const long double EPS = 1e-6;

int n,k,h[100050],dp[100500];


int solve(int indx){

        if(indx >= n)
                return 1e9;
        if(indx == n - 1)
                return 0;
        int &ret = dp[indx];
        if(~ret)
                return ret;
        ret = 1e9;
        for(int i = 1; i <= k; ++i){
                if(indx + i >= n)break;
                ret = min(ret,abs(h[indx + i]-h[indx]) + solve(indx + i));
        }
        return ret;
}
int main()
{
    ios_base::sync_with_stdio();cin.tie(0),cout.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; ++i)
            cin >> h[i];
    memset(dp,-1,sizeof dp);
    cout << solve(0) << "\n";
    return 0;
}


Measured memory_bytes: 5760
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
#define mem(a,n) memset(a,n,sizeof(a))
typedef long long ll;
const ll N=205;
const double eps=1e-6;
const int mod=1e9+7;
int MIN,sum;
int c[10][10],a[N][N];
bool vis[N][N];
int dfs(int x,int sum)
{
    if(x == 1) return MIN=sum;
    for(int i=0; i<10; i++)
    {
        if(x!=i&&sum+c[x][i] < MIN)
        {
            vis[x][i]=1;
            dfs(i,sum + c[x][i]);
            vis[x][i]=0;
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    int h,w;
    while(cin>>h>>w)
    {
        mem(vis,0);
        for(int i=0; i<10; i++)
            for(int j=0; j<10; j++)
                cin>>c[i][j];
        for(int i=0; i<h; i++)
            for(int j=0; j<w; j++)
                cin>>a[i][j];
        ll ans=0;
        for(int i=0; i<h; i++)
            for(int j=0; j<w; j++)
            {
                if(a[i][j]!=-1&&a[i][j]!=1)
                {
                    MIN=c[a[i][j]][1];
                   dfs(a[i][j],0);
                   int tmp=MIN;
                    ans += tmp;
                }
            }
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 512
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(){
	char str[200];
	char te[200];
	int m;
	char temp = '-';
	int i, j;
	int num;
	int h;
	
	while(1){
		scanf("%s", str);

		if(str[0] == temp){
			break;
		}
		else{
			scanf("%d", &h);
			for(j=0; j<h; j++){
				scanf("%d", &num);
/*				printf("b:%s\n", str);*/

				strcpy(te, str);
				for(i=num; i<strlen(str); i++){
					str[i-num] = te[i];
				}
				for(i=0; i<num; i++){
					str[i + strlen(str) - num] = te[i];
				}
/*				printf("a:%s\n", str);*/
			}
			printf("%s\n", str);
		}
	}
	return 0;

}


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

#define ll long long
#define ld long double
#define ull unsigned long long
#define pw(x) (1LL << (x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

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

    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    string path = "";

    path += string(ty - sy, 'U');
    path += string(tx - sx, 'R');

    path += string(ty - sy, 'D');
    path += string(tx - sx, 'L');

    path += 'L';
    path += string(ty - sy, 'U');
    path += 'U';
    path += 'R';
    path += string(tx - sx, 'R');
    path += 'D';

    path += 'R';
    path += string(ty - sy, 'D');
    path += 'D';
    path += 'L';
    path += string(tx - sx, 'L');
    path += 'U';

    cout << path;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  priority_queue<ll> ans;
  for (int i = 0; i < N; i++) {
    ll a;
    cin >> a;
    int count = 0;
    while (a > 1) {
      if (a % 2 == 0) {
        a = a/2;
        count++;
      }
      else {
        break;
      }
    }
    ans.push(count);
  }
  int sum = 0;
  while (!ans.empty()) {
    sum += ans.top();
    ans.pop();
  }
  cout << sum << endl;
}


Measured memory_bytes: 512
x = int(input())
if  400 <= x <= 599:
    print("8")
elif 600 <= x <= 799:
    print("7")
elif 800 <= x <= 999:
    print("6")
elif 1000 <= x <= 1199:
    print("5")
elif 1200 <= x <= 1399:
    print("4")
elif 1400 <= x <= 1599:
    print("3")
elif 1600 <= x <= 1799:
    print("2")
else:
    print("1")

Measured memory_bytes: 9184
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
    	try(Scanner sc = new Scanner(System.in)) {

    		int N = sc.nextInt();
    		int T = sc.nextInt();
    		int min = 10000000;
    		while(N-->0) {
    			int c = sc.nextInt();
    			int t = sc.nextInt();
    			if(t<=T && c<min) {
    				min = c;
    			}
    		}
    		System.out.println(min==10000000? "TLE" : min);

    	}
    }
}


Measured memory_bytes: 21844
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

S = sum(A)
ans = [0 for _ in range(N)]
s = 0
for k in range(int((N - 1) / 2)):
    s += A[2 * k + 1] * 2
ans[0] = S - s
for k in range(1, N):
    ans[k] = A[k - 1] * 2 - ans[k - 1]
print(*ans)


Measured memory_bytes: 63984
# ABC139 C -Lower

N = int(input())
H = list(map(int,input().split()))

diff = []

for i in range(len(H)-1):
    diff.append(H[i+1] - H[i])

count = 0
max = 0
for d in diff:
    if d <= 0:
        count += 1
        if count > max:
            max = count
    else:
        count = 0


print(max)

Measured memory_bytes: 14252
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

void Rotate(vector<string>& board)
{
	rep(y, 4) swap(board[y], board[7 - y]);
	
	rep(y, 8) rep(x, y) swap(board[y][x], board[x][y]);
}

int main()
{
    vector<string> board(8);
	
	rep(i, 8) cin >> board[i];
	
	for(int i = 1; i <= 3; i++)
	{
		Rotate(board);
		
		cout << 90 * i << endl;
		
		rep(y, 8) rep(x, 8)	cout << board[y][x] << (x == 7 ? "\n" : "");
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
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;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b, c;
	cin >> a >> b >> c;
	for(int i = b; i <= c; i++) {
		if(i % a == 0) {
			puts("OK");
			return 0;
		}
	}
	puts("NG");
	return 0;
}

Measured memory_bytes: 3656
# include <bits/stdc++.h>
#define INF 1e9
using namespace std;

int main(){

  int P, Q, R;
  cin >> P >> Q >> R;
  int ans = INF;
  ans = min(ans, P+Q);
  ans = min(ans, P+R);
  ans = min(ans, Q+R);
  cout << ans << endl;
}

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

#define rep(i, n) for(i=0;i<(int)(n);i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define bit(n) (1LL<<(n))
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void rev_string(char str[])
{
    int i;
    int len = strlen(str);
    for (i = 0; i < len / 2; i++) {
        char temp = str[i];
        str[i] = str[len-i-1];
        str[len-i-1] = temp;
    }
}

int main(void){
  char s[500001];
  int f[200001];
  char c[200001]={'\0'};
  int rev[200001];
  int q,i,j,revMode=0,start=250000,len=0;
  
  scanf("%s", &s[start]);
  scanf("%d", &q);
  len = strlen(&s[start]);
  for(i=0;i<q;i++){
    scanf("%d", &j);
    switch(j){
      case 1:
        revMode += 1;
        revMode %= 2;
        break;
      case 2:
        scanf("%d %c", &f[i], &c[i]);
        if(revMode == 1){
          f[i] %= 2;
          f[i] += 1;//hanten
        }
        if(f[i] == 1){
          //atama
          f[i] = start-1;
          start--;
        }else{
          //ketsu
          f[i] = start+len;
        }
        len++;
        
        break;
    }
  }
  for(i=0;i<q;i++){
    //create string
    s[f[i]] = c[i];
  }
  if(revMode == 0) printf("%s", &s[start]);
  else{
    //printf("%s", &s[start]);
    for(i=start+strlen(&s[start])-1;i>=start;i--){
      printf("%c", s[i]);
    }
  }
  
  return 0;
}



Measured memory_bytes: 1792
a = input()
s = []
k = a[0]
count = 1
for li in range(len(a)-1):
    i = li + 1
    if k == 'R' and a[i] == "R":
        count = count + 1
    if k == 'L' and a[i] == "L":
        count = count + 1
    if k == 'R' and a[i] == "L":
        s.append(count)
        count = 1
        k = "L"
    if k == 'L' and a[i] == "R":
        s.append(count)
        count = 1
        k = "R"
s.append(count)
d = []
for i in range(len(s)//2):
    for k in range(s[i*2]-1):
        d.append(0)
    d.append((s[i*2]+1)//2+s[i*2+1]//2)
    d.append(s[i*2]//2+(s[i*2+1]+1)//2)
    for k in range(s[i*2+1]-1):
        d.append(0)
print(*d)    



Measured memory_bytes: 7160
#include <iostream>
#include <assert.h>
using namespace std;

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

    assert(1 <= N && N <= 100);
    int num_odd = 0;
    if(N % 2 == 0){
        num_odd = N / 2;
    }
    else{
        num_odd = N / 2 + 1;
    }
    float p_odd = (float) num_odd / N;
    cout << p_odd;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

int main() {
    int K,X;
    cin >> K >> X;

    for(int i = X-K+1; i < X+K; i++){
        if(i < -1000000){
            i = -1000000;
        }

        if(i > 1000000){
            break;
        }

        cout << i << " ";
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	vector<int> a(n);

	for (unsigned i = 0; i < a.size(); i++) {
		cin >> a[i];
	}

	vector<long long> s(n + 1, 0);

	for (unsigned i = 0; i < a.size(); i++) {
		s[i + 1] = s[i] + a[i];
	}

	sort(s.begin(), s.end());

	long long c = 0;
	long long r = 0;

	for (unsigned i = 0; i < a.size(); i++) {
		if (s[i] == s[i + 1]) {
			++c;
		}
		else if (c) {
			r += (c + 1) * c / 2;
			c = 0;
		}
	}

	if (c) {
		r += (c + 1) * c / 2;
	}

	cout << r;

	return 0;
}

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

int main() {
  string s; cin >> s;
  FOREACH(c,s) if(c==',') c = ' ';
  cout << s << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

using namespace std;

int main()
{
    int n;
    cin >> n;
    cout << n * n * n << endl;
    return 0;
}

Measured memory_bytes: 256
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    x = intin()

    ans = 1

    for i in range(2, x + 1):
        for j in range(2, 999999):
            k = i**j
            if k > x:
                break
            ans = max(ans, k)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3540
#include<stdio.h>
#include<stdlib.h>

int compar(const void *a, const void *b)
{
	return *(int *)b- *(int *)a;
}

int main(void)
{
	int i,a[5];
	
	for(i=0;i<=4;i++)
	{
	   scanf("%d",&a[i]);
	}
	qsort(a,5,sizeof(int),compar);
	printf("%d",a[0]);
	for(i=1;i<=4;i++)
	{
		printf(" %d",a[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
# define INF 0x3f3f3f3f 
  
// iPair ==>  Integer Pair 
typedef pair<int, int> iPair; 
  
// This class represents a directed graph using 
// adjacency list representation 
class Graph 
{ 
    int V;    // No. of vertices 
  
    // In a weighted graph, we need to store vertex 
    // and weight pair for every edge 
    list< pair<int, int> > *adj; 
  
public: 
    Graph(int V);  // Constructor 
  
    // function to add an edge to graph 
    void addEdge(int u, int v, int w); 
  
    vector<int> shortestPath(int s); 
}; 
  
// Allocates memory for adjacency list 
Graph::Graph(int V) 
{ 
    this->V = V; 
    adj = new list<iPair> [V]; 
} 
  
void Graph::addEdge(int u, int v, int w) 
{ 
    adj[u].push_back(make_pair(v, w)); 
    adj[v].push_back(make_pair(u, w)); 
} 
  
vector<int> Graph::shortestPath(int src) 
{ 
    // Create a priority queue to store vertices that 
    // are being preprocessed. This is weird syntax in C++. 
    // Refer below link for details of this syntax 
    // https://www.geeksforgeeks.org/implement-min-heap-using-stl/ 
    priority_queue< iPair, vector <iPair> , greater<iPair> > pq; 
  
    // Create a vector for distances and initialize all 
    // distances as infinite (INF) 
    vector<int> dist(V, INF); 
  
    // Insert source itself in priority queue and initialize 
    // its distance as 0. 
    pq.push(make_pair(0, src)); 
    dist[src] = 0; 
  
    /* Looping till priority queue becomes empty (or all 
      distances are not finalized) */
    while (!pq.empty()) 
    { 
        // The first vertex in pair is the minimum distance 
        // vertex, extract it from priority queue. 
        // vertex label is stored in second of pair (it 
        // has to be done this way to keep the vertices 
        // sorted distance (distance must be first item 
        // in pair) 
        int u = pq.top().second; 
        pq.pop(); 
  
        // 'i' is used to get all adjacent vertices of a vertex 
        list< pair<int, int> >::iterator i; 
        for (i = adj[u].begin(); i != adj[u].end(); ++i) 
        { 
            // Get vertex label and weight of current adjacent 
            // of u. 
            int v = (*i).first; 
            int weight = (*i).second; 
  
            //  If there is shorted path to v through u. 
            if (dist[v] > dist[u] + weight) 
            { 
                // Updating distance of v 
                dist[v] = dist[u] + weight; 
                pq.push(make_pair(dist[v], v)); 
            } 
        } 
    } 
    return dist; 
} 
int main() {
  int N, M, R, A, B, C, answer = INF, E;
  cin >> N >> M >> R;
  int r[R];
  for (int i = 0; i < R; r[i++]--) {
    cin >> r[i];
  }
  sort(r,r+R);
  Graph G(N);
  while (M--) {
    cin >> A >> B >> C;
    G.addEdge(--A,--B,C);
    G.addEdge(B,A,C);
  }
  map<int,vector<int>> D;
  for (int i = 0; i < R; i++) {
    D[r[i]] = G.shortestPath(r[i]);
  }
  do {
    E = 0;
    for (int i = 1; i < R; i++) {
      E += D[r[i-1]][r[i]];
    }
    answer = min(answer,E);
  } while (next_permutation(r,r+R));
  cout << answer;
}

Measured memory_bytes: 6084
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    double t,x;

    cin >> t >> x;
    
    cout << t/x << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n[3];
int main()
{
    for(int i = 0; i<3; ++i)
        cin>>n[i];
    if(n[0]==n[1] && n[1]==n[2])
        cout<<"No\n";
    else if((n[0]!=n[1]) && (n[1]!=n[2]) && (n[2]!=n[0]))
        cout<<"No\n";
    else 
        cout<<"Yes\n";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string S;
    cin >> S;

    if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2])
    {
        cout << "Yes" << endl;
        return 0;
    }
    else if (S[0] == S[2] && S[1] == S[3] && S[0] != S[3])
    {
        cout << "Yes" << endl;
        return 0;
    }
    else if (S[0] == S[3] && S[1] == S[2] && S[0] != S[1])
    {
        cout << "Yes" << endl;
        return 0;
    }

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

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

using namespace std;

long long n , a[200] , sum , x , j;

int main()
{
	cin >> n >> x;
	for(int i = 0 ; i < n ; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	sort(a , a + n);
	for(int i = 0 ; i < n ; i++)
	{
		x -= a[i];
		if(x < 0)
			j++;
	}
	if(j > 0)
		cout << n - j;
	else if(x > 0)
		cout << n - 1;
	else
		cout << n;
}		

Measured memory_bytes: 256
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:[isize;3],
    }
    println!("{} {}",min(a[1],a[2]),max(a[1]+a[2]-a[0],0))
}

Measured memory_bytes: 2120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
const int  N = 2e5 + 314;
void foo(){
    int n, k;
    cin>>n>>k;
    ll sum=0;
    for(int i = 0; i < k; i++){
        int x;
        cin>>x;
        sum+=x;
    } 
    if(sum>=n)cout<<"Yes";
    else cout<<"No";
}
int main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)foo();
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>

using namespace std;

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (C % gcd(A, B) == 0) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
}

Measured memory_bytes: 3092
n = int(input())
happy = []
for i in range(n):
    happy.append(tuple(map(int, input().split())))
happy.sort(key=sum, reverse=True)
ans = 0
for i, (a, b) in enumerate(happy):
    if i % 2 == 0:
        ans += a
    else:
        ans -= b
print(ans)


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

int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a;
        cin >> a;
        ++mp[a];
    }
    int ans = 0;
    for ( auto tmp_mp : mp ) {
        if ( tmp_mp.second % 2 == 1 ) {
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
// AOJ 1566 Movie
// 2018.2.6 bal4u

#include <stdio.h>
#include <stdlib.h>

typedef struct { int a, b; } T;
T tbl[101];
char seen[101];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int cmp(T *a, T *b) { if (a->b - b->b) return a->b - b->b; return a->a - b->a; }

int main() 
{
	int n, i, j, saw, ans;

	n = in();
	for (i = 0; i < n; i++) tbl[i].a = in(), tbl[i].b = in();
	qsort(tbl, n, sizeof(T), cmp);

	ans = 0, saw = 0;
	for (i = 1; i <= 31; i++) {
		for (j = 0; j < n; j++) {
			if (i < tbl[j].a || tbl[j].b < i) continue;
			if (seen[j]) continue;
			ans += 100, seen[j] = 1, saw++;
			break;
		}
	}
	ans += (31-saw)*50;
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(((s[0]==s[1]&&s[2]==s[3])||(s[0]==s[2]&&s[1]==s[3])||(s[0]==s[3]&&s[1]==s[2]))&&(s[0]!=s[1]||s[0]!=s[2]))
		cout<<"Yes";
	else cout<<"No";
	return 0;
} 

Measured memory_bytes: 256
# 久々の幅優先探索……

import queue

n, k = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(n-1)]

def add_edge(u, v ):
	G[u].append(v)
	G[v].append(u)

G = [[] for _ in range(n)] #グラフの隣接リスト表現
for edge in edges:
	add_edge(edge[0]-1, edge[1]-1)

q = queue.Queue()
q.put(0)

n_colors = [-1] * n
n_colors[0] = k

count = 0
for v in G[0]:
	q.put(v)
	n_colors[v] = k - count - 1 #※
	count += 1

while(q.qsize() > 0):
	now = q.get()
	count = 0
	for v in G[now]:
		if n_colors[v] >= 0:
			pass
		else:
			q.put(v)
			n_colors[v] = k - count - 2
			count += 1

			if n_colors[v] == 0:
				print(0)
				exit()

ans = 1
for i in range(n):
	ans *= n_colors[i]
	ans %= (10 ** 9 + 7)

print(ans)


Measured memory_bytes: 47344
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> anys;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(anys{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	while(true){
		C-=B;
		if(C<=0){
			cout << "Yes" << endl;
			return 0;
		}
		A-=D;
		if(A<=0){
			cout << "No" << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 3624
import java.io.*;

class Main {
	private static final int NOT_ADD = -1;

	public static void main (String args[]) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String buf;
 
		try {
			if ((buf = br.readLine())!=null) {
				double max,min;
				max = min = Double.parseDouble(buf);
				while ((buf = br.readLine())!=null) {
					double d = Double.parseDouble(buf);
					if (max<d) max = d;
					if (min>d) min = d; 
				}
				System.out.println(max-min);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int n;
	while (cin >> n, n) {
		vector<vector<int> >v(n, vector<int>(n, INF));
		rep(i, 0, n)v[i][i] = 0;
		int k; cin >> k;
		bool f = false;
		rep(i, 0, k) {
			int x; cin >> x;
			if (x == 0) {
				if (!f) {
					rep(j, 0, n) {
						rep(l, 0, n) {
							rep(h, 0, n) {
								v[l][h] = min(v[l][h], v[l][j] + v[j][h]);
							}
						}
					}
					f = true;
				}

				int a, b; cin >> a >> b; a--; b--;
				cout << ((v[a][b] == INF) ? -1 : v[a][b]) << endl;
			}
			else {
				int c, d, e; cin >> c >> d >> e; c--; d--;
				v[c][d] = v[d][c] = min(v[c][d], e);
				f = false;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
int A[50];
int n;
int solve(int i,int x){
    if(x == 0){
        return 1;
    }
    if(i >= n)
        return 0;
    int res = solve(i+1,x)||solve(i+1,x-A[i]);
    return res;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    int q,x;
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>x;
        if(solve(0,x))
            cout<<"yes"<<endl;
        else
            cout<<"no"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
	int n;cin>>n;
	vector<int> v(n);
	rep(i,n) cin>>v[i];
	int count = 0;
	rep(i,n-2){
		if(v[i+1] != max(max(v[i],v[i+1]),v[i+2]) && v[i+1] != min(min(v[i],v[i+1]),v[i+2]))count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(i) sort((i).begin(),(i).end())
#define INF 2000000000
constexpr ll mod = 1000000007;

int main() {
	int N, K;
	cin >> N >> K;
	vector<ll>h(N);
	for (int i = 0;i < N;++i) {
		cin >> h[i];
	}
	SORT(h);
	ll ans = INF;
	for (int i = K - 1;i < N;++i) {
		ans = min(ans, h[i] - h[i - K + 1]);
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1024