akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  cout<<fixed<<setprecision(10);
  ll N;
  ll root;
  cin >> N;
  REP(i,pow(10,6)+2) {
    if (pow(i,2) > N) {
      root = i-1;
      break;
    }
  }
  if(pow(root,2) == N) cout << 2*root-2 << endl;
  else REP(i,pow(10,6)+1) {
    if(N%(root+i+1)==0) {
      cout << root+i+1 + N/(root+i+1) -2;
      break;
    } else if(root-i-1>0) {
      if(N%(root-i-1)==0) {
      	cout << root-i-1 + N/(root-i-1) -2 << endl;
      	break;
      }
    }
  }
}

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

using namespace std;

int main(void) {
  int questions, posts;
  cin >> questions >> posts;

  vector<bool> solutions(questions);
  vector<int> penalties(questions);

  for (int i = 0; i < posts; ++i) {
    int q;
    string result;
    cin >> q >> result;
    q -= 1;

    if (solutions[q]) continue;
    if (result == "AC") {
      solutions[q] = true;
    } else {
      ++penalties[q];
    }
  }

  int solved = 0, penaltied = 0;
  for (int i = 0; i < questions; ++i) {
    if (solutions[i]) {
      ++solved;
      penaltied += penalties[i];
    }
  }

  cout << solved << " " << penaltied << endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF=(1LL<<60);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
	init();
	ll H,W;cin>>H>>W;
	string S[H+2];
	string test;
	for(int i=0;i<W+2;i++){
		test.push_back('.');
	}
	S[0]=test;
	for(int i=1;i<=H;i++){
		string s;cin>>s;
		S[i]='.'+s+'.';
	}
	S[H+1]=test;
	
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			ll num=0;
			if(S[i][j]=='#')continue;
			for(int k=0;k<8;k++){
				if(S[i+ddx[k]][j+ddy[k]]=='#')num++;
			}
			S[i][j]=('0'+num);
		}
	}
	
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			
			cout<<S[i][j];
		}
		cout<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
	int n, A, B;
	cin >> n >> A >> B;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long ans = 0;
	for (int i = 1; i < n; i++) {
		long long Cmp = a[i] - a[i - 1];
		ans += min(Cmp * A, (long long)B);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
ins = input().split()
w = int(ins[0])
h = int(ins[1])
x = int(ins[2])
y = int(ins[3])
r = int(ins[4])
if x - r >= 0 and y - r >= 0 and x + r <= w and y + r <= h:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 7668
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    //　整数の入力
    int N = sc.nextInt();
    int K = sc.nextInt();
    // 個数の計算
    int answer = K;
    for (int i=2; i<=N; i++) {
      answer *= (K - 1);
    }
    // 出力
    System.out.println(answer);
  }
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define MAXN 100005
#define endl "\n"
#define readln(x) getline(cin, x);
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
ll fpow(ll x, ll n, ll mod){if (n==0) return 1%mod; ll u = fpow(x, n/2, mod); u = (u*u)%mod; if (n%2==1)u = (u*x)%mod;return u;}
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

ll N, dp[MAXN], h[MAXN];
int main(){
    //freopen("data.txt","r",stdin);
    cin >> N;
    for (int i = 1; i<=N; i++){
        cin >> h[i];
    }
    dp[2] = abs(h[2]-h[1]);
    for (int i = 3; i<=N; i++){
      ll a = dp[i-2]+abs(h[i]-h[i-2]);
      ll b = dp[i-1]+abs(h[i]-h[i-1]);
      dp[i] = min(a,b);
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		
		var c = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		int a = c[0];
		int b = c[1];
		string s;
		int n;
			
		if(a<=b){
			s = a.ToString();
			n = b;
		}else{
			s = b.ToString();
			n = a;
		}
		
		for(int i=1;i!=n;i++){
			s = s + s.Substring(0,1);
		}
		
		Console.WriteLine(s);
		
	}
}

Measured memory_bytes: 13396
#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 off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pi 3.141592653589793116
#define mod 1e9+7
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;


bool cmp (pair <string ,pair <int,int> > a,pair <string ,pair <int,int> > b)
{
    if(a.first==b.first)
        {
            return a.second.first>b.second.first;
        }
    else
        return a.first<b.first;    

}


int main() {
    off;
    int t;
    //cin>>t;
    t=1;
    while(t--){    
        vector <pair <string ,pair<int,int > > > c;
        int n;
        cin>>n;
        for(int i=0;i<n;i++)
            {
                string s;
                int t;
                cin>>s>>t;
                c.push_back({s,{t,i+1}});
            }
        sort(c.begin(),c.end(),cmp);
        for(auto it:c)
            {
                cout<<it.second.second<<'\n';
            }    
    }
      return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)




