akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
    string S;
    cin>>S;
    int n=S.size();
    int x[n];
    for(int i=0;i<n;i++)
        x[i]=S[i]-'0';

    long long sum=0;
    for(int bit=0;bit<(1<<(n-1));++bit){
         long long y=0;
         for(int i=0;i<n-1;++i){
             y*=10;
             y+=x[i];
                          
             if(bit&(1<<i)){
                 sum+=y;
                 y=0;
             }
         }    
         y*=10;
         y+=x[n-1];
         sum+=y;          
    }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*

class Scanner(`in`: java.io.InputStream) {
    private val reader = java.io.BufferedReader(java.io.InputStreamReader(`in`))
    private var tokenizer: StringTokenizer? = null

    fun next(): String {
        if (tokenizer?.hasMoreTokens() != true) {
            tokenizer = StringTokenizer(reader.readLine())
        }
        return tokenizer!!.nextToken()
    }

    fun nextLine(): String {
        return if (tokenizer?.hasMoreTokens() != true) {
            reader.readLine()
        } else tokenizer!!.nextToken("\n")
    }
}

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

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

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val X = sc.next().toLong()

        val A = (0..1000).map { Pair(it, Math.pow(it.toDouble(), 5.0).toLong()) }
        A.forEach { a ->
            A.forEach { b ->
                if (a.second - b.second == X) {
                    pw.println("${a.first} ${b.first}")
                    return
                }
                if (a.second + b.second == X) {
                    pw.println("${a.first} -${b.first}")
                    return
                }
            }
        }
    }
}


Measured memory_bytes: 36812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, long long D, std::vector<std::vector<long long>> X)
{
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i; j < N; j++)
        {
            if (i == j)
                continue;

            ll tmp = 0;
            for (int k = 0; k < D; k++)
            {
                tmp += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }

            for (int i = 0; i <= tmp; i++)
            {
                if (i * i == tmp)
                {
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long D;
    scanf("%lld", &D);
    std::vector<std::vector<long long>> X(N, std::vector<long long>(D));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < D; j++)
        {
            scanf("%lld", &X[i][j]);
        }
    }
    solve(N, D, std::move(X));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<long long> > vvll;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define INF 1000000000
#define MOD 1000000007
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define p_q priority_queue

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

#define MN 200005
int n;
int c[MN];
int lst[MN];
ll dp[MN];

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

    cin >> n;
    FOR(i, 1, n){
        cin >> c[i];
    }
    dp[0] = 1;
    
    FOR(i, 1, n){
        dp[i] = dp[i-1];
        if(c[i] != c[i-1] && lst[c[i]] != 0){
            dp[i] = (dp[i] + dp[lst[c[i]]]) % MOD;
        }
        //cout << dp[i] << "\n";
        lst[c[i]] = i;
    }
    
    cout << dp[n] << "\n";
    
    return 0;
}


Measured memory_bytes: 3328
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
  int64_t x,y,a,b,c,ans=0; cin>>x>>y>>a>>b>>c;
  vector<int> p(a,0),q(b,0),r(c,0);
  rep(i,a) cin>>p[i];
  rep(i,b) cin>>q[i];
  rep(i,c) cin>>r[i];
  sort(al(p)); sort(al(q));
  reverse(al(p)); reverse(al(q));
  rep(i,x) r.push_back(p[i]);
  rep(i,y) r.push_back(q[i]);
  sort(al(r)); reverse(al(r));
  rep(i,x+y) ans+=r[i];
  cout<<ans<<endl;
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

/*
int	gcd(int A, int B) {
	while (0!=B) {
		A %=B;
		swap(A, B);
	}
	return A;
}
*/

#define	MOD 1000000007

int	get_g(int i, vector<int> &grp) {
	if (i==grp.at(i)) return i;
	return get_g(grp.at(i), grp);
}

