akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=1005,INF=1<<30;
string T="AAA";

string expr(string S,int &i);
char term(string S,int &i);

string expr(string S,int &i){
    string res;
    
    while(i<S.size()){
        if(S[i]=='['){
            i++;
            string plus=expr(S,i);
            reverse(all(plus));
            res+=plus;
            //break;
        }else if(S[i]==']'){
            i++;
            break;
        }else{
            res+=term(S,i);
            i++;
        }
    }
    //cout<<res<<endl;
    return res;
}

char term(string S,int &i){
    char res;
    if('A'<=S[i]&&S[i]<='Z'){
        res=S[i];
        //i++;
    }
    else if('0'<=S[i]&&S[i]<='2'){
        res=T[S[i]-'0'];
        //i++;
    }
    else if(S[i]=='+'){
        i++;
        res=char(term(S,i)+1);
        while(res>'Z') res-=26;
    }else{
        i++;
        res=char(term(S,i)-1);
        while(res<'A') res+=26;
    }
    
    return res;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        string S;cin>>S;
        if(S==".") break;
        int cn=0;
        for(int i=0;i<S.size();i++){
            if(S[i]=='?'){
                S[i]=char('0'+cn);
                cn++;
            }
        }
        string ans="{";
        for(int i=0;i<26;i++){
            for(int j=0;j<26;j++){
                for(int k=0;k<26;k++){
                    T[0]=char('A'+i);
                    T[1]=char('A'+j);
                    T[2]=char('A'+k);
                    int ii=0;
                    ans=min(ans,expr(S,ii));
                }
            }
        }
        cout<<ans<<endl;
    }
}





Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int main()
{
	double a,b,x;
	cin>>a>>b>>x;
	double c=b-x/(a*a);
	double ans;
	if((a*b*b)/(2*x)<=b/a)
		ans=atan(2*c/a)*180/pi;
	else
		ans=atan((a*b*b)/(2*x))*180/pi;
	printf("%.10lf\n",ans);




	return 0;
}

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

ans = 0
tmp = ""
cnt = 0
for i in range(n):
	if a[i] == tmp:
		cnt += 1
	else:
		ans += (cnt+1) // 2
		tmp = a[i]
		cnt = 0

ans += (cnt+1) // 2

print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
bool primes[1000000];
void Sieve(){
    for(int i = 2; i < 1000000; i++) {
      primes[i] = true;
    }//全部素数とする
    primes[0] = primes[1] = false;//0,1は素数ではない
    
    for(int i = 2; i < 1000000; i++){
            for(int j = 2 * i; j < 1000000; j += i){
                primes[j]=false;
            }
        
            
        }
    
}
int main(void){
    int n, count;
    Sieve();
    while(cin>>n){
        count = 0;
        for(int k = 2; k <= n; k++){
            if(primes[k]) count++;
        }
        cout<<count<<endl;
    }
    return 0;
}


Measured memory_bytes: 4072
n, k = map(int, input().split())
A = list(map(int, input().split()))
A = [a - 1 for a in A]

visited = [0] * n
steps = []

i = 0
cnt = 0
while visited[i] == 0:
  visited[i] = 1
  steps.append(i)
  cnt += 1
  i = A[i]
  if cnt == k:
    print(i + 1)
    exit()

loop_start = steps.index(i)
loop_cycle = len(steps) - loop_start

pos = (k - loop_start) % loop_cycle
ans = steps[loop_start:][pos] + 1

print(ans)

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

using namespace std;

