akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
#include <limits>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <deque>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <sstream>
#include <type_traits>
#define SET(x,y) x |= (1 << y)
#define CLEAR(x,y) x &= ~(1<< y)
#define READ(x,y) ((0u == (x & (1<<y)))?0u:1u)
#define TOGGLE(x,y) (x ^= (1<<y))
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define si(n) scanf("%d",&n)
#define sf(n) scanf("%f",&n)
#define sl(n) scanf("%lld",&n)
#define slu(n) scanf("%llu",&n)
#define sd(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define pnl printf("\n")
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pF first
#define pS second
#define CL(a,b) memset(a,b,sizeof(a))
#define sqr(x) ((x)*(x))
#define intLIMIT numeric_limits<int>
#define longLIMIT numeric_limits<long long>
#define GCD(a,b) __gcd((a),(b))
#define dbl(x) (double)(x)
#define vi vector <int>
#define vii vector < pair <int, int> >
#define vll vector <long long>
#define allof(x) (x).begin(), (x).end()
#define fastCin cin.sync_with_stdio(0);cin.tie(0)
#define scanUnsigned(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define printArr(a,l) cout<<#a<<": ";for(int i=0;i<(l);i++){cout<<a[i]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(int i=0;i<(r);i++){for(int j=0;j<(c);j++){cout<<a[i][j]<<" ";}cout<<endl;}
char _;
using namespace std;
void PRINT (int x, int y) { for (int i = y-1; i >= 0; i--) { cout << READ(x,i); } cout << endl; }

vector<string>vec_splitter(string s){s+=',';vector<string>res;while(!s.empty()){res.push_back(s.substr(0,s.find(',')));s=s.substr(s.find(',')+1);}
return res;}
void debug_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,__attribute__((unused))int LINE_NUM){cerr<<endl;}
template<typename Head,typename...Tail>void debug_out(vector<string>args,int idx,int LINE_NUM,Head H,Tail...T){if(idx>0)cerr<<", ";else cerr<<"Line("<<LINE_NUM<<") ";stringstream ss;ss<<H;cerr<<args[idx]<<" = "<<ss.str();debug_out(args,idx+1,LINE_NUM,T...);}
#ifdef LOCAL_DBG
#define dbg(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define dbg(...) 42
#endif

int main () {
	fastCin;
	int n;
	cin >> n;
	if (n <= 599) {
		cout << 8;
	} else if (n <= 799) {
		cout << 7;
	} else if (n <= 999) {
		cout << 6;
	} else if (n <= 1199) {
		cout << 5;
	} else if (n <= 1399) {
		cout << 4;
	} else if (n <= 1599) {
		cout << 3;
	} else if (n <= 1799) {
		cout << 2;
	} else {
		cout << 1;
	} cout << "\n";
	return 0;
}

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

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

  int cnt[n] = {};
  cnt[0] = 1;
  int key = 0;
  vector<int> v;
  v.push_back(0);

  for (int i = 0;;) {
    cnt[a[i]] += 1;
    v.push_back(a[i]);
    if (cnt[a[i]] == 2) {
      key = a[i];
      break;
    }
    i = a[i];
  }
  v.pop_back();
  int x = v.size();
  int memory = 0;
  for (int i = 0; i < x; i++) {
    if (v.at(i) == key) {
      memory = i;
      break;
    }
  }
  if (k < memory) {
    int next = 0;
    for (int i = 0; i < k; i++) {
      next = a[next];
    }
    cout << next + 1 << endl;
  } else {
    ll ans = (k - memory) % (x - memory);
    cout << v[ans + memory] + 1 << endl;
  }

  return 0;
}

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(int base, int exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if(exp & 1 == 0) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}

long long p[10][10];

bool issquare(long long n){

    for(int i = 0; i * i <= n; ++i){
        if(i * i == n)
            return true;
    }

    return false;

}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    long long l, r;
    cin >> l >> r;

    long long best = 2019;

    for(long long left = l; left <= min(l + 2019, r); ++left){
        for(long long L = left + 1; L <= min(l + 2019, r); ++L)
            best = min(best, L * left % 2019LL);
    }

    cout << best;

    return 0;
}


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

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using ull = unsigned long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vvs = vector<vs>;
using vc = vector<char>;
using vvc = vector<vc>;
using ii = pair<int,int>;
using vii = vector<ii>;
using vvii = vector<vii>;
using dd = pair<double, double>;
using vdd = vector<dd>;
using vvdd = vector<vdd>;
using Mii = map<int,int>;
using vMii = vector<Mii>;

#define fi first
#define se second
#define INF INT_MAX
#define mod(a,m) (a%m+m)%m
#define PB push_back
#define MP make_pair

vi v;
vll memo;

ll dp(int n) {
	if(n == 0) return 0;
	ll& ans = memo[n];
	if(ans != -1) return ans;
	ans = dp(n-1) + abs(v[n-1] - v[n]);
	if(n != 1) ans = min(ans, dp(n-2) + abs(v[n-2] - v[n]));
	return ans;
}