int	main() {
	int N;
	cin >>N;
	vector<vector<int>> X(N, vector<int> (2, 0));
	vector<vector<int>> Y(N, vector<int> (2, 0));
	for (int i=0; i<N; i++) {
		cin >>X.at(i).at(0) >>Y.at(i).at(0);
		X.at(i).at(1)=i;
		Y.at(i).at(1)=i;
	}
	sort(X.begin(), X.end());
	sort(Y.begin(), Y.end());
	vector<vector<int>> D;
	for (int i=0; i<N-1; i++) {
		int d=X.at(i+1).at(0)-X.at(i).at(0);
		D.push_back({d, X.at(i).at(1), X.at(i+1).at(1)});
		d=Y.at(i+1).at(0)-Y.at(i).at(0);
		D.push_back({d, Y.at(i).at(1), Y.at(i+1).at(1)});
	}
	sort(D.begin(), D.end());
	vector<int> grp(N, 0);
	vector<int> grp_depth(N, 0);
	for (int i=0; i<N; i++)
		grp.at(i)=i;
	int ix=0;
	int S=0;
	int NoB=0;
	while (NoB!=N-1) {
		while (get_g(D.at(ix).at(1), grp)==get_g(D.at(ix).at(2), grp))
			ix++;
		S +=D.at(ix).at(0);
		int p1=get_g(D.at(ix).at(1), grp);
		int p2=get_g(D.at(ix).at(2), grp);
		if (grp_depth.at(p1)==grp_depth.at(p2)) {
			// Groups have same height
			// Merge into less-number-group
			grp.at(max(p1, p2)) = get_g(min(p1, p2), grp);
			grp_depth.at(min(p1, p2))++;
		} else if (grp_depth.at(p1)>grp_depth.at(p2)) {
			// x is higher
			// Merge into x so that the hight will not increase
			// (height for y will be +1)
			grp.at(p2) = p1;
		} else
			// y is higher
			// Merget into y
			grp.at(p1) = p2;
		NoB++;
	}
	cout <<S <<endl;
	return 0;
}