int main(){
	int ans = 0,n,x,m,min;
	cin >> n >> x;
	cin >> m;
	ans++;
	x -= m;
	min = m;
	for (int i = 1; i < n;i++) {
		cin >> m;
		ans++;
		x -= m;
		if (min > m) {
			min = m;
		}
	}
	ans += x / min;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int N  = 1001000;
int head[N],vis[N],n,m,d[N],tot,cur[N],nxt[N];
struct edge{int v,nxt;}e[N*2];
vector<int> ans;
void add(int x,int y){
	e[++tot]={y,head[x]};
	head[x]=tot;
}
void dfs(int x){
	for(int&i=cur[x];i;i=e[i].nxt)
		if(!vis[i]&&!vis[i^1]){
			vis[i]=1;
			dfs(e[i].v);
		}
	ans.push_back(x);
}
int main(){
	read(n);read(m);
	tot=1;
	for(int i=1;i<=m;i++){
		int x,y;read(x);read(y);
		add(x,y);add(y,x);
		d[x]++;d[y]++;
	}
	memcpy(cur,head,sizeof(cur));
	for(int i=1;i<=n;i++)
		if(d[i]&1){cout<<"No\n";return 0;}
	dfs(1);
	int S=0,tim=0;
	memset(vis,0,sizeof(vis));
	for(int x:ans){
		nxt[++tim]=vis[x];
		vis[x]=tim;
	}
	int mn=-1,mx=-1;S=1;
	for(int i=ans.size()-1;i>1;i--)
		if(nxt[i]){
			if(mn<0){
				mn=mx=nxt[i];S=2;
			}
			else{
				if(i<=mx) S=3;
				if(nxt[i]>mn) S=3;
				mn=min(mn,nxt[i]);mx=max(mx,nxt[i]);
			}
		}
	if(S>=3) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 19832
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;


int main() {
	string s;
	int ans = 0;
	cin>>s;
	while(s.size()){
		s.pop_back();
		if(s.size()%2!=0) continue;
		string t;
		for(int i=0;i<s.size()/2;i++) t.pb(s[i]);
		if(t+t==s) ans = max(ans, (int)t.size()*2);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
get_string(String) :-
  current_input(Input),
  read_string(Input, ' \n', '', _, String).
 
get_number(Number) :-
  get_string(String),
  number_string(Number, String).

get(0,[]) :- !.
get(N,[S|R]) :-
  Next is N - 1,
  get_string(S),
  get(Next,R).

kind([H],1).
kind([H1,H2|R],A) :- 
  H1 == H2,!,
  kind([H2|R],A).
kind([H1,H2|R],A) :-
  kind([H2|R],B),
  A is B + 1.

main :-
  get_number(N),
  get(N,R),
  sort(R,RR),
  kind(RR,Ans),
  writeln(Ans).

Measured memory_bytes: 46524
import java.util.*;
public 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 {
			int i = r + 100*(10-n);
			System.out.println(i);
		}
	}
}

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

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    bool f = true;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        mp[a]++;
        if (mp[a] > 1) f = false;
    }
    cout << (f ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}
void solve()
{
    ll n;
    cin>>n;
    while(1)
    {
        if(isPrime(n))
        {
            cout<<n<<endl;
            return;
        }
        n++;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<double> p(n+1);
    p[0] = 0;
    rep(i, n){
        double tmp;
        cin >> tmp;
        tmp = (double)((tmp+1)/2.0);
        p[i+1] = p[i] + tmp;
    }
    double ans = 0.0;
    for(int i=0; i<=n-k; i++){
        chmax(ans, p[i+k] - p[i]);
    }
    cout << setprecision(12) << (double)ans << endl;
    return 0;
}

Measured memory_bytes: 1792
N,M = map(int, input().split())

AB = [[0,0] for i in range(N)]
for n in range(N):
    AB[n][0],AB[n][1] = map(int, input().split())

AB.sort(key=lambda x:x[0])
#print(AB)


num = 0
yen = 0
for n in range(N):
    if num+AB[n][1] >= M:
        yen += (M-num)*AB[n][0]
        print(yen)
        break
    else:
        num += AB[n][1]
        yen += AB[n][1]*AB[n][0]

Measured memory_bytes: 21364
#include <iostream>

int main()
{
    int a, b, c;

    std::cin >> a >> b >> c;

    if (a < b && a < c && b < c)
    {
        std::cout << "Yes" << std::endl;
    }
    else
    {
        std::cout << "No" << std::endl;
    }

    return 0;
}



Measured memory_bytes: 3092
/* Problem b */
#include<stdio.h>

int main(){
    int k,x;
    int arr[300];
    int i,j;
    int lim;

    scanf("%d %d",&k,&x);

    if(k==1){
        printf("%d\n",x);
    } else {
        
        j = -k+1;
        lim = 2*k -1;
        
        for(i=0; i < lim; i++,j++){
            arr[i]=x + j;
        }

        for(i=0; i < lim; i++){
            printf("%d ",arr[i]);
        }

        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 128
input_l = input()
a = int(input_l[0])
b = int(input_l[2])
c = int(input_l[-1])

if a == b:
    if b == c:
        print("No")
    else:
        print("Yes")

elif b == c:
    if a == b:
        print("No")
    else:
        print("Yes")

elif c == a:
    if a == b:
        print("No")
    else:
        print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>

using namespace std;

#define INF (1 << 20)
#define MAX_V 12000

struct edge{
	int to;
	int cost;
};

typedef pair<int, int> P; // first??????????????¢???second??????????????????

vector<edge> G[MAX_V];
int d[MAX_V];

// ?????????O(|E|log|V|)

void shortest_path(int s, int V){ // V???????????°
	
	priority_queue<P, vector<P>, greater<P> > que;
	
	for(int i = 0; i < V; i++){
		d[i] = INF;
	}
	d[s] = 0;
	
	que.push(P(0, s));
	
	while(!que.empty()){
		
		P p = que.top();
		que.pop();
		
		int v = p.second;
		
		if(d[v] < p.first){
			continue;
		}
		
		for(int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] > e.cost + d[v]){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		} // ????????????????°???????????????´??°
	}
}

int main(){
	
	int W, H;
	
	while(true){
		
		cin >> W >> H;
		
		if(W * H == 0){
			break;
		}
		
		string map[200];
		
		for(int i = 0; i < MAX_V; i++){
			G[i].erase(G[i].begin(), G[i].end());
		}
		
		for(int i = 0; i < H; i++){
			cin >> map[i + 1];
			map[i + 1] = "." + map[i + 1] + ".";
		}
		
		H += 2;
		W += 2;
		
		string str = "";
		
		for(int i = 0; i < W; i++){
			str = str + ".";
			map[0] = str;
			map[H - 1] = str;
		}
		
		
		for(int i = 0; i < H - 1; i++){
			for(int j = 0; j < W; j++){
				int index1 = i * W + j;
				int index2 = (i + 1) * W + j;
				int cost;
				if(map[i][j] != map[i + 1][j] && (map[i][j] == '#' || map[i + 1][j] == '#')){
					cost = 1;
				}else{
					cost = 0;
				}
				edge e1, e2;
				e1.to = index2;
				e2.to = index1;
				e1.cost = cost;
				e2.cost = cost;
				G[index1].push_back(e1);
				G[index2].push_back(e2);
			}
		}
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W - 1; j++){
				int index1 = i * W + j;
				int index2 = i * W + j + 1;
				int cost;
				if(map[i][j] != map[i][j + 1] && (map[i][j] == '#' || map[i][j + 1] == '#')){
					cost = 1;
				}else{
					cost = 0;
				}
				edge e1, e2;
				e1.to = index2;
				e2.to = index1;
				e1.cost = cost;
				e2.cost = cost;
				G[index1].push_back(e1);
				G[index2].push_back(e2);
			}
		}
		
		int index_goal;
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if(map[i][j] == '&'){
					index_goal = i * W + j;
				}
			}
		}
		
		int V = H * W;
		
		shortest_path(0, V);
		
		cout << d[index_goal] / 2 << endl;
		/*
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cout << d[i * W + j] << " ";
			}
			cout << endl;
		}
		*/
	}
	return 0;
}