int main() {
	string s; cin >> s;
	int len = s.length();
	rep(i, len) {
		if (i % 2 == 1 && s[i] == 'R') {
			cout << "No" << endl;
			return 0;
		}
		if (i % 2 == 0 && s[i] == 'L') {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	string s(n, 'a');
	while(s[0] == 'a'){
		cout << s << "\n";
		++s[n-1];
		for(int i=n-1; i>0; --i){
			int t = 0;
			for(int j=0; j<i; ++j)
				t = max(t, s[j]-'a');
			if(s[i] == 'a'+t+2){
				s[i] = 'a';
				++s[i-1];
			}
		}
	}
}

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


int main() {
    string N;
    cin>>N;
    ll s=N.size();
    vector<int> n(s);
    rep(i,s){
        n.at(i)=N.at(i)-'0';
    }

    reverse(n.begin(),n.end());
    n.push_back(0);
    ll count=0;
    rep(i,s){
        if(n.at(i)<5){count+=n.at(i);}
        else if(n.at(i)==5){
            count+=5;
            if(n.at(i+1)>=5){n.at(i+1)++;}
        }
        else{count+=10-n.at(i);n.at(i+1)++;}
    }
    count+=n.at(s);
    cout<<count<<endl;
}

Measured memory_bytes: 11012
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
using namespace std;

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	if (a - b == b - c) {
		cout << "YES";
		return 0;
	}
	cout << "NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e3 + 5;
int ans[N];

int main()
{
	int n, x, y; scanf("%d%d%d", &n, &x, &y);
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if ((i <= x && j <= x) || (i >= y && j >= y)) ans[j - i]++;
			else if (i <= x && j >= y) ans[x - i + j - y + 1]++;
			else if (j >= y && i >= x) ans[j - y + min(y - i, i - x + 1)]++;
			else if (i <= x && j >= x) ans[x - i + min(j - x, y - j + 1)]++;
			else ans[min(j - i, i - x + 1 + y - j)]++;
		}
	}
	for (int i = 1; i < n; i++) {
		printf("%d\n", ans[i]);	
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    
        var sc = new Scanner(System.in);
    
        int n = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int t = Integer.parseInt(sc.next());
        
        int a = 0;
        int b = 0;
        while(a < n){
            a += x;
            b += t;
        }
        System.out.println(b);
    }
}

Measured memory_bytes: 35580
#include <stdio.h>

int main(int argc, char *argv[])
{
        int W, H, x, y, r;

        scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

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

        return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    ll n; cin>>n;
    for(int i=0;;i++){
        string temp, hoge;
        ll ans=0;
        temp=to_string(n+i);
        hoge=to_string(n-i);
        bool check=true;
        for(int j=0; j<(int)(temp.length()/2);j++){
            if(temp[j]!=temp[(int)temp.length()-1-j]){check=false; break;}
        }
        if(check){ans=stoi(temp);}
        check=true;
        for(int j=0; j<(int)hoge.length()/2;j++)
            if(hoge[j]!=hoge[hoge.length()-1-j]){check=false;break;}
        if(check&&ans!=0){ll poge=stoi(hoge); cout<<min(ans,poge)<<endl; return 0;}
        else if(ans!=0){cout<<stoi(temp)<<endl;return 0;}
        else if(check){cout<<stoi(hoge)<<endl;return 0;}
    }
}

