akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

#define DEF_ELM_MAX 36

typedef	struct	_CARD {
	char	mark;
	int		value;
} CARD;

	CARD R1[DEF_ELM_MAX];
	CARD R2[DEF_ELM_MAX];

////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
void swap(CARD *x, CARD *y)
{
	CARD tmp;
	tmp = *x;
	*x = *y;
	*y = tmp;
	return;
}

////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
void bubbleSort(CARD *A, int N) // N ??????????´?????????? 0-????????????????????? A
{
	int flag = 1; // ????????£??\????´?????????¨??????
	int i;
	int j;

	i = 0;
	while (flag) {
		flag = 0;
		for ( j = N-1 ; j > i ; j-- ) {
			if (A[j].value < A[j-1].value) {
				swap(&A[j], &A[j-1]);
				flag = 1;
			}
		}
		i++;
	}
	return;
}

////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
void selectionSort(CARD *A, int N) // N??????????´??????????0-?????????????????????A
{
	int i;
	int j;
	int minj;
	int flag;

	for ( i = 0 ; i < N ; i++ ) {
		minj = i;
		flag = 0;
		for ( j = i ; j < N ; j++ ) {
			if ( A[j].value < A[minj].value ) {
				minj = j;
				flag = 1;
			}
		}
		if (flag) {
			swap(&A[i], &A[minj]);
		}
	}
	return;
}

////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
void printStable(CARD *A1, CARD *A2, int N)
{
	int i;
	int cnt = 0;
	for ( i = 0 ; i < N ; i++ ) {
		if (A1[i].mark == A2[i].mark) {
			cnt++;
		}
	}
	printf("%s\n", ((cnt == N) ? "Stable" : "Not stable"));
}
////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
void printout(CARD *A, int N)
{
	int i;
	for ( i = 0 ; i < N ; i++ ) {
		printf("%c%d", A[i].mark, A[i].value);
		if (i == N-1) {
			printf("\n");
		} else {
			printf(" ");
		}
	}
}

////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
int main(void)
{
	int N;
	int i;
//
	scanf("%d", &N);
	for ( i = 0 ; i < N ; i++ ) {
		scanf(" %c%d", &R1[i].mark, &R1[i].value);
		R2[i] = R1[i];
	}
//
	bubbleSort(R1, N);

	selectionSort(R2, N);

	printout(R1, N);
	printf("Stable\n");
	
	printout(R2, N);
	printStable(R1, R2, N);

	return 0;
}

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

int main() {
    int n;
    cin >>n;
    string a,b,c;
	cin>>a>>b;
	int count =0,x=0,y=0;
	for(int i=0;i<(2*n);i++){
	    if(count%2 ==0){
	        c[i]=a[x];
	        x++;
	        count++;
	    }else{
	        c[i]=b[y];
	        y++;
	        count++;
	        }
	    
	    
	    
	    
	}
	
for(int i=0;i<(2*n);i++){
    cout<<c[i];
}
	
	
	
	
	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 N = sc.nextInt();
		String S = sc.next();
		int max = 0;
		for (int i = 1; i < N - 1; i++) {
			String X = S.substring(0, i);
			String Y = S.substring(i);
			int result = 0;
			int min = Math.min(X.length(), Y.length());
			for (int j = 0; j < 26 && result < min; j++) {
				char alphabet = (char) ('a' + j);
				if (X.contains(String.valueOf(alphabet)) && Y.contains(String.valueOf(alphabet))) {
					result++;
				}
			}
			max = Math.max(max, result);
		}
		System.out.println(max);
	}
}


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

void primeFactors(int n)
{
    // Print the number of 2s that divide n


    // n must be odd at this point. So we can skip
    // one element (Note i = i +2)


    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        cout << n << " ";
}

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

	long long n;
    int counting, max_times=0;

    cin >> n;

    counting = 0;
    while (n % 2 == 0) {
        counting ++;
        n = n/2;
    }
    max_times += (-1+sqrt(1+8*counting))/2;

    for (int i = 3; i <= sqrt(n); i = i + 2) {
        counting = 0;
        while (n % i == 0) {
            n = n/i;
            counting++;
        }
        max_times += (-1+sqrt(1+8*counting))/2;
    }

    if (n > 2) {
        max_times++;
    }

    cout << max_times;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
using ii = pair<int, int>;
 
#define fi first
#define re return
#define se second
#define in insert
#define pb push_back
#define eb emplace_back
#define y1 y123123123123
#define all(x) x.begin(), x.end()
#define hash hash123s
#define index ind123
 
