akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
	string S;
	cin >> S;
	int L = S.size();
	string ans = "AC";
    if (S[0] != 'A') {
	   ans = "WA";
	}
    int cnt = 0;
	for (int i = 1; i < L; ++i) {
		 if (isupper(S[i])) {
			 if (i == 1 || i == L - 1 || S[i] != 'C') {
				 ans = "WA";
			 }
			++cnt;
		}
	}
    if (cnt != 1) {
	    ans = "WA";
	}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s = input()
t = input()
n = len(s)
jisho1 = {}
jisho2 = {}


def ng():
    print("No")
    exit()


for i in range(n):
    if s[i] in jisho1:
        if jisho1[s[i]] != t[i]:
            ng()
    else:
        jisho1[s[i]] = t[i]
    if t[i] in jisho2:
        if jisho2[t[i]] != s[i]:
            ng()
    else:
        jisho2[t[i]] = s[i]
print("Yes")



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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){

  int x,a,b;
  cin >> x >> a >> b;
  if(b-a <= 0)cout << "delicious" << endl;
  else if(b-a <= x)cout << "safe" << endl;
  else cout << "dangerous" << endl;
  


  
  

  return 0;
}


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

int main() {
	int n; cin >> n;
	for (int i=0; i<n; i++) {
		double ra,rb,xa,ya,xb,yb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d = 	sqrt(pow(xa-xb, 2) + pow(ya-yb, 2));
		if (d > ra + rb) {
			cout << "0" << endl;
			continue;
		}
		if (ra > rb) {
			if (d < ra - rb)
				cout << "2" << endl;
			else if (d >= ra - rb && d <= ra + rb)
				cout << "1" << endl;
		} else {
			if (d < rb - ra)
				cout << "-2" << endl;
			else if (d >= rb - ra && d <= ra + rb)
				cout << "1" << endl;
		}
	}
}

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

using namespace std;

const int MOD = 1000000007;

int N, M;

int main() {
	cin >> N >> M;
	vector<int> a(N + 1, 0);
	for (int i = 0; i < M; i++) { 
		int x;
		cin >> x;
		a[x] = -1;
	}
	a[0] = 1;
	for (int i = 1; i <= N; i++) {
		if (a[i] == -1) { continue; }
		if (a[i - 1] != -1) { a[i] += a[i - 1] % MOD; }
		if (i > 1 && a[i - 2] != -1) { a[i] += a[i - 2] % MOD; }
		a[i] %= MOD;
	}
	cout << a[N] << endl;
}

Measured memory_bytes: 640
#ifdef LOCAL111
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<int> a(n);
		REP(i, n) cin >> a[i];
		auto b = a;
		sort(ALL(a));
		int cnt = 0;
		REP(i, n) cnt += (a[i] != b[i]);
		if(cnt <= 2) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    for (;;) {
        int n;
        cin >> n;
        if (!n) break;
        vector<string> v;
        rep(i, 0, n) {
            string s;
            cin >> s;
            string buf;
            buf += s[0];
            rep(i, 0, s.length() - 1) {
                if (s[i] == 'a' || s[i] == 'i' || s[i] == 'u' || s[i] == 'e' || s[i] == 'o')
                    buf.push_back(s[i + 1]);
            }
            v.push_back(buf);
        }
        set<string> s(v.begin(), v.end());
        if (s.size() < n) {
            cout << -1 << endl;
            continue;
        }

        int lcp = 0;
        rep(i, 0, n) {
            rep(j, i + 1, n) {
                int p = 0;
                while (v[i][p] == v[j][p]) p++;
                lcp = max(lcp, p);
            }
        }
        cout << lcp + 1 << endl;
    }
}



Measured memory_bytes: 3188
import java.util.*;

public class Main{
	//1200 start
	int size, n, ans, rightsize;
	String [] data;
	HashMap<Character, Integer> change, leftmap;
	boolean [] used;
	ArrayList<Character> data2;
	HashSet<Character> nonzero;

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			n = sc.nextInt();
			if(n == 0)break;
			leftmap = new HashMap<Character, Integer>();
			HashSet<Character> kind = new HashSet<Character>();
			HashSet<Character> rightkind = new HashSet<Character>();
			nonzero = new HashSet<Character>();
			data = new String[n];
			for(int i = 0; i < n; i++){
				data[i] = sc.next();
				int nowlen = data[i].length();
				for(int j = 0; j < nowlen; j++){
					char c = data[i].charAt(j);
					if(j == 0 && nowlen > 1){
						nonzero.add(c);
					}
					int value =  pow((nowlen - 1 - j));

					if(i != n-1){
						kind.add(c);
						if(leftmap.containsKey(c)){
							leftmap.put(c, leftmap.get(c) + value);
						}
						else{
							leftmap.put(c, value);
						}
					}
					else{
						rightkind.add(c);
						if(leftmap.containsKey(c)){
							leftmap.put(c, leftmap.get(c) - value);
						}
						else{
							leftmap.put(c, -value);
						}
					}
				}
			}