Measured memory_bytes: 4068
#include <iostream>
#include <array>
#include <algorithm>

int main() {
    std::array<long long int, 5> arr;
    std::cin >> arr[0] >> arr[1] >> arr[2]
             >> arr[3] >> arr[4];
    std::sort(arr.begin(), arr.end(), std::greater<long long int>());

    std::cout << arr[0] << " " << arr[1] << " "
              << arr[2] << " " << arr[3] << " "
              << arr[4] << std::endl;
    
    return 0;
}

Measured memory_bytes: 1172
#include <iostream>

using namespace std;

int main(void) {

  string S;
  string T;

  cin >> S;
  cin >> T;

  string tmp = T.substr(0,S.size());

  if(S == tmp)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3040
N,A,B = map(int, input().split())
  
if N % (A + B) == 0:
  print(N // (A + B) * A)
elif N % (A + B) - A < 0:
  print(N // (A + B) * A + abs(N % (A + B)))
elif N % (A + B) - A > 0:
  print(N // (A + B) * A + A)

Measured memory_bytes: 3064
#include <iostream>
#include <array>
#include <algorithm>

typedef struct {
    int point1;
    int point2;
    int cost;
} way;

int main()
{
    int number_point, number_edge;
    int start_point;
    std::cin >> number_point >> number_edge >> start_point;//?????????????????°??¨?§???????????????????

    //?§????????????????????????????
    const int BIGNUMBER = 1001001001;
    int *shortest_way = new int[number_point];

    for (int i = 0; i < number_point; i++) {
        shortest_way[i] = BIGNUMBER;//??§???????????§?????????
    }
    shortest_way[start_point] = 0;//???????????´??????????§????????????????0

    //?§?????????????????´?????????????????????£???????????????????????????
    way *way_data = new way[number_edge];
    for (int i = 0; i < number_edge; i++) {
        std::cin >> (way_data[i]).point1 >> (way_data[i]).point2 >> (way_data[i]).cost;
    }
   
   //????????????????°?????????´??°??????
    while(true) {
        bool changed = false;
        for (int i = 0; i < number_edge; i++) {
            //?????????point1????????±????????????????????£??????????????±??????
            if (shortest_way[(way_data[i]).point2] > shortest_way[(way_data[i]).point1] + (way_data[i]).cost) {
                shortest_way[(way_data[i]).point2] = shortest_way[(way_data[i]).point1] + (way_data[i]).cost;
                changed = true;
            }
        }
        
        //??????for??§???????????????????????????????????????????????????????????????????????£??????,?????????????????????
        if (!changed) {
            break;
        }
    }
    
    for(int i = 0; i < number_point; i++) {
        if (shortest_way[i] == BIGNUMBER) {
            std::cout << "INF" << std::endl;
        } else {
            std::cout << shortest_way[i] << std::endl;
        }
    }
    
    delete[] shortest_way;
    delete[] way_data;
    
    return 0;
}

Measured memory_bytes: 8792
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int w,a,b; cin >> w >> a >> b;
    if(a>b) swap(a,b);
    if(a+w<b) out(b-a-w);
    else out(0);

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>
using namespace std;

// Debug Vector
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v)
{
    if (!v.empty())
    {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p)
{
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}

typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (b % a == 0)
    {

        cout << a + b << endl;
    }
    else
    {
        cout << b - a << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstdio>
#include <queue>

using namespace std;

typedef struct{
  string name;
  int prcstime;
}prcs;


typedef queue<prcs> prcsQueue;

int main(void){
  prcsQueue que;
  int i,time=0;
  //????´??????????
  //  for(i=0;i<5;++i){
  //    que.push(i);
  //  }

  //  cout<<que.size()<<endl;
  //  cout<<"Hello maniac"<<endl;
  //  cout<<que.front()<<endl;
  //  cout<<que.back()<<endl;
  
  int N;
  int quantum;

  prcs tempPrcs;
  string tempName;
  int tempTime;
  scanf("%d",&N);
  scanf("%d",&quantum);
  
  for(i=0;i<N;i++){
    cin>>tempName;                  // ???????????????????????????????????????
    cin>>tempTime;
    tempPrcs.name=tempName;
    tempPrcs.prcstime=tempTime;
    que.push(tempPrcs);                  // 
  }

  while(que.size()!=0){
    tempPrcs=que.front();
    que.pop();
    if(tempPrcs.prcstime>quantum){
      time+=quantum;
      tempPrcs.prcstime=tempPrcs.prcstime-quantum;
      que.push(tempPrcs);
    }else{                      // ??????????????????????????????quantum??????????????£?????´????????????????????????????????????????????????????????´???
      time+=tempPrcs.prcstime;
      cout<<tempPrcs.name<<" "<<time<<endl;
    }
  }


  
  return 0;
}



/*
n???????????????????????????????????????
CPU???quantum??¨??????????????????????????????CPU??????????????????????????????????????????????????????????????§???????????§?????????
??????????????????????????????????????????????????¨??????????????????????????????CPU?????????????????????????????????????????????????????????????????§?????????
P1,P2,P3,...Pn???????????????????????£?????????CPU??????????????§??????????????????????????????quantum???????????????????????????????????¨?¬????????????????????§?????????????
quantum?????????????????????
??????????????????????????¨???????????????????????????????????????????????????

????????¨????????????????????????????????????????????????????????????????????¨??????????????????????§????????????????????????????????????°?????§???????????£?????????????????????????????????
*/

/*
queue???????????????????????????????????¨?????????????????????????´????????????????

do
???????°??????????????????????????????????????????????????????????quantum??????????????????time????¨?????????????
	?????????????????????????????´???
    ????????????????????????
    ??????????????????
	????????????????????????????????£?????´???
    ?????????????????????????????????????????????quantum???????????????????????????????????´
    ?????????????????????queue?????\??????
    ??????????????????
queue???????????????????????????????????????????????????
????´????????????????
end do

*/

Measured memory_bytes: 6296
#include <iostream>
#include <algorithm>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";

int main(){
 string s;
 cin >> s;
 if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2])cout << "Yes" << endl;
 else if(s[0] == s[2] && s[1] == s[3] && s[0] != s[1])cout << "Yes" << endl;
 else if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1])cout << "Yes" << endl;
 else cout << "No" << endl;
}


Measured memory_bytes: 256
import sys

a,b,k = map(int,input().split())
a1 = k-a
if a1 >=1:
  a2=b-a1
  if a2 <=0:
    a2 = 0
  a1=0
else:
  a1=a-k
  a2=b
print(a1,a2)

Measured memory_bytes: 2940
#include<stdio.h>
int ss(int); /*3乗を求める関数*/
int main(void)
{
    int x;
    int t;
    scanf("%d",&x);
    t=ss(x);
    printf("%d\n",t);
}
int ss(int a){
    int y=a*a*a;
    return y;
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()


int main(){
    ll k, a, b;
    cin >> k >> a >> b;
    for(ll x = a; x <= b; ++x){
        if(x % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

const int INF = 1e9+7;

using ipair = pair<int, int>;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}



int main(){
    ll N, T;
    cin >> N >> T;

    ll ans = 0;
    ll l = 0, r=T;

    rep(i, N){
        ll t;
        cin >> t;

        if(i==0) continue;

        if(t <= r){
            r = t + T;
        }else{
            ans += r - l;
            r = t+T;
            l = t;
        }
    }

    ans += r - l;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.split(" ");
	input = input.split("\n");
	//input = input.split(" ").map((a)=>Number(a));
	//input = input.split("\n").map((a)=>Number(a));
  var K = input[0].split(" ").map((a)=>Number(a))[1];
  var list = input[1].split(" ").map((a)=>Number(a)).sort(function(a,b){
  	return b - a;
  });
  var output = 0;
  for(var i = 0; i < K; i++){
    output += list[i];
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 9420
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
int main(){
  ll n; cin >> n;
  vector<ll> v(n);
  ll sum = 0;
  rep(i,n){
    cin >> v[i];
    sum ^= v[i];
  }
  rep(i,n){
    ll p = sum^v[i];
    cout << p << " ";
  }
  return 0;
}

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

int main(){
	int n;
	cin>>n;
	
	int a[n+2];
	a[0]=0;
	a[n+1]=0;
	for(int i=1;i<=n;i++)
		cin>>a[i];
		
	int b[n+1]; //b[i]=cost of i->i+1
	int sum=0;
	for(int i=0;i<=n;i++){
		b[i]=abs(a[i+1]-a[i]);
		sum+=b[i];
	}
	
	for(int i=1;i<=n;i++)
		cout<<sum-b[i-1]-b[i]+abs(a[i+1]-a[i-1])<<endl;
}


Measured memory_bytes: 4380
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
void dump(vector<int> vec){
  rep(i, vec.size()){
    cout << vec[i];
    if(i+1 == vec.size())cout << endl;
    else cout << " ";
  }
}

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    cin >> a[i];
  }
  dump(a);
  FOR(i, 1, n){
    int key = a[i];
    int j = i - 1;
    while(j >= 0 && a[j] > key){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = key;
    dump(a);
  }
	return 0;
}



Measured memory_bytes: 3152
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(new InputStreamReader(System.in));
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if((a==b && a!=c)||(a==c && a!=b)||(b==c && a!=c)){
			System.out.println("2");
		}else if (a==b && b==c) {
			System.out.println("1");
		}else {
			System.out.println("3");
		}
	}
}


Measured memory_bytes: 21844
<?php
// Try AtCoder
// author: Leonardone @ NEETSDKASU

function gets() { return trim(fgets(STDIN)); }
function getVals() { return explode(' ', gets()); }
function getInts() { return array_map(intval, getVals()); }

$N = intval(gets());
$xs = getInts();

$ans = 0;

for ($i = 0; $i < $N; $i++) {
    if ($xs[$i] === $i + 1) {
        if ($i > 0) {
            $ans++;
            if ($i+1<$N) {
                if ($xs[$i+1] === $i+2) {
                    $i++;    
                }            
            }
        } else {
            $t = $xs[$i];
            $xs[$i] = $xs[$i+1];
            $xs[$i+1]= $t;
            $ans++;
        }
    }
}

echo $ans, PHP_EOL;

Measured memory_bytes: 35308
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll k,x;
    cin>>k>>x;
    cout<<(500*k>=x?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,ma=-0x7fffffff,mi=0x7fffffff;
	cin>>n;
	while(n--){
		cin>>a;
		ma=max(a,ma);
		mi=min(a,mi);
	}
	cout<<ma-mi<<endl;
}

Measured memory_bytes: 256
s = input()
if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2] or s[0]==s[2] and s[1]==s[3] and s[0]!=s[1] or s[0]==s[3] and s[1]==s[2] and s[0]!=s[1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    
    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var n = Read();
        var input = Reads();
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = input[i];
        bool b = false;
        for (int i = 0; i < n; i++)
        {
            if (a[i] % 2 == 0)
            {
                if (a[i] % 3 != 0 && a[i] % 5 != 0)
                    b=true;
            }
        }
        if (b)
            Console.WriteLine("DENIED");
        else
            Console.WriteLine("APPROVED");


        Console.Out.Flush();
    }
}




Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <algorithm> 
#include <map> 
using namespace std;




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

	while(n != 0){
		vector < pair<long long, long long> > v(n);
		int order[n];
		int num = 0;
		for (int i = 0; i < n; ++i){
			long long id, p, q;
			cin >> id >> p >> q;
			v[i] = make_pair(id, p * q);
			order[i] = id;
		}

		sort(v.begin(), v.end());
		int c = 1;

		for (int i = 0; i < n - 1; ++i){
			if(v[i].first != v[i+1].first){
				c++;
			}
		}

		vector < pair<long long, long long> > sum(c);
		int k = 0;
		for (int i = 0; i < c; ++i){
			sum[i] = make_pair(0, 0);
		}

		long long s = 0;
		for (int i = 0; i < n ; ++i){
			s += v[i].second;
			if(i < n - 1){
				if(v[i].first != v[i+1].first){
					sum[k] = make_pair(v[i].first, s);
					s = 0;
					k++;
				}
			}else{
				sum[k] = make_pair(v[i].first, s);
			}
		}

		int ids[c];
		for (int i = 0; i < c; ++i){
			if(sum[i].second >= 1000000){
				ids[num] = sum[i].first;
				num++;
			}
		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < num; j++){
				if(order[i] == ids[j]){
					cout << order[i] << endl;
					ids[j] = -10000;
				}
			}
		}

		if(num == 0){
			cout << "NA" << endl;
		}

		cin >> n;
	}

	return 0;
}