#define repx(i, x, n) for (int i = x; i < (n); i++)
#define repd(i, n, d) for (int i = 0; i < (n); i += d)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepd(i, n, d) for (int i = (n) - 1; i >= 0; i -= d)
#define rep(i, n) for (int i = 0; i < (n); i++)
 
template<class t>
void print(t x, int end = 1) {
    cout << x << (end == 1 ? "\n" : " ");
}
 
template<class T>
void print(const vector<T> &v, int end = 1) {
    rep(i, (int) v.size()) {
        print(v[ i ], 0);
    }
    cout << endl;
}
 
template<class T>
void print(const set<T> &v, int end = 1) {
    for(auto to = v.begin(); to != v.end(); to++) {
        print(*to);
    }
    cout << endl;
}
 
template<class T>
void print(const map<T, T> &v, int end = 1) {
    for(auto to : v) {
        print(to.fi, 0);
        cout << ": ";
        print(to.se);
    }
}
 
template<class t>
void errprint(t x, int end = 1) {
    cerr << x << (end == 1 ? "\n" : " ");
}

#define name(x) cerr << #x << " = ";
#define errprint_var(x) cerr << #x << " = " << x << endl;
#define errprint_vec(x) { name(x); cerr << "{"; rep(i, x.size()) cerr << x[ i ] << (i == x.size() - 1 ? "" : ", "); cerr << "}" << endl; }
 
#ifdef artem
    #define debug(x) x
    #define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
    #define debug(x)
#endif
 
void solve();
 
clock_t start_time;
double get_current_time() {
    return (double)(clock() - start_time) / CLOCKS_PER_SEC;
}
 
int main() {
    // freopen("", "r", stdin);
    // freopen("", "w", stdout);
 
    ios_base::sync_with_stdio(false);
    solve();
}
 
/* ==================== actual code starts here ==================== */

const int limitN = (int)1e5 + 123;
const int limitK = 300 + 123;
const int limit2 = 18;

int n, m, k;
ll a[ limitN ], dp[ limitK ][ limitN ]; // [ cnt ][ last pos ] = max impact
ll st[ limit2 + 1 ][ limitN ];
int p2[ limitN ];

void init_sparse(int x) {
	rep(i, n) {
		st[ 0 ][ i ] = dp[ x ][ i ];
	}
	repx(j, 1, limit2 + 1) {
		rep(i, n - (1 << j) + 1) {
			st[ j ][ i ] = max(st[ j - 1 ][ i ], st[ j - 1 ][ i + (1 << (j - 1)) ]);
		}
	}
}

ll get_max(int l, int r) {
	int lg = p2[ r - l + 1 ];
	re max(st[ lg ][ l ], st[ lg ][ r - (1 << lg) + 1 ]);
}

void solve() {
	cin >> n >> m >> k;
	rep(i, n) cin >> a[ i ];

	rep(i, n) {
		dp[ 1 ][ i ] = a[ i ];
	}
	repx(i, 2, n + 1) {
		p2[ i ] = p2[ i / 2 ] + 1;
	}

	repx(j, 2, k + 1) {
		init_sparse(j - 1);
		repx(i, j - 1, n) {
			int l = max(0, i - m), r = i - 1;
			ll mx = get_max(l, r);
			// cout << "l = " << l << ", r = " << r << " : " << mx << endl;
			dp[ j ][ i ] = max(dp[ j ][ i ], (ll)j * a[ i ] + mx);
		}
	}

	// repx(j, 1, k + 1) {
	// 	cout << "j = " << j << endl;
	// 	rep(i, n) {
	// 		print(dp[ j ][ i ], 0);
	// 	}
	// 	cout << endl;
	// }

	ll ans = 0;
	rep(i, n) ans = max(ans, dp[ k ][ i ]);
	print(ans);
}

Measured memory_bytes: 251776
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <set>
#include <cstring> 

using namespace std;

#ifdef DEBUG_MODE
#define DBG(n) n;
#else
#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;