			change = new HashMap<Character, Integer>();
			rightsize = rightkind.size();
			data2 = new ArrayList<Character>();
			for(char c : rightkind){
				data2.add(c);
			}
			for(char c: kind){
				if(rightkind.contains(c)) continue;
				data2.add(c);
			}
			size = data2.size();
			ans = 0;
			used = new boolean[10];
			dfs(0,0);
			System.out.println(ans);
		}
	}

	private int pow(int x) {
		int sum = 1;
		for(int i = 0; i < x; i++){
			sum *= 10;
		}
		return sum;
	}

	private void dfs(int deep, int left) {
		if(deep == size){
			if(left ==0){
				ans++;
			}
			return;
		}
		if(deep > rightsize && left > 0){
			return;
		}
		char now = data2.get(deep);

		for(int i = 0; i < 10; i++){
			if(used[i])continue;
			if(i == 0 && nonzero.contains(now)){
				continue;
			}
			used[i] = true;
			int addleft = 0;
			addleft = leftmap.get(now) * i;
			if(deep+1 == size){
				if(left + addleft == 0){
					ans++;
				}
			}
			else{
				dfs(deep+1, left + addleft);
			}
			used[i] = false;
		}
	}

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

Measured memory_bytes: 12000
import java.util.Scanner;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.PriorityQueue;
class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();

        for(int i = 0;i < 20; i++) {
            if((1+i*(a-1) >= b)){
                System.out.println(i);
                break;
            }
        }



        
    }

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int start(int n){
	int x;
	while(n!=0){
		x=n%10;
		n/=10;
	}
	return(x);
}

int end(int n){
	return(n%10);
}