Measured memory_bytes: 24364
#include <map>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 100005;
const int mod = 1e9 + 7;
LL a[maxn], b[maxn], aa[maxn], bb[maxn];
map<LL, int> mp;
vector<LL> p;
#define N 2555
bool vis[N];
void pre() {
    for (int i=2; i<N; i++) {
        if (!vis[i]) {
            p.push_back(i);
            for (int j=i+i; j<N; j+=i) {
                vis[j] = 1;
            }
        }
    }
}
int main() {
    int n,ans=0;
    pre();
    cin>>n;
    for (int i=0; i<n; i++) {
        cin>>a[i];b[i]=a[i];
    }
    for (int i=0; i<n; i++) {
        aa[i] = 1, bb[i] = 1;
        for (int j=0; j<p.size(); j++) {
            int cnt = 0;
            while (a[i] % p[j] == 0) {
                a[i] /= p[j];
                cnt++;
            }
            if (cnt % 3 == 1) {
                aa[i] *= p[j]; bb[i] *= p[j] * p[j];
            } else if (cnt % 3 == 2) {
                bb[i] *= p[j]; aa[i] *= p[j] * p[j];
            }
        }
        aa[i] *= a[i];
        LL t = floor(sqrt(a[i]*1.0));
        if (t * t == a[i]) bb[i] *= t;
        else {
            if (bb[i]*a[i]>0 && bb[i]*a[i]*a[i]>0) bb[i] *= a[i] * a[i];
            else bb[i] = 0;
        }
        mp[aa[i]]++;
    }
    //for (int i=0; i<n; i++) {
    //    cout<<b[i]<<": "<<aa[i]<<" "<<bb[i]<<endl;
    //}
    int flag = 0;
    for (int i=0; i<n; i++) {
        if (aa[i] == 1) {
            if (flag == 0) {ans++; flag=1;}
        } else {
            ans += max(mp[aa[i]], mp[bb[i]]);
            mp[aa[i]] = mp[bb[i]] = 0;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL N, M;
    cin >> N >> M;
    if(N >= M / 2) {
        cout << M / 2 << endl;
    } else {
        LL res = N;
        M -= N * 2;
        cout << res + M / 4 << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> ans(n+1,0);
    rep(i,n)
    {
        int a;
        cin>>a;
        ans[a]=i+1;
    }
    for (int i = 1; i <=n; i++)cout<<ans[i]<<" ";
    cout<<endl;
    
   return 0;
}

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

int main(void) {
	int a;
	char s[10];
	scanf("%d", &a);
	scanf("%s", &s);
	if (a < 3200) {
		printf("red");
	}
	else {
		printf("%s", s);
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int k = sc.nextInt();
		char[] c = s.toCharArray();
		for (int i = 0; i < c.length; i++) {
			if (c[i] == 'a') {
				continue;
			}
			int times = 'z' - c[i] + 1;
			if (k >= times) {
				c[i] = 'a';
				k -= times;
			} else {
				continue;
			}
		}
		if (k != 0) {
			k = k % 26;
			if (c[c.length - 1] + k > 122) {
				c[c.length - 1] = (char) (c[c.length - 1] + k - 26);
			} else {
				c[c.length - 1] = (char) (c[c.length - 1] + k);
			}
		}
		System.out.println(new String(c));
	}
}

Measured memory_bytes: 14244
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
/********************************************************************************************************************************/
/* main *************************************************************************************************************************/
/********************************************************************************************************************************/
int DEBUG = 1;										/* デバッグプリント 提出時は0 */
int main()
{
	int		s, ans = 0;
	char	a[5];
	scanf("%s", &a);

	for(s=0;s<3;s++) {
		if ((a[s] == a[s+1])) ans = 1;
	}
	if (ans == 1) printf("Bad\n");
	else printf("Good\n");



	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main(void)
{
	int i,c,w;
	char n[1001];
	while(1){
		c=0;
		w=0;
		scanf("%s",n);
		if(n[0]=='0') break;
		for(i=1;i<strlen(n);i++){
			if(n[i]=='A'){
				c++;
			}
			else{
				w++;
			}
		}	
			if(c<w){
				w++;
			}
			else{
				c++;
			}		
		printf("%d %d\n",c,w);
	}	
	return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] AandB = new long[n];
		long ans = 0;
		for(int i=0;i<n;i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			ans += a;
			AandB[i] = a+b;
		}
		Arrays.sort(AandB);
		for(int i=n-2;i>=0;i-=2) {
			ans -= AandB[i];
		}
		System.out.println(ans);
		in.close();
	}

}


Measured memory_bytes: 64628
def main():
    n = int(input())
    s = list(map(int, input().split())) 
    q = int(input())
    t = list(map(int, input().split()))
    
    # 集合的なら
    # res = len(set(s) & set(p))
    # print(res)
    # 線形探索なら
    cnt = 0
    for i in t:
        if i in s:
            cnt += 1
    print(cnt)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 6544
S = list(input())
T = list(input())
ans = []
for i in range(len(S) - len(T) + 1):
    tmp = S[:]
    count = 0
    for j in range(len(T)):
        if S[i+j] != T[j] and S[i+j] != '?':
            break
        elif S[i+j] == T[j]:
            tmp[i+j] = T[j]
            count += 1
        elif S[i+j] == '?':
            tmp[i+j] = T[j]
            count += 1

    if len(T) == count:
        ans.append(tmp)

if ans:

    ans1 = []
    for i in ans:
        word = ''.join(i)
        word = word.replace('?', 'a')
        ans1.append(word)

    ans1.sort()
    print(ans1[0])
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,m,sum;
int a[10005]; 
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	if(sum>n)
		cout<<-1;
	else
		cout<<n-sum;
return 0;
}


Measured memory_bytes: 3636
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;
const int MOD = 1000000007;

int gcd(int x, int y) {
	if (x < y) {
		swap(x, y);
	}
	if (y == 0) {
		return x;
	}
	return gcd(y, x%y);
}

int main() {
	int p, q;
	cin >> p >> q;
	int m = sqrt(q) + 1;
	vi prime(m+1, 1);
	prime[0] = prime[1] = 0;
	FOR(i, 2, m) {
		if (prime[i]) {
			for (int j = i*i; j <= m; j += i) {
				prime[j] = 0;
			}
		}
	}

	int ans = 1;
	q /= gcd(p, q);
	FOR(i, 2, m) {
		if ((prime[i] == 1) && (q%i == 0)) {
			ans *= i;
			while (q%i == 0) {
				q /= i;
			}
		}
	}
	
	if (q > 1) {
		ans *= q;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3208
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int solve(int n, int m, int p){
    int x[n];
    int sum_x=0;
    int ans;
    for(int i=0;i<n;i++){
        cin >>x[i];
        sum_x+=x[i];
    }
    if(x[m-1]==0)ans=0;
    else ans = sum_x*(100-p)/x[m-1];
    return ans;
}

int main(int argc, char const *argv[]) {
    int n, m, p;
    vector<int>ans;
    while (1) {
        cin >> n >> m >> p;
        if(n == 0 && m == 0 && p == 0)break;
        ans.push_back(solve(n,m,p));
    }
    for(int i=0;i<ans.size();i++){
        cout << ans[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3144
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    int ans = 1e18;
    int cnt = min(k, x / d);
    x -= cnt * d;
    k -= cnt;
    if (k & 1ll) {
        ans = min(ans, abs(x - d));
    }
    else ans = min(ans, x);
    cout << ans << '\n';
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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()
{
    lol result{0};
    //lol n; cin >> n;
    //int k; cin >> k;
    int n = 5;
    vector<int> a(n);
    REP(i, n)
    {
        cin >> a[i];
        if(a[i] == 0)
            cout << i + 1 << endl;
    }
    

    //cout << result << endl;
    return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int n, W;
int weight[110], value[110];

int dp[110][10010];

int main() {
   cin >> n >> W;
   rep (i, n) cin >> value[i] >> weight[i];

   rep (i, W+1) dp[0][i] = 0;
   for (int i = 0; i < n; i++) {
      for (int j = 0; j <= W; j++) {
         if (j >= weight[i]) {
            dp[i+1][j] = max(dp[i][j], dp[i][j-weight[i]]+value[i]);
         } else {
            dp[i+1][j] = dp[i][j];
         }
      }
   }

   cout << dp[n][W] << endl;

   return 0;
}


Measured memory_bytes: 7020
//IOI 2021
//this will accept, By the order of the peaky fucking blinders
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define ff first
#define ss second

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

const int MAXN = 100 * 1000 + 17;

int n, col[MAXN];
vector<pii> adj[MAXN];

void dfs(int v, int par, int Ncol) {
	int tmp = 1;
	for (auto i : adj[v])
		if (i.ff != par) {
			if (Ncol == tmp)
				tmp++;
			col[i.ss] = tmp++;
			dfs(i.ff, v, tmp - 1);
		}
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i < n; i++) {
		int v, u;
		cin >> v >> u;
		adj[v].pb({u, i});
		adj[u].pb({v, i});
	}
	dfs(1, 0, 0);
	int mx = 1;
	for (int i = 1; i < n; i++)
		mx = max(mx, col[i]);
	cout << mx << endl;
	for (int i = 1; i < n; i++)
		cout << col[i] << endl;
	return 0;
}


Measured memory_bytes: 9344
let id x = x
let (x,y) = Scanf.scanf "%d %d" (fun x y -> (x,y))
 
let alist = [1;3;5;7;8;10;12]
let blist = [4;6;9;11]
          
let ans = if x=2 || y=2 then false else
            if List.mem x alist then List.mem y alist
            else List.mem y blist

let ans' = if ans then "Yes" else "No"
 
let () = Printf.printf "%s\n" ans'

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int game(int n,int k,int a[]){
	vector<int> v(k+1);
	for(int i=0;i<n;i++)
	v[a[i]]=1;
	sort(a,a+n);
	for(int i=1;i<k+1;i++){
		int j=0,flag=0;
		while(j<n&&a[j]<=i){
			if(v[i-a[j]]==0){
				flag=1;break;
			}
			j++;
		}
		if(flag)
		v[i]=1;
	}
	if(v[k])
	cout<<"First"<<endl;
	else
	cout<<"Second"<<endl;
	//for(int i=0;i<k+1;i++)
	//cout<<v[i]<<" ";
}
int main(){
	int n,k;cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	game(n,k,a);
}

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

using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;

template<typename C>
i64 Size(const C& c) { return static_cast<i64>(c.size()); }

template<typename C>
void Sort(C &c) { std::sort(c.begin(), c.end()); }

template<typename C>
void SortR(C &c) { std::sort(c.rbegin(), c.rend()); }

template<typename T, typename U, typename Comp=std::less<>>
bool ChMax(T& x_max, const U& x, Comp comp={}) {
  if(comp(x_max, x)) {
    x_max = x;
    return true;
  }
  return false;
}

template<typename T, typename U, typename Comp=std::less<>>
bool ChMin(T& x_min, const U& x, Comp comp={}) {
  if(comp(x, x_min)) {
    x_min = x;
    return true;
  }
  return false;
}

struct ProconInit {
  static constexpr int IOS_PREC = 15;
  static constexpr bool AUTOFLUSH = false;

  ProconInit() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(IOS_PREC);
    if (AUTOFLUSH) std::cout << std::unitbuf;
  }
} PROCON_INIT;

void solve() {
  f80 r; std::cin >> r;

  std::cout << r * 2.0 * 3.1415926535 << "\n";
}

signed main() {
  solve();

  return 0;
}


Measured memory_bytes: 3808
// 未解決

#include <bits/stdc++.h>

#include <iostream>
using namespace std;

#define EACH(i, a) for (auto &&i : a)
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RFOR(i, a, b) for (int i = (int)b - 1; i >= (int)a; --i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREPS(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(x) (x).begin(), (x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define debug(x) cout << #x << ": " << x << endl

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF (1L << 30)
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
template <class T>
void pvp(T a, T b) {
  for (T i = a; i != b; ++i)
    cout << "(" << i->first << ", " << i->second << ") ";
  cout << endl;
}
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 in() {
  int x;
  scanf("%d", &x);
  return x;
}

using ll = long long;
#define int ll

template <typename Sequence, typename BinaryPredicate>
struct IndexCompareT {
  IndexCompareT(const Sequence &seq, const BinaryPredicate comp)
      : seq_(seq), comp_(comp) {}
  bool operator()(const size_t a, const size_t b) const {
    return comp_(seq_[a], seq_[b]);
  }
  const Sequence seq_;
  const BinaryPredicate comp_;
};

template <typename Sequence, typename BinaryPredicate>
IndexCompareT<Sequence, BinaryPredicate> IndexCompare(
    const Sequence &seq, const BinaryPredicate comp) {
  return IndexCompareT<Sequence, BinaryPredicate>(seq, comp);
}

template <typename Sequence, typename BinaryPredicate>
std::vector<size_t> ArgSort(const Sequence &seq, BinaryPredicate func) {
  std::vector<size_t> index(seq.size());
  for (int i = 0; i < index.size(); i++) index[i] = i;

  std::sort(index.begin(), index.end(), IndexCompare(seq, func));

  return index;
}
//**********

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

  int n, m, x;
  cin >> n >> m >> x;
  int c[12];
  int a[12][12];
  REP(i, n) {
    cin >> c[i];
    {
      REP(j, m) { cin >> a[i][j]; }
    }
  }

  int ans_cost = INF;
  bool ans = false;

  REP(i, pow(2, n)) {
    int cost = 0;
    int rikai[m];
    MEMSET(rikai, 0);
    // debug(i);
    REP(j, n) {
      // debug(j);
      int b = pow(2, j);
      if (i & b) {
        // debug(b);
        cost += c[j];
        REP(k, m) { rikai[k] += a[j][k]; }
      }
    }
    bool ok = true;
    REP(k, m) {
      if (rikai[k] < x) {
        ok = false;
        break;
      }
    }
    if (ok) {
      // debug(cost);
      chmin(ans_cost, cost);
      ans = true;
    }
  }

  if (ans) {
    cout << ans_cost << endl;
  } else {
    cout << "-1" << endl;
  }
  return 0;
};


Measured memory_bytes: 4120
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N; 
  cin>>N; int sum=0; vector<int> vec(N);
  for(int i=0;i<N;i++){
    int n;
    cin>>n; vec.at(i)=n;
    sum+=n;
  }
   
  vector<int> vec2(N);
  for(int i=0;i<N;i++) 
   if(N*vec.at(i)>=sum) vec2.at(i)=N*vec.at(i)-sum;
    else vec2.at(i)=sum-N*vec.at(i);
  int x=vec2.at(0); int y=0;
  for(int i=0;i<N;i++)
    if(vec2.at(i)<x) {x=vec2.at(i); y=i;}
  cout<<y<<endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

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

	public void run() {
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		long X = sc.nextLong();
		long[] x = new long[N];
		for (int i = 0; i < N; ++i) {
			x[i] = Math.abs(sc.nextInt() - X);
		}
		long ans = x[0];
		for (int i = 0; i < N; ++i)
			ans = gcd(ans, x[i]);
		System.out.println(ans);
	}

	long gcd(long a, long b) {
		if (a > b)
			return gcd(b, a);
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	class Scanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[ptr++];
			else
				return -1;
		}

		private boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		private void skipUnprintable() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
		}

		public boolean hasNext() {
			skipUnprintable();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		int nextInt() {
			return (int) nextLong();
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

using namespace std;

int main(){

  string s,t;

  cin >> s;
  cin >> t;

  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s<t){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }


  return 0;
}


Measured memory_bytes: 888
/*------U Have To DO It------*/
/* BY-> RicoProg */
/*        ___ 
           __|__|
          |  |___       */
#include <bits/stdc++.h>
using namespace std;
 
 
//---------------------------------------------------MACROS----------------------------------------------------------
#define ll long long
#define beg(i ,n) for(int i=0;i<n;i++)
#define beg1(i ,n) for(int i=1;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back 
#define mp make_pair
#define nl "\n" 
#define vec(v , n) vector<ll> v(n)
#define all(x) x.begin() , x.end()
#define pii pair<int , int>
#define pll pair<ll , ll>
#define mii map<int , int>
#define mll map<ll , ll>
#define msi map<string , int>
#define mci map<char , int>
#define f1 first
#define f2 second
 
//---------------------------------------------------GLOBAL----------------------------------------------------------
const ll MOD = 998244353 ;
const ll MAX = 1e5 + 7;
//---------------------------------------------------FUNCTIONS-------------------------------------------------------

struct node{
	ll n , x , y ;
	bool st ;
};

node dp[3001][3001] ;
string s , t ;

void rec(ll x , ll y){
	if(x<0 || y<0){
		return ;
	}
	else if(dp[x][y].n != -1){
		return ;
	}
	else if(s[x]==t[y]){
		//cout << x << " A " << y << nl ;
		rec(x-1 , y-1) ;
		if(x-1>=0 && y-1>=0)
			dp[x][y].n = 1 + dp[x-1][y-1].n ;
		else
			dp[x][y].n = 1 + 0 ;
		dp[x][y].st = true ;
		dp[x][y].x = x-1 , dp[x][y].y = y-1 ;
		return ;
	}
	else{
		//cout << x << " B " << y << nl ;
		rec(x-1 , y) ;
		rec(x , y-1) ;
		ll a , b ;
		a = b = 0;
		if(x-1>-1) a = dp[x-1][y].n ;
		if(y-1>-1) b = dp[x][y-1].n ;
		dp[x][y].st = false ;
		if(a > b) dp[x][y].x = x-1 , dp[x][y].y = y , dp[x][y].n = a ;
		else dp[x][y].x = x , dp[x][y].y = y-1 , dp[x][y].n = b ;
		return ;
	}
	return ;
}

void solve(){
	beg(i , 3001){
		beg(j , 3001) dp[i][j].n = -1 , dp[i][j].st = false ;
	}
	cin >> s >> t ;
	rec(s.length()-1 , t.length()-1) ;
	string ans="" ;
	ll x_n = s.length()-1 , y_n = t.length()-1 , x_t , y_t ;
	while(true){
		//cout << x_n << " " << y_n << nl ;
		if(x_n<0 || y_n<0){
			break ;
		}
		x_t = x_n , y_t = y_n ;
		x_n = dp[x_t][y_t].x ;
		y_n = dp[x_t][y_t].y ;
		if(dp[x_t][y_t].st) ans+=s[x_t] ;
	}
	//cout << dp[s.length()-1][t.length()-1].n << nl ;
	reverse(all(ans)) ;
	cout << ans ;
}
 
//---------------------------------------------------DRIVER----------------------------------------------------------
int main()
{
    fast ;
    int t=1 ;
    //cin >> t ;
    while(t--){
        solve() ;
    }
    return 0;
}	

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

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

typedef long long ll; 
typedef long double ld; 
typedef vector<int> vi; 
typedef pair<int,int> pii; 
#define pb push_back
#define mp make_pair
#define prarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define prmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<"\t";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define endl '\n'
#define fast_io ios_base::sync_with_stdio(NULL); cin.tie(NULL)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
template <class T> void prall(T a) { prc(all(a)); }
const int inf=1000*1000*1000+9; 
const ll infl=1ll*inf*inf; 
const int mod=1000*1000*1000+7;  

// ----------------------------------------------------------------------------	-------------- 


const int nax=1e5+5; 
vector<pii> adj[nax];
int deg[nax];

int digs(ll n){
  int ret=0; 
  while(n>0) {
    ret++; 
    n/=10; 
  }
  return ret; 
}

void solve(){
  string s; cin>>s; 
  if(s=="SAT"){
    cout<<1; 
  }
  else if(s=="FRI"){
    cout<<2; 
  }
  else if(s=="THU"){
    cout<<3; 
  }
  else if(s=="WED"){
    cout<<4; 
  }
  else if(s=="TUE"){
    cout<<5; 
  }
  else if(s=="MON"){
    cout<<6; 
  }
  else cout<<7; 
}



int main(){
	// clock_t beg=clock(); 
	fast_io; 
  // cout << fixed << setprecision(13); 
  int t; 
  t=1; 
  //cin>>t; 
  while(t--){
	  solve(); 	
  }
	// clock_t end=clock(); 
	// fprintf(stderr, "%lf\n", (double)(end-beg)/(CLOCKS_PER_SEC));
}

Measured memory_bytes: 2560
N = int(input())
L = list(map(int, input().split()))
import itertools

ans = 0
for K in itertools.combinations(L, 3):
    if K[0] != K[1] and K[1] != K[2] and K[2] != K[0]:
        k_sorted= sorted(K)
        #print(k_sorted)
        if k_sorted[2] < k_sorted[0] + k_sorted[1]:
            ans += 1
print(ans)



Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans[n], j = 0;
    for (int i = n - 1; i >= 0; i -= 2, j++) {
        ans[j] = a[i];
    }
    for (int i = (n & 1 ? 1 : 0); i < n; i += 2, j++) {
        ans[j] = a[i];
    }
    for (int i = 0; i < n; i++) {
        if (i > 0) cout << ' ';
        cout << ans[i];
    }
    cout << endl;
}

Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if (N < 4) {
			System.out.println("No");
			return;
		}
		if (N % 4 == 0 || N % 7 == 0) {
			System.out.println("Yes");
			return;
		}

		for (int i = 7; i <= N; i += 7) {
			for (int j = 4; j <= N; j += 4) {
				if (N - (i + j) == 0) {
					System.out.println("Yes");
					return;
				}
			}
		}

		System.out.println("No");

	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int N;
    cin >> N;
    vector<int> v(N);
    for (int i = 0; i < N ; i++) {
        std::cin >> v.at(i);
    }
    std::sort(v.begin(),v.end());
    double po = v[0];
    for (int j = 0; j < N; j++)
    {
       po = (po+v[j])/2;
    }
    cout << po;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut a = vec![];
    let mut b = vec![];
    for i in 0..n {
        let v = read_vec::<i64>();
        a.push(v[0]);
        b.push(v[1]);
    }
    a.sort();
    b.sort();

    if n % 2 == 1 {
        let ans = b[n / 2] - a[n / 2] + 1;
        println!("{}", ans);
    } else {
        let ans = b[n / 2 - 1] + b[n / 2] - a[n / 2 - 1] - a[n / 2] + 1;
        println!("{}", ans);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

using namespace std;

#define pb			push_back
#define all(v)			((v).begin()), ((v).end())
#define SZ(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define has(c,i) 		((c).find(i) != end(c))
#define hastr(s, c)		((s).find(c) != string::npos)

template <class U, class V>
istream& operator>>(istream& is, pair<U, V>& p) {
  is >> p.first >> p.second;
  return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& x : v) {
    is >> x;
  }
  return is;
}
template <class T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto& x : v) {
    os << x << " ";
  }
  return os;
}

const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[] { 0, 1, 1, 1, 0, -1, -1, -1 };

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
#ifndef	ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    char c;
    cin >> c;
    if(c < 97)
    	cout << 'A';
    else
    	cout << 'a';
    return 0;
}


Measured memory_bytes: 3656
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <deque>
#include <map>
#include <set>

#define ll long long
#define inf 0x3f3f3f3f
#define il inline

namespace io {

#define in(a) a = read()
#define out(a) write(a)
#define outn(a) out(a), putchar('\n')

#define I_int ll
inline I_int read() {
    I_int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}
char F[200];
inline void write(I_int x) {
    if (x == 0) return (void) (putchar('0'));
    I_int tmp = x > 0 ? x : -x;
    if (x < 0) putchar('-');
    int cnt = 0;
    while (tmp > 0) {
        F[cnt++] = tmp % 10 + '0';
        tmp /= 10;
    }
    while (cnt > 0) putchar(F[--cnt]);
}
#undef I_int

}
using namespace io;

using namespace std;

#define N 100010

int a, b, k, d[N], tot;

int main() {
	in(a), in(b), in(k);
	int g = __gcd(a, b);
	for(int i = 1; i * i <= g; ++i) {
		if(g % i == 0) {
			d[++tot] = i;
			if(g / i != i) d[++tot] = g / i;
		}
	}
	sort(d+1, d + tot + 1); reverse(d + 1, d + tot + 1);
	printf("%d\n", d[k]);
}

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

#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define fori(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(n) fori(somethingStupid,1,(n))

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

bool tests = false;
void solve(){
    string str; cin >> str;
    int ct = 0;
    for (int i=0; i<str.size(); i++){
        ct += str[i] - '0';
        ct %= 9;
    }if (ct == 0){
        cout << "Yes" << endl; return;
    }cout << "No" << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    if (tests){
        cin >> t;
    }
    rep(t) solve();
    return 0;
}


Measured memory_bytes: 3772
def main():
    # N,M,X = map(int, input().split())
    N=int(input())
    a=N%10
    
    if a==3:
        print("bon")
    elif a==0 or a==1 or a==6 or a==8:
        print("pon")
    else:
        print("hon")


main()

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

const int inf = 1e9;
const ll linf = 1e18;

class UnionFind
{
protected:
    vector<int> par;
    vector<int> rank;
    vector<int> sz;
    int _count;

public:
    UnionFind(int n) : par(n), rank(n, 0), sz(n, 1), _count(n) {
        iota(par.begin(), par.end(), 0);
    }

    virtual int find(int x) {
        if (par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return;

        _count--;
        if (rank[x] < rank[y]) {
            swap(x, y);
        }
        if (rank[x] == rank[y]) rank[x]++;

        par[y] = x; sz[x] += sz[y];
    }

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

    int size(int x) { return sz[find(x)]; }

    int count() { return _count; }
};

template <typename T>
class WeightedUnionFind : public UnionFind
{
private:
    vector<T> wt;

public:
    WeightedUnionFind(int n, T unity = 0) : UnionFind(n), wt(n, unity) {}

    int find(int x) override {
        if (par[x] == x) return x;
        else {
            int t = find(par[x]);
            wt[x] += wt[par[x]];
            return par[x] = t;
        }
    }
    
    int weight(int x) {
        find(x); return wt[x];
    }

    void unite(int x, int y, T w) {
        w += weight(x); w -= weight(y);
        x = find(x); y = find(y);
        if (x == y) return;

        _count--;
        if (rank[x] < rank[y]) {
            swap(x, y); w = -w;
        }
        if (rank[x] == rank[y]) rank[x]++;

        par[y] = x; sz[x] += sz[y]; wt[y] = w;
    }

    T diff(int x, int y) { return weight(y) - weight(x); }
};

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

    int n, m; cin >> n >> m;
    vector<int> a(m), b(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
    }

    int ans = 0;
    for (int i = 0; i < m; i++) {
        UnionFind uf(n);
        for (int j = 0; j < m; j++) {
            if (j != i) uf.unite(a[j], b[j]);
        }
        if (uf.count() > 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

using ll = long long;

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

int main(){
    ll x;
    std::cin >> x;
    for(ll time = 1;; time++){
        if(time * (time + 1) >= 2 * x){
            std::cout << time << std::endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        if(n >= 10)
            System.out.println(r);
        else
            System.out.println(r+(100*(10-n)));
    }
}

Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	
    	Dice d = new Dice();
        Scanner sc = new Scanner(System.in);
        int i;
        for(i = 0; i < 6; i++) {
        	d.x[i] = sc.nextInt();
        }
        for(char c: sc.next().toCharArray()) {
        	d.roll(c);
        }
        
        System.out.println(d.x[0]);
        
    }
}


class Dice{
	public int x[] = {1, 2, 3, 4, 5, 6};
	int tmp1, tmp2;
	
	public void roll(char direction) {
		switch(direction) {
		case 'E':
			tmp1 = x[0];
    		x[0] = x[3];
    		tmp2 = x[2];
    		x[2] = tmp1;
    		tmp1 = x[5];
    		x[5] = tmp2;
    		x[3] = tmp1;
    		return;
    		
		case 'S':
			tmp1 = x[0];
    		x[0] = x[4];
    		tmp2 = x[1];
    		x[1] = tmp1;
    		tmp1 = x[5];
    		x[5] = tmp2;
    		x[4] = tmp1;
    		return;
		
		case 'W':
			tmp1 = x[0];
    		x[0] = x[2];
    		tmp2 = x[3];
    		x[3] = tmp1;
    		tmp1 = x[5];
    		x[5] = tmp2;
    		x[2] = tmp1;
    		return;
    		
		case 'N':
			tmp1 = x[0];
    		x[0] = x[1];
    		tmp2 = x[4];
    		x[4] = tmp1;
    		tmp1 = x[5];
    		x[5] = tmp2;
    		x[1] = tmp1;
    		return;
		}
	}
}




Measured memory_bytes: 26432
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

S = input().rstrip()
n = len(S)//2 if not len(S)%2 else len(S)//2+1
L = len(S)

cnt = 0
for i in range(n):
	# print(S)
	# print(i, L-i-1)
	# print(S[i], S[L-i-1])
	if i == L-i-1: continue
	if S[i]==S[L-i-1]: continue
	else: cnt+=1

print(cnt)

Measured memory_bytes: 39252