int main() {
	double a, b; cin >> a >> b;
	if (b > a) {
		cout << Decimal << b * b * b * acos(-1) * 4 / 3 << endl;
	}
	else {
		cout << Decimal << acos(-1) * a * a * b * 2 / 3 << endl;
	}
	return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll& a, ll b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
bool chmax(ll& a, ll b) {
    if (b > a) {
        a = b;
        return 1;
    }
    return 0;
}
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
map<ll, ll> ZIPX, ZIPY;
vl UNZIPX, UNZIPY;
vector<PP> tasu, hiku;
    ll dp[4030][4030];
int main() {
    cin >> n;
    rep(i, n) {
        cin >> a >> b >> c >> d;
        ZIPX[a] = 1;
        ZIPY[b] = 1;
        ZIPX[c] = 1;
        ZIPY[d] = 1;
        tasu.push_back({a, b});
        hiku.push_back({c, d});
    }

    for (auto ite = ZIPX.begin(); ite != ZIPX.end(); ite++) {
        UNZIPX.push_back((*ite).first);
    }

    for (auto ite = ZIPY.begin(); ite != ZIPY.end(); ite++) {
        UNZIPY.push_back((*ite).first);
    }

    rep(i, UNZIPX.size()) { ZIPX[UNZIPX[i]] = i+1; }
    rep(i, UNZIPY.size()) { ZIPY[UNZIPY[i]] = i+1; }

    rep(i, 4030) {
        rep(j, 4030) { dp[i][j] = 0; }
    }

    rep(i,n){
        tie(a, b) = tasu[i];
        tie(c, d) = hiku[i];
        dp[ZIPX[a]][ZIPY[b]]++;
        dp[ZIPX[a]][ZIPY[d]]--;
        dp[ZIPX[c]][ZIPY[b]]--;
        dp[ZIPX[c]][ZIPY[d]]++;

    }

    rep(i, 4010) {
        rep(j, 4010) {
                dp[i+1][j] += dp[i][j];
        }
    }

   rep(i, 4010) {
        rep(j, 4010) {
                dp[i][j+1] += dp[i][j];
                if(dp[i][j]>0)ans+=(UNZIPX[i]-UNZIPX[i-1])*(UNZIPY[j]-UNZIPY[j-1]);
        }
    }

    cout << ans << endl;
}



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

int main() {
	char s[11];
	scanf("%s", s);
	
	bool chk = false;
	for(int i=1;s[i];i++)
		if(s[i]!=s[i-1]) chk = true;
	puts(chk ? "Yes" : "No");
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    typedef unsigned long long ull;
    ull n;
    while (cin >> n, n){
        ull _5 = 0, _2 = 0;
        for (ull i = 2; i <= n; i++){
            ull t = i;
            while (t % 2 == 0)_2++, t /= 2;
            while (t % 5 == 0)_5++, t /= 5;
        }
        cout << min(_2, _5) << endl;
    }
}

Measured memory_bytes: 1148
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

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

//
#define MAX_V 100000
#define MAX_LOG_V 17
//
typedef pair<long long,long long> P;
typedef pair<long long,P> PP;
long long V;
long long Depth[MAX_V];
vector<long long> G_dep[MAX_V];
//
vector<long long> G[MAX_V];
long long root;
long long parent[MAX_LOG_V][MAX_V];
long long depth[MAX_V];

void dfs(long long v,long long p,long long d,long long index)
{
	parent[0][v]=p;
	depth[v]=d;
	//
	if(v==root)Depth[v]=0;
	else Depth[v]=Depth[p]+G_dep[p][index];
	//
	rep(i,G[v].size())
	{
		if(G[v][i]!=p)dfs(G[v][i],v,d+1,i);
	}
}

void init(long long V)
{
	dfs(root,-1,0,0);
	rep(k,MAX_LOG_V-1)
	{
		rep(v,V)
		{
			if(parent[k][v]<0)parent[k+1][v]=-1;
			else parent[k+1][v]=parent[k][parent[k][v]];
		}
	}
}

long long lca(long long u,long long v)
{
	if(depth[u]>depth[v])swap(u,v);
	rep(k,MAX_LOG_V)
	{
		if((depth[v]-depth[u])>>k&1)
		{
			v=parent[k][v];
		}
	}
	if(u==v)return u;
	for(long long k=MAX_LOG_V-1;k>=0;k--)
	{
		if(parent[k][u]!=parent[k][v])
		{
			u=parent[k][u];
			v=parent[k][v];
		}
	}
	return parent[0][u];
}
//
long long aa,bb,cc;
long long Q;
long long K;
long long x[100000];
long long y[100000];
int main()
{
	cin>>V;
	rep(i,V-1)
	{
		cin>>aa>>bb>>cc;
		aa--;bb--;
		G[aa].push_back(bb);
		G[bb].push_back(aa);
		G_dep[aa].push_back(cc);
		G_dep[bb].push_back(cc);
	}
	cin>>Q>>K;K--;
	rep(i,Q){cin>>x[i]>>y[i];x[i]--;y[i]--;}
	init(V);
	rep(i,Q)
	{
		long long v1=lca(K,x[i]);
		long long v2=lca(K,y[i]);
		cout<<2*Depth[K]+Depth[x[i]]+Depth[y[i]]-2*Depth[v1]-2*Depth[v2]<<endl;
	}
	return 0;
}

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

#define    int               long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    fast
    int d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d)  cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3636
