akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll bunshi(ll n, ll a, ll mod) {
    ll res = 1;
    while (a > 0) {
        res *= n;
        n--;
        a--;
        res %= mod;
    }
    return res;
}

ll bunbo(ll a, ll mod) {
    ll res = 1;
    for (int i = a; i > 0; i--) {
        res *= i;
        res %= mod;
    }

    return res;
}

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

    ll n, a, b;
    cin >> n >> a >> b;
    ll MOD = pow(10, 9) + 7;
    ll whole = modpow(2, n, MOD) - 1;

    ll abunshi = bunshi(n, a, MOD);
    ll abunbo = bunbo(a, MOD);
    ll bbunshi = bunshi(n, b, MOD);
    ll bbunbo = bunbo(b, MOD);

    ll nca = abunshi * modpow(abunbo, MOD - 2, MOD) % MOD;
    ll ncb = bbunshi * modpow(bbunbo, MOD - 2, MOD) % MOD;

    ll ans = whole - nca - ncb;
    if (ans < 0) {
        while (ans < 0)
            ans += MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
using System;
using System.Linq;
using static System.Console;

namespace AtCorder
{
  class Program
  {
    static void Main()
    {
      WriteLine(CheckReverse());
    }

    static string CheckReverse()
    {
      string chara = ReadLine();
      string reverseChara = new string(chara.Reverse().ToArray()); 
      chara = chara.Length > 2 ? reverseChara : chara;
      return chara;
    }
  }
}

Measured memory_bytes: 13268
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    if(  floor(ceil(n / 1.08)* 1.08) == n)
    {
        cout << ceil(n / 1.08);
    }
    else
    {
        cout<< ":(";
    }
    

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int MAXN = 100005;

int N, u[MAXN], v[MAXN], color[MAXN];
vector < vector < pii > > Graph;

void dfs ( int node, int c = 0, int p = -1 )
{
	int col = 0;
	for ( auto i : Graph[node] )
		if ( i.first != p )
		{
			while ( ++col == c );
			color[i.second] = col;
			dfs ( i.first, col, node );
		}
}

int main ()
{
	cin >> N;
	Graph.resize ( N + 1 );
	int ans = 0;
	for ( int i = 0; i < N - 1; i++ )
	{
		cin >> u[i] >> v[i];
		Graph[u[i]].push_back ( {v[i], i} );
		Graph[v[i]].push_back ( {u[i], i} );
		ans = max ( ans, (int)max ( Graph[u[i]].size(), Graph[v[i]].size() ) );
	}
	
	dfs ( 1 );
	cout << ans << "\n";
	for ( int i = 0; i < N - 1; i++ )
		cout << color[i] << "\n";
	return 0;
}


Measured memory_bytes: 7936
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int itemCount = int.Parse(Reader.ReadLine());
        long[] items = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).OrderBy(a => a).ToArray();

        long num1 = items.Last();
        long num2 = items[GetAns(0, itemCount - 2, items)];

        Console.WriteLine(num1 + " " + num2);
         
    }

    private int GetAns(int min, int max, long[] arr) {
        if(max-min<=2) {
            int mid = (max + min) / 2;
            decimal diff1 = Math.Abs(arr.Last() / 2m - arr[min]);
            decimal diff2 = Math.Abs(arr.Last() / 2m - arr[mid]);
            decimal diff3 = Math.Abs(arr.Last() / 2m - arr[max]);

            decimal diffTemp = Math.Min(diff1, Math.Min(diff2, diff3));
            if(diffTemp == diff1) {
                return min;
            } else if(diffTemp == diff2) {
                return mid;
            } else {
                return max;
            }
        }

        int mid1 = min + (max - min) / 3;
        int mid2 = min + (max - min) * 2 / 3;

        decimal diffMin = Math.Abs(arr.Last() / 2m - arr[min]);
        decimal diffMid1 = Math.Abs(arr.Last() / 2m - arr[mid1]);
        decimal diffMid2 = Math.Abs(arr.Last() / 2m - arr[mid2]);
        decimal diffMax = Math.Abs(arr.Last() / 2m - arr[max]);

        decimal target = new decimal[] { diffMin, diffMid1, diffMid2, diffMax }.Min();

        if(target == diffMin) {
            return GetAns(min, mid1, arr);
        } else if(target == diffMid1) {
            return GetAns(min, mid2, arr);
        } else if(target == diffMid2) {
            return GetAns(mid1, max, arr);
        } else {
            return GetAns(mid2, max, arr);
        }

    }



    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


5
6 9 4 2 11



";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


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

