akhauriyash/Code-Regression huggingface dataset:
/*author: hyperion_1724
  date: 
*/

//Required Libraries

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

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define endl '\n'
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(int a=b;a<c;a++)
#define FORD(a,b,c) for(int a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

using namespace std; 
  
ll calc(ll arr[], ll N) 
{ 
    multiset<ll> last; 
    FORI(i,0,N) 
    { 
        auto it = last.lower_bound(arr[i]); 
        if (it == last.begin()) 
            last.insert(arr[i]); 
        else 
        { 
            it--; 
            last.erase(it);
            last.insert(arr[i]);
        } 
    } 
    return last.size();
} 

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

	READV(N);
	READAR(A,N);
	ll ans=calc(A,N);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <sstream>
#include <math.h>
#include<string>
using namespace std;
int h,w;
int main(){
    cin >> h >> w;
    char s[h+2][w+2];
    for (int i = 1; i <= h; i++){
        for (int j = 1; j <= w; j ++){
            cin >> s[i][j];
        }
    }
    for (int i = 0; i < h+2; i ++){
        s[i][0] = '.';
        s[i][w+1] = '.';
    }
    for (int i = 0; i < w+2; i ++){
        s[0][i] = '.';
        s[h+1][i] = '.';
    }
    // 全ての点について隣接する店があるかどうかを調べる．もしなければ，その時点でその絵を作ることはできない．
    for (int i = 1; i <= h; i ++){
        for (int j = 1; j <= w; j ++){
            if(s[i][j] =='#' && !(s[i-1][j] == '#' || s[i+1][j] == '#'|| s[i][j-1] == '#'|| s[i][j+1]== '#')){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int AscendingSort(const void *A,const void *B){return *(long long*)A>*(long long*)B?1:0;}

int main(void){
    int n;
    scanf("%d",&n);
    long long a[n],v[n],ans=0,sum=pow(2,31);
    for (int i=0; i<n; i++){
        scanf("%lld",&a[i]);
        v[i]=0;
    }
    qsort (a,n,sizeof(long long),AscendingSort);
    
    for (int i=0; i<=31; i++){
        int count=0,back=n-1;
        while(count<back){
            if (v[count]==1){
                count++;
            } else if (v[back]==1){
                back--;
            } else if (a[count]+a[back]==sum){
                v[count]=1;
                v[back]=1;
                ans++;
                count++;
                back--;
            } else if (a[count]+a[back]<sum){
                count++;
            } else {
                back--;
            }
        }
        sum/=2;
    }
    printf("%lld\n",ans);
	return 0 ;
}


Measured memory_bytes: 4860
#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <math.h>


using namespace std;

int main(int argc, char const* argv[])
{
    int e;
    while (cin >> e, e) 
    {
        int x,y,z;
        int m = 1000000;

        //for (int i = 0; i <= e; i++) 
        //{
        //    for (int j = 0; j*j <= e; j++) 
        //    {
        //        for (int k = 0; k*k*k <= e; k++) 
        //        {
        //            //cout << " x y z = " << i << j << k <<endl;
        //            if ( i + j*j + k*k*k == e) 
        //            {
        //                m = min( m, i + j + k);
        //            }
        //        }
        //    }
        //}
        for (int k = 0;  k*k*k <= e; k++) 
        {
            int j = sqrt(e - k*k*k);
            int i = e - k*k*k -j*j;
            m = min( m, i + j + k);
        }
        cout << m << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define maxn 100005
#define maxm 500005
#define inf 0x7fffffff
#define ll long long
#define ld long double
#define debug(x) cerr<<#x<<": "<<x<<endl
#define fgx cerr<<"--------------"<<endl
#define dgx cerr<<"=============="<<endl

using namespace std;
struct vc{
	ld x,y;
	vc operator*(const ld b){vc t;t.x=x*b,t.y=y*b;return t;}
};
struct pt{
	ld x,y;
	pt operator+(const vc b){pt t;t.x=x+b.x,t.y=y+b.y;return t;}
	vc operator-(const pt b){vc t;t.x=x-b.x,t.y=y-b.y;return t;}
};

inline int read(){
	int x=0,f=1; char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}

inline pt get(){pt t;t.x=read(),t.y=read();return t;}
inline ld dot(vc a,vc b){return a.x*b.x+a.y*b.y;}
inline ld cross(vc a,vc b){return a.x*b.y-a.y*b.x;}

int main(){
	int Q=read();
	while(Q--){
		pt a=get(),b=get(),c=get(),d=get();		
		vc u=b-a,v=d-c; 
		ld x=dot(u,v),y=cross(u,v);
		if(x==0) printf("1\n");
		else if(y==0) printf("2\n");
		else printf("0\n");
	}
	return 0;
}



Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
using namespace std;
 
int main(void) {
  int n, m, x;
  cin >> n >> m >> x;
  int a[110];
  int r1=0;
  int r2=0;
  int ans;
  	for (int i=0; i<m; ++i) cin >> a[i];
  
  	for (int b=x; b<n; ++b) {
      for (int i=0; i<m; ++i) {
      	if (b == a[i]) {
          r1 += 1;
        }
      }
    }
  	for (int b=1; b<x; ++b) {
      for (int i=0; i<m; ++i) {
      	if (b == a[i]) {
          r2 += 1;
        }
      }
    }
  	ans = min(r1, r2);
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{


	static char[][] map;

	static long[][] c;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int l = sc.nextInt();
		int r = sc.nextInt();
		long mod = 2019;
		if(r-l >= 2019){
			System.out.println(0);
			return;

		}
		long ans = Integer.MAX_VALUE;
		for(long i = l;i <= r;i++){
			for(long j = i + 1 ; j <= r;j++){
				ans = Math.min(ans, (i * j)%mod);
			}
		}
		System.out.println(ans);
		

		
	}
	
	static boolean judge(int num){
		
		for(int i = 1;i*i <= num;i++){
			if(i*i == num){
				return true;
			}
		}
		
		return false;
		
		
	}


	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}



class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   end- otherpair.end;
	}







	static int find(int index,int current,int[] students,int ans,int[][] memo){
		if(current == index){
			return 1;
		}

		if(memo[current][index] != 0){
			return memo[current][index];
		}

		memo[current][index] = find(index, students[current]-1, students, ans+1, memo)+1;

		return memo[current][index];
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}






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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll inf = 1e18;
const int N = 100005;
ll a[N], ans;

bool check(int n){
	ll cur = 1;
	for(int i = 0; i <= n; i++){
		cur -= a[i];
		if(cur < 0)return false;
		cur *= 2;
		if(cur > 1e18)cur = 1e18;
	}
	return true;
}

ll dfs(int i, int n, ll cur){
	if(i == n){
		ans += min(cur, a[n]);
		return min(cur, a[n]);
	}
	ll tmp = dfs(i + 1, n, min(inf, 2*(cur - a[i])));
	tmp += a[i];
	ans += min(cur, tmp);
	return min(cur, tmp);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n;
	cin>>n;
	for(int i = 0; i <= n; i++){
		cin>>a[i];
	}
	if(!check(n)){
		cout<<-1<<'\n';
		exit(0);
	}
	ans = 0;
	dfs(0, n, 1);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 7556
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int A;
	cin >> A;

	int B = A / 200;

	co(10 - B);



	Would you please return 0;
}

Measured memory_bytes: 3652
from sys import exit, setrecursionlimit
setrecursionlimit(10**6)

def array2D(row, col ,val=0):
    return [[val]*col for i in range(row)]


A = [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(A[k-1])

Measured memory_bytes: 3064
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

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

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
	int n;
	cin >> n;
	switch (n % 10) {
	case 2 :
	case 4 :
	case 5 :
	case 7 :
	case 9 :
		cout << "hon";
		break;
	case 0 :
	case 1 :
	case 6 :
	case 8 :
		cout << "pon";
		break;
	case 3 :
		cout << "bon";
	}
}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a+b)%24 << endl;
    return 0;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int h = ri();
	int w = ri();
	int k = ri();
	int sx = ri() - 1, sy = ri() - 1;
	int gx = ri() - 1, gy = ri() - 1;
	std::string map[h];
	for (auto &i : map) std::cin >> i;
	
	int dist[h][w];
	for (auto &i : dist) for (auto &j : i) j = 1000000000;
	dist[sx][sy] = 0;
	std::queue<std::pair<int, int> > que;
	que.push({sx, sy});
	
	std::set<int> r0[h], r1[w];
	for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) if (i != sx || j != sy) r0[i].insert(j), r1[j].insert(i);
	
	while (que.size()) {
		auto i = que.front();
		que.pop();
		
		// std::cerr << "!" << i.first << " " << i.second << " " << dist[i.first][i.second] << std::endl;
		
		auto itr = r0[i.first].lower_bound(i.second);
		for (; itr != r0[i.first].begin(); ) {
			int y = *std::prev(itr);
			if (map[i.first][y] == '@' || i.second - y > k) break;
			r0[i.first].erase(std::prev(itr));
			r1[y].erase(i.first);
			dist[i.first][y] = dist[i.first][i.second] + 1;
			que.push({i.first, y});
		}
		for (auto j = itr; j != r0[i.first].end(); ) {
			int y = *j;
			if (map[i.first][y] == '@' || y - i.second > k) break;
			r0[i.first].erase(j++);
			r1[y].erase(i.first);
			dist[i.first][y] = dist[i.first][i.second] + 1;
			que.push({i.first, y});
		}
		itr = r1[i.second].lower_bound(i.first);
		for (; itr != r1[i.second].begin(); ) {
			int x = *std::prev(itr);
			if (map[x][i.second] == '@' || i.first - x > k) break;
			r0[x].erase(i.second);
			r1[i.second].erase(std::prev(itr));
			dist[x][i.second] = dist[i.first][i.second] + 1;
			que.push({x, i.second});
		}
		for (auto j = itr; j != r1[i.second].end(); ) {
			int x = *j;
			if (map[x][i.second] == '@' || x - i.first > k) break;
			r0[x].erase(i.second);
			r1[i.second].erase(j++);
			dist[x][i.second] = dist[i.first][i.second] + 1;
			que.push({x, i.second});
		}
	}
	printf("%d\n", dist[gx][gy] == 1000000000 ? -1 : dist[gx][gy]);
	
	return 0;
}


Measured memory_bytes: 148948
import qualified Data.IntSet as S
import Data.List
import Control.Monad
import Data.Maybe

main = do
 getLine
 ls <- map read. words <$> getLine
 let als = scanl1 (+) (init ls)
 let als' = scanr1 (+) (tail ls)
 let s1 = S.fromList als
 let s2 = S.fromList als'
 let med = div (sum ls) 2
 print $ pile s1 s2 med

pile s1 s2 med = min (abs (hi-lo)) (abs (hi'-lo'))
 where
  lo = maybe 0 id (S.lookupLE med s1)
  hi = maybe (maxBound :: Int) id (S.lookupGE med s2)
  lo' = maybe 0 id (S.lookupGE med s1)
  hi' = maybe (maxBound :: Int) id (S.lookupLE med s2)

Measured memory_bytes: 74108
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;

    vector<ll> a(n);
    vector<ll> sum_init(n, 0);
    ll length = 0;

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

        if (i == 0)
        {
            sum_init[i] = a[i];
        }
        else
        {
            sum_init[i] = sum_init[i - 1] + a[i];
        }
    }
    ll min_loss = length;
    int argmin_loss = 0;
    for (int i = 0; i < n; i++)
    {
        ll loss =abs(2*sum_init[i] - length);
        if(loss < min_loss)
        {
            argmin_loss=i;
            min_loss = loss;
        }else if(loss >= min_loss)
        {
            break;
        }
    }
    cout << min_loss <<endl;

    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int n,wt;
long long a[100007];
long long v[100007];
const long long INF = 1e18L;
vector<long long> mem(100007,INF);
long long res = 0;
long long kema=0;

long long swim(int i=0,int val=kema)
{
    if(i == n || val == 0)
        return INF;
    long long &r = mem[val];
    if(r!=INF)
        return r;
    return r= min(swim(i+1,val), v[i] <= val ? swim(i+1,val - v[i]) + a[i] : INF );
}

int main()
{
    cin>>n>>wt;
    for(int i=0;i<n;++i)
    {
        cin>>a[i]>>v[i];
        kema+=v[i];
    }
//    swim();
    mem[0]=0;
    for(int i=0;i<n;++i)
    {
        for(int val=kema -v[i] ; val>=0;--val)
        {
            mem[val+v[i]]= min(mem[val+v[i]],mem[val]+a[i]);
        }
    }
    long long ans=0;
    for(int i=0;i<=kema;++i)
        if(mem[i]<=wt)
        {
            ans= max(ans,(long long) i);
        }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

#define N 100005
int n[N];
int dp[N][13];

#define MOD 1000000007

int main() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());

    n[0] = 1;
    for(int i=1; i<N; i++)
        n[i] = (n[i-1] * 10) % 13;
    
    memset(dp,0,sizeof(dp));
    dp[0][0] = 1;
    for(int i=0; i<s.length(); i++)
    {
        if(s[i] == '?')
        {
            for(int j=0; j<13; j++)
            {
                for(int k=0; k<10; k++)
                {
                    dp[i+1][(j + k * n[i]) % 13] += dp[i][j];
                    dp[i+1][(j + k * n[i]) % 13] %= MOD;
                }
            }
        }
        else
        {
            for(int j=0; j<13; j++)
            {
                dp[i+1][(j + (s[i] - '0') * n[i]) % 13] = dp[i][j];
            }
        }
    }
    
    cout << dp[s.length()][5] << endl;
    
    return 0;
}