Measured memory_bytes: 3204
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long[] h = new long[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
        }
        int[] a = new int[m];
        int[] b = new int[m];
        Map<Integer, List<Integer>> map = new HashMap<>();
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            List<Integer> l = new ArrayList<>();
            if (map.containsKey(a[i])) {
                l = map.get(a[i]);
            }
            l.add(b[i]);
            map.put(a[i], l);
            List<Integer> l2 = new ArrayList<>();
            if (map.containsKey(b[i])) {
                l2 = map.get(b[i]);
            }
            l2.add(a[i]);
            map.put(b[i], l2);
        }
        long ans = 0;
        for (int i = 0; i < n; i++) {
            if (!map.containsKey(i + 1)) {
                ans++;
                continue;
            }
            List<Integer> list = map.get(i + 1);
            boolean top = true;
            for (Integer l : list) {
                if (h[i] <= h[l - 1]) {
                    top = false;
                    break;
                }
            }
            if (top) {
                ans++;
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 83360
#include <bits/stdc++.h>
using namespace std;
void makeCombiUtil(vector<vector<int> >& ans, 
    vector<int>& tmp, int n, int left, int k) 
{ 
    // Pushing this vector to a vector of vector 
    if (k == 0) { 
        ans.push_back(tmp); 
        return; 
    } 
  
    // i iterates from left to n. First time 
    // left will be 1 
    for (int i = left; i <= n; ++i) 
    { 
        tmp.push_back(i); 
        makeCombiUtil(ans, tmp, n, i + 1, k - 1); 
  
        // Popping out last inserted element 
        // from the vector 
        tmp.pop_back(); 
    } 
} 

vector<vector<int> > makeCombi(int n, int k) 
{ 
    vector<vector<int> > ans; 
    vector<int> tmp; 
    makeCombiUtil(ans, tmp, n, 1, k); 
    return ans; 
} 
int main() {
  int c,N,C,answer=INT_MAX;
  cin >> N >> C;
  int D[C+1][C+1];
  for (int i = 1; i <= C; i++) {
    for (int j = 1; j <= C; j++) {
      cin >> D[i][j];
    }
  }
  vector<vector<int>> d(3,vector<int>(C+1));
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; d[(i+j)%3][c]++, j++) {
      cin >> c;
    }
  }
  for (auto p : makeCombi(C,3)) {
    do {
      int wrongness = 0;
      for (int c = 1; c <= C; c++) {
        wrongness += d[0][c]*D[c][p[0]];
        wrongness += d[1][c]*D[c][p[1]];
        wrongness += d[2][c]*D[c][p[2]];
      }
      answer = min(answer,wrongness);
    } while (next_permutation(p.begin(),p.end()));
  }
  cout << answer;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a,b;
  cin>>a>>b;
  ll d=0;
  for(ll i=0;i<a;i++){
    ll c;
    cin>>c;
    if(c>=b){
      d+=1;
    }
  }
  cout<<d<<endl;
  return 0;
  
  
      
                        
                        
}


Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	ll A;
	string B;
	cin >> A >> B;
	string b;
	b += B[0];
	b += B[2];
	b += B[3];
	ll bb = stoll(b);

	ll ans = A * bb;
	ans /= 100;

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


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

int N,V,M = 19;
int A[200010];
int mem[2][20][2000010];
int dp[2][2000010];
int ans[200010];
int INF = 1001001001;

int unit(int id,int bit)
{
    if(!bit)
    {
        if(id)return 0;
        else return N - 1;
    }
    if(dp[id][bit] != -1)return dp[id][bit];
    int res;
    if(id)res = 0;
    else res = N - 1;
    for(int i = 0; i < M; i++)
    {
        if(bit & (1 << i))
        {
            if(id)res = max(res,mem[id][i][unit(id,bit - (1 << i))] + 1);
            else res = min(res,mem[id][i][unit(id,bit - (1 << i))] - 1);
        }
    }
    return dp[id][bit] = res;
}

int main()
{
    scanf("%d%d",&N,&V);
    for(int i = 0; i < N; i++)scanf("%d",A + i);

    int v = V;
    int cnt = 0;
    while(V)V /= 2,cnt++;

    M = cnt + 1;

    for(int i = 0; i < 20; i++)
    {
        int tmp = 0;
        for(int j = 0; j < N; j++)
        {
            if(j && A[j] - A[j - 1] > v)tmp = j;
            mem[0][i][j] = tmp;
        }
        tmp = N - 1;
        for(int j = N - 1; j >= 0; j--)
        {
            if(j != N - 1 && A[j + 1] - A[j] > v)tmp = j;
            mem[1][i][j] = tmp;
        }
        v /= 2;
    }

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

    for(int i = 0; i < (1 << M - 1); i++)
    {
        int l = unit(1,((1 << M - 1) - 1 << 1) - (i << 1));
        int r = unit(0,(i << 1));
        if(l > r)
        {
            for(int j = 0; j < N; j++)printf("Possible\n");
            return 0;
        }
        if(mem[1][0][l] >= r)
        {
            ans[l]++;
            ans[r + 1]--;
        }
    }
    for(int i = 1; i < N; i++)ans[i] += ans[i - 1];

    for(int i = 0; i < N; i++)
    {
        if(ans[i])printf("Possible\n");
        else printf("Impossible\n");
    }

    return 0;
}


Measured memory_bytes: 134272
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
  int N; cin >> N;
  ll X; cin >> X;
  vector<ll> x;
  for(int i = 0;i < N;i++){
    ll x_i; cin >> x_i;
    x.push_back(max(X-x_i,x_i-X));
  }

  for(int i = 1;i < N;i++){
    x[i] = __gcd(x[i],x[i-1]);
  }

  cout << x[N-1] << endl;
}


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

#define ll long long int