int32_t main(){
	IOS;
	int n;
	cin>>n;
	int a[10][10];
	memset(a,0,sizeof(a));
	for(int i=1;i<=n;i++){
		int s=start(i);
		int e=end(i);
		a[s][e]++;
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		int s=start(i);
		int e=end(i);
		ans+=a[e][s];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]

count = 0
flag = True
while flag:
    flag = False
    for i in range(n - 1):
        if a[i] > a[i + 1]:
            a[i + 1], a[i] = a[i], a[i + 1]
            count += 1
            flag = True

print(" ".join([str(i) for i in a]))
print(count)


Measured memory_bytes: 5608
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
vector<int> v[1000];
int main() {
	int n; cin >> n;
	int c = 1; bool f = false;
	for (int i = 1; i < (1 << 17); i += c) {
		if (i == n) {
			f = true; break;
		}
		c++;
	}
	if (!f)cout << "No" << endl;
	else {
		cout << "Yes" << endl;
		cout << c + 1 << endl;
		int now = 1;
		int id = 0;
		per1(i, c) {
			Rep(j, now, now+i) {
				v[id].push_back(j);
				v[id + 1 + j - now].push_back(j);
			}
			now += i;
			id++;
		}
		rep(i, c + 1) {
			cout << v[i].size();
			rep(j, (int)v[i].size()) {
				cout << " " << v[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2304
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double s = r*r*Math.PI;
        double l = 2*r*Math.PI;
        System.out.printf("%.6f %.6f",s,l);
        sc.close();
    }
}


Measured memory_bytes: 28256
#include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, K;
    cin>>N>>K;
    if(K==1) cout<<0<<endl;
    else cout<<N-K<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
A = inpl()

ans = 0
mini = 0
for i in range(n):
    if A[i] < mini:
        ans += mini - A[i]
    mini = max(A[i],mini)

print(ans)

Measured memory_bytes: 54600
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
       ll n,k;
       cin>>k;
       string s;
       cin>>s;
       n=s.size();
       //cout<<k<<" "<<n;
       if(k>=n)
       cout<<s;
       else
       {
           for(ll i=0;i<k;i++)
           {
               cout<<s[i];
           }
           cout<<"...";
       }
       
    }        
    return 0;
}

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

int main() {
  double a,b,x;
  cin>>a>>b>>x;
  double volume=2*a*a*b-2*x;
  double vol=volume/(a*a*a);
  double ans=atan(vol);
  double uni=180.0/M_PI;
  if(a*a*b/2.0<x){
    ans*=uni;
    cout<<setprecision(10)<<ans<<endl;
  }
  else{
    double nibu=a*b*b;
    double akari=2.0*x;
    double answer=atan(nibu/akari);
    answer*=uni;
    cout<<setprecision(10)<<answer<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>

using namespace std;
#define INF 99999
#define _GLIBCXX_DEBUG
#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()
#define fi first
#define se second
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
using namespace std;



int main() {
    string s;
    cin >> s;
    REP(i, s.length()){
        if(i % 2 == 0){
            cout << s[i];
        }
    }

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <string.h>
using namespace std;

int n;
string s;
long long m = 0;
int dp[101][64];

bool tes(string s4) {
	bool f = 1;
	for (int i = 0; i < 4; i++) {
		if(i > 0)
			swap(s4[i], s4[i - 1]);

		if (s4.find("AGC") != std::string::npos)
			f = 0;

		if (i > 0)
			swap(s4[i], s4[i - 1]);
	}

	return f;
}

int dfs(int t, string s3) {
	int d = 0;

	for (int i = 0; i < 3; i++) {
		if (s3[i] == 'G')
			d += 1 << (i * 2);
		if (s3[i] == 'C')
			d += 1 << (i * 2 + 1);
		if (s3[i] == 'T')
			d += 3 * (1 << (i * 2));
	}

	if (dp[t][d] > 0)
		return dp[t][d];

	if (t == n)
		return 1;

	int r = 0;
	string sd = "AGCT";

	for (int i = 0; i < 4; i++) {
		if (tes(s3 + sd[i]))
			r = (r + dfs(t + 1, s3.substr(1, 2) + sd[i])) % 1000000007;
	}

	dp[t][d] = r;
	return r;
}

int main()
{
	memset(dp, 0, sizeof(dp));

	cin >> n;

	cout << dfs(0, "TTT") << endl;

	return 0;
}

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

signed main()
{
    int a; cin >> a;
    vector<int> regist(1000010,0);
    int i = 1;

    ++regist[a];
    while(1){
        if (a & 1) // 奇数の場合
            a = 3 * a + 1;
        else
            a = a / 2;
        if(regist[a]) break;
        ++regist[a];
        ++i;
    }

    cout << i + 1 << endl;

    return 0;
}


Measured memory_bytes: 4096
// Problem : C - Forbidden List
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;

int absol(int x, int y)
{
	if(x > y)
	{
		return (x-y);
	}
	else
	{
		return (y-x);
	}
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x,n;
	cin>>x>>n;
	vector <int> ele(n);
	set <int> pikachu;
	for(int j = 0; j < n; j++)
	{
		cin>>ele[j];
		pikachu.insert(ele[j]);
	}
	
	int front_max;
	int front_min;
	for(int j = x; ; j++)
	{
		auto it = pikachu.find(j);
		if(it == pikachu.end())
		{
			front_max = j;
			break;
		}
	}
	
	for(int j = x; ; j--)
	{
		auto it = pikachu.find(j);
		if(it == pikachu.end())
		{
			front_min = j;
			break;
		}
	}
	
	int x1 = absol(front_max, x);
	int x2 = absol(front_min, x);
	
	if(x1 < x2)
	{
		cout<<front_max;
	}
	else if(x1 > x2)
	{
		cout<<front_min;
	}
	else
	{
		cout<<front_min;
	}
	return 0;
}

Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 998244353;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

long long fac[MAX], finv[MAX], inv[MAX];

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll ans = pow(3,n);
    ll sum = 1;
    rep(i,n){
        if(a[i] % 2 == 0) sum*=2;
    }
    cout << ans - sum << endl;
}

Measured memory_bytes: 4004
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


int main(void) {
	int64_t x=2,y=1;
	int N;
	
	cin >> N;

	if(N==1){
	}else{
		for(int i=1;i<N; i++){
			int64_t t = y;
			y=x+y;
			x=t;
		}
	}
	cout << y << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
main(){
  char ch;
  while(1){
    scanf("%c",&ch);
    if(islower(ch)) printf("%c",toupper(ch));
    else if(isupper(ch)) printf("%c",tolower(ch));
    else printf("%c",ch);
    if(ch=='\n') break;
  }
  return 0;
}

Measured memory_bytes: 524
#include <stdio.h>
#include <stdlib.h>
#define LIM 100000
#define INF 1e18;

int binary_seaach(long long *array,long key,int min,int max){
	if(min<max){
		int mid = min + (max-min)/2;
		if(key<array[mid])return binary_seaach(array,key,min,mid);
		else if(array[mid]<key)return binary_seaach(array,key,mid+1,max);
	}
	if(key>array[min])return min+1;
	return min;
}


int main(void){
	int A,B,Q,i;
	scanf("%d%d%d",&A,&B,&Q);
	long long s[LIM+2],t[LIM+2],ans,x,r;
	for(i=1;i<=A;i++)scanf("%lld",&s[i]);
	for(i=1;i<=B;i++)scanf("%lld",&t[i]);
	s[0] = t[0] = -INF;
	s[A+1] = t[B+1] = INF;
	for(i=0;i<Q;i++){
		scanf("%lld",&x);
		ans=INF;
		
		int b,d,j,k;
		b = binary_seaach(s,x,0,A+1);
		d = binary_seaach(t,x,0,B+1);
		
		for(j=b-1;j<=b;j++){
			for(k=d-1;k<=d;k++){
				r = llabs(s[j]-x)+llabs(t[k]-s[j]);
				ans = r<ans?r:ans;
				r = llabs(t[k]-x)+llabs(s[j]-t[k]);
				ans = r<ans?r:ans;
			}
		}
		
		
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int maxV = 90010;
const int maxN = 1e5+500;
const int inf = 0x3f3f3f3f;
const ll MOD = 1e9+7;
const ll INF = 1000000000000000010LL;
#define X first
#define Y second

int n,p;
ll ans[maxN];
int main() {
	int x,y,z;
	scanf("%d%d%d",&x,&y,&z);
	if(x+y+z >= 22)
	{
		puts("bust");
	}
	else
	{
		puts("win");
	}
	return 0;
}

Measured memory_bytes: 256
main :: IO ()
main = do
  [n,k] <- map read . words <$> getLine :: IO [Int]
  s <- getLine
  let c = case s!!(k-1) of 'A' -> 'a'
                           'B' -> 'b'
                           'C' -> 'c'
  putStrLn $ (take (k-1) s) ++ [c] ++ (drop (k) s)

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define prime 31
#define mp make_pair
#define INF 1000000000
#define mod 1000000007
#define fi first
#define se second
ll parent[200001];
ll rnk[200001]={0};
ll par(ll x)
{
	if(parent[x]==x)
	return x;
	return par(parent[x]);
}
void dsu(ll x,ll y)
{
	x=par(x);
	y=par(y);
	if(rnk[x]>rnk[y])
	{
		parent[y]=x;
	}
	else
	{
		parent[x]=y;
	}
	if(rnk[x]==rnk[y])
	rnk[y]++;
	return;
}
int main()
{
	ll n,m;
	cin>>n>>m;
	for(ll i=1;i<=n;i++)
	parent[i]=i;
	while(m--)
	{
		ll x,y;
		cin>>x>>y;
		dsu(x,y);
	}
	map<ll,ll> ma;
	ll ans=INT_MIN;
	for(ll i=1;i<=n;i++)
	{
		ll p=par(i);
		ma[p]++;
		ans=max(ans,ma[p]);
	}
	cout<<ans<<endl;
}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		for(int i=y-(x-1);i<=y+x-1;i++) {
			if(i==y-(x-1))
			    System.out.print(i);
			else
				System.out.print(" "+i);
		}
	}

}

Measured memory_bytes: 23764
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map(String::toInt)
    if (k > (n - 1) * (n - 2) / 2) {
        println(-1)
    } else {
        val m = n * (n - 1) / 2 - k
        println(m)
        var tmp1 = n
        var tmp2 = 1
        for (i in 0 until m) {
            println("$tmp2 $tmp1")
            tmp2++
            if (tmp1 == tmp2) {
                tmp1--
                tmp2 = 1
            }
        }
    }
}


Measured memory_bytes: 38544
#include <bits/stdc++.h>
#define ls (o << 1)
#define rs (o << 1 | 1)
using namespace std;

const int inf = 1 << 30;

int a[200005], n;

struct Seg {
    int l, r;
    pair <int, int> v[2];
    bool lz;
} T[800005];

void push_up(int o) {
    for (int i = 0; i < 2; ++i)
        T[o].v[i] = min(T[ls].v[i], T[rs].v[i]);
}

void rev(int o) {
    T[o].lz ^= 1;
    swap(T[o].v[0], T[o].v[1]);
}

void push_down(int o) {
    if (!T[o].lz)
        return;
    rev(ls);
    rev(rs);
    T[o].lz = 0;
}

void build(int o, int l, int r) {
    T[o].l = l; T[o].r = r;
    T[o].lz = 0;
    if (l == r) {
        T[o].v[0] = T[o].v[1] = {inf, l};
        T[o].v[l & 1] = {a[l], l};
    } else {
        int m = (l + r) >> 1;
        build(ls, l, m);
        build(rs, m + 1, r);
        push_up(o);
    }
}

void del(int o, int x) {
    if (T[o].l == T[o].r) {
        T[o].v[0] = T[o].v[1] = {inf, x};
        return;
    }
    push_down(o);
    int m = (T[o].l + T[o].r) >> 1;
    del(x <= m ? ls : rs, x);
    push_up(o);
}

pair <int, int> query(int o, int l, int r, int x) {
    if (T[o].l == l && T[o].r == r)
        return T[o].v[x];
    push_down(o);
    int m = (T[o].l + T[o].r) >> 1;
    if (r <= m)
        return query(ls, l, r, x);
    if (l > m)
        return query(rs, l, r, x);
    pair <int, int> a = query(ls, l, m, x), b = query(rs, m + 1, r, x);
    return min(a, b);
}

void update(int o, int l, int r) {
    if (T[o].l == l && T[o].r == r) {
        rev(o);
        return;
    }
    int m = (T[o].l + T[o].r) >> 1;
    if (r <= m)
        update(ls, l, r);
    else if(l > m)
        update(rs, l, r);
    else {
        update(ls, l, m);
        update(rs, m + 1, r);
    }
    push_up(o);
}

vector < pair <int, int> > ans;

set <int> st;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        scanf("%d", a + i);
    build(1, 1, n);
    for (int i = 0; i < n / 2; ++i) {
        int x = query(1, 1, n, 1).second;
        auto it = st.upper_bound(x);
        int r;
        if (it == st.end())
            r = n;
        else
            r = *it - 1;
        int y = query(1, x + 1, r, 0).second;
        printf("%d %d ", a[x], a[y]);
        st.insert(x);
        st.insert(y);
        del(1, x);
        del(1, y);
        if (x + 1 <= y - 1)
            update(1, x + 1, y - 1);
    }
    return 0;
}


Measured memory_bytes: 33536
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n;cin>>n;
  vector<pair<int,int>> pr(n);
  rep(i,n){
    int a,b;cin>>a>>b;
    pr[i]=make_pair(a,b);
  }
  sort(all(pr));
  int ans=pr[n-1].first+pr[n-1].second;
  cout<<ans<<endl;
}

Measured memory_bytes: 4052
Sa = input()
Sb = input()
Sc = input()

now = 'a'
while True:
    # if len(Sa) == 0 or len(Sb) == 0 or len(Sc) == 0:
    #     break
    if now == 'a':
        if len(Sa) == 0:
            print(now.capitalize())
            exit()
        now = Sa[0]
        Sa = Sa[1:len(Sa) + 1]
        continue

    elif now == 'b':
        if len(Sb) == 0:
            print(now.capitalize())
            exit()
        now = Sb[0]
        Sb = Sb[1:len(Sb) + 1]
        continue

    elif now == 'c':
        if len(Sc) == 0:
            print(now.capitalize())
            exit()
        now = Sc[0]
        Sc = Sc[1:len(Sc) + 1]
        continue


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

int main(){
int n; cin >> n;
map<int,int> a;
int ans =0;
for(int i=0;i<n;i++){
int t;cin >>t;
if(a.find(t)==a.end()){
a[t]=1;
}
else{ 
if(a[t] ==t)ans ++;
else a[t]++;
}}
for(map<int,int>::iterator it=a.begin();it!=a.end();it++){
if(it->second!=it->first){
ans+=it->second;
}
}
 cout << ans <<endl;
return 0;
}


Measured memory_bytes: 4736
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd

class SegmentTree:
    def __init__(self, N, func, I):
        self.sz = N
        self.func = func
        self.I = I
        self.seg = [I] * (self.sz * 2)
 
    def assign(self, k, x):
        self.seg[k + self.sz] = x
 
    def build(self):
        for i in range(self.sz - 1, 0, -1):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])
 
    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k >>= 1
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])

    def query(self, a, b):
        L = self.I
        R = self.I
        a += self.sz
        b += self.sz
        while a < b:
            if a & 1:
                L = self.func(L, self.seg[a])
                a += 1
            if b & 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a >>= 1
            b >>= 1
        return self.func(L, R)