// node�ő��
#define MAX 100005
#define NIL -1

struct Node {
    int parent;
    int left;
    int right;
};
// �z��ŕێ�����
struct Node gNode[MAX];
int gDepth[MAX];
/*�\���̂Ƃ���Node���`����
�q���Ȃ����ƂȂǂ���������NIL���`���܂����B
NIL��objective-c�Ȃǂɂ���`����Ă��܂��B

left�͎q�Ƃ����Ӗ�������right�͓����K�w�̌Z��̂悤�ȈӖ������ł��B

�����ďo�͊֐����`���܂��B
*/
void print(int node){
int i,left;
    printf("node %d: parent = %d, depth = %d, ",node,gNode[node].parent,gDepth[node] );
    
    if(gNode[node].parent == NIL) printf("root, ");
    else if(gNode[node].left == NIL)printf("leaf, ");
    else printf("internal node, ");
    
    printf("[");
    
    for(i = 0,left = gNode[node].left;left != NIL;++i,left = gNode[left].right){
        if(i) printf(", ");
        printf("%d",left);
    }
    printf("]\n");
}
/*���ԂƂ��Ă܂��A�Ώۂ�node��left���o�͂��܂��B
�����āA�o�͂���left node�ɔ�сA����left(node�ƕ\���ł���)��right����left���o��
������J��Ԃ��܂��B

�[�������߂āAglobal�ϐ�gDepth�ɑ������֐��ł��B

*/

// �ċA�I�ɐ[�������߂�
void rec(int node ,int parent){
    gDepth[node] = parent;
    if(gNode[node].right != NIL){
        // �E�̌Z��ɓ����[����ݒ�
        rec(gNode[node].right,parent);
    }
    if(gNode[node].left != NIL){
        // �ł����̎q�Ɏ����̐[��+1��ݒ�
        rec(gNode[node].left,parent + 1);
    }
}

int main(){
    int nodeNum,nodeIndex,node,left,root,n,i,j;
    scanf("%d",&n);
    // 1.������
    for(i = 0;i < n;++i){
        gNode[i].parent = gNode[i].left = gNode[i].right = NIL;
    }
    // 2.node�ɑ�����Ă���
    for(i = 0;i < n;++i){
        scanf("%d%d",&nodeIndex,&nodeNum);
        for(j = 0;j < nodeNum;++j){
            scanf("%d",&node);
            // �����l��left
            if(j == 0){
                gNode[nodeIndex].left = node;//nodeIndex�̈�ԍ��̎q (the most left child of id)
            }
            else{
                gNode[left].right = node;//���̌Z��Ɍq���� (connect to left sibling)
            }
            left = node;
            gNode[node].parent = nodeIndex;
        }
    }
    
    // 3.root��T��
    for(i = 0;i < n;++i){
        if(gNode[i].parent == NIL){
            root = i;
        }
    }
    
    // ������͂��߂Đ[����������
    rec(root,0);
    
    // 4.node��index���Ƃɏo�͂���
    for(i = 0;i < n;++i){
        print(i);
    }
    return 0;
}



Measured memory_bytes: 6448
/*
	Solved!
	Time: 05:23:26 PM
	Date: 05-04-2020
*/
#include <bits/stdc++.h>
using namespace std;
 
typedef unsigned long long  ll;
typedef vector<int>         vi;
typedef vector<ll>          vll;

#define ff                  first
#define sf                  scanf
#define pf                  printf
#define ss                  second
#define ppb                 pop_back
#define pb                  push_back
#define MP                  make_pair
#define MAXN                5000005
#define MOD                 100000007
#define inf                 0x3f3f3f3f
#define PI                  (2.0*acos(0.0))
#define INF                 0x3f3f3f3f3f3f3f3f
#define rev(v)              reverse(all(v))
#define all(v)              v.begin(), v.end()
#define __lcm(x, y)         (x * y) / __gcd(x, y)
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define si(n)               scanf("%d", &n)
#define sl(n)               scanf("%lld", &n)
#define sii(a, b)           scanf("%d %d", &a, &b)
#define sll(a, b)           scanf("%lld %lld", &a, &b)
#define siii(a, b, c)       scanf("%d %d %d", &a, &b, &c)
#define slll(a, b, c)       scanf("%lld %lld %lld", &a, &b, &c)
#define siiii(a, b, c, d)   scanf("%d %d %d %d", &a, &b, &c, &d)
#define sllll(a, b, c, d)   scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl;}