int main() {
	// your code goes here
	
	ll n;
	//cin>>n;
	
	string s;
	cin>>s;
	n=s.size();
	int arr[n+1];
	for(int i=0;i<n;i++){
		arr[i]=s[i]-'0';
	}
	ll dp[n+1][3];
	dp[0][0]=arr[0];
	dp[0][1]=1+(9-arr[0]);
//	dp[0][2]=1;
	for(ll i=1;i<n;i++){
		dp[i][0]=arr[i]+min(dp[i-1][0],dp[i-1][1]+1);
		dp[i][1]=min(1+(9-arr[i])+dp[i-1][0],(9-arr[i])+dp[i-1][1]);
		//dp[i][2]=min(dp[i-1][2]+(9-arr[i]),min(dp[i-1][1],dp[i-1][0])+1);
	}
	cout<<min(dp[n-1][0],dp[n-1][1]+1);
	

	return 0;
}

Measured memory_bytes: 28676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

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

int main() {
    init();

    int n, m; cin >> n >> m;
    VL a(n); cin >> a;

    set<int> c;
    FOR(i, 0, n)FOR(j, 0, 40)if (a[i] & (1LL << j)) {
        c.insert(j);
        break;
    }
    if (c.size() != 1) {
        cout << "0\n";
        return 0;
    }

    ll x = 1;
    FOR(i, 0, n)x = max(lcm(x, a[i]), 0LL);
    if (x % 2 == 1 || x == 0) {
        cout << "0\n";
        return 0;
    }

    ll ans = (m - x / 2 + x) / x;
    cout << ans << "\n";
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> A(N+1);
    rep(i,N) cin >> A[i+1];

    vector<ll> dp(N+1,-1e18);
    dp[0] = dp[1] = 0;
    vector<ll> O(N+5),E(N+5);
    for (int i = 1; i <= N; i++) {
        if (i&1) O[i+2] = O[i] + A[i];
        else E[i+2] += E[i] + A[i];
    }
    for (int i = 2; i <= N; i++) {
        if (i&1) {
            //cout << O[i+2] << ln;
            chmax(dp[i],O[i]);
            chmax(dp[i],dp[i-3]+A[i-1]);
            chmax(dp[i],dp[i-2]+A[i]);
        } else {
            chmax(dp[i],O[i+1]);
            chmax(dp[i],dp[i-2]+A[i]);
        }
        //cout << dp[i] << " ";
    }
    //cout << ln;

    cout << dp[N] << ln;
}




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

int main() {
  ll x,y,ans=0;
  cin >> x >> y;
  x=y/x;
  while(x){
    x/=2; ans++;
  }
  cout << ans <<endl;
}

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

int main() {
	int k, t;
	cin >> k >> t;
	vector<int>a(t);
	for (int i = 0; i < t; i++)cin >> a.at(i);
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	if (a.at(0) <= ceil((double)k / 2))cout << 0 << endl;
	else {
		if (k % 2 == 0)cout << 1 + 2 * (a.at(0) - ceil((double) k/2 ) - 1) << endl;
		else cout << 2 * (a.at(0) - ceil((double)k / 2)) << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const lll MOD = 756627637274933; //998244353;
const int N = 2e5+1;
int n, a[N], b[N];
lll ha, hb, d=bit(30);
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) cin >> a[i];
  FOR(i, 0, n) cin >> b[i];
  a[n] = a[0];
  b[n] = b[0];
  FOR(i, 0, n){
    ha = (ha*d + a[i]^a[i+1]) % MOD;
    hb = (hb*d + b[i]^b[i+1]) % MOD;
  }
  lll p = modPow(d, n, MOD)-1;
  FOR(i, 0, n){
    if(ha == hb) printf("%d %d\n", i, a[i]^b[0]);
    ha = (ha*d%MOD - p*(a[i]^a[i+1])%MOD + MOD) % MOD;
  }
}

Measured memory_bytes: 4992
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	int i, t;
	do{
		cin >> s;
		if ((int)s[0]-48 == 0)
			break;
		i = 0, t = 0;
		while (s[i])
		{
			t += ((int)s[i] - 48);
			i++;
		}
		cout << t << endl;
	} while (1);
	return 0;
}

Measured memory_bytes: 3124
#include <stdio.h>
int main(void) {
  int s;
  scanf("%d", &s);
  long long dp[s];
  for (int i = 0; i <= s; i++) {
    if (i < 3)
      dp[i] = 0;
    else if (i == 3)
      dp[i] = 1;
    else
      dp[i] = dp[i - 3] + dp[i - 1];
    dp[i] %= 1000000007;
  }
  printf("%lld\n", dp[s]);
  return 0;
}