Measured memory_bytes: 5888
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(a,b);
  OUT(a%b);
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, a[3], b[3];
LL d[26000005];

int main() {
    scanf("%d", &n);
    forn(i, 3) scanf("%d", a + i);
    forn(i, 3) scanf("%d", b + i);
    forn(i, n) {
        d[i + 1] = max(d[i + 1], d[i]);
        forn(j, 3) {
            d[i + a[j]] = max(d[i + a[j]], d[i] + b[j] - a[j]);
        }
    }
    n = d[n] + n;

    memset(d, 0, sizeof d);
    forn(i, n) {
        d[i + 1] = max(d[i + 1], d[i]);
        forn(j, 3) {
            d[i + b[j]] = max(d[i + b[j]], d[i] + a[j] - b[j]);
        }
    }
    cout << d[n] + n << endl;
    return 0;
}


Measured memory_bytes: 203392
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n, m;
    cin >> n >> m;
  char a[n][n], b[m][m];
  string ans="No";
      for(int i=0; i<n; i++)
        for(int j=0; j<n; j++) cin >> a[i][j];
      for(int i=0; i<m; i++)
        for(int j=0; j<m; j++) cin >> b[i][j];


      for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
          if(i+m>n or j+m>n) continue;
          bool match=true;
          for(int h=0; h<m; h++)
            for(int w=0; w<m; w++)
              if(a[i+h][j+w]!=b[h][w]) match=false;
          if(match) ans="Yes";
        }
      }

    cout << ans << endl;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector <int> A(2*M);
  
  for(int i=0;i<2*M;i++){
    cin >> A.at(i);
  }
  


    for(int p=0;p<N;p++){
      int count =0;
     for(int k=0; k<2*M; k++){
      if(A.at(k)==p+1){
        count ++;
      }
     }
    cout << count << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int W,H,x,y,r;
   
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    

    if(W>=x+r && H>=y+r && r<=x && r<=y && x>=0 && y>=0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    
    return 0;
}


Measured memory_bytes: 2100
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        int h, w;
        String[][] mat;
        // 読み込み
        try(Scanner sn = new Scanner(System.in)) {
            h = sn.nextInt();
            w = sn.nextInt();
            mat = new String[h][];
            for (int i = 0; i < h; i++)
                mat[i] = sn.next().split("");
        }
        List<Integer> showRowIndex = new LinkedList<>();
        for (int i = 0; i < h; i++)
            for (String s: mat[i])
                if (s.equals("#")) {
                    showRowIndex.add(i);
                    break;
                }
        List<Integer> showColIndex = new LinkedList<>();
        for (int i = 0; i < w; i++)
            for (int j: showRowIndex)
                if (mat[j][i].equals("#")) {
                    showColIndex.add(i);
                    break;
                }
        // 表示
        for (int i: showRowIndex) {
            for (int j: showColIndex) {
                System.out.print(mat[i][j]);
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 26404
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pii pair<ll, ll> 
#define pb push_back
#define mod (1e9+7)
#define debug(x) cerr<< #x << " is " <<x<<endl;
#define debug2(x) cerr<<#x<< " is\n"; for (auto &i:x) {cout<<i<<' '; } cout<<endl;
#define f first
#define s second
using namespace std;

int dp[3005][3005];
int dir[3005][3005];

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    string a, b; cin>>a>>b; 
    int n = a.length(), m = b.length();
    for (int i=0; i<n; i++){
    	for (int j=0; j<m; j++){
    		if (a[i]==b[j]){
    			dp[i+1][j+1]=dp[i][j]+1;
    		}else{
    			if (dp[i][j+1]>dp[i+1][j]){
    				dir[i][j]=1;
    			}else dir[i][j]=2;
    			dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
    		}
    	}
    }
    string re = "";
    int i = n-1, j = m-1;
    while (i>-1&&j>-1){
    	if (dir[i][j]==0){
    		re+=a[i];
    		i--; j--;
    	}else if (dir[i][j]==1){
    		i--;
    	}else j --;
    }
    reverse(re.begin(), re.end());
    cout<<re<<endl;

}

Measured memory_bytes: 70784
N = int(input())
if N%4 == 0 or N%7 ==0:
    print('Yes')
else:
    while N > 6:
        N -= 7
        if N%4 == 0:
            print('Yes')
            break
        else:
            pass
    if 0<N<4 or 4<N<7:
        print('No')

Measured memory_bytes: 3060
import java.lang.*;
import java.io.*;
import java.util.*;

class Main{
	public static void main(String args[]) throws FileNotFoundException{
		Scanner sc=new Scanner(System.in);
		
		String[] a=sc.nextLine().split("");
		String b=sc.nextLine();
		boolean c=false;
		
		
			for(int i=0; i<a.length; i++){
				String s="";
				for(int j=a.length-i-1; j<a.length; j++){
					s+=a[j];
					
				}
				for(int k=0; k<a.length-i-1; k++){
					s+=a[k];
				}
				
				if(s.equals(b)){
					c=true;
				}
			}
			System.out.println((c==true)? "Yes": "No");
			
	}

	static void disp(int[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
}


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

int main(){
  int k,s,x,y,z,ans=0;cin>>k>>s;
  for(x=0;x<=k;x++){
    for(y=0;y<=k;y++){
      z=s-x-y;
      if(0<=z&&z<=k) ans++;
    }
  }  
  cout<<ans;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	n := 0
	fmt.Scanf("%d", &n)
	r := 0

	if n > 399 {
		if n < 600 {
			r = 8
		} else if n < 800 {
			r = 7
		} else if n < 1000 {
			r = 6
		} else if n < 1200 {
			r = 5
		} else if n < 1400 {
			r = 4
		} else if n < 1600 {
			r = 3
		} else if n < 1800 {
			r = 2
		} else if n < 2000 {
			r = 1
		}
	}

	fmt.Println(r)
}


Measured memory_bytes: 1832
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SUM(x) accumulate(rng(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))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//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; }

// a<0 || b<0　のとき、余りが負にならないようなa/bの商と余りを計算
pair<int, int> mdivmod (int a, int b) {
  pair<int, int> ret;
  int q = a/b;
  int r = a%b;
  if (r != 0 && a < 0) {
    if (b > 0) {
      q--;
      r += b;
    }
    else {
      q++;
      r -= b;
    }
  }
  ret = make_pair(q, r);
  return ret;
}

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

  string ans;
  while (n != 0) {
    auto x = mdivmod(n, -2);
    ans = (char)(x.se + '0') + ans;
    n = x.fi;
  }
  if (ans == "") ans = '0';
  cout << ans << endl;
  return 0;
}

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

int main()
{
  uint64_t n, x = 0;
  vector<uint64_t> a;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    uint64_t t;
    cin >> t;
    a.push_back(t);
    x ^= t;
  }
  for (auto i : a)
  {
    cout << (x ^ i) << ' ';
  }
}


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

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


int main() {
	// your code goes here
	int a, b;
	cin >> a >> b;
	cout << gcd(a, b) << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include<bits/stdc++.h>
#include<string>
#include<map>
#define ll long long

using namespace std;

 int main()
 {
     ll n;
     cin>>n;
     map<ll,ll>mp;
     for(ll i=1;i<=n;i++)
        mp[i]=0;
        for(ll i=2;i<=n;i++)
         {
             ll t;
             cin>>t;
             mp[t]++;
         }
        
        for(auto x:mp)
          cout<<x.second<<endl;
          return 0;
     
 }

Measured memory_bytes: 16128
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long n = read.to!long;
	string a = readln.chomp;
	string b = readln.chomp;
	string c = readln.chomp;
	
	long ans;
	foreach(i; 0 .. n){
		char x = a[i], y = b[i], z = c[i];
		if(x == y && y == z) ans += 0;
		else if(x == y || y == z || z == x) ans += 1;
		else ans += 2;
	}
	
	ans.writeln;
	
}


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


/*
ll binpow(ll a, ll b) {
    ll res=1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}*/


int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     
    ll n;
    cin>>n;
    vector<pair<ll,ll>>v;
    ll ans;
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        v.push_back({x,y});
    }
        //sort(v.begin(),v.end());
        vector<ll>a,b;
        for(ll i=n-1;i>=0;i--)
        {
            a.push_back((v[i].first+v[i].second));
            b.push_back((v[i].first-v[i].second));
        }
        sort(a.begin(),a.end());
        sort(b.begin(),b.end());
        ans=a[n-1]-a[0];
        ans=max(ans,(b[n-1]-b[0]));
    
    cout<<ans<<endl;
    
	return 0;
}