int main(){
    /*#ifndef ONLINE_JUDGE
        double start = clock(); READ(); WRITE();
    #endif*/
        int n, k; sii(n, k);
        int ans;
        if(k == 1) ans = 0;
        else ans = n - k;

        pf("%d\n", ans);

    /*#ifndef ONLINE_JUDGE
        printf("\n>>Runtime: %.10fs\n", (double)(clock() - start) / CLOCKS_PER_SEC);
    #endif*/

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
 
using namespace std; 
 
 
int main() 
{ 
    int N;

    cin >> N;

    int max_wk=1;
    vector<int> Xi(N);
    for(int i=0;i<N;i++){
        cin >> Xi.at(i);
        max_wk = max(max_wk,Xi.at(i));
    }

    int dist_sum;
    int minwk=214783648;
    int index_wk;
    for(int i=1;i<max_wk+1;i++){
        dist_sum=0;
        for(int j=0;j<N;j++){
            dist_sum +=(i-Xi.at(j))*(i-Xi.at(j));
        }
        minwk = min(minwk,dist_sum);
    }

    cout << minwk;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<map>

using namespace std;

int main() {
	map<int, bool> m;
	int a ,b,c;
	cin >> a >> b >> c;
	m[a] = m[b] = m[c] = true;
	cout << m.size() << endl;
}

Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    }
    let mut dp = vec![false; k + 1];
    for i in 0..k {
        if dp[i] {
            continue;
        }
        for &x in &a {
            if i + x > k {
                break;
            }
            dp[i + x] = true;
        }
    }
    let ans = if dp[k] {"First"} else {"Second"};
    println! ("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int prime[52000], length = 0, r[114514] = {}, cnt = 0;
bool primeb[114514];
void insert(int p) { prime[length] = p; length++; primeb[p] = 1; return; }
void f() {
	r[1] = 0;
	insert(2);
	for (int i = 3; i < 100002; i += 2) {
		for (int j = 0; j < length; j++) {
			if (!(i%prime[j]))goto hell;
		}
		insert(i);
		if (primeb[(i + 1) / 2])cnt++;
	hell:r[i] = cnt;
	}
}
int main() {
	f();
	int q; cin >> q;
	for (int i = 0; i < q; i++) {
		int li, ri; cin >> li >> ri;
		if (li != 1)li -= 2;
		cout << r[ri] - r[li] << endl;
	}
}

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

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int R=sc.nextInt();
        if(R<1200){
            System.out.println("ABC");
        }else if(R<2800){
            System.out.println("ARC");
        }else{
            System.out.println("AGC");
        }
    }
}

Measured memory_bytes: 21972
#import collections
# c = collections.Counter()
#import itertools as it
#import math
#import numpy as np
#import sys 
#sys.exit()
 
s = input()
t = input()
 
#k = int(input())
#a, b  = map(int, input().split())
'''
#  = list(map(int, input().split()))
'''
'''
n = input()
a = [int(input()) for i in range(n)]
'''
'''
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
'''

#-------------------------------#
#len(t)==len(s)+1
#print(t[0:-1])
count=0
for i in range (len(s)):
    if s[i]!=t[i]:
        count=count+1
print(count)

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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