int main(int argc, char const *argv[])
{
	int n;
	long long d,a;
	cin>>n>>d>>a;
	pair<long long,long long> xh[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>xh[i].first>>xh[i].second;
	}
	sort(xh,xh+n);
	long long ans=0LL,now=0LL;
	pair<long long,long long> bomb[n];
	int r=0,w=0;
	for (int i = 0; i < n; ++i)
	{
		while (i>0&&xh[i].first>bomb[r].first)
		{
			now-=bomb[r].second;
			++r;
			if (r>=w)
			{
				break;
			}
		}
		if (xh[i].second-now>0LL)
		{
			long long b=(xh[i].second-now+a-1LL)/a;
			ans+=b;
			now+=a*b;
			bomb[w]=make_pair(xh[i].first+2LL*d,a*b);
			++w;
			int j=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 6528
A,B,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
min_price = min(a)+min(b)
for _ in range(m):
  x,y,c=map(int,input().split())
  price = a[x-1]+b[y-1]-c
  if price < min_price:
    min_price = price
print(min_price)

Measured memory_bytes: 18736
#include <iostream>
using namespace std;
int trib(int a){
	if(a==1){return 1;}
	if(a==2){return 2;}
	if(a==0){return 1;}
//	if(a==3){return }
	return trib(a-3)+trib(a-2)+trib(a-1);
}
int main() {
	// your code goes here
int a;
while(true){
	cin>>a;
	if(a==0){return 0;}
cout<<((trib(a)+1)/10+1)/365+1<<endl;
	
}
	return 0;
}


Measured memory_bytes: 2980
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;



signed main() {
int ans;
vector<int> N(5);
REP(i,5){
cin >> N[i];
}
REP(i,5){
    if(N[i]==0){
        ans = i+1;
    }
}
answer(ans);
return 0;
}


Measured memory_bytes: 3564
#include<stdio.h>

int main(void){

  int a,b,c,x,y,z;

  scanf("%d%d%d",&a,&b,&c);

  if(a > b){

    x = a;

    a = b;

    b = x;

  }

  if(b > c){

    y = b;

    b = c;

    c = y;

  }

  if(a > b){

    z = a;

    a = b;

    b = z;

  }

  printf("%d %d %d\n",a,b,c);

  return 0;

}

Measured memory_bytes: 596
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const double EPS = 1e-8;
const int MOD = 1000 * 1000 * 1000 + 7;

const int MAX = 100 * 10000 + 47;





int main()
{
    int n;
    scanf("%d", &n);
    map<int, int> M;
    FOR(i, 0, n)
    {
        int x;
        scanf("%d", &x);
        M[x]++;
    }
    int m;
    scanf("%d", &m);
    FOR(i, 0, m)
    {
        int x;
        scanf("%d", &x);
        if (!M[x])
        {
            printf("NO");
            return 0;
        }
        M[x]--;
    }
    printf("YES");
}


Measured memory_bytes: 9600
#include <stdio.h>

int main()
{
        char str[1025];
        char sepstr[1025];
        int i = 0, offset = 0;
        int flag = 0;

        scanf( "%[^\n]", str );
        while ( 1 ) {
                i = 0;
                while ( str[i+offset] != ',' && str[i+offset] != ' ' && str[i+offset] != '.' ) {
                        sepstr[i] = str[i+offset];
                        i++;
                }
                offset += i+1;



                if ( i > 2 && i < 7 ) {
                        sepstr[i] = '\0';
                        if ( flag == 0 ) {
                                printf( "%s", sepstr );
                                flag = 1;
                        } else {
                                printf( " %s", sepstr );
                        }
                }

                if ( offset > 1024 ) {
                        printf( "\n" );
                        break;
                }
        }

        return 0;
}



Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c;
	cin>>a>>b>>c;
	unordered_map<int,int> cnt;
	cnt[a]++;
	cnt[b]++;
	cnt[c]++;
	cout<<cnt.size();
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		
		int h1 = sc.nextInt();
		int m1 = sc.nextInt();
		int h2 = sc.nextInt();
		int m2 = sc.nextInt();
		int k = sc.nextInt();
		
		int ans1 = (h2-h1)*60;
		int ans2 = m2-m1;
		
		if(ans2 < 0) {
			ans1-=60;
			ans2 = 60-m1+m2;
		}
		
		int total = ans1+ans2;
		
		System.out.println(total-k);
		
 
	}
}


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

typedef long long ll;
typedef long long LL;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#ifdef DEBUG
    #define cek(x) cout<<x
#else
    #define cek(x) if(false){}
#endif // DEBUG

#define fi first
#define se second
#define INF 1000000000
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define PI acos(-1.0)
#define pb push_back
#define TC() while(tc--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORN(i,n) for(int i=0;i<=n;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define REPN(i,a,b) for(int i=a;i<=b;i++)
#define reset(a,b) memset(a,b,sizeof(a))
#define sc(x) scanf("%d",&x)

int group[2][200010];

int main(void){
    #ifdef ccsnoopy
        freopen("D:/Code/in.txt","r",stdin);
    #endif

    int n,k,l;
    sc(n);sc(k);sc(l);
    int fr, to;
    vector<set<int> > vecset;
    vector<vi> adjList;
    adjList.assign(n, vi());
    vecset.assign(n, set<int>());
    reset(group, -1);
    FOR(i,k){
    	sc(fr);sc(to);
    	fr--;to--;

    	adjList[fr].pb(to);
    	adjList[to].pb(fr);
    }

    vector<vi> train;
    train.assign(n, vi());
    FOR(i,l){
    	sc(fr);sc(to);
    	fr--;to--;
    	train[fr].pb(to);
    	train[to].pb(fr);
    }
    int cc_ctr = 0;
    FOR(i,n){
    	if(group[0][i] == -1){
    		vector<int> v;
    		queue<int> q;
    		q.push(i);
    		group[0][i] = cc_ctr;
    		v.pb(i);
    		while(!q.empty()){
    			int cur = q.front();
    			q.pop();
    			FOR(j, adjList[cur].size()){
    				int nxt = adjList[cur][j];
    				if(group[0][nxt] == -1){
    					group[0][nxt] = cc_ctr;
    					v.pb(nxt);
    					q.push(nxt);
    				}
    			}
    		}
    		cc_ctr++;
    	}
    }
    vector<int> ret;
    ret.assign(n, 0);
	FOR(i,n){
    	if(group[1][i] == -1){
    		queue<int> q;
    		q.push(i);
    		group[1][i] = cc_ctr;
    		map<int, set<int> > mapper;
    		mapper[group[0][i]].insert(i);
    		while(!q.empty()){
    			int cur = q.front();
    			q.pop();
    			FOR(j, train[cur].size()){
    				int nxt = train[cur][j];
    				if(group[1][nxt] == -1){
    					group[1][nxt] = cc_ctr;
    					mapper[group[0][nxt]].insert(nxt);
    					q.push(nxt);
    				}
    			}
    		}
    		cc_ctr++;
    		for(map<int, set<int> >::iterator it = mapper.begin();it!=mapper.end();it++){
    			int sz = it->second.size();
    			for(set<int>::iterator s_it = it->second.begin();s_it != it->second.end();s_it++){
    				ret[*s_it] = sz;
    			}
    		}
    	}
    }

    FOR(i,n){
    	printf("%d ", ret[i]);
    }



    return 0;
}




Measured memory_bytes: 35396
#include<cstdio> 
#include<algorithm> 
#include<cstring> 
#define gc getchar() 
#define pc putchar 
inline int read() { 
	int x = 0,f = 1; 
	char c = gc; 
	while(c < '0' || c > '9') c = gc; 
	while(c <= '9' && c >= '0') x = x * 10 + c - '0',c = gc; 
	return x * f ;
} 
void print(int x) { 
	if(x >= 10 ) print(x / 10); 
	pc(x % 10 + '0'); 
} 
int n; 
const int mod = 1000000007; 
inline int fstpow(int x,int k ){  
	int ret = 1; 
	for(;k;k >>= 1,x = 1ll * x * x % mod)  
		if(k & 1) ret = 1ll * ret * x % mod; 
	return ret; 
} 

const int maxn = 2001; 
int a[200006],b[200007]; 
int c[(maxn << 1) + 7][(maxn << 1) + 7]; 
int jc[(maxn << 2)],inv[(maxn << 2) + 7]; 
inline int C(int x,int y) { 
	return 1ll * jc[x] * inv[y] % mod * inv[x - y]% mod; 
} 
int main() { 
	n = read(); 
	int ans = 0; 
	for(int i = 1;i <= n;++ i) { 
		a[i] = read(),b[i] = read(); 
		c[maxn - a[i]][maxn - b[i]] += 1; 
	} 
	for(int i = 1;i < (maxn << 1);++ i) 
		for(int j = 1;j <= (maxn << 1);++ j)  
			(c[i][j] += c[i - 1][j] + c[i][j - 1]) %= mod; 
	for(int i = 1;i <= n;++ i) { 
		(ans += c[maxn + a[i]][maxn + b[i]]) %= mod; 
	} 
	jc[0] = jc[1] = 1; 
	
	for(int i = 2;i < (maxn << 2); ++ i) jc[i] = 1ll * jc[i - 1] * i % mod;  
	
	inv[(maxn << 2) - 1] = fstpow(jc[(maxn << 2) - 1],mod - 2); 
	
	for(int i = (maxn << 2) - 2;i;-- i)  inv[i] = 1ll * inv[i + 1] * (i + 1) % mod; 
	for(int i = 1;i <= n;++ i) { 
		ans = ((ans - C(a[i] * 2 + b[i] * 2,a[i] * 2)) % mod + mod) % mod; 
	} 
	ans = (1ll * 500000004 * ans) % mod; 
	print(ans); 
	return 0; 
	
} 	

Measured memory_bytes: 64512
N=int(input())
List = list(map(int, input().split()))
flag = True
for i in range(N):
  if List[i]%2 ==0:
    if List[i] % 3 != 0 and List[i] % 5 != 0:
      flag = False
if flag:
  print("APPROVED")
else:
  print("DENIED")

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

#define fr first
#define sc second

using namespace std;
typedef pair<int, int> ii;
typedef long long ll;
typedef unsigned long long u64;

const int NMAX = 1e5 + 3, KEK = 1453, CMAX = 'z' - 'a' + 1;
const double EPS = 1e-5;

main() {
    #ifdef HOME
        freopen("input.txt", "r", stdin);
    #else
//        freopen("newphone.in", "r", stdin);
//        freopen("newphone.out", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int m;
    cin >> m;
    int arr[4][m + 2];
    for (int i = 1; i <= 2; ++i) {
        for (int j = 1; j <= m; ++j) {
            cin >> arr[i][j];
        }
    }
    int dp[4][m + 2];
    memset(dp, 0, sizeof(dp));
    dp[1][1] = arr[1][1];
    for (int i = 1; i <= 2; ++i) {
        for (int j = 1; j <= m; ++j) {
            dp[i][j] = max(dp[i][j], dp[i - 1][j] + arr[i][j]);
            dp[i][j] = max(dp[i][j], dp[i][j - 1] + arr[i][j]);
        }
    }
    cout << dp[2][m];
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int N; cin >> N;
  vi C(N-1), S(N-1), F(N-1); REP(i,N-1) cin >> C[i] >> S[i] >> F[i];

  REP(i,N-1) {
    int t = 0;
    FOR(j,i,N-1) {
      if (t <= S[j]) {
        t = S[j];
        t += C[j];
      }
      else {
        t = S[j]+F[j]*DUP(t-S[j],F[j]);
        t += C[j];
      }
    }
    cout << t << "\n";
  }
  cout << 0 << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	ll a,b,v,w,t;
	cin>>a>>v>>b>>w>>t;
	ll dis=abs(a-b);
	ll dif=v-w;
	if(w>=v) {
		cout<<"NO"<<endl;
	}
	else{
		double time=(double)dis/dif;
		if(time>t) {
			cout<<"NO"<<endl;
		}
		else{
			cout<<"YES"<<endl;
		}
	}



	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define mod (int)(1e9 + 9)
#define fir first
#define sec second
#define all(v) begin(v),end(v)
using i64 = int_fast64_t;

i64 w,h;
vector<pair<i64,int>> obs;
vector<i64> dp;
vector<vector<i64>> mt;

vector<vector<i64>> mul(vector<vector<i64>> &a, vector<vector<i64>> &b) {
    vector<vector<i64>> ret(a.size());
    for(int i=0; i<a.size(); ++i) {
        ret[i].resize(b[0].size());
        for(int j=0; j<b[0].size(); ++j) {
            for(int k=0; k<b.size(); ++k) {
                (ret[i][j]+=(a[i][k]*b[k][j])%mod)%=mod;
            }
        }
    }
    return ret;
}

void calc(i64 y1,i64 y2) {
    vector<i64> nx(w);
    i64 dy=y2-y1;
    assert(dy>=0);
    vector<vector<i64>> now(w);
    for(int i=0; i<w; ++i) {
        now[i].resize(w);
        now[i][i]=1;
    }
    auto tmp=mt;
    while(dy) {
        if(dy&1) {
            now=mul(tmp,now);
        }
        dy>>=1;
        tmp=mul(tmp,tmp);
    }
    for(int i=0; i<w; ++i) {
        for(int j=0; j<w; ++j) {
            (nx[i]+=now[i][j]*dp[j])%=mod;
        }
    }
    dp=nx;
}

void solve() {
    obs.clear();
    dp.clear();
    mt.clear();
    static int casenum=0;
    int n;
    cin>>w>>h>>n;
    if(!w) exit(0);
    dp.resize(w);
    mt.resize(w);
    for(int i=0; i<w; ++i) {
        mt[i].resize(w,0);
        mt[i][i]++;
        if(i) mt[i][i-1]++;
        if(i+1<w) mt[i][i+1]++;
    }
    for(int i=0; i<n; ++i) {
        i64 a,b; cin>>a>>b;
        a--,b--;
        if(b) {
            obs.emplace_back(b,a);
        }
    }
    sort(begin(obs),end(obs));
    i64 lasy=0;
    dp[0]=1;
    for(auto i=obs.begin(); i!=obs.end(); ) {
        vector<int> xs;
        i64 y=i->fir;
        calc(lasy,y);
        while(i!=end(obs) && i->fir==y) {
            dp[i->sec]=0;
            ++i;
        }
        lasy=y;
    }
    calc(lasy,h-1);
    cout<<"Case "<<++casenum<<": "<<dp[w-1]<<endl;
}

signed main() {
    while(1) solve();
}


Measured memory_bytes: 3164
R, B, G, N = map(int,input().split())
 
 
cnt = 0
ball = 0
a = sorted([R,G,B])
for r in range(N//a[0]+1):
    ball = r*a[0]
    for b in range((N-ball)//a[1]+1):
        if N-ball >= 0 and (N-ball-b*a[1])%a[2] == 0:
            cnt += 1
 
print(cnt)

Measured memory_bytes: 40428
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n, p; cin >> n >> p;
        if(n == 0 and p == 0) return 0;
        else{
            vector<int> person(n, 0);
            int turn = 0, cup = p; // turnは今誰のターンか示す, cupは椀の中に入っている小石の個数
            while(true){
                if(cup != 0){ //cupに小石がある時
                    person[turn]++;
                    cup--;
                }
                else if(person[turn] != 0){ //小石を持っているとき
                    cup += person[turn];
                    
                    person[turn] = 0;
                }

                if(person[turn] == p) break;
                turn++;
                if(turn == n) turn = 0;
            }
            cout << turn << endl;
        }
    }
}


Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>

using namespace std;
#define REP(m,n) for(int i=m;i<n;++i)
#define REPj(m,n) for(int j=m;j<n;++j)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair

vector<pair<int, int>>edge[200000];
vector<pair<int, int>>na[200000];
vector<int>cost(100000, INF);
vector<int>city;
queue<int>que;

int main() {
	string s, a;
	cin >> s;
	if (s.size() < 4) {
		cout << "No" << endl;
		return 0;
	}
	a = s.substr(0, 4);
	if (a == "YAKI") {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 9984
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    HashMap<String, Long> map = new HashMap<String, Long>();
    long ans = 0;
    for(int i = 0; i < n; i++) {
      String s = sc.next();
      int[] c = new int[26];
      for(int j = 0; j < 10; j++) {
        c[s.charAt(j) - 'a']++;
      }
      String str = "";
      for(int j = 0; j < 26; j++) {
        String ss = String.valueOf(c[j]);
        str += ss;
      }
      if(map.containsKey(str)) {
        ans += map.get(str); 
        map.put(str, map.get(str) + 1);
      } else {
        map.put(str, (long)1);
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 75852
#include <iostream>

#define long long long

using namespace std;

// element of ring of integers modulo mod
template<int mod>
struct RingMod {
    int val;
    RingMod(): val(0) {}
    RingMod(long x)
    {
        if (x < 0) x += mod;
        if (x >= mod) x -= mod;
        if (x >= mod) x %= mod;
        val = x;
    }
    explicit operator int() { return val; }
    RingMod operator + (const RingMod& b) const { return RingMod(val + b.val); }
    RingMod operator - (const RingMod& b) const { return RingMod(val - b.val); }
    RingMod operator * (const RingMod& b) const { return RingMod((long) val * b.val); }
};

template<int mod>
RingMod<mod> pow(RingMod<mod> a, long n)
{
    RingMod<mod> t = 1;
    for (; n > 0; n >>= 1) {
        if (n & 1) t = t * a;
        a = a * a;
    }
    return t;
}

typedef RingMod<1'000'000'007> int_mod;

const int N = 2e5 + 2;

int_mod ft[N], invft[N];

int_mod C(int k, int n) { return ft[n] * invft[k] * invft[n - k]; }

int main()
{
    int n, m, k;
    cin >> n >> m >> k;

    ft[0] = 1;
    for (int i = 1; i <= m * n; ++i)
        ft[i] = ft[i - 1] * i;
    invft[m * n] = pow(ft[m * n], 1'000'000'007 - 2);
    for (int i = m * n - 1; i >= 0; --i)
        invft[i] = invft[i + 1] * (i + 1);

    int_mod ans = 0;
    for (int i = 0; i < m; ++i) {
        ans = ans + int_mod(i) * (int_mod(i) * 2 - m + 1) * n * n * C(k - 2, m * n - 2);
    }

    for (int i = 0; i < n; ++i) {
        ans = ans + int_mod(i) * (int_mod(i) * 2 - n + 1) * m * m * C(k - 2, m * n - 2);
    }

    cout << (int) ans;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>

using namespace std;

int main()

{
   string x = "aeouiAEOUI";
   int counter=0;
   char c;
   cin>>c;

   for (int i=0;i<10;i++){
       if (x[i]==c){
        counter++;
        break;
       }

   }
   if (counter==0){
    cout<<"consonant"<<endl;
   }
   else{
    cout<<"vowel"<<endl;
   }
    return 0;
    }

Measured memory_bytes: 256
//InTheNameOfGod
#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;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define rep(i,j,k) for(int i=j;i<k;++i)
#define rrep(i,j,k) for(int i=j;i>=k;i--)
#define pb push_back
#define lb(i) i&(-i);
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int maxn =2e5+5;
ll n,a[maxn],x[maxn],re;
set<ll> s;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin>>n;
    rep(i,0,n)
    {
        cin>>a[i];
    }
    if(a[0]!=0)
    {
        cout<<-1;
        return 0;
    }
    rep(i,1,n)
    {
        if(a[i]>i)
        {
            cout<<-1;
            return 0;
        }
        if(a[i-1]<a[i]-1)
        {
            cout<<-1;
            return 0;
        }
        if(a[i-1]!=a[i]-1)
        {
            re+=a[i];
        }
        else if(a[i])re++;
    }
    cout<<re;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int maxn = 3e5+7;
const int mod = 1e9+7;
typedef long long ll;

int n,m;
ll a[maxn], b[maxn];

int main()
{
    scanf("%d", &n);
    for(int i=1;i<=n;i++)scanf("%lld", a+i);
    ll sum=0;
    for(int i=1;i<=n;i++){
        if(i&1)sum += a[i];
        else sum -= a[i];
    }
    sum /= 2;
    b[1] = sum;
    for(int i=2;i<=n;i++){
        sum = a[i-1]-sum;
        b[i] = sum;
    }
    for(int i=1;i<=n;i++){
        printf("%lld%c", b[i]*2, i==n?'\n':' ');
    }
    return 0;
}


Measured memory_bytes: 4096
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
using namespace std;

int main() {
	int N;
	cin >> N;
	string a = "Three";
	char S[110];
	for (int i = 0; i < N; ++i) cin >> S[i];
	for (int  i= 0; i < N; ++i) {
		if (S[i] == 'Y') a = "Four";
	}
	cout << a << endl;
}

Measured memory_bytes: 256
// problem: "https://atcoder.jp/contests/abc155/tasks/abc155_c"

#include<bits/stdc++.h>

using namespace std;

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

    vector<string>V(n);
    int i;
    for(i=0;i!=n;i++)
        cin>>V[i];

    map<string,int>M;
    for(i=0;i!=n;i++)
    {
        if(M.count(V[i]))
            M[V[i]]++;

        else
            M[V[i]] = 1;
    }

    int m = 0;
    for(auto it=M.begin();it!=M.end();it++)
        m = max(it->second,m);

    vector<string>S;
    for(auto it=M.begin();it!=M.end();it++)
        if(it->second == m)
            S.push_back(it->first);

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

    for(i=0;i!=S.size();i++)
        cout<<S[i]<<'\n';

    return 0;
}


Measured memory_bytes: 28404
#include <iostream>
#include <string>

using namespace std;
const int L = 1001;
const int INF = -1001001001;

int main()
{
    string s, t;
    int dp[L][L];
    int q;
    cin >> q;
    for(int i=0;i<q;++i)
    {
        cin >> s;
        cin >> t;
        for(int j=0;j<s.size()+1;++j) dp[j][0] = 0;
        for(int j=0;j<t.size()+1;++j) dp[0][j] = 0;
        for(int j=1;j<s.size()+1;++j)
        {
            for(int k=1;k<t.size()+1;++k)
            {
                if(s[j-1] == t[k-1])
                {
                    dp[j][k] = max(max(dp[j][k-1], dp[j-1][k-1] + 1), dp[j-1][k]);
                }
                else
                {
                    dp[j][k] = max(dp[j][k-1], dp[j-1][k]);
                }
            }
        }
        cout << dp[s.size()][t.size()] << endl;
    }
}



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

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n ;
    cin >> n ;
    if(n%2==0)
        cout << n/2 << endl;
    else
        cout << (n/2)+1 << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque
n,m = [int(x) for x in input().split()]

g = [ [] for _ in range(n+1)]

for _ in range(m):
    u,v = [int(x) for x in input().split()]
    g[u].append(v)
    g[v].append(u)


vis = [0]*(n+1)

d = deque()
for x in g[1]:
    vis[x] = 1
    d.append(x)


while d:
    cur = d.popleft()

    for x in g[cur]:
        if vis[x] == 0:
            vis[x] = cur
            d.append(x)


vis[0],vis[1] = 1,1

if all(vis):
    print("Yes")
    for i in range(2,n+1):
        print(vis[i])
else:
    print('No')

    

Measured memory_bytes: 34048
#include <algorithm> 
#include <iostream> 
using namespace std;
long long int N,a[100000],b,c,d;
int main(){
cin>>N;
for(int i=0;i<N;i++){
cin>>a[i];
if(a[i]%2==1){
b++;
}else{
if(a[i]%4==0){
c++;
}else{
d++;
}
}
}
if(d<=1){
if(c>=b+d-1){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}else{
if(c>=b){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}
}

Measured memory_bytes: 1024
import std.stdio : write, writeln, writefln, stdin;
import std.array;
import std.range;

void main(){
	while(true){
		double[] stack;
		
		bool start = false;
		string[] str = readln.chomp.split;
		if(stdin.eof) break;
		foreach(s; str){
			if(s=="+"){
				double t = stack.back;
				stack.popBack;
				double u = stack.back;
				stack.popBack;
				
				stack ~= u+t;
			}else if(s=="-"){
				double t = stack.back;
				stack.popBack;
				double u = stack.back;
				stack.popBack;
				
				stack ~= u-t;
			}else if(s=="*"){
				double t = stack.back;
				stack.popBack;
				double u = stack.back;
				stack.popBack;
				
				stack ~= u*t;
			}else if(s=="/"){
				double t = stack.back;
				stack.popBack;
				double u = stack.back;
				stack.popBack;
				
				stack ~= u/t;
			}else{
				stack ~= s.to!double;
			}
		}
		
		writefln("%.6f", stack.back);
	}
}


import std.stdio : readln, chomp;
import std.conv : to;
import std.string : split;
shared string[] input;
shared string delim = " ";
T next(T)()
in
{
	assert(hasNext());
}
out
{
	input.popFront;
}
body
{
	return input.front.to!T;
}

void next(T)(ref T v){
	v = next!T();
}

bool hasNext(){
	if(input.length > 0){
		return true;
	}
	
	string str = readln;
	if(str.length > 0){
		input ~= str.chomp.split(delim);
		return true;
	}else{
		return false;
	}
}


void dbg(T...)(T vs)
{
	import std.stdio : stderr;
	foreach(v; vs)
		stderr.write(v.to!string ~ " ");
	stderr.write("\n");
}

T clone(T)(T v){
	T v_;
	static if(isInputRange!(T)){
		foreach(ite; v){
			v_ ~= ite.clone;
		}
	}else{
		v_ = v;
	}
	
	return v_;
}

Measured memory_bytes: 1092
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  while(1){
    int n;
    cin>>n;
    if(n==0) break;
    string ans="TIE";
    int ansnum=0;
    pair<int,int> a[26];
    rep(i,26){
      a[i]=make_pair(0,i);
    }
    repi(i,1,n+1){
      char c;
      cin>>c;
      if(ansnum!=0) continue;
      rep(j,26){
	if(a[j].scd == c-65 ) a[j].fst++;
      }
      sort(a,a+26 );
      if(a[25].fst > a[24].fst + n - i){
	ans="";
	ans+=a[25].scd + 65;
	ansnum=i;
      }
      
    }
    if(ans == "TIE") cout<<ans<<endl;
    else cout<<ans<<" "<<ansnum<<endl;
    
  }

  return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MD = 1e9 + 7;
map<pair<ll, ll>, int> ma;
int quick_pow(int x, int y) {
    int ans = 1;
    while(y) {
        if(y & 1) ans = 1LL * ans * x % MD;
        y >>= 1;
        x = 1LL * x * x % MD;
    }
    return ans;
}
int main() {
    int n, s = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        ll a, b;
        scanf("%lld%lld", &a, &b);
        ll d = __gcd(a, b);
        if(d == 0) {
            s++;
            continue;
        }
        a /= d, b /= d;
        if(a < 0) a = -a, b = -b;
        ma[{a, b}]++;
    }
    ll ans = 1;
    for(auto it : ma) {
        if(it.second == 0) continue;
        ll a = it.first.first, b = it.first.second;
        ll d = quick_pow(2, ma[{a, b}]);
        b = -b;
        if(b < 0) a = -a, b = -b;
        if(ma.count({b, a})) {
            d = (d + quick_pow(2, ma[{b, a}]) - 1) % MD;
            ma[{b, a}] = 0;
        }
        ans = ans * d % MD;
    }
    ans = (ans - 1 + s + MD) % MD;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 16212
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 1000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;
 
LL G[N][N];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            scanf("%lld",&G[i][j]);
 
    bool flag=false;
    LL res=0;
    for(int i=1;i<=n&&!flag;i++){
        for(int j=i+1;j<=n&&!flag;j++){
            bool flag2=false;
            for(int k=1;k<=n&&!flag;k++){
                if(G[i][k]+G[k][j]<G[i][j])
                    flag=true;
                else{
                    if(i!=k&&j!=k&&G[i][j]==G[i][k]+G[k][j])
                        flag2=true;
                }
            }
            if(!flag2)
                res+=G[i][j];
        }
    }
 
    if(flag)
        printf("-1\n");
    else
        printf("%lld\n",res);
 
    return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
#define int long long
#define REP(i,a,n) for(int i=a;i<(n);i++)
#define RE return
#define FILL(a,b) memset(a,b,sizeof(a))
#define SO(a) sort(all(a))
#define pb push_back
#define sz(a) a.size()
#define V vector
#define ld long double
#define viit(a) vector<int>::iterator a
#define IT iterater
#define FOR(i,a,n) for(int i=a;i<=(n);i++)
#define B(s) s.back()
#define all(a) a.begin(),a.end()
#define ER1(a) a.erase(a.begin())
#define ER0(a) a.erase(a.end())
#define pii pair<int,int>
#define pause system("PAUSE")
#define cls system("CLS")
using namespace std;
signed main()
{
    ios::sync_with_stdio(0);
	int red,green,blue,times;
	cin>>red>>green>>blue>>times;
	while(green<=red){
		green*=2;
		times--;
		if(times==0)break;
	}
	if(times==0){
		if(green>red&&blue>green&&blue>red)cout<<"Yes";
		else cout<<"No";
		return 0;
	}
	while(blue<=green){
		blue*=2;
		times--;
		if(times==0&&blue<=green){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
    return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int N, M, A, B = 1e9+7;
  cin >> N >> M;

  vector<int> vec(N + 1, -1);
  vec.at(0) = 1;
  vec.at(1) = 1;

  for (int i = 0; i < M; i++) {
    cin >> A;
    vec.at(A) = 0;
  }

  for (int i = 2; i < N + 1; i++) {
    if (vec.at(i) != 0) vec.at(i) = (vec.at(i - 2) + vec.at(i - 1)) % B;
  }

  cout << vec.at(N) << 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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
    int K, S;
    cin >> K >> S;
    int cnt;
    for (int x = K; x >= 0; x--){
        if (x + 2 * K < S) {
            break;
        }
        for (int y = K; y >= 0; y--){
            if (x + y + K < S || x + y > S){
            }
            else {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
K,N = map(int, input().split())
a = list(map(int, input().split()))

diff = [a[i + 1] - a[i] for i in range(len(a)-1)]
diff.append(K - a[len(a)- 1] + a[0])
diff.sort()
diff.pop(-1)
print(sum(diff))


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

int main(){
  int h, w;
  cin >> h >> w;
  int a[100][100];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      char c;
      cin >> c;
      a[i][j] = (c == '.');
    }
  }
  bool f[100];
  fill(f, f + 100, true);
  for(int i = 0; i < h; i++){
    bool ff = true;
    for(int j = 0; j < w; j++){
      if(a[i][j] == 0){
        ff = false;
        f[j] = false;
      }
    }
    if(ff){
      for(int j = 0; j < w; j++){
        a[i][j] = -1;
      }
    }
  }
  for(int i = 0; i < w; i++){
    if(f[i]){
      for(int j = 0; j < h; j++){
        a[j][i] = -1;
      }
    }
  }
  for(int i = 0; i < h; i++){
    bool up = true;//全て-1なら改行しない
    for(int j = 0; j < w; j++){
      if(a[i][j] == 1){
        cout << '.';
        up = false;
      }else if(a[i][j] == 0){
        cout << '#';
        up = false;
      }
    }
    if(!up) cout <<endl;
  }
}

Measured memory_bytes: 3612
//Md Fahad
// CSE 18

#include<bits/stdc++.h>


using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);
#define Infi                0x3f3f3f3f

const int fx[] = {+1,-1,+0,+0};                         // 4 X directions
const int fy[] = {+0,+0,+1,-1};                         // 4 Y directions
const int fx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves
const int fy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves
const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves
const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves



int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on
int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off
bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif


typedef long long int           ll;
typedef unsigned long long int  llu;

int main(void)
{
    //READ_IN;

    ll n;

    cin >> n;


    ll ans = 1000*(n/500);
    ll r = n%500;
    ans+=(r/5)*5;

    cout << ans << endl;


    return 0;
}



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

int main(void){
	
	int n; std::string line; 
	std::cin >> n >> line;
	
	std::vector<int> whitecount(n+1, 0), blackcount(n+1, 0);
	//whitecount[0] = (int)(line[0] == '.');
	//blackcount[0] = (int)(line[0] == '#');
	for(int i=1; i<=n; i++){
		whitecount[i] = whitecount[i-1] + (int)(line[i-1] == '.');
		blackcount[i] = blackcount[i-1] + (int)(line[i-1] == '#');
	}
	
	//for(int i=0; i<=n; i++) printf("Black ~%d: %d, White ~%d: %d\n", i, blackcount[i], i, whitecount[i]); printf("-----\n");
	
	int min = 1987654321;
	for(int i=0; i<=n; i++){
		// Check WWW (i) ... BBB (n-i) -> white * i + black * (n-i).
		int btow = blackcount[i]; // count black for ~i
		int wtob = whitecount[n] - whitecount[i]; // count white for i+1~
		//printf("Black ~%d: %d, White %d~: %d\n", i, btow, i+1, wtob);
		if(min > btow + wtob){
			min = btow + wtob;
		}
	} std::cout << min;
	return 0;
}

Measured memory_bytes: 2180
import java.io.*
import java.util.*

val pw = PrintWriter(System.out)
fun solve(r: Long){
    println(r*r)
    pw.flush()
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val r = sc.next().toLong()
    solve(r)
}



Measured memory_bytes: 31528
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D: Grid Repainting
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_H = 50;
const int MAX_W = 50;

const int dxs[] = { 1, 0, -1, 0 }, dys[] = { 0, -1, 0, 1 };

/* typedef */

typedef pair<int,int> pii;

/* global variables */

string flds[MAX_H];
int dists[MAX_H][MAX_W];

/* subroutines */

/* main */

int main() {
  int h, w;
  cin >> h >> w;

  int n = 0;
  for (int y = 0; y < h; y++) {
    cin >> flds[y];
    for (int x = 0; x < w; x++)
      if (flds[y][x] == '.') n++;
  }

  int gx = w - 1, gy = h - 1;

  dists[0][0] = 1;
  queue<pii> q;
  q.push(pii(0, 0));

  while (! q.empty()) {
    pii u = q.front(); q.pop();
    int &ux = u.first, &uy = u.second;
    if (ux == gx && uy == gy) break;

    int vd = dists[uy][ux] + 1;
    for (int di = 0; di < 4; di++) {
      int vx = ux + dxs[di], vy = uy + dys[di];
      if (vx >= 0 && vx < w && vy >= 0 && vy < h &&
	  flds[vy][vx] == '.' && dists[vy][vx] == 0) {
	dists[vy][vx] = vd;
	q.push(pii(vx, vy));
      }
    }
  }

  if (dists[gy][gx] > 0) printf("%d\n", n - dists[gy][gx]);
  else puts("-1");
  return 0;
}


Measured memory_bytes: 256
n = int(input())
l1 = list(map(int,input().split()))
l2 = list(map(int,input().split()))
ans = 0
for i in range(n):
#  print(l1[:i+1],l2[i:n])
#  print("ans:"+ str(sum(l1[:i+1]) + sum(l2[i:n])))
  ans = max(ans, sum(l1[:i+1]) + sum(l2[i:n]))
print(ans)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b;
	cin >> a >> b;
	if(a > 0 && b > 0) cout << "Positive" << endl;
	else if(a == 0 || b == 0 || (b > 0 && a < 0)) cout << "Zero" << endl;
	else if((b-a)%2 == 0) cout << "Negative" << endl;
	else cout << "Positive" << endl; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll h[n],sum=0;
	for(ll i=0;i<n;i++){
		cin>>h[i];
	}
	sort(h,h+n);
	ll ans=0;
	for(ll i=0;i<n-k;i++){
		ans+=h[i];
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 200005
ll a, b, v, w, t;

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

    cin >> a >> v >> b >> w >> t;
    ll dif = abs(a-b);
    if(v<=w){
        cout << "NO\n";
    } else{
        ll spd = v-w;
        if(spd*t>=dif){
            cout << "YES\n";
        } else{
            cout << "NO\n";
        }
    }

    return 0;
}


Measured memory_bytes: 3644