Measured memory_bytes: 1712
using System;
using System.Collections.Generic;
using System.Linq;
 
class Procon {
    public Procon () { }
    static void Main (string[] agrs) {
        new Procon ().Do ();
    }
 
    Scanner cin;
 
    public void Do () {
        cin = new Scanner ();
 
        int N = cin.nextInt ();
 
        List<string> list = new List<string> ();
 
        for (int i = 0; i < N; i++) {
            string s = cin.nextString ();
 
            var c = s.ToCharArray ();
 
            Array.Sort (c);
 
            list.Add (new String (c));
        }
 
      	var array = list.ToArray();
        Array.Sort (array);
 
        long ans = 0;
        long tmp = 1;
        string prev = "";
        for (int i = 0; i < N; i++) {
            if (array[i] != prev) {
                ans += (tmp * (tmp - 1)) / 2;
                prev = array[i];
                tmp = 1;
            } else {
                tmp++;
            }
        }
        ans += (tmp * (tmp - 1)) / 2;
        Console.WriteLine (ans);
    }
}
 
class Scanner {
    string[] s;
    int i;
    int max_i;
 
    public Scanner () {
        s = new string[0];
        max_i = 0;
        i = 0;
    }
 
    public string nextString () {
        if (i >= s.Length) {
            s = Console.ReadLine ().Split (' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0) {
                return "";
            }
            return s[i++];
        } else {
            return s[i++];
        }
    }
 
    public int nextInt () {
        return int.Parse (nextString ());
    }
 
    public long nextLong () {
        return long.Parse (nextString ());
    }
 
    public double nextDouble () {
        return double.Parse (nextString ());
    }
 
    public string[] arrayString () {
        return Console.ReadLine ().Split (' ');
    }
 
    public int[] arrayInt () {
        string[] str = Console.ReadLine ().Split (' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++) {
            array[i] = int.Parse (str[i]);
        }
        return array;
    }
 
    public long[] arrayLong () {
        string[] str = Console.ReadLine ().Split (' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++) {
            array[i] = long.Parse (str[i]);
        }
        return array;
    }
 