Measured memory_bytes: 1244
// #include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
const int MOD = 1e9 + 7; // 10^9 + 7
using namespace std;

// ------------------ コンビネーション関数 ------------------ //
// ---------------- 使用前「COMinit();」必須 ---------------- //
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// ------------------ 最大公約数関数 ------------------ //
int GCD(int x, int y) {
	if (x == 0) return y;
	else GCD(y % x, x);
}

// ------------------ ベクター表示 ------------------ //
void printVec(vector<int>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}


// ------------------------------------------------ //
// ------------------ ここから下 ------------------ //
// ------------------------------------------------ //

int main(void) {

	int N;
	cin >> N;
	vector<string> S(N);
	rep(i, N) cin >> S[i];

	set<string> tmp(S.begin(), S.end());

	cout << tmp.size() << endl;

	return 0;
}

Measured memory_bytes: 25172
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


N = int(input())

primes = collections.Counter(prime_factorize(N))

answer = 0

for key in primes:
    number = primes[key]
    minus_number = 1
    while True:
        number -= minus_number
        if number < 0:
            break
        minus_number += 1
    answer += (minus_number - 1)

print(answer)


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

int main(){
	int n,x,y;
	cin >> n >> x >> y;
	x--;y--;
	vector<int> ans(n);
	for (int i = 0; i < n; ++i) {
		for (int j = i+1; j < n; ++j) {
			int dist = j - i;
			dist = min(dist, abs(j-y)+abs(i-x)+1);
			ans[dist]++;
		}
	}
	REP(i,n-1){
		cout << ans[i] << endl;
	}
    return 0;
}