Measured memory_bytes: 11352
#include<stdio.h>
#include<algorithm>
using namespace std;
int n;
int a[22222],b[22222];
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++){
		int x;
		scanf("%d",&x);
		a[i] = 1;
		b[x] = i;
	}
	for(int i=1; i<n; i++){
		int todo = 0;
		if(a[i] >= a[i+1]){
			todo = max(todo,a[i] - a[i+1] + 1);
		}
		if(b[i] <= b[i+1]){
			todo = max(todo,b[i+1] - b[i] + 1);
		}
		a[i+1] += todo;
		b[i+1] -= todo;
	}
	int base = 0;
	for(int i=1; i<=n; i++)
		base = min(base,b[i]);
	for(int i=1; i<=n; i++)
		b[i] = b[i] - base + 1;
	for(int i=1; i<=n; i++)
		printf("%d%c",a[i],i<n?' ':'\n');
	for(int i=1; i<=n; i++)
		printf("%d%c",b[i],i<n?' ':'\n');
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<cmath>
#define inf (1<<29)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int N,M;
int C[17];
int x[20010];
int dp[20010][256];

int main()
{
  while(cin >> N >> M,N|M)
    {
      REP(i,1,M+1)cin >> C[i];
      REP(i,1,N+1)cin >> x[i];
      rep(i,20010)rep(j,256)dp[i][j] = inf;
      dp[0][128] = 0;

      rep(i,N+1)
	{
	  REP(j,1,M+1)
	    {
	      rep(k,256)
		{
		  if(dp[i][k] == inf)continue;
		  int value = k+C[j];
		  if(value < 0)value = 0;
		  else if(value > 255)value = 255;
		  dp[i+1][value] = min(dp[i+1][value],
				       dp[i][k]+(x[i+1]-value)*(x[i+1]-value));
		}
	    }
	}

      int men = inf;
      rep(i,256)men = min(men,dp[N][i]);
      cout << men << endl;
    }
  return 0;
}