int main(){
//	cout.setf(ios::fixed);
//	cout.precision(4);
	int n;
	while (cin >> n) {
		v = vi(n);
		for (int i = 0; i < n; ++i) cin >> v[i];
		memo = vll(n, -1);
		cout << dp(n-1) << '\n';
	}
}




Measured memory_bytes: 6144
import collections

N = int(input())
V = [int(_) for _ in input().split()]

def calc(vs):
    r = dict(collections.Counter(vs))
    r[0] = 0
    ri = r.items()
    return sorted(ri, key=lambda x:-x[1])

ve = calc(V[::2])
vo = calc(V[1::2])

result = 0

if ve[0][0] != vo[0][0]:
    result = N - ve[0][1] - vo[0][1]
else:
    result = min(N - ve[0][1] - vo[1][1], N - ve[1][1] - vo[0][1])

print(result)



Measured memory_bytes: 23760
//g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  ll N,M,X;
  cin >> N >> M >> X;
  vector<ll> C(N+10);
  vector<vector<ll>> A(N+10,vector<ll>(M+10));
  rep(i,N){
    cin >> C[i];
    rep(j,M){
      cin >> A[i][j];
    }
  }

  ll ans = INFL;


  for(int bit = 0;bit < (1<<N);bit++){
    vector<ll> sum(M,0);
    ll tmp = 0;
    for(int i = 0;i < N;i++){
      if((bit>>i)&1){
        tmp+=C[i];
        rep(j,M)sum[j]+=A[i][j];
      }
    }
    bool  flag = true;
    rep(i,M){
      if(sum[i]<X)flag = false;
    }
    if(flag)ans = min(ans,tmp);
  }
  if(ans!=INFL){
    cout << ans << endl;
  }else{
    cout << -1 << endl;
  }


}


Measured memory_bytes: 3640
//  n!n よくわかってない


#include <bits/stdc++.h>
using namespace std;
 
double distance(double xi, double yi, double xj, double yj) {
    // ２点間の距離を求める関数
    return sqrt((xi - xj) * (xi - xj) + (yi - yj) * (yi - yj));
}
 
int main() {
    // 入力
    int N;
    cin >> N;
    vector<double> x, y;
    for (int i = 0; i < N; i++) {
        double tmp_x, tmp_y;
        cin >> tmp_x >> tmp_y;
        x.emplace_back(tmp_x);
        y.emplace_back(tmp_y);
    }
 
    // 距離を計算して distance_table に格納しておく
    double distance_table[10][10]; // distance_table[i][j]: i,jの距離
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            distance_table[i][j] = distance(x[i], y[i], x[j], y[j]);
            distance_table[j][i] = distance(x[i], y[i], x[j], y[j]);
        }
    }
 
    // 順列の始めのケースを作成: {0,1,2,...,n-1}
    vector<int> one_permutation_case;
    for (int i = 0; i < N; i++) {
        one_permutation_case.emplace_back(i);
    }
 
    double sum_distance = 0; // 総移動距離の合計
    int case_number = 0;     // 何通りあったか
    do {
        // 移動距離を sum_distance に加えていく
        case_number++;
        int now = one_permutation_case[0];
        for (int i = 1; i < N; i++) {
            int next = one_permutation_case[i];
            sum_distance += distance_table[now][next];
            now = next;
        }
    } while (next_permutation(one_permutation_case.begin(), one_permutation_case.end()));
 
    // setprecision(10) が無いと精度が足りない
    cout << setprecision(10) << sum_distance / case_number << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define inl(a) cin >> a