    public double[] arrayDouble () {
        string[] str = Console.ReadLine ().Split (' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++) {
            array[i] = double.Parse (str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 24772
h, w =  [ int(v) for v in input().split() ]
column_list = []
row_list = []
field = [ None for i in range(h) ]
space_column = "." * w
space_row = "." * h
for i in range(h):
	s = input()
	field[i] = s
	if s != space_column:
		column_list.append(i)

for i in range(w):
	s = "".join([field[j][i] for j in range(h)])
	if s != space_row:
		row_list.append(i)


for i in column_list:
	print("".join([ field[i][j] for j in row_list ]))

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

#define INF ((ll)1e18)
#define ll long long

int N;
ll v[200201];
ll two[200201], five[200201];
ll cnt[20][20];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> N;
	for(int i=0; i<N; i++)
	{
		string s;
		cin >> s;
		int pos = -1;
		for(int j=0; j<s.size(); j++)
		{
			if (s[j] == '.')
				pos = j;
		}
		if (pos == -1) pos = s.size(), s += '.' + string(9, '0');
		if (s.size() < pos+10) s += string(pos+10-(int)s.size(), '0');

		ll val = 0;
		for(int j=0; j<s.size(); j++)
		{
			if (s[j] == '.') continue;
			val *= 10;
			val += s[j]-'0';
		}
		v[i] = val;

		ll x = val, y = 0;
		while(x % 2 == 0)
		{
			y++;
			x /= 2;
		}
		two[i] = y;

		x = val; y = 0;
		while(x % 5 == 0)
		{
			y++;
			x /= 5;
		}
		five[i] = y;

		two[i] = min(18LL, two[i]);
		five[i] = min(18LL, five[i]);
		cnt[two[i]][five[i]]++;
	}
	ll res = 0;
	for(int i=0; i<N; i++)
	{
		ll t = 18-two[i], f = 18-five[i];
		for(ll a=t; a<=18; a++)
			for(ll b=f; b<=18; b++)
			{
				res += cnt[a][b];
				if (a == two[i] && b == five[i])
					res--; // 자기 자신은 세면 안 된다.
			}
	}
	assert(res%2==0);
	res /= 2;
	printf("%lld", res);
	return 0;
}

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

#define ll long long
#define endl '\n'

int nb[101];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, n, k;
    cin >> x >> n;
    vector<int> p(n);
    nb[0] = x;
    int diff = 1, pn;
    for (int i = 0; i < 100; i++) {
        if (i & 1) {
            nb[1 + i] = x + diff;
            diff++;
        } else
            nb[1 + i] = x - diff;
    }
    for (int i = 0; i < n; i++) {
        cin >> k;
        for (int j = 0; j < n; j++) {
            if (k == nb[j]) nb[j] = 10000;
        }
    }
    int i = 0;
    for (; i < n; i++) {
        if (nb[i] != 10000) {
            cout << nb[i] << endl;
            break;
        }
    }
    if (i == n) cout << nb[n] << endl;
    return 0;
}


Measured memory_bytes: 3644
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def prime_numbers(n):
    if n < 2:
        return []

    m = (n + 1) // 2
    p = [1] * m
    for i in range(1, int((n ** 0.5 - 1) / 2) + 1):
        if p[i]:
            p[2 * i * (i + 1) :: 2 * i + 1] = [0] * (((m - 1) - 2 * i * (i + 1)) // (2 * i + 1) + 1)

    a = [2 * i + 1 for i in range(m) if p[i]]
    a[0] = 2
    return a


def main():
    N = int(readline())

    primes = [p for p in prime_numbers(55555) if p % 2 and (p - 1) // 2 % 5 == 0]
    ans = primes[:N]

    print(*ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9748
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[100000+2],l,memo[100000+2];

int solve(int x){
	if(memo[x]!=-1)return memo[x];
	int ret=0;
	if(a[x-1]>a[x])ret=solve(x-1);
	if(a[x+1]>a[x])ret=max(ret,solve(x+1));
	ret+=l-a[x];
	memo[x]=ret;
	return ret;
}

int main(){
	for(int i=0;i<100002;i++){a[i]=0; memo[i]=-1;}
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	int ans=0;
	for(int i=1;i<=n;i++)ans=max(ans,solve(i));
	printf("%d\n",ans);
}

Measured memory_bytes: 3512
<?php
/*
    Problem URL : http://agc004.contest.atcoder.jp/tasks/agc004_a

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

fscanf(STDIN, "%d %d %d", $a, $b, $c);

if ($a % 2 == 0 ||  $b % 2 == 0 || $c % 2 == 0) {
	echo "0\n";
} else {
	$ans = min($a * $b, $a * $c, $b * $c);
	echo $ans . "\n";
}


Measured memory_bytes: 3704
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int s = 0;
        int a = scn.nextInt();
        int b = scn.nextInt();
        int c = scn.nextInt();
        while(a <= b) {
            if(c % a++ == 0) {
                s++;
            }
        }
        System.out.println(s);
    }
}

Measured memory_bytes: 17232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) throws NumberFormatException, IOException {
        int[] arr;
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            arr = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        }

        int a = arr[0];
        int b = arr[1];

        if( a < b ) {
            System.out.println("a < b");
        }else if(a > b) {
            System.out.println("a > b");
        }else {
            System.out.println("a == b");
        }
    }

}


Measured memory_bytes: 30664
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 1000000009
typedef long long ll;
typedef pair<int,int> P;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define int ll

signed main(void){
    int N,P[214514],Q[214514];
    cin >> N;
    REP(i,N){
        cin >> P[i];
        Q[P[i]-1]=i;
    }
    int r=1,sum=1;
    REP(i,N-1){
        if(Q[i]<Q[i+1]){
            r++;
        }else{
            sum=max(sum,r);
            r=1;
            //cout << i << " " << r << endl;
        }
    }
    sum=max(sum,r);
   // REP(i,N){cout << Q[i]+1 << " ";}cout << endl;
    cout << N - sum << endl;
  return 0;
}


Measured memory_bytes: 3584
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int W = int.Parse(input[0]);
    int a = int.Parse(input[1]);
    int b = int.Parse(input[2]);
    
    int diff = Math.Max(a, b) - (Math.Min(a, b) + W);
    Console.WriteLine(Math.Max(0, diff));
  }
}

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

int main() {
  int N, K, i, a = 1;
  cin >> N >> K;
  
  for(i = 0; i < N; i++){
    if(a < K){
      a = 2 * a;
    }
    else{
      a = a + K;
    }
  }
  
  cout << a << endl;
}


Measured memory_bytes: 256
N,Y = map(int,input().split())

Y /= 1000

a = 0
b = 0
c = 0

for i in range(N+1):
    for j in range(N-i+1):
        if 9*i + 4*j + N == Y:
            a = i
            b = j
            c = N - i - j
            break

if a != 0 or b != 0 or c != 0:
    print(a,b,c)
else:
    print(-1,-1,-1)


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

 int main()
 {

     int a,b,c,d,e,f;
     cin>>a>>b>>c;

     if(b>c)
        cout<<"0"<<endl;
     else
     {
         d=c/a;
         e=d*b;

         cout<<e<<endl;
     }

     return 0;
 }


Measured memory_bytes: 256
//この問題の書き方だと「有向グラフ」に見えてしまいます。サンプルで察しましたが…
//解法：3つの候補すべてに辺をはってもよい。→ダメだとしたらs->t最短路の中に「必ず2つ以上の候補を使わないといけない」ことがある
//→実際は2回で移動できるなら1回でより良い移動ができるので、こういうパターンはない→つまりダメなパターンはない。
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#define int long long
using namespace std;

int INF = 1e+15;
int n, m, s, t;
vector<int> et[100000];
vector<int> ec[100000];
int dist[100000];

signed main() {
	int i;
	
	cin >> n >> m >> s >> t; s--; t--;
	for (i = 0; i < m; i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--; b--; c--;
		et[a].push_back(b); ec[a].push_back(d); et[b].push_back(a); ec[b].push_back(d);
		et[a].push_back(c); ec[a].push_back(d); et[c].push_back(a); ec[c].push_back(d);
		et[b].push_back(c); ec[b].push_back(d); et[c].push_back(b); ec[c].push_back(d);
	}
	
	typedef pair<int, int> P;
	priority_queue<P, vector<P>, greater<P> > que;
	for (i = 0; i < n; i++) dist[i] = INF;
	
	dist[s] = 0; que.push(P(0, s));
	while (!que.empty()) {
		P now = que.top(); que.pop();
		int cst = now.first;
		int pos = now.second;
		for (i = 0; i < et[pos].size(); i++) {
			int npos = et[pos][i];
			int ncst = cst + ec[pos][i];
			if (dist[npos] > ncst) {
				dist[npos] = ncst;
				que.push(P(ncst, npos));
			}
		}
	}
	
	cout << dist[t] << endl;
	return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;            typedef vector<ll> vl;
typedef vector<vi> vvi;         typedef vector<vl> vvl;
typedef pair<int, int>     pii;    typedef pair<ll, ll> pll;
typedef vector<pii> vii;         typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define in insert
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
const ll INFL = 1e18;
const int INFI = 1e9;
#ifdef KARAN
    #include "../../trace.h"
#else
    #define trace(args...)
#endif

ll div_floor(const ll &a,const ll &b) { return a / b - (((a ^ b) < 0) and a % b);}
ll div_ceil(const ll &a,const ll &b) { return a / b + (((a ^ b) >= 0) and a % b);}
ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
    while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; x--; y--; forn(i, m){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}}

void process(int s, vvi &adj, vi &dp){
    if(dp[s]) return;
    dp[s] = 1;
    for(auto v: adj[s])
        process(v, adj, dp), dp[s] = max(dp[s], 1 + dp[v]);
}

void solve(){
    int n, m; cin>>n>>m;
    vvi adj(n);
    vb visited(n, false);
    vi dp(n, 0);
    forn(i, m){
        int u, v; cin>>u>>v;
        u--; v--;
        adj[u].pb(v);
    }
    forn(i, n) process(i, adj, dp);
    trace(dp);
    int ans = 0;
    forn(i, n) ans = max(ans, dp[i]);
    cout<<ans-1<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifdef KARAN
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        freopen("err.txt", "w", stderr);
    #endif
    int t=1;
    while(t--)
        solve();
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
  ll N, A;
  cin >> N;
  vector<ll> buka(N,0);
  for (int i = 0; i < N - 1; i++) {
    cin >> A;
    buka[A-1]++;
  }
  for(int i = 0; i < N; i++) cout << buka[i] << endl;
}

Measured memory_bytes: 4764
#include<iostream>
#include<cstdio>

using namespace std;

int main(void){
	while(1){
		int n;
		scanf("%d",&n);
		if(n==0)break;
		int f=-1,t=0;
		bool ch=false;
		for(int i=0;i<n;i++){
			int a;
			scanf("%d",&a);
			if(f>=0){
				if(t+1==a){
					t=a;
					if(i+1==n){
						if(ch==true)printf(" ");
						printf("%d-%d",f,t);
						ch=true;
					}
				}else{
					if(ch==true)printf(" ");
					if(f!=t)printf("%d-%d",f,t);
					if(f==t)printf("%d",f);
					if(i+1==n)printf(" %d",a);
					ch=true;
					f=a;
					t=a;
				}
			}else{
				if(i+1==n){
					if(ch==true)printf(" ");
					printf("%d",a);
					ch=true;
				}
				f=a,t=a;
			}
		}
		printf("\n");
	}
    return 0;
}

Measured memory_bytes: 1192
def atc_077a(input_value: str) -> str:
    C1 = input_value[0]
    C2 = input_value[1]

    if C1[0] == C2[2] and C1[1] == C2[1] and C1[2] == C2[0]:
        return "YES"
    else:
        return "NO"


C1 = input()
C2 = input()
print(atc_077a([C1, C2]))

Measured memory_bytes: 8988
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [i for i in range(n)]
ans = set(l)
for i in range(m):
  a, b = map(int, input().split())
  a = a-1
  b = b-1
  if h[a] > h[b]:
    ans.discard(b)
  elif h[a] == h[b]:
    ans.discard(a)
    ans.discard(b)
  else:
    ans.discard(a)

print(len(ans))
    

Measured memory_bytes: 23776
#include<cstdio>
#include<algorithm>
using namespace std;

int main()
{
	int n,m,ans=1;
	scanf("%d%d",&n,&m);
	for(int i=0 ; i<n ; i++ ){
		ans+=min(ans,m);
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

#include <set>
constexpr int Inf = 2*1e9;

int main(void){
    Cin(int, n, q);
    vector<pair<int, int>> ev;
    For(i, n){
        Cin(int, s, t, x);
        ev.emplace_back(s-x, x);
        ev.emplace_back(t-x, -x);
    }
    Sort(ev);
    set<int> x {Inf};
    auto e = ev.begin();
    Rep(q){
        Cin(int, d);
        while(e != ev.end() && e->first <= d){
            if(e->second > 0) x.insert(e->second);
            else x.erase(-e->second);
            e ++;
        }
        Cout(*x.begin() < Inf ? *x.begin() : -1);
    }
}


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

int main() {
	ll a;
	double b;
	cin >> a >> b;
	ll c;
	c = 100 * b+0.1;
	cout << a * c / 100;
	return 0;
}

Measured memory_bytes: 3688
#include<cstdio>
const int N=200002;
int n,m,q,i,j,k,a,b,h[N],t[N],v[N];
int col[N],vis[N],x[N],d[N],c[N];
void add(int a,int b){
	t[++k]=h[a];
	h[a]=k;
	v[k]=b;
}
void init(){
	scanf("%d%d",&n,&m);
	while(m--){
		scanf("%d%d",&a,&b);
		add(a,b);
		add(b,a);
	}
	scanf("%d",&q);
	for(i=1;i<=q;i++)
		scanf("%d%d%d",x+i,d+i,c+i);
}
void dfs(int i,int d,int c){
	if(vis[i]>>d)return;
	vis[i]|=1<<d;
	if(!col[i])col[i]=c;
	if(d)
		for(int j=h[i];j;j=t[j])
			dfs(v[j],d-1,c);
}
void work(){
	for(i=q;i;i--)
		dfs(x[i],d[i],c[i]);
	for(i=1;i<=n;i++)
		printf("%d\n",col[i]);
}
int main(){
	init();
	work();
	return 0;
}

Measured memory_bytes: 5888
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int a=in.nextInt(),b=in.nextInt(),c=in.nextInt();
		if((a==1 && b==1) || c==1)System.out.println("Open");
		else System.out.println("Close");
	}

}



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

using namespace std;

typedef long long ll;

ll MOD = 1000000007;

int main(int, char**) {
        int n;
        cin >> n;
        for (int i=0; i<n; i++) {
                int a;
                cin >> a;
                if (a%2==1) continue;
                if (a%2==0&&(a%3==0||a%5==0)) continue;
                else {
                        cout << "DENIED" << endl;
                        return 0;
                }
        }
        cout <<"APPROVED" << endl;
        return 0;
}


Measured memory_bytes: 256
// @Author :- Gaurav Bharti
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define empb emplace_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define mapii map<int,int> 
#define mapll map<ll,ll>
#define all(a) a.begin(),a.end()
#define test ll t; cin>>t; while(t--)
#define prec(n) fixed<<setprecision(n)
#define jaldibazi ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007


int main(){
	jaldibazi;

	ll n, ans =0 ;cin >> n;
	vll a(n);

	for (auto &i : a) cin >> i;

	ll in = a[0];

	for(int i = 1; i< n; ++i ){
		if(a[i]<in ){
			ans += in - a[i];
		}
		else if(a[i]>=in) {
			in = a[i];
			ans += in - a[i];
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t n, k, a = 0;
  cin >> n >> k;
  if (n > k) {
    n = n % k;
  }
  do {
    a = n;
    if (n > k) {
      n -= k;
    } else {
      n = k - n;
    }
  } while (n < a);
  cout << a << endl;
}


Measured memory_bytes: 256