Measured memory_bytes: 256
s = gets.strip.split('')
t = gets.strip.split('')

hs = {}
s.each { |c| hs[c] = hs[c].nil? ? 1 : hs[c] + 1 }

ht = {}
t.each { |c| ht[c] = ht[c].nil? ? 1 : ht[c] + 1 }

is_enable = false
if s.size == t.size
  as = hs.map { |char, count|  count }
  at = ht.map { |char, count|  count }
  is_enable = true if as == at
end

puts is_enable ? 'Yes' : 'No'


Measured memory_bytes: 22780
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define per(i, n, s) for (int i = (n-1); i >= (int)(s); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int a,b; cin>>a>>b;
	cout<<a*b<<endl;
}

Measured memory_bytes: 3632
def resolve():
    r, g, b = map(int, input().split())
    k = int(input())

    c = 0
    # gがrより大きくなるまで2倍する
    while r >= g:
        g *= 2
        c += 1
    
    # bがgより大きくなるまで2倍する
    while g >= b:
        b *= 2
        c += 1

    if c <= k:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
#define PI 3.141592653589793238
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
void bfs(vector<int> adj[], int s, bool vis[], int ans[]){
	queue<int> q;
	q.push(s);
	vis[s] = true;
	while(!q.empty()){
		int par = q.front(); q.pop();
		dbg(par);
		for(int neigh : adj[par]){
			if(vis[neigh] == false){
				dbg(neigh);
				ans[neigh] = par;
				q.push(neigh);
				vis[neigh] = true;
			}
		}
	}
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in2.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		int n, m; cin >> n >> m;
		vector<int> adj[n+1];
		FOR1(i, m){
			int a, b;
			cin >> a >> b;
			adj[a].pb(b); adj[b].pb(a);
		}
		int ans[n+1];
		bool vis[n+1]; mset(vis, false);
		bfs(adj, 1, vis, ans);
		cout << "Yes\n";
		for(int i = 2; i <= n; i++) cout << ans[i] << '\n';
		//cout << '\n';
	}
	return 0;
}


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