#define prl(a) cout << a << " "
#define outl(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
#define tddd tuple<double,double,double>
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int > >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define N 10005
typedef long long int ll;
ll dp[2][N];
bool cmp(pair<ii,int> A,pair<ii,int> B)
{
    return min(A.F.S,B.F.S-A.F.F)>min(B.F.S,A.F.S-B.F.F);

}
int main()
{
    int i,j,n,w,c,v;
    int C=0;
    in(n);
    viii ad(n);
    rep(i,n)
    {
        in3(w,c,v);
        C=max(C,c);
        ad[i]={{w,c},v};
    }
    sort(all(ad),cmp);
    int a=0,b=1;
    ll x,ans=0;
    rep(i,n)
    {
        w=ad[i].F.F,c=ad[i].F.S,v=ad[i].S;
        x=0;
        rep(j,c+1)
            x=max(x,dp[a][j]);
        ans=max(ans,x+v);
        lp(j,w,1+min(C,c+w))
            dp[b][j]=max(dp[b][j],v+dp[a][j-w]);
        lp(j,w,1+min(C,c+w))
            dp[a][j]=dp[b][j];
    }
    outl(ans);
}








Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
const ll INF = 1000000000;
const ll mod = 1000000007;
#define PI 3.1415926535
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
bool seen[100000];
void dfs(const Graph &G, int v) {
    seen[v] = true; // v を訪問済にする
 
    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

//dpTable
int dp[100050];

int main(){
    int N;
    string S;
    cin >> N >> S;
    stack<char> hoge;
    rep (i,N) {
        if (S.at(i) == '(') hoge.push('(');
        else {
            if (hoge.empty()) hoge.push(')');
            else {
                if (hoge.top() == '(') hoge.pop();
                else hoge.push(')');
            }
        }
    }
    while (!hoge.empty()) {
        if (hoge.top() == '(') {
            S = S + ')';
        }
        else {
            S = '(' + S;
        }
        hoge.pop();
    }
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 3592
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = true;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = sc.nextInt();
        }

        boolean flg = true;
        int[] b = new int[n];
        int left = n / 2;
        int right = left - 1;
        for (int i = 0; i < n; ++i) {
            if (flg) {
                b[++right] = a[i];
            } else {
                b[--left] = a[i];
            }
            flg = !flg;
        }
        if (flg) {
            for (int i = 0; i < n; ++i) {
                if (i > 0) {
                    _out.print(" ");
                }
                _out.print(b[i]);
            }
        } else {
            for (int i = n - 1; i >= 0; --i) {
                _out.print(b[i]);
                if (i > 0) {
                    _out.print(" ");
                }
            }
        }
        _out.println();
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

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

int main(){

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

    int N, K;
    cin >> N >> K;

    vector <int> A;

    for (int i = 0; i < N; i++ ){
        int y;
        cin >> y;
        A.push_back(y);
    }

    for (int i = 0; i < N - K; i++){
        if (A[i] < A[i+K]){
            cout << "Yes\n";
        }
        else{
            cout << "No\n";
        }
    }

}


Measured memory_bytes: 4220
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    int a,b; cin >> a >> b;
    int ans;
    if(a <= 9 && b <= 9) ans = a*b;
    else ans = -1;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int N = 202020;
int a[N],b[N],n;
set<int> S;


int main(){
    scanf("%d",&n);
    rep(i,0,n) scanf("%d",a + i) , b[a[i]] = i;
    ll ans = 0;
    S.insert(-1);S.insert(n);
    rep(i,1,n+1){
        int pos = b[i];
        auto e = S.lower_bound(pos);
        ll R = *e - pos;
        --e;R *= pos - *e;
        S.insert(pos);
        ans += R * i;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 11136
//
//  main.cpp
//  2
//
//  Created by RISHAV SINGH MEHTA on 29/12/19.
//  Copyright © 2019 RISHAV SINGH MEHTA. All rights reserved.
//

#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
int main(int argc, const char * argv[]) {
    // insert code here...
    ll int A,B,K,i,j,k,l;
    cin>>A>>B>>K;
    
    if (K>=A) {
        l= K-A;
        B=B-l;
        if (B<0) {
            B=0;
        }
        A=0;
    }else{
        A=A-K;
        B=B;
    }
    cout<<A<<"\t"<<B;
    
    return 0;
}


Measured memory_bytes: 256
import sys
#許容す再帰処理の回数を変更
sys.setrecursionlimit(10**5+10)
# input処理を高速化する
input = sys.stdin.readline

def chmax(a,b):
    # 最大値を返す関数
    if (a>=b):
        return a
    else:
        return b

def main():
    #入力
    N, M = map(int,input().split())
    #隣接関係は隣接リストで管理する
    lst_edge = [[] for _ in range(N)]
    for _ in range(M):
        x,y = map(int,input().split())
        #最初のindexをゼロとする
        lst_edge[x-1].append(y-1)
    
    #dp[v] :: ノードvを始点とした時の有向パスの長さの最大値
    # -1で初期化
    dp = [-1]*N

    #メモ化再帰
    def rec(v):
        #すでに更新済み
        if (dp[v] != -1):
            return dp[v]
        ans = 0
        lst_nv = lst_edge[v]
        for nv in lst_nv:
            ans = chmax(ans,rec(nv)+1)
        dp[v] = ans
        return dp[v]
      

    # 全ての点に対して更新する
    ans = 0
    for v in range(N):
        ans = chmax(ans,rec(v))

    print(ans)

main()


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

struct Card { char suit, value; };

void bubble(struct Card A[], int N) {
	for (int i = 0;i < N;i++) {
		for (int j = N - 1;j >= i + 1;j--) {
			if (A[j].value < A[j - 1].value) {
				Card t = A[j];A[j] = A[j - 1];A[j - 1] = t;
			}
		}
	}
}

void selection(struct Card A[], int N) {
	for (int i = 0;i < N;i++) {
		int minj = i;
		for (int j = i;j < N;j++) {
			if (A[j].value < A[minj].value) minj = j;
		}
		Card t = A[i];A[i] = A[minj];A[minj] = t;
	}
}

void print(struct Card A[], int N) {
	for (int i = 0;i < N;i++) {
		if (i > 0) cout << " ";
		cout << A[i].suit << A[i].value;
	}
	cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N) {
	for (int i = 0;i < N;i++) {
		if (C1[i].suit != C2[i].suit) return false;
	}
	return true;
}

int main() {
	Card C1[100], C2[100];
	int N;
	char ch;

	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> C1[i].suit >> C1[i].value;
	}

	for (int i = 0;i < N;i++) C2[i] = C1[i];

	bubble(C1, N);
	selection(C2, N);

	print(C1, N);
	cout << "Stable" << endl;
	print(C2, N);
	if (isStable(C1, C2, N)) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}

	return 0;
}

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

int main(){
  int N,M; cin>>N>>M;
  int l=1, r=N;
  rep(i,M){
    int L,R; cin>>L>>R;
    l=max(l,L);
    r=min(r,R);
  }
  cout<<max(0,r-l+1)<<endl;
  return 0;
}


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

const int MOD = 1000000007;

int pos(int m, int n) {
	if (n == 0) {
		return 1;
	}
	else if (n % 2 == 0) {
		return pos((m * m) % MOD, n / 2) % MOD;
	}
	else if (n % 2 == 1) {
		return (pos((m * m) % MOD, n / 2) * m) % MOD;
	}
	return 0;
}


signed main() {
	int m, n;
	cin >> m >> n;

	cout << pos(m, n) % MOD << endl;
}



Measured memory_bytes: 3088
n = int(input())
a = list(map(int, input().split()))
x = max(a)
a.sort()
min = 10 ** 10
del a[-1]
for i in range(n - 1):
    if min > abs(x / 2 - a[i]):
        min = abs(x / 2 - a[i])
        y = a[i]
print(x, y)

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

int main(){
    int N, M;
    int a, b;

    cin >> N >> M;

    vector<int> vec(N,0);

    for(int i=0; i<M; i++){
        cin >> a >> b;
        vec.at(a-1)++;
        vec.at(b-1)++;
    }

    for(int i=0; i<N; i++){
        cout << vec.at(i) << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc,char* argv[]){
  double x1,y1,x2,y2,xq,yq;

  while(scanf("%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&xq,&yq) != EOF){
    double a,b,qa,qb,tx,ty;
    if(x1 == x2){
      if(x1 < xq){
	printf("%lf %lf\n",x1 - (xq - x1),yq);
      }else{
	printf("%lf %lf\n",x1 + (x1 - xq),yq);
      }
      continue;
    }

    a = (y1 - y2)/(x1 - x2);

    if(a == 0){
      if(y1 < yq){
	printf("%lf %lf\n",xq,y1 - (yq - y1));
      }else{
	printf("%lf %lf\n",xq,y1 + (y1 - yq));
      }
      continue;
    }
    
    b = y1 - a*x1;
    
    qa = -1/a;
    qb = yq - qa*xq;

    tx = -(b-qb)/(a-qa);
    ty = tx*a + b;
    printf("%lf %lf\n",tx + (tx - xq),ty + (ty - yq));
  }

  return 0;
  
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

const i32 mod = 998244353;

i32 inv (i32 a) {
  i32 t = 1;
  while (a > 1) {
    t = (i64) t * (mod - mod / a) % mod;
    a = mod % a;
  }
  return t;
}

i32 *fact = NULL;
i32 *iFact = NULL;
void init_fact (const i32 n) {
  fact = (i32 *) calloc (n + 1, sizeof (i32));
  fact[0] = 1;
  for (i32 i = 1; i <= n; ++i) {
    fact[i] = (i64) i * fact[i - 1] % mod;
  }
  iFact = (i32 *) calloc (n + 1, sizeof (i32));
  iFact[n] = inv (fact[n]);
  for (i32 i = n - 1; i >= 0; --i) {
    iFact[i] = (i64) (i + 1) * iFact[i + 1] % mod;
  }
}

i32 comb (i32 n, i32 k) {
  if (!(0 <= k && k <= n)) return 0;
  return (i64) fact[n] * iFact[k] % mod * iFact[n - k] % mod;
}

void run (void) {
  i32 n, x;
  scanf ("%" SCNi32 "%" SCNi32, &n, &x);
  init_fact (n);
  i64 ans = 0;
  for (i32 i = 0; i < x; ++i) {
    for (i32 j = 0; 2 * j <= i; ++j) {
      i32 k = i - 2 * j;
      if (j + k > n) continue;
      i64 way = (i64) comb (n, j) * comb (n - j, k) % mod;
      ans += way;
    }
  }
  for (i32 i = x + 1; i < 2 * x; i += 2) {
    for (i32 j = i / 2; j >= 0; --j) {
      i32 k = i - 2 * j;
      if (j + k > n) break;
      i32 y = (i - x) / 2;
      i64 way = (i64) comb (n, j + k) * comb (j + k - 2 * y - 2, k) % mod;
      ans += way;
    }
  }
  if (x % 2 == 1) {
    for (i32 i = 2 * x; i <= 2 * n; i += 2) {
      ans += comb (n, i / 2);
    }
  }
  printf ("%" PRIi64 "\n", ans % mod);
}

int main (void) {
  run();
  return 0;
}


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


int main(){
	int N; cin >> N;
	LL ans = 0;
	rep(i,N) {
		LL tmp;cin >> tmp;
		while(tmp%2==0){
			ans++;
			tmp /= 2;
		}
	}
	cout << ans << endl;

}














Measured memory_bytes: 3644
n = int(input())
a_input = list(map(int,input().split()))

ans_li = [0 for i in range(min(a_input),max(a_input)+1)]
ans=float('inf')
for i in range(min(a_input),max(a_input)+1):
    cost=sum([(i-a)**2 for a in a_input])
    if cost<ans:
        ans=cost
print(ans)


Measured memory_bytes: 3060
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(void) {
	ll n, k;

	cin >> n >> k;

	ll c = 1;

	int ma = 0;
	int modi = 1e9 + 7;

	for (ll i = 0; i <= n ; i++) {
		ma += i;
	}

	ll min = ma, max = ma;

	for (ll i = n; i >= k;i--) {
		min -= i ;
		max -= (n-i);
		
		c += (max - min + 1);
		c %= modi;
	}

	c %= modi;

	cout << c << endl;

	return 0;
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>

using namespace std;


int main(int argc, char *argv[])
{
	//init
	string s, t;
	cin >> s >> t;

	int a, b;
	cin >> a >> b;

	string u;
	cin >> u;


	//calc
	if (u == s){
		a--;
	}
	else{
		b--;
	}


	//ans
	cout << a << " " << b << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ull = uint64_t;
using ll = int64_t;
using ld = long double;

const int MAXN = 200228;
int b[MAXN];
int a[MAXN];
int nx[MAXN][3];
const ll MOD = 1e9 + 7;
ll f[MAXN];

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);
    string s;
    cin >> s;

    int n = s.length();
    b[0] = 0;

    for (int i = 0; i < n; ++i) {
        a[i] = s[i] - 'a' + 1;
        b[i + 1] = (b[i] + a[i]) % 3;
    }

    bool alternate = true;
    for (int i = 1; i < s.length(); ++i) {
        alternate &= (s[i] != s[i - 1]);
    }

    if (alternate) {
        cout << 1 << "\n";
        return 0;
    }

    for (int i = 0; i < 3; ++i) {
        nx[n + 1][i] = n + 1;
    }

    for (int i = n; i >= 0; --i) {
        copy(nx[i + 1], nx[i + 1] + 3, nx[i]);
        nx[i][b[i]] = i;
    }

    ll ans = (b[0] == b[n]) ? (MOD - 1) : 0;
    f[0] = 1;

    for (int i = 0; i <= n; ++i) {
        if (b[i] == b[n]) {
            ans = (ans + f[i]) % MOD;
        }

        for (int j = 1; j <= 2; ++j) {
            int d = nx[i + 1][(b[i] + j) % 3];
            f[d] = (f[d] + f[i]) % MOD;
        }
    }

    cout << ans << "\n";
}



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

using namespace std;

int a, b, c;

int main () {
	cin >> a >> b >> c;
	for(int i = a; i <= 10000001; i += a) {
		if(i % b == c) {
			cout << "YES";
			return 0;
		}
	}
	cout << "NO";
	return 0;
}

Measured memory_bytes: 256
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int dp[1005][1005];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int H, W; cin >> H >> W;
    rep1(i, H) {
        rep1(j, W) {
            char c; cin >> c;
            if(i == 1 && j == 1) {
                dp[i][j] = 1;
                continue;
            }
            if(c == '#') {
                dp[i][j] = 0;
                continue;
            }
            dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
        }
    }
    cout << dp[H][W] << endl;
}



Measured memory_bytes: 4224
#  = gets.chomp.to_i
# A, B, C = gets.chomp.split.map(&:to_i)
S = gets.chomp

if S == 'Sunny'
  print "Cloudy\n"
elsif S == 'Cloudy'
  print "Rainy\n"
elsif S == 'Rainy'
  print "Sunny\n"
else 
  raise "Invalid!"
end


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector <int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int ans = 0;
  bool stop = false;
  while (!stop) {
    for (int i = 0; i < N; i++) {
      if (A[i]%2==0) {
        A[i] = A[i]/2;
      } else {
        stop = true;
        break;
      }
    }
    if (!stop) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3608
n,m = map(int,input().split())
x = []
y = []
z = []

for i in range(n):
    X,Y,Z = map(int,input().split())
    x.append(X)
    y.append(Y)
    z.append(Z)
    
ppp = []
ppn = []
npp = []
pnp = []
pnn = []
npn = []
nnp = []
nnn = []

for j in range(n):
    ppp.append(x[j] + y[j] + z[j])
    ppn.append(x[j] + y[j] - z[j])
    npp.append(-x[j] + y[j] + z[j])
    pnp.append(x[j] -y[j] + z[j])
    pnn.append(x[j] - y[j] - z[j])
    npn.append(-x[j] + y[j] - z[j])
    nnp.append(-x[j] - y[j] + z[j])
    nnn.append(-(x[j] + y[j] + z[j]))
    
ppp.sort(reverse=True)
ppn.sort(reverse=True)
npp.sort(reverse=True)
pnp.sort(reverse=True)
pnn.sort(reverse=True)
npn.sort(reverse=True)
nnp.sort(reverse=True)
nnn.sort(reverse=True)

print(max(sum(ppp[:m]),sum(ppn[:m]),sum(npp[:m]),sum(pnp[:m]),sum(pnn[:m]),sum(npn[:m]),sum(nnp[:m]),sum(nnn[:m])))

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	for(int i=0;;i++)
	{
		c-=b;
		if(c<=0){
			cout<<"Yes\n";
			break;
		}
		a-=d;
		if(a<=0){
			cout<<"No\n";
			break;
		}
	}
} 

Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>
int main(void){
    
    int a,b,c,d,e;
    scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
    printf("%d",15-a-b-c-d-e);
    
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define prsp(v) loop(i,0,v.size())cout<<v[i],sp;nl;
#define prpsp(v) loop(i,0,v.size())cout<<v[i].F<<" "<<v[i].S<<" , ";nl;
#define prnl(v) loop(i,0,v.size())cout<<v[i],nl;nl;
#define prpnl(v) loop(i,0,v.size())cout<<v[i].F<<" "<<v[i].S,nl;nl;
#define MOD 1000000007
#define mod(n) (((n%MOD)+MOD)%MOD)
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const int MAXN = 1e5+5;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();
    cout<<fixed<<setprecision(10);

    ld n,k;
    cin>>n>>k;

    ld ans = 0;
    for(ld i=1;i<=n;i++)
    {
        ld sc = i;
        ld cc = 0;
        while( sc < k )
        {
            sc *= 2;
            cc++;
        }
        ans += pow(0.5,cc);
    }
    ans /= n;
    cout<<ans,nl;

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#include<deque>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
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; }
const long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n=0;
	string s;
	cin >> s;
	n = s.length();
	for (ll i = 0; i < n/2; i++) {
		rep(v, 2)s.pop_back();
		ll p = s.length();
		for (ll k = 0; k < p/2; k++) {
			if (s[k] == s[k + p / 2]) {
				if (k == p / 2 - 1)return cout << s.length() << endl,0;
				continue;
			}
			else break;
		}
	}
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<queue>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
map<ll,ll>mmp;
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++){
            ll x;
            scanf("%lld",&x);
            mmp[x]++;
        }
        ll ans=2147483648,sum=0;
        for(int i=0;i<31;i++)
        {
            for(map<ll,ll>::iterator it=mmp.begin();it!=mmp.end();it++)
            {

                ll a=(*it).first,b=(*it).second;
                if(a+a==ans) {sum+=b/2;mmp[a]%=2;continue;}
                if(b>0&&ans>a)
                {
                    if(mmp[ans-a]>0)
                    {
                        ll _min=min(b,mmp[ans-a]);
                        mmp[a]-=_min;
                        mmp[ans-a]-=_min;
                        sum+=_min;
                        //printf("%lld %lld %lld\n",a,ans-a,_min);
                    }
                }
            }
            ans/=2;

        }
        //printf("%d\n",ans);
        printf("%lld\n",sum);
        mmp.clear();
    }
    return 0;
}