N = int(readline())
m = map(int,read().split())
seg = SegmentTree(N , gcd , 0)
for i in range(N):
    seg.assign(i , next(m))
seg.build()
ans = 1
for i in range(N):
    ans = max(ans,gcd(seg.query(0,i) , seg.query(i+1,N)))
print(ans)

Measured memory_bytes: 81340
import Data.List

main = do
  xs <- reverse <$> getLine
  putStrLn $ if solve xs then "YES" else "NO"

solve :: String -> Bool
solve "" = True
solve xs
  | isPrefixOf "remaerd" xs = solve $ drop 7 xs
  | isPrefixOf "maerd" xs   = solve $ drop 5 xs
  | isPrefixOf "resare" xs  = solve $ drop 6 xs
  | isPrefixOf "esare" xs   = solve $ drop 5 xs
  | otherwise = False

Measured memory_bytes: 7548
#include<bits/stdc++.h>
using namespace std;
    int main()
    {
    int ch;
    cin>>ch;
    if(ch==1)
    {
     cout<<"Hello World";
    }
    else if(ch==2)
    {
      int a,b;
    cin>>a>>b;
    a = a + b;
    cout<<a<<'\n';
    }
    }

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
using namespace std;
int a = 0, b = 0, c = 0, d = 0, e[60][60], f[120], g[101000], h[10100], counto = 1, ans = 0, x[100] = {}, y, z;
int64_t ab[10000] = {}, abc = 0, abcd = 0;
pair<int, int>manji[101] = {};
char rikka, toka[150][150] = {};
vector<int> train,code;
vector<char>aka,ao;
string saya, homu, kyok, mami[108], mado[100];
bool gg;
bool exist[1000];
int main() {
	cin >> a;
	for (int i = 1; i*i <= a; i++) {
		counto = i * i;
	}
	cout << counto << endl;
	return 0;
}