#define rng(i,l,r) for(int i=int(l);i<int(r);i++)
#define rep(i,r) rng(i,0,r)
#define mp make_pair
#define F first
#define S second

using pi=pair<int,int>;
using mint = modint998244353;

mint ans,beki[200005],one[200005];
int n,q;
multiset<pair<pi,int>>s;
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cin>>n>>q;
	beki[0]=1;
	rng(i,1,n+1)beki[i]=beki[i-1]*mint(10);
	one[0]=1;
	rng(i,1,n+1)one[i]=one[i-1]*mint(10)+mint(1);
	s.insert(mp(mp(1,n),1));
	ans=one[n-1];
	while(q--){
		int l,r,d;
		cin>>l>>r>>d;
		l=n+1-l,r=n+1-r;
		swap(l,r);
		ans+=one[r-l]*mint(d)*beki[l-1];
		auto it=s.insert(mp(mp(l,r),d));
		auto pr=it;
		pr--;
		if(l<=pr->F.S){
			pair<pi,int> x=*pr;
			s.erase(pr);
			ans-=one[min(x.F.S,r)-l]*mint(x.S)*beki[l-1];
			if(r<x.F.S)s.insert(mp(mp(r+1,x.F.S),x.S));
			x.F.S=l-1;
			if(x.F.F<=x.F.S)s.insert(x);
		}
		it++;
		while(it!=s.end()&&it->F.F<=r){
			pair<pi,int> x=*it;
			pr=it;
			it++;
			s.erase(pr);
			ans-=one[min(x.F.S,r)-x.F.F]*mint(x.S)*beki[x.F.F-1];
			x.F.F=r+1;
			if(x.F.F<=x.F.S)s.insert(x);
		}
		cout<<ans.val()<<endl;
	}
}