map<ll, ll> mp;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  ll x,t;cin>>x>>t;
  cout<<max(x-t, 0ll)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int main() {
	int n, m;
	
	scanf("%d %d", &n, &m);
	printf("%lld\n", 1ll * n * m / gcd(n, m));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int inf=1e18+10;
int32_t main(){
	int n,a,b;cin>>n>>a>>b;
	int ans=inf;
	int ans2=inf;
	int ans1=inf;
	if((b-a+1)%2==1){
		int m=a+(b-a)/2;
		ans=m-a;
	}else{
		int time1=min(n-b,a-1);
		ans=time1+1;
		if(b-a>1)
		ans+=(a+1+(b-(a+1))/2-(a+1));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N, M = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]

R = {}
ans = N
cnt = [0] * N

for i in range(M):
  L = [0] * (M + 1)
  for j in range(N):
    while A[j][cnt[j]] in R:
      cnt[j] += 1
    L[A[j][cnt[j]]] += 1
  ma = 0
  man = L[0]
  for j in range(M + 1):
    if man < L[j]:
      ma = j
      man = L[j]
  ans = min(ans, man)
  R[ma] = 1

print(ans)

Measured memory_bytes: 69324
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
  int first,second;
  cin>>first>>second;
  vector<int>nish(first+1,0);
  for(int i=1;i<=second;i++)
  {
    int total;
    cin>>total;
    for(int j=1;j<=total;j++)
    {
      int temp;
      cin>>temp;
      nish[temp]++;
    }
  }
  
  
  int ans=0;
  for(int i=1;i<=first;i++)
  {
    if(nish[i]==0)
      ans++;
  }
  cout<<ans<<endl;
  
  
  return 0;
}

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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string s; cin >> s;
    string t; cin >> t;
    bool ok = true;
    rep(i,0,s.size()){
        if(ok==false) break;
        if(s[i]!=t[i]) ok = false;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
#define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

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

  int A, B, C;
  cin >> A >> B >> C;
  if (C >= A && C <= B) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

int main() {
	int n,a,b,c,d,sum,i,j,k,sw=0;
	cin>>n;
	d=n%10;
	n=n/10;
	c=n%10;
	n=n/10;
	b=n%10;
	n=n/10;
	a=n%10;
	//cout<<a<<" "<<b<<" "<<c<<" "<<d;
            if(a+b+c+d==7)
                 cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"="<<7;
            else if(a-b+c+d==7)  
                 cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"="<<7;
            else if(a+b-c+d==7)
                 cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"="<<7;
            else if(a-b-c+d==7)
                 cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"="<<7;
            else if(a+b+c-d==7)
                 cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"="<<7;
            else if(a-b-c-d==7)
                 cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"="<<7;
            else if(a+b-c-d==7)
                 cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"="<<7;
            else if(a-b+c-d==7)
                 cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"="<<7;
            return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';
    if (a + b + c + d == 7)
        cout << a << "+" << b << "+" << c << "+" << d << "=7";
    else if (a - b + c + d == 7)
        cout << a << "-" << b << "+" << c << "+" << d << "=7";
    else if (a + b - c + d == 7)
        cout << a << "+" << b << "-" << c << "+" << d << "=7";
    else if (a + b + c - d == 7)
        cout << a << "+" << b << "+" << c << "-" << d << "=7";
    else if (a - b - c + d == 7)
        cout << a << "-" << b << "-" << c << "+" << d << "=7";
    else if (a + b - c - d == 7)
        cout << a << "+" << b << "-" << c << "-" << d << "=7";
    else if (a - b + c - d == 7)
        cout << a << "-" << b << "+" << c << "-" << d << "=7";
    else if (a - b - c - d == 7)
        cout << a << "-" << b << "-" << c << "-" << d << "=7";
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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 ll INF=1e18;
//abc166d
ll f(ll n){
    return n*n*n*n*n;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll x;
    cin>>x;
    ll a,b;
    V<ll> d;
    for(ll i=-1000;i<=1000;i++){
        for(ll j=-1000;j<=1000;j++){
            if(f(i)-f(j)==x){
                a=i;
                b=j;
                break;
            }
        }
    }
    cout<<a<<' '<<b<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
(全探索できるなら全探索しろ)
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'\n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え(=でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
*/

Measured memory_bytes: 3640
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let n:usize=read();
    let m:usize=read();
    let a=(0..n).map(|_|(read::<isize>(),read::<isize>())).collect::<Vec<(isize,isize)>>();
    let b=(0..m).map(|_|(read::<isize>(),read::<isize>())).collect::<Vec<(isize,isize)>>();
    for (x,y)in a{
        let mut s=1e9 as isize;
        let mut j=0 as usize;
        for i in 0..m{
            let now=(x-b[i].0).abs()+(y-b[i].1).abs();
            if now<s{s=now;j=i+1}
        }
        println!("{}",j);
    }
}


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

int main(){
  int N,M;
  cin >> N;
  vector<string>s(N);
  for(int i = 0; N > i ; i++){
    cin >> s.at(i);
  }
  cin >> M;
  vector<string>t(M);
  for( int i = 0 ; M > i ; i++){
    cin >> t.at(i);
  }
  int sum;
  string a;
  vector<int>answer(N);
  for(int i = 0 ; N > i ; i++){
    a = s.at(i);
    sum = 0;
     for(int i = 0 ; N > i ; i++){
       if( a == s.at(i) ){
         sum++;
       }
     }
      for(int i = 0 ; M > i ; i++){
        if( a == t.at(i) ){
          sum--;
        }
      }
     answer.at(i) = sum;   
    }
  int b,max;
  for( int i = 0; N > i ; i++ ){
    if ( b > max){
      max = b;
    }
    b = answer.at(i);
  }
  if ( max < 0 ){
    cout << 0 << endl;
  }
  else{
    cout << max << endl;
  }
}

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

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1000000007;

int H,W;

int main(void){
	cin>>H>>W;
	string picture;
	for(int i=0;i<H;i++){
		 cin>>picture;
		printf("%s\n%s\n", picture.c_str(), picture.c_str());
	}

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  int64 ret = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int cur = a[i] + a[j];
      auto it = lower_bound(a.begin() + j + 1, a.end(), cur);
      --it;
      ret += it - a.begin() - j;
    }
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 256
import math
N, K = map(int, input().split())
count = 0
for i in range(1, N+1):
    if K % 2 == 0:
        a = i * K/2
        if a >= N+1:
            break
        maxn = int((N + a) // K)
        minn = math.ceil(( a + 1) / K)
        maxln = int((N - a) // K)
        minln = max(math.ceil((1 - a) / K), 1- i)
        #print(a)
        #print(maxn)
        #print(minn)
        #print(maxln)
        #print(minln)
        count += (maxn - minn + 1) * (maxln - minln + 1)
    else:
        a = i * K
        if a >= N + 1:
            break
        maxn = int((N + a) // K)
        minn = math.ceil((a + 1) / K)
        maxln = int((N - a) // K)
        minln = max(math.ceil((1 - a) / K), 1 - i)
        # print(a)
        # print(maxn)
        # print(minn)
        # print(maxln)
        # print(minln)
        count += (maxn - minn + 1) * (maxln - minln + 1)


print(int(count))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
long double n,x;
int main(){
	cin>>n;
	for(int i=n;i>=1;i--){
		x=(long double)((long double)(i)*(long double)(1.08));
		int a=(int)(x/1);
		if(a==n){
			cout<<i;
			re 0;
		}
	} 
	cout<<":(";
	re 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a, b,N,i,sumA,sumB;
	while (cin >> N) {
		if (N == 0) {
			break;
		}
		sumA = 0;
		sumB = 0;
		for (i = 0; i < N; i++) {
			cin >> a >> b;
			if (a > b) {
				sumA += a + b;
			}
			else if (a == b) {
				sumA += a;
				sumB += a;
			}
			else if (a < b) {
				sumB += a + b;
			}
		}
		cout << sumA << " " << sumB << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
for i in range(input()):
    X,Y,W,H=map(int,raw_input().split())
    cnt=0
    N=input()
    for	i in range(N):
	x,y=map(int,raw_input().split())
	if (X<=x<=X+W) and (Y<=y<=Y+H):
            cnt+=1
    print cnt

Measured memory_bytes: 4228
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int x,a;
  cin >> x >> a;
 
  if(x < a)
    cout << "0" << endl;
  else cout << "10" << endl;
  }

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

#define mod 1000000007
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;

int X[] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Y[] = {1, 1, 1, 0, -1, -1, -1, 0};

void solve() {
    int n, res=0;
    cin >> n;
    int p[n];
    REP(i, n) cin >> p[i];

    REP(i, n){
        if(p[i] == i+1){
            swap(p[i], p[i+1]);
            res++;
        }
    }

    cout << res << endl;
}

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
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;}

int main(){
    string s, t;
    cin >> s >> t;
    string ans = "Yes";
    rep(i, s.length()){
        if(s.at(i) != t.at(i)) ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }

    return true;
}
int cnt;
int main(void){
    int n;
    cin >> n;
    vector<char> vec(n);
    rep(i, n) cin >> vec[i];
    rep(i, n) {
        if (vec[i] == 'Y') {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 3584
a=input()
ans="AC"
if a[0]!="A":
    ans="WA"
if a[2:-1].count("C")!=1 or a.count("C")!=1 or a.count("A")!=1:
    ans="WA"
a=a.replace("A","")
a=a.replace("C","")
if a.islower()==False:
    ans="WA"
print(ans)

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys
import math

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    A, B = map(int, readline().split())
    # 1 + (A - 1) * n >= B
    # n >= (B - 1) / (A - 1)
    ans = math.ceil((B - 1) / (A - 1))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int h, n; cin >> h >> n;
  vector<int> a(n);
  int sum = 0;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    sum += a[i];
  }
  cout << (sum >= h ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 9 * 1e18;
const ll MOD = 1e9 + 7;

void solve(long long K) {
  ll base = 49 + K / 50;
  ll rest = K % 50;
  ll num1 = base + 50 - (rest - 1);
  ll num2 = base - rest;

  ll N = 50;
  vl ans(N);
  rep(i, 0, N) {
    if (i < rest) {
      ans[i] = num1;
    } else {
      ans[i] = num2;
    }
  }

  print(N);
  rep(i, 0, N) {
    cout << ans[i];
    if (i != N - 1) {
      cout << " ";
    }
  }
  cout << endl;
}

int main() {
  long long K;
  scanf("%lld", &K);
  solve(K);
  return 0;
}


Measured memory_bytes: 256
a,b,m=map(int,input().split())
la=list(map(int,input().split()))
lb=list(map(int,input().split()))
ans=min(la)+min(lb)
for i in range(m):
  x,y,c=map(int,input().split())
  ans=min(ans,la[x-1]+lb[y-1]-c)










print(ans)

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l;
  cin >> l;
  int r = 1;
  vector<tuple<int, int, int>> ans;
  while(pow(2, r) <= l) {
    ans.push_back(make_tuple(r, r + 1, pow(2, r-1)));
    ans.push_back(make_tuple(r, r + 1, 0));
    r++;
  }
  r--;
  int e = r;
  while(l - pow(2, r) > 0) {
    if(l - pow(2, r) >= pow(2, e-1)) {
      ans.push_back(make_tuple(e, r + 1, l - pow(2, e - 1)));
      l -= pow(2, e - 1);
    }
    e--;
  }
  cout << r + 1 << " " << ans.size() << endl;
  for(auto &c : ans) {
    cout << get<0>(c) << " " << get<1>(c) << " " << get<2>(c) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int a,b;
  	cin>>a>>b;
  	vector<int> v(3,1);
  	v[a-1]=0;
  	v[b-1]=0;
  
  for(int i=0;i<3;i++){
  	if(v[i]==1)cout<<i+1<<endl;
  }
}

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

int sm(1<<20), tot, n, x;

int main()
{
	scanf("%d", &n);
	for (int i = 0;i < n;i++)
	{
		scanf("%d", &x);
		tot += x;
		if (x%10) sm = min(sm, x);
	}
	if (tot%10) printf("%d\n", tot);
	else printf("%d\n", max(tot-sm, 0));
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
    string s;
    cin >> s;
    map<char, int> map;
    REP(i, s.size()) {
        map[s[i]]++;
    }
    if (map.size() == 26) cout << "None" << endl;
    else {
        REP(i, 26) {
            char c = 'a' + i;
            if (map.find(c) == map.end()) {
                cout << c << endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,d;
    cin >> n >> d;
    int x[n][d];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin >> x[i][j];
        }
    }
    int ans = 0;
    for(int i;i<n;i++){
        for(int j=i+1;j<n;j++){
            long tmp = 0;
            for(int k=0;k<d;k++){
                tmp += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            }
            if(sqrt(tmp) == floor(sqrt(tmp)))ans++;
        }
    }
    cout << ans << endl;
}


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

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

        String s = sc.next();
        int ans = 0;
        for (int i = 0; i<(s.length()/2); i++){
            if (s.charAt(i) != s.charAt(s.length()-i-1)){
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35728
#include <stdio.h>
int main(void) {
	int A,B,T;
	int time = 0;
	int bis = 0;

	scanf("%d %d %d",&A,&B,&T);

	while (time <= T) {
		time += A;
 			if (time > T) {
     			break;
     		} else {
        	bis += B;
     		}
    }
    
  printf("%d\n",bis);
  return 0;
}


Measured memory_bytes: 128
s = input()
t = input()
 
s_c = []
t_c = []
for c in 'abcdefghijklmnopqrstuvwxyz':
    s_c.append(s.count(c))
    t_c.append(t.count(c))
s_c.sort()
t_c.sort()
if s_c == t_c:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 41456
import numpy as np
n = int(input())
d_list = []
for i in range(n):
    d = int(input())
    d_list.append(d)
d_array = np.array(d_list)
d_array_sort = np.sort(d_array)[::-1]
count = 0
maximum = 0
for i, d in enumerate(d_array_sort):
    if i == 0:
        maximum = d
        count += 1
    elif d < maximum:
        maximum = d
        count += 1
print(count)

Measured memory_bytes: 12488
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<stdio.h>
#include<vector>
#include<cmath>
using namespace std;
int main() {
	int h, w, n;
	cin >> h >> w >> n;
	int ans = 0;
	for (int i = 1; i <= max(h, w); i++) {
		if (n == i && h == 1 && w == 1) {
			ans = 1; 
			break;
		}
		if (max(h, w) * i >= n) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import math

# スペース区切りの整数の入力
N, D = map(int, input().split())
# 文字列の入力
#s = input()
#開業されたN個要素を受け付ける
input_list = [list(map(float, input().split())) for i in range(N)]

#print(input_list)
ans = 0
for i, input in enumerate(input_list):
    j = i+1
    while j<len(input_list):
        sum = float(0)
        for k in range(D):
            sum = sum + (input_list[i][k] - input_list[j][k])**2
        #print(sum)
        if math.sqrt(sum).is_integer():
            ans = ans +1
        j=j+1

print(ans)


Measured memory_bytes: 38384