Measured memory_bytes: 256
from math import floor

def main():
    a, b = map(int, input().split())
    
    ans = -1
    for i in range(10000):
        if floor(i * 0.08) == a and floor(i * 0.1) == b:
            ans = i
            break
    print(ans)

if __name__ == "__main__":
    main()

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

using namespace std;


int N, Q;
vector< int > g[100000];
vector< int > query[100001];
int sz[100000];

int lca[100000];
bool buf[100000];

int sub(int idx)
{
  sz[idx] = int(query[idx].size());
  for(auto &to : g[idx]) sz[idx] += sub(to);
  return (sz[idx]);
}

void dfs(int idx, bool keep)
{
  if(g[idx].empty()) {
    if(keep) for(int &v : query[idx]) buf[v] = true;
    return;
  }

  int heavy = g[idx][0];
  for(auto &to : g[idx]) if(sz[to] > sz[heavy]) heavy = to;
  for(auto &to : g[idx]) if(heavy != to) dfs(to, false);
  dfs(heavy, true);
  query[idx].swap(query[heavy]);

  for(auto &to : g[idx]) {
    for(int &v : query[to]) {
      if(buf[v]) lca[v] = idx;
    }
    for(int &v : query[to]) {
      if(~lca[v]) continue;
      buf[v] = true;
      query[idx].push_back(v);
    }
  }

  if(!keep) {
    for(auto &v : query[idx]) buf[v] = false;
  }
}