Measured memory_bytes: 21248
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main(){
	int n;
	cin >> n;
	map<string, int>mp;
	rep(i, n) {
		string s;
		cin >> s;
		mp[s]++;
	}
	int ans = mp.size();
	cout << ans;
	return 0;
}

Measured memory_bytes: 19232
//****author RKN
//DATE 5/2/2020 5.15 AM
 
 
// ***************DREAM IS NOT THAT YOU SEE WHILE SLEEPING BUT IT IS WHAT DONT LET YOU SLEEP************//
 
 
///////////////////////    machayenge......sala hoga apne se bhi ek din    ///////////////////////////////////////////////////////////
 
#include<bits/stdc++.h>
#include <utility> 
using namespace std;
 
/////////////////////////////   %   variable  %   //////////////////////////////////////////////////////////////
 
#define ll long long
#define pb push_back 
#define pof pop_front
#define f1 first
#define s2 second
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pr pair<ll,ll>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define loop(start,end,inc) for(int i=start;i<=end;i+=inc)
typedef std::vector<std::vector<int>> vec2d;
#define pr1 pair<ll,pair<ll,ll>>
//#define prm pair<ll,map<ll,ll>>
int dir1[8]={1,-1,0,0,-1,1,-1,1};
int dir2[8]={0,0,-1,1,-1,1,1,-1};
#define en "\n"