Measured memory_bytes: 17704
#include <cstdlib>
#include <iostream>

using namespace std;

long long n, k, ans_id;
int a[220000];
int b[220000];   // 町 番目
int bb[220000];   // 番目 町
bool done[220000];

void dfs(int u, int idx) {
  b[u] = idx;
  bb[idx] = u;
  done[u] = true;
  if (idx == k) {
    cout << u+1 << endl;
    return;
  }
  int v = a[u];
  idx++;
  if (done[v]) {
    int loop = idx - b[v];
    ans_id = (k - b[v]) % loop + b[v];
    cout << bb[ans_id] + 1 << endl;
    return;
  }
  dfs(v, idx);
}


int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  
  dfs(0, 0);
}

Measured memory_bytes: 5964
from copy import copy
import random
import math
import sys
input = sys.stdin.readline
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(D)]
last = [0]*26
ans = [0]*D
score = 0
for i in range(D):
    ps = [0]*26
    for j in range(26):
        pl = copy(last)
        pl[j] = i+1
        ps[j] += s[i][j]
        for k in range(26):
            ps[j] -= c[k]*(i+1-pl[k])
    idx = ps.index(max(ps))
    last[idx] = i+1
    ans[i] = idx+1
    score += max(ps)
for k in range(1,40001):
    na = copy(ans)
    x = random.randint(1,365)
    y = random.randint(1,365)
    if x == y:
        continue
    na[x-1],na[y-1] = na[y-1],na[x-1]
    last = [0]*26
    ns = 0
    for i in range(D):
        last[na[i]-1] = i+1
        ns += s[i][na[i]-1]
        for j in range(26):
            ns -= c[j]*(i+1-last[j])
    if k%100 == 1:
        T = 300-(298*k/40000)
    p = pow(math.e,-abs(ns-score)/T)
    if ns > score or random.random() < p:
        ans = na
        score = ns
for a in ans:
    print(a)

Measured memory_bytes: 88540
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		 //sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
vector<vector<int>> G;
//dist[0][i]　N-1（白）からの距離
//dist[1][i] 0（黒）からの距離
int dist[2][100005];
void dfs(int c, int x, int pre, int d){
    dist[c][x] = d;
    for(auto nxt: G[x]){
        if(nxt==pre)continue;
        dfs(c, nxt, x, d+1);
    }
}
int main() {
    int N;
    cin>>N;
    G.resize(N);
    rep(i,N-1){
        int a,b;
        cin>>a>>b;a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(1,0,-1,0);
    dfs(0,N-1,-1,0);
    int cntb = 0;
    rep(i,N){
        if(dist[0][i]>=dist[1][i]){
            cntb++;
        }
    }
    int cntw = N - cntb;
    if(cntb>cntw){
        cout<<"Fennec"<<endl;
    }
    else{
        cout<<"Snuke"<<endl;
    }
}

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

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

    int h[N];
    for (int i = 0; i < N; i++ ) cin >> h[i];

    int answer = 0;
    for (int i = 0; i < N; i++ ){
        if( K <= h[i] ) {
            answer++;
        }
    }

    cout << answer << endl;

    return 0;
}



Measured memory_bytes: 640
//To do- All bs, b_lift, ads(sa,ft(adv),st(node_adv),sut),gg(sp(multiple_constraints problem_traffic_hackerrank_uva),ffa,scc, dpot(ma,monta)),combinatorics, dpog(1900-2000)
//gauravsinghh
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 100005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(int i = a; i <= b; i++)
#define ffo(i, a, b) for(int i = a; i >= b; i--)
#define MAX 100005
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")