int main()
{
  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    int K;
    scanf("%d", &K);
    while(K--) {
      int U;
      scanf("%d", &U);
      g[i].push_back(U);
    }
  }
  scanf("%d", &Q);

  memset(lca, -1, sizeof(lca));

  for(int i = 0; i < Q; i++) {
    int U, V;
    scanf("%d %d", &U, &V);
    if(U == V) {
      lca[i] = V;
    } else {
      query[U].push_back(i);
      query[V].push_back(i);
    }
  }

  sub(0);
  dfs(0, false);
  for(int i = 0; i < Q; i++) {
    printf("%d\n", lca[i]);
  }
}

Measured memory_bytes: 25304
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
#define ll long long
using namespace std;


int main() {
    int n, k, q;
    cin >> n >> k >> q;
    V b(n, 0);
    rep(i, 0, q){
        int a; cin >> a;
        b[a-1]++;
    }

    rep(i, 0, n){
        if(k - q + b[i] > 0) cout << "Yes" << "\n";
        else cout << "No" << "\n";
    }
}

Measured memory_bytes: 1024
#include<stdio.h>


int main(void){

  double m;
  double max, min;


  scanf("%lf", &m);
  max=min=m;
  while(scanf("%lf", &m)!=EOF){
    if(max<m) max=m;
    if(m<min) min=m;
  }
  printf("%.1f\n", max-min);

  return(0);
}



Measured memory_bytes: 1924
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
#define LL long long
#define mod 1000000007
#define G() Cr=getchar()
LL Xr;char Cr;
inline LL rd(){   //读入优化
    Xr=0,G();
    while(Cr<'0'||Cr>'9')G();
    while(Cr>='0'&&Cr<='9')Xr=(Xr<<3)+(Xr<<1)+Cr-'0',G();
    return Xr;
}
#define MAX_N 100005
int X,Y,A,B,C;
LL a[MAX_N],b[MAX_N],c[MAX_N];
LL ans;
int la,lb;
bool comp(int x,int y){
	return x>y;
}
int main(){
	scanf("%d%d%d%d%d",&X,&Y,&A,&B,&C);
	for(int i=1;i<=A;i++)a[i]=rd();
	for(int i=1;i<=B;i++)b[i]=rd();
	for(int i=1;i<=C;i++)c[i]=rd();
	sort(a+1,a+1+A,comp);
	sort(b+1,b+1+B,comp);
	sort(c+1,c+1+C,comp);
	la=X,lb=Y;
	for(int i=1;i<=C;i++){
		if(la>=1){
			if(a[la]<c[i]&&(a[la]<=b[lb]||lb<1)){
				a[la--]=c[i];
				continue;
			}
		}
		if(lb>=1){
			if((b[lb]<a[la]||la<1)&&b[lb]<c[i])b[lb--]=c[i];
		}
	}
	for(int i=1;i<=X;i++)ans+=a[i];
	for(int i=1;i<=Y;i++)ans+=b[i];
	cout<<ans;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
 
using namespace std;
 
const int O = 1e6 + 5;
 
int n, a[O];
 
map <int, int> cnt;
 
main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++ i){
        cin >> a[i];
        cnt[a[i]] ++;
    }
    int sum = 0;
    for (int i = 1; i <= n; ++ i){
        sum += cnt[i] * (cnt[i] - 1) / 2;
    }
    for (int i = 1; i <= n; ++ i){
        sum -= (cnt[a[i]] - 1);
        cout << sum << '\n';
        sum += (cnt[a[i]] - 1);
    }
}

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