//void rtime(){time_p=clock()-time_p;cerr<<"******************\nTime taken : "<<(double)(time_p)/CLOCKS_PER_SEC<<"\n";}

ll MAX=1000000007;
//ll MAX=13;
vector<ll>prime(1000001);
vector<ll>getprm;
ll power(ll a,ll b)
{
       if(b == 0)
       return 1;
       auto q= (power( a, (b/2) ));
       q=q%MAX;
       q = (q * q) % MAX;
       if ( b%2 == 0)
       return q%MAX;
       else
       return ((q%MAX)*(a%MAX)) % MAX;
}

ll modinv ( ll val )
{
       return power ( val, MAX-2 );
}
 
void primecalc()
{
       fill(all(prime),1);
       prime[0]=0;prime[1]=0;
       for(int i=2;i<=sqrt(1000001);i++)
       {
              if(prime[i])
              {
                     //cout<<i<<" ";
                     getprm.pb(i);
                     for(int j=i+i;j<=1000000;j+=i)
                     prime[j]=0;
              }
       }
}

////////////////////////////////////////////////////////////////////////////////////////////

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int l1=s1.size(),l2=s2.size();
    int lcs[l1+1][l2+1];
    for(int i=0;i<=l1;i++)
    {
     for(int j=0;j<=l2;j++)
     {
         if(i==0 || j==0)
         {lcs[i][j]=0;continue;}
         if(s1[i-1]==s2[j-1])
         lcs[i][j]=lcs[i-1][j-1]+1;
         else
         lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
     }
    }
   // cout<<lcs[l1][l2];
    if(lcs[l1][l2]!=0)
    {
        string res;
        int i=l1,j=l2;
        while(i>0 && j>0)
        {
            if(s1[i-1]==s2[j-1])
            {
                res+=s1[i-1];
                i--;j--;
            }
            else if(lcs[i-1][j]>lcs[i][j-1])
            i--;
            else
            j--;
        }
        reverse(all(res));
        cout<<res;
    }
    return 0;
}