Measured memory_bytes: 53248
#include "bits/stdc++.h"
using namespace std;
 
// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
 
 
/*
--------------------------------------------
 
	type
 
--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
//using pair<T1, T2> = p12;
 
/*
--------------------------------------------
 
	container
 
--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
 
/*
--------------------------------------------
 
	repetition
 
--------------------------------------------
*/
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)
 
//algorithm
//#define SORT(c) sort((c).begin(),(c).end())
 
/*
--------------------------------------------
 
	constant
 
--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
/*
 
	Optimizer
 
*/
//#pragma GCC optimize("Ofast")


/*
 
	Utility Algorithm
 
*/
template <typename T>
void swapAlgorithm(T& a, T& b) {
    T tmp = a;
    a = b;
    b = tmp;
}

LL euclideanAlgorithm(LL a, LL b) {
    LL a_tmp = a;
    LL b_tmp = b;

    if (a_tmp > b_tmp) {
        swapAlgorithm<LL>(a_tmp, b_tmp);
    }

    LL r = a_tmp % b_tmp;
    while (r != 0) {
        a_tmp = b_tmp;
        b_tmp = r;
        r = a_tmp % b_tmp;
    }
    return b_tmp;    
}

LL getLCM(LL a, LL b) {
    return (a * b)/(euclideanAlgorithm(a, b));
}