#define int long long

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

  int ans = 0;
  for ( int i = 0; i < N; i++ ) {
    int a;
    cin >> a;
    for ( int j = 1; j <= sqrt(a); j++ ) {
      if ( (a-j) % (2*j+1) == 0 ) {	
	ans++;
	break;
      }
    }
  }

  cout << N-ans << endl;
  
  return 0;
}



Measured memory_bytes: 3028
using System;

namespace _128_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int q, b, c;
            string[] array = Console.ReadLine().Split(' ');
            int a= int.Parse(array[0]);
            int p= int.Parse(array[1]);
            q = (a * 3) + p;
            c = q / 2;
            Console.WriteLine(c);

            

        }
    }
}

Measured memory_bytes: 13140
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) (a*a)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 998244353

int main() {
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	LL ans = 0;
	LL x;
	scanf("%lld", &x);
	REP(i, n - 1) {
		LL y;
		scanf("%lld", &y);
		ans += min((y - x)*a, (LL)b);
		x = y;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ldouble = long double;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;


int main()
{
	ll n, t;
	cin >> n >> t;

	vector<pair<ll, ll>> a(n);
	for (ll i = 0; i < n; i++)
	{
		cin >> a[i].first >> a[i].second;
	}

	sort(all(a));

	for (ll i = 0; i < n; i++)
	{
		if (a[i].second <= t)
		{
			println(a[i].first);
			return 0;
		}
	}

	println("TLE");
}


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

#define rep(i,start,n) for(int i=start ; i<n ; i++)          //???????????????

using namespace std;

struct dice{                                     //dice??¨???????§????????????????
  int surface[6];
  void turn_n(){                                 //n??????????????¢???????????¨???
    int temp = surface[0];
    surface[0] = surface[1];
    surface[1] = surface[5];
    surface[5] = surface[4];
    surface[4] = temp;
  }
  void turn_e(){                                 //e??????????????¢???????????¨???
    int temp = surface[0];
    surface[0] = surface[3];
    surface[3] = surface[5];
    surface[5] = surface[2];
    surface[2] = temp;
  }
  void turn_s(){                                 //s??????????????¢???????????¨???
    rep(i,0,3) turn_n();
  }
  void turn_w(){                                 //w??????????????¢???????????¨???
    rep(i,0,3) turn_e();
  }
  void top_print(){                                 //????????????????????´?????¨???
    cout << surface[2] << endl;
  }
  void sidespin_change(int a,int b,int c,int d){     //??¢?????\?????????
    int temp[4] = {};

        temp[0] = surface[a];
        temp[1] = surface[b];
        temp[2] = surface[c];
        temp[3] = surface[d];
        //???????????\?????????
        surface[a] = temp[3];
        surface[b] = temp[0];
        surface[c] = temp[1];
        surface[d] = temp[2];

  }
  int sidespin(int f){                                           //front?????¢????????°?????¨??£?????????????????????????????¢?????\?????????
       if(f == 0 || f == 1 || f == 5) {return 0;}
       if(f == 3) sidespin_change(1,2,4,3);
       if(f == 2) {
               rep(i,0,3){
                       sidespin_change(1,2,4,3);
               }
       }
       if(f == 4) {
               rep(i,0,2){
                       sidespin_change(1,2,4,3);
               }
       }
   }

};

int main(){

  dice d;

  int x;
  int top,front,t_num,f_num;                                

    rep(i,0,6){
        cin >> d.surface[i];
      }
        cin >> x;
    rep(i,0,x){
          cin >> top >> front;
          //????????¢?????§?????¢

          for(t_num = 0;t_num < 6;t_num++){
            if(d.surface[t_num] == top) break;
          }
          switch(t_num){
                case 0:break;
                case 1:
                     d.turn_n();
                     break;
               case 4:
                     d.turn_s();
                     break;
               case 5:
                     d.turn_n();
                     d.turn_n();
                     break;
               case 2:
                     d.turn_w();
                     break;
               case 3:
                     d.turn_e();
                     break;
               default: break;
             }
             //????????¢?????§?????¢
             for(f_num = 0;f_num < 6;f_num++){
               if(d.surface[f_num] == front) break;
             }
           d.sidespin(f_num);
           d.top_print();
           }

           return 0;

}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final int n = scanner.nextInt();
        final Map<Integer, Integer> map = new HashMap<>();
        IntStream.range(0, n)
                .mapToObj(i -> scanner.nextInt())
                .forEach(value -> map.compute(value, (k, v) -> v == null ? 1 : v + 1));

        final List<Integer> keys = map.keySet().stream().sorted().collect(Collectors.toList());
        if (keys.size() == 1) {
            System.out.println(keys.get(0) == n - 1 || keys.get(0) <= n / 2 ? "Yes" : "No");
            return;
        }

        final int smaller = keys.get(0);
        final int bigger = keys.get(1);
        if (keys.size() >= 3 || bigger - smaller != 1) {
            System.out.println("No");
            return;
        }

        final int min = map.get(keys.get(0));
        final int max = map.get(keys.get(1));
        if (min >= bigger) {
            System.out.println("No");
            return;
        }
        final int rest = n - min;
        final int numOfBiggerGroups = bigger - min;
        System.out.println(rest / numOfBiggerGroups >= 2 || rest == numOfBiggerGroups ? "Yes" : "No");
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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


Measured memory_bytes: 43624
import math
n, m = map(int, input().split())
ans = 1
k = m
soy = []
for i in range(2, int(math.sqrt(m))+1):
    if k % i == 0:
        are = 0
        while True:
            if k % i == 0:
                k = k // i
                are += 1
            else:
                break
        soy.append([i, are])
if k != 1:
    soy.append([k, 1])
for i in range(10-len(soy)):
    soy.append([1, 0])
for a in range(soy[0][1] + 1):
    for b in range(soy[1][1] + 1):
        for c in range(soy[2][1] + 1):
            for d in range(soy[3][1] + 1):
                for e in range(soy[4][1] + 1):
                    for f in range(soy[5][1] + 1):
                        for g in range(soy[6][1] + 1):
                            for h in range(soy[7][1] + 1):
                                for i in range(soy[8][1] + 1):
                                    for j in range(soy[9][1] + 1):
                                        t = soy[0][0]**a * soy[1][0]**b * soy[2][0]**c * soy[3][0]**d * soy[4][0]**e * soy[5][0]**f * soy[6][0]**g * soy[7][0]**h * soy[8][0]**i * soy[9][0]**j
                                        if n <= t:
                                        	ans = max(ans, m//t)
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int long long
#define ends ' '
#define endl '\n'
#define pb push_back
#define x first
#define y second


int32_t main()
{
	#ifndef ONLINE_JUDGE
		// freopen("input.txt", "r", stdin);
		// freopen("output.txt", "w", stdout);
	#endif
	IOS;

	int n, k;
	cin >> n >> k;

	if(k <= (ceil((double)n/2)))
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}

	return 0;
}

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

int main(){
    int a,b,ab;
    string a_str,b_str,ab_str;
    cin >> a >> b;
    int b_tes = b%10;
    if(b_tes==2||b_tes==3||b_tes==7||b_tes==8){
        puts("No");
        return 0;
    }
    a_str = to_string(a);
    b_str = to_string(b);
    ab_str = a_str + b_str;
    ab = atoi(ab_str.c_str());
    rep(i,1000){
        if(ab==i*i){
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 384
import Data.List (sort)

indexed :: [a] -> [(Int, a)]
indexed xs = go 0 xs
  where
    go i (a:as) = (i, a) : go (1+i) as
    go _ _ = []

splitEvery :: Int -> [a] -> [[a]]
splitEvery _ [] = []
splitEvery n xs = as : splitEvery n bs 
     where (as,bs) = splitAt n xs

solve1 (n:rest) = 
    do {
        (i, [s,p]) <- indexed $ splitEvery 2 rest;
        return (s,100 - (read p), i)
    }

solve2 arr = 
    do {
        (_,_,i) <- sort arr;
        return (1 + i);
    }

main = interact $ unlines.map show.solve2.solve1.words


Measured memory_bytes: 892
from sys import stdin, stdout

INF = float('inf')
n = int(stdin.readline())
vl = list(map(int, stdin.readline().split()))
dp = [INF for i in range(n)]
dp[0] = 0

for i in range(n - 1):
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(vl[i + 1] - vl[i]))
    
    if i + 2 != n:
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(vl[i + 2] - vl[i]))

stdout.write(str(dp[-1]))

Measured memory_bytes: 14012
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
ll a[10000005];
int main(){
	cin>>n;
	ll sum=0;
	for(int i=1;i<=n;i++){
		a[i]=i;
		sum+=i;
		if(sum>n)
			break;
	}
	ll drt=sum-n;
	for(int i=1;i<=n;i++){
		if(!a[i])continue;
		if(a[i]!=drt){
			printf("%lld\n",a[i]);
		}
	}
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair<ll, ll> P;
typedef pair<double, double >pd;
typedef pair<string, string> sP;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 5e14;
const double eps = 1e-10;
const double PI = acos(-1);
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second


ll n, k, a[1000], ma = 0, mi = 100000;

int main() {
	cin >> n >> k;
	if (n%k == 0)cout << 0 << endl;
	else cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 384
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: String = read();
    let mut ans: String = String::new();
    for i in s.chars() {
        if i != ',' {
            ans += &i.to_string();
        } else {
            ans += &" ".to_string();
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352