Measured memory_bytes: 43264
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string>
#include<math.h>
#include<string.h>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a,b,k;
    cin>>k>>a>>b;
    int i,flag=0;
    for(i=a;i<=b;i++)
        if(i%k==0)flag=1;
    if(flag)printf("OK\n");
    else printf("NG");
    return 0;
}


Measured memory_bytes: 3764
/**
*    author:  yuya1234
*    created: 15.08.2020 21:02:53
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#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--)

#define SORT(x) sort(x.begin(),x.end())
#define SORTD(x) sort(x.rbegin(),x.rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SZ(x) ll(x.size())

#define MEMSET(v, h) memset((v), h, sizeof(v))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

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

  int n;
  cin>>n;

  ll l[n];
  REP(i,n)cin>>l[i];
  int ans=0;

  REP(i,n)
  {
    FOR(j,i+1,n-1)
    {
      FOR(k,j+1,n-1)
      {
        //if(abs(l[i]-l[j])<l[k] && l[k]<l[i]+l[j] && l[i]!=l[j] && l[i]!=l[k] && l[j]!=l[k])ans++;
        if(l[i]<l[j]+l[k] && l[j]<l[i]+l[k] && l[k]<l[i]+l[j] && l[i]!=l[j] && l[i]!=l[k] && l[j]!=l[k])ans++;
      }
    }
  }

  cout<<ans<<endl;


  return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
vector<int> ans;
int n;
int main(){
	n=read();
	if(n==3){
		ans.push_back(2);
		ans.push_back(3);
		ans.push_back(25);
	}
	for(int i=1;ans.size()<=n-2 and i<30000;i++){
		int q=i/12,r=i%12;
		if(r<=1 or r>=6 or 12%r!=0)
			continue;
		ans.push_back(12*q+r);
		ans.push_back(12*q+12-r);
	}
	for(int i=1;ans.size()<=n-2 and 24*i<=30000;i++){
		ans.push_back(24*i-18);
		ans.push_back(24*i-6);
	}
	for(int i=1;ans.size()<n and 12*i<=30000;i++)
		ans.push_back(12*i);
	assert(ans.size()==n);
	for(int i=0;i<n;i++)
		cout << ans[i] << " ";
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

struct mint {
    LL x; // typedef long long LL;
    mint(LL x=0):x( x >= 0 ? x%mod : x%mod+mod){}
    mint& operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator-=(const mint a) {
      if ((x += mod-a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator*=(const mint a) {
      (x *= a.x) %= mod;
      return *this;
    }
    mint operator+(const mint a) const {
      mint res(*this);
      return res+=a;
    }
    mint operator-(const mint a) const {
      mint res(*this);
      return res-=a;
    }
    mint operator*(const mint a) const {
      mint res(*this);
      return res*=a;
    }
    mint pow(LL t) const {
      if (!t) return 1;
      mint a = pow(t>>1);
      a *= a;
      if (t&1) a *= *this;
      return a;
    }
   
    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a) {
      return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
      mint res(*this);
      return res/=a;
    }
  };

mint dp[11234][2][110];

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    string K; cin >> K;
    int N = K.length();
    int D; cin >> D;

    dp[0][0][0] = 1;
    REP(i,N) REP(j,D){
        REP(dig,10) dp[i+1][1][(j+dig)%D] += dp[i][1][j];
        REP(dig,K[i]-'0') dp[i+1][1][(j+dig)%D] +=  dp[i][0][j];
        dp[i+1][0][(j+(K[i]-'0'))%D] += dp[i][0][j];
    }
    mint ans = dp[N][0][0] + dp[N][1][0] - 1;
    cout << ans.x << endl;


}


Measured memory_bytes: 19584
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	A := ReadInts(ReadInt())
	ans := A[0]
	for _, a := range A[1:] {
		ans = GCD(ans, a)
	}
	fmt.Println(ans)
}

func GCD(a, b int) int {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 4300
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());
		int Z = Integer.parseInt(sc.next());
		sc.close();

		int ans = 0;
		for(int num = 1; num < 100000; num++) {
			int distance = Y * num +  Z *(num + 1);
			if(distance > X) {
				ans = num - 1;
				break;
			}else if(distance == X){
				ans = num;
				break;
			}else {
				continue;
			}
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 22988
a, b, c, x, y = list(map(int, input().split()))
INF = float("inf")
ans = INF
for ab in range(max(x, y)*2+1):
    if ab % 2 == 0:
        ans = min(ans, ab*c + max(x-ab//2, 0)*a + max(y-ab//2, 0)*b)
print(ans)


Measured memory_bytes: 65684
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
//#include <boost/multiprecision/cpp_int.hpp>
//using bint = boost::multiprecision::cpp_int;


int main(){
    int h,n;
    cin >> h >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) h-=a[i];
    cout << (h <= 0 ? "Yes":"No");
}


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

public class Main {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	boolean solve() throws IOException {
		int n = nextInt();
		int[][] a = new int[3][n];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = nextInt() - 1;
			}
		}
		
		int[] perm = new int[n];
		boolean[] flip = new boolean[n];
		
		for (int i = 0; i < n; i++) {
			int cand = Math.min(a[0][i], Math.min(a[1][i], a[2][i]));
			if (cand % 3 != 0) {
				return false;
			}
			
			int what = cand / 3;
			if (a[0][i] == cand && a[1][i] == cand + 1 && a[2][i] == cand + 2) {
				perm[i] = what;
				flip[i] = false;
				continue;
			}
			
			if (a[2][i] == cand && a[1][i] == cand + 1 && a[0][i] == cand + 2) {
				perm[i] = what;
				flip[i] = true;
				continue;
			}
			
			return false;
		}
		
//		System.err.println(Arrays.toString(perm));
//		System.err.println(Arrays.toString(flip));
		
		int[] evenP = new int[(n + 1) / 2];
		
		int evenFlip = 0;
		for (int i = 0; i < n; i += 2) {
			if (flip[i]) {
				evenFlip++;
			}
			if (perm[i] % 2 == 1) {
				return false;
			}
			evenP[i / 2] = perm[i] / 2;
		}
		
		
		int[] oddP = new int[n / 2];
		int oddFlip = 0;
		for (int i = 1; i < n; i+= 2) {
			if (flip[i]) {
				oddFlip++;
			}
			if (perm[i] % 2 == 0) {
				return false;
			}
			oddP[i / 2] = perm[i] / 2;
		}
		
//		System.err.println(Arrays.toString(evenP) + " " + Arrays.toString(oddP));
		
		return (permParity(evenP) == oddFlip % 2) && (permParity(oddP) == evenFlip % 2); 
	}
	
	int permParity(int[] p) {
		int n = p.length;
		int ret = n & 1;
		
		boolean[] vis = new boolean[n];
		for (int i = 0; i < n; i++) {
			if (vis[i]) {
				continue;
			}
			ret ^= 1;
			for (int j = i; !vis[j]; j = p[j]) {
				vis[j] = true;
			}
		}
		
		return ret;
	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		out.println(solve() ? "Yes" : "No");
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

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

int main(){
  int n,i,kotae=0;
  cin>>n;
  string s[n],x;
  int a[n];
  for(i=0;i<n;i++){
    cin>>s[i]>>a[i];
  }
  cin>>x;
  for(i=0;i<n;i++){
    if(s[i]==x){
      break;
    }
  }
  i++;
  for(;i<n;i++){
    kotae+=a[i];
  }
  cout<<kotae;
}


Measured memory_bytes: 256
# 文字列の結合。互い違い
# for をlen(O)で回る
o = input()
e = input()
for i in range(min(len(o),len(e))):
  print(o[i]+e[i],end="")
if len(o) > len(e):
  print(o[-1])
elif len(o) < len(e):
  print(e[-1])
else:
  pass


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

using namespace std;

using ll = long long;

int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int ans = 0;
  for (int i = 0; i <= a; i++) {
    for (int j = 0; j <= b; j++) {
      for (int k = 0; k <= c; k++) {
        if (i * 500 + j * 100 + k * 50 == x) {
          ans++;
        }
      }
    }
  }
  cout << ans << '\n';
  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ULL = unsigned long long;

int x[200000] = {};
int p[200000];
int dp[200000];

int solve2(int i) {
	if (dp[i] != -1) return dp[i];
	if (i == 0) return dp[i] = x[0];
	return dp[i] = solve2(p[i]) + x[i];
}

void solve() {
	int n, q; cin >> n >> q;
	{
		vector<vector<int>> e(n);
		rep(i, n - 1) {
			int a, b; cin >> a >> b; a--; b--;
			e[a].push_back(b); e[b].push_back(a);
		}
		queue<int> Q; Q.push(0);
		while (!Q.empty()) {
			int qp = Q.front(); Q.pop();
			rep(i, e[qp].size()) {
				if(p[qp] != -1) if (e[qp][i] == p[qp]) continue;
				Q.push(e[qp][i]);
				p[e[qp][i]] = qp;
			}
		}
	}
	rep(i, q) {
		int pp, xx; cin >> pp >> xx; pp--;
		x[pp] += xx;
	}
	rep(i, n) { dp[i] = -1; }

	rep(i, n) {
		cout << solve2(i) << endl;
	}
}

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 13872
'use strict'

const main = (input) => {
    input = input.split('\n')
    let temp = input[0].split(' ').map(i => parseInt(i))
    const N = temp[0]
    const T = temp[1]
    temp = input.slice(1, N + 1)
    let minc = 1001
    temp.forEach(t => {
        let temp = t.split(' ').map(i => parseInt(i))
        if(temp[1] <= T){
            minc = Math.min(temp[0], minc) 
        }
    })

    if(minc === 1001){
        console.log('TLE')
    }else{
        console.log(minc)
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

void solve() {
    i64 n;
    cin >> n;
    i64 ans = 0;
    for (i64 i = 1; i <= n; i++) {
        i64 a;
        cin >> a;
        if (a % 2 && i % 2) ans++;
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 3576