void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

signed main(){ 
    IOS
    //io_set();
    string s;
    cin >> s;
    if(s[0] == '9'){
        cout << 1;
    }
    else{
        cout << 9;
    }
    if(s[1] == '9'){
        cout << 1;
    }
    else{
        cout << 9;
    }
    if(s[2] == '9'){
        cout << 1;
    }
    else{
        cout << 9;
    }
    return 0;
}



Measured memory_bytes: 256
import math

def _print(S):
  print(S)
  return
  S = list(map(int, S.split()))
  print(len(S))
  for s in S:
    if math.gcd(s, sum(S)-s) == 1:
      print("FAIL!!")
      
  

def main():
  N = int(input())
  # 2, 3, 5, 7, 11, ...
  # 2, p-2, p
  # sum 2 * (p-2) * p: 2pp-4p
  # 2, p-2, p, = 2p, rest = 2pp - 6p
  
  # 2, 3, 4, 6, 8, 9, 10, 12,     14, 15, 16, 18, 20, 21, 22, 24,     ...

  # 12, 4+8, 6 ,  18, 14+16,   24  
  if N > 8:
    n = N % 8
    t = (8 - n)%8
    S = {2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24}
    if t >= 4:
      S -= {4, 8, 14, 16}
      t -= 4
    elif t >= 2:
      S -= {4, 8}
      t -= 2
    while t:
      S -= {6*t}
      t -= 1
    #print(len(S), S)
    i = 2
    
    while N > len(S):
      S.update({i*12+j for j in [2,3,4,6,8,9,10,12]})
      i += 1
      #print(i, S)
    _print(' '.join(f'{s}' for s in S))
    
   # for s in S:
    #  print(math.gcd(s, sum(S)-s))
  elif N == 8:
    _print('2 3 4 6 8 9 10 12')
  elif N == 7:
    _print('2 3 4 8 9 10 12')
  elif N == 6:
    _print('2 3 4 8 9 10')
  elif N == 5:
    _print('2 3 9 10 12')
  elif N == 4:
    _print('2 5 20 63')
  elif N == 3:
    _print('2 5 63')
  
  
main()

Measured memory_bytes: 12144
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ALL = [A,B,C,D,E]
G=[[0,0],[0,0],[0,0],[0,0],[0,0]]
for i in range(len(ALL)):
  G[i][1] = ALL[i]
  if (ALL[i]%10 == 0):
    G[i][0] = 0
  else:
    G[i][0] = 10-(ALL[i] %10)
G.sort()
total = 0
for j in range(4):
  total = total+G[j][1]+G[j][0]
total = total + G[4][1]
print(total)
  

Measured memory_bytes: 3064
#include<bits/stdc++.h>
const int N=1e5+5,mo=1e9+7;
int n,i,j,nxt[N][3],lst,f[N],s[N];
char c[N];
inline void add(int&x,int y){x+=y-mo;x+=x>>31&mo;}
int main(){
	scanf("%s",c+1);n=strlen(c+1);
	for(i=1;i<=n;++i)s[i]=(s[i-1]+c[i]-'a'+1)%3;
	f[n+1]=1;
	for(i=n;i;--i){
		memcpy(nxt[i],nxt[i+1],12);nxt[i][s[i]]=i;
		if(i<n && c[i]==c[i+1])lst=i+1;
		int a=0,b=0;
		if(c[i]=='a')a=i;else b=i;
		if(!a)a=nxt[lst][(s[i-1]+1)%3];
		if(!b)b=nxt[lst][(s[i-1]+2)%3];
		if(a)add(f[i],f[a+1]);if(b)add(f[i],f[b+1]);
		if(s[i-1]==s[n] && i>1)add(f[i],1);
	}
//for(i=1;i<=n;++i)printf("%d ",f[i]);puts("");
	if(!lst)f[1]=1;
	printf("%d\n",f[1]);
	return 0;	
}

Measured memory_bytes: 2304
n, k = map(int, input().split())
li = []
for x in range(k*2):
    li.append(input().split())
li2 = []
i = 1
while i < k*2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))

Measured memory_bytes: 9664
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <queue>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
const long double PI = acos(-1);
typedef long long ll;
const long long MOD = 1e9 + 7;
using namespace std;

//main
int main(){
  long double a, b, x; cin >> a >> b >> x;
  if (x <= a*a*b/2) cout << fixed << setprecision(15) << atan(a*b*b/(2*x))*180/PI << endl;
  else cout << fixed << setprecision(15) << atan(2*(a*a*b-x)/(a*a*a))*180/PI << endl;
}

Measured memory_bytes: 256