/*
  Code
*/

double eauclidDistance(pair<double, double>& x1, pair<double, double>& x2) {
  return sqrt((x1.first - x2.first) * (x1.first - x2.first) + (x1.second - x2.second) * (x1.second - x2.second));
}

void swap(int& a, int& b) {
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
}

int main(int argc, char const *argv[])
{
  int A,B;
  cin >> A >> B;

  string S,sA,sB;
  cin >> S;

  regex re("(\\d+)");
  std::smatch matchA;
  std::smatch matchB;

  if(S.size() != (A + B + 1)) {
    cout << "No" << endl;
    return 0;
  }

  sA = string(S.substr(0, A));
  sB = string(S.substr(A+1, B));

  if (regex_match(sA, matchA, re)
  && regex_match(sB, matchB, re)
  && S[A] == '-') {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = 0
for i in range(N):
    if B[i] > A[i]:
        if B[i] >= A[i+1] + A[i]:
            ans += A[i+1] + A[i]
            #print(ans,i)
            A[i+1] = 0
        else:
            ans += B[i]
            A[i+1] = A[i+1] - B[i] + A[i]
            #print(ans,i)
    else:
        ans += B[i]
        #print(ans,i)

print(ans)

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

long long int n, m, p[100001], y[100001], ci[100001];
priority_queue<LP,vector<LP>, greater<LP> > city[100001];

int main(){
	cin >> n >> m;
	for(int i=0;i<m;i++){
		cin >> p[i] >> y[i];
		city[p[i]].push(P(y[i], i));
	}
	for(int i=1;i<=n;i++){
		int co = 1;
		while(!city[i].empty()){
			LP q;
			q = city[i].top();
			ci[q.second] = co;
			co++;
			city[i].pop();
		}
	}
	for(int i=0;i<m;i++){
		printf("%06lld%06lld\n", p[i], ci[i]);
	}
	return 0;
}

Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	double sum=0;
	rep(i,n) sum+=a.at(i);
	sum/=n;
	int ans=0;
	double d=10000;
	rep(i,n){
		if(d>abs(sum-a.at(i))){
			ans=i;
			d=abs(sum-a.at(i));
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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


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

    map<ll,ll> m;
    ll i = 2;
    while(p > 1 && i*i <= p){
	while(p%i == 0){
	    m[i]++;
	    p /= i;
	}
	i++;
    }
    m[p]++;

    ll ans = 1;
    for(auto a: m){
	ans *= pow(a.ft,a.sd/n);
    }
    P(ans);
    
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
double getSum(double arr[], int k, int n) {
        int start = 0;
        double sum = 0;
        double maxSum = 0;
 
        for(int end = 0; end < n; end++) {
            sum = sum + arr[end];
 
            if(end >= k -1) {
               maxSum = max(sum, maxSum);
               sum = sum - arr[start];
               start++;
            }
         }
      
       return maxSum;
   }
int main() {
	ll n,k;
	cin>>n>>k;
	double a[n], b[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[i]=(a[i]*(a[i]+1))/2;
		b[i]/=a[i];
	}
	cout<<fixed<<setprecision(7)<<getSum(b, k, n)<<endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  int n, a;
  unordered_map<int, int> amap;
  cin >> n;
  for (int i = 1; i <= n; ++i)
  {
    cin >> a;
    amap[a] = i;
  }
  for (int i = 1; i <= n; ++i) cout << amap[i] << " ";
}


Measured memory_bytes: 7248
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    T=ST()
    N=len(S)
    M=len(T)
    ans = []
    for i in range(N-M+1)[::-1]:
        can = True
        for s,t in zip(S[i:],T):
            if s!=t and s!="?":
                can = False
        if can:
            for j,s in enumerate(S):
                if j<i:
                    if s=="?":
                        ans.append("a")
                    else:
                        ans.append(s)
                else:
                    if len(T)>j-i:
                        ans.append(T[j-i])
                    else:
                        if s=="?":
                            ans.append("a")
                        else:
                            ans.append(s)
            break
    if ans:
        print(*ans,sep="")
    else:
        print("UNRESTORABLE")
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define int long long
#define double long double
#define N 20
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
const double g = 1.0;
int p[N],h[N];

double calcX(double radian,double v){
  double vix = v * cos(radian);
  double viy = v * sin(radian);
  double t = 2 * viy / g;
  return vix * t;
}

double calcV(double x,int n,int b,double radian){
  double L = 0, R = 1e10, cnt = 100;
  while(cnt--){
    double M = (L+R)/2;
    if(calcX(radian,M) > x) R = M;
    else L = M;
  }
    
  double v = L,pos = 0;
  for(int i=0;i<b;i++, pos += x){
    for(int j=0;j<n;j++){
      if(!(pos <= p[j] && p[j] <= pos+x)) continue;
      double vix = v * cos(radian);
      double viy = v * sin(radian);
      double t = (p[j] - pos)/vix;
      double y = -(g*t/2 - viy) * t;
      if(y-h[j]+EPS < 0) return INF;
    }
  }
  return v;  
}

double solve(double x,int n,int b){
  double L = PI/4,R = PI/2,cnt = 100;
  while(cnt--){
    double M = (L+R)/2;
    if(calcV(x,n,b,M) < INF) R = M; 
    else L = M;
  }
  return calcV(x,n,b,R);
}

signed main(){
  int D,n,B;
  cin>>D>>n>>B;
  for(int i=0;i<n;i++) cin>>p[i]>>h[i];
  double ans = INF;
  for(int i=1;i<=B+1;i++) Min(ans,solve(1.0*D/i,n,i));
  printf("%.5Lf\n",ans);
  return 0;
}

Measured memory_bytes: 3512
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
string s;
cin>>s;
if(s[2]==s[3]&&s[4]==s[5])
{
    cout<<"Yes"<<endl;
}else
{
    cout<<"No"<<endl;
}
return 0;
}

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

int main(){
  ll a,b,k;
  cin>>a>>b>>k;
  if(a-k>=0){
    cout<<a-k<<" "<<b<<endl;
  }else if(k<=a+b){
    cout<<0<<" "<<a+b-k<<endl;
  }else{
    cout<<0<<" "<<0<<endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		
		double px, py, x1, y1, x2, y2, angle1, angle2, back, rad, leng1, leng2;
		
		int q;
		
		px = scan.nextDouble();
		py = scan.nextDouble();
		x1 = scan.nextDouble();
		y1 = scan.nextDouble();

		rad = Math.atan2(y1 - py, x1 - px);
		
		angle1 = rad * 180 / Math.PI;
		
		if(angle1 < 0) angle1 += 360;
		
		back = angle1 + 180;
		
		leng1 = Math.sqrt((x1 - px) * (x1 - px) + (y1 - py) * (y1 - py));

		if(back >= 360) back -= 360;
		
		q = scan.nextInt();
		
		for(int i = 0; i < q; i++) {
			x2 = scan.nextDouble();
			y2 = scan.nextDouble();

			rad = Math.atan2(y2 - py, x2 - px);
			angle2 = rad * 180 / Math.PI;
			
			if(angle2 < 0) angle2 += 360;
			
			if(px == x2 && py == y2) {
				System.out.println("ON_SEGMENT");
				
			} else if(angle2 == angle1) {
				leng2 = Math.sqrt((x2 - px) * (x2 - px) + (y2 - py) * (y2 - py));
				
				if((leng2 - leng1) <= 0) {
					System.out.println("ON_SEGMENT");
					
				} else {
					System.out.println("ONLINE_FRONT");
					
				}				
			} else if(angle2 == back) {
				System.out.println("ONLINE_BACK");
				
			} else if (back < 180) {
				if(angle2 > back && angle2 < angle1) {
					System.out.println("CLOCKWISE");
					
				} else {
					System.out.println("COUNTER_CLOCKWISE");
				}
				
			} else {
				if(angle2 < back && angle2 > angle1) {
					System.out.println("COUNTER_CLOCKWISE");
					
				} else {
					System.out.println("CLOCKWISE");
				}				
			}
		}
		scan.close();
	}

}

Measured memory_bytes: 41632
import java.io.PrintWriter;
import java.util.*;

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

        int sum=sc.nextInt();
        dp=new Long[sum+1];
        out.println(f(sum));

        sc.close();
        out.close();
    }
    static  long mod=1000000007;
    static long mul(long a,long b){
        a%=mod;
        b%=mod;
        return (a*b)%mod;
    }
    static long sub(long a,long b){
        a%=mod;
        b%=mod;
        return ((a-b)%mod+mod)%mod;
    }
    static long add(long a,long b){
        a%=mod;
        b%=mod;
        return (a+b)%mod;
    }

    static Long dp[];
    static long f(int sum){
        if(dp[sum]!=null){
            return dp[sum];
        }
        if(sum==0){
            return dp[sum]=1l;
        }
        long ans=0;
        for (int i = 3; i <=sum ; i++) {
            ans=add(ans,f(sum-i));
        }
        return dp[sum]=ans;
    }




}

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

int main() {
	ios_base::sync_with_stdio( false );

	int A, B;
	cin >> A >> B;

	if( A > B ) {
		cout << 2*A - 1 << endl;
	}
	else if( A < B ) {
		cout << 2*B - 1 << endl;
	}
	else {
		cout << 2*A << endl;
	}

	return 0;
}


Measured memory_bytes: 256