akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
const int INF= 1e8;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int h,w,k;
cin>>h>>w>>k;
vector<string>s(h);
rep(i,h)cin>>s[i];
int ans=INF;
rep(div,1<<(h-1)){
    int g=0;
    vector<int> id(h);    
    rep(i,h){
        id[i]=g;
        if(div>>i&1)++g;        
    }
    g++;
    vector<vector<int>>c(g,vector<int>(w));
    rep(i,g)rep(j,w)c[i][j]=0;
    rep(i,h)rep(j,w)c[id[i]][j]+=(s[i][j]-'0');

    vector<int>now(g,0);
    auto add = [&] (int j){
        rep(i,g)now[i]+=c[i][j];
        bool ok=true;
        rep(i,g) if (now[i]>k) return false;
        return true;
    };

    int num=g-1;    
    rep(j,w){
        if(!add(j)){
            num++;
            now=vector<int>(g,0);
            if(!add(j)){
                num=INF;
                break;
            }       
        }
    }
    ans=min(ans,num);
}
cout<<ans<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b, ans=0;
	cin >> a >> b;

	for(int i=0;i<2;i++){
		if(a>=b){
			ans += a;
			a--;
		}
		else{
			ans += b;
			b--;
		}
	}
	cout << ans << endl;
}

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

struct Node { int p, l, r;};

Node T[MAX];
int n,D[MAX];

int rec(int u, int p){
  D[u]=p;
  if(T[u].r!=NIL) rec(T[u].r,p);
  if(T[u].l!=NIL) rec(T[u].l,p+1);
}

int main() {
  int c,id,k[MAX],l,r;
  cin >> n;
  r(i,n)T[i].p=T[i].l=T[i].r=NIL;//ノードを初期化
  
  r(i,n){
    cin >> id;
    cin >> k[id];
    r(j,k[id]){
      cin >> c;
      if(!j)T[id].l=c;
      else T[l].r=c;
      l=c;//一人目の子供の入力を受け取ったとき、子ノードの番号を記録。
      T[c].p=id;
    }
  }
  
  r(i,n){
    if(T[i].p==NIL)r=i;
  }
  
  rec(r,0);
  
  r(i,n){
  cout<<"node "<<i<<": parent = "<<T[i].p<<", depth = "<<D[i]<<", ";
    if(T[i].l!=NIL||T[i].p==NIL){
      if(T[i].p==NIL)cout<<"root, [";
      else cout<<"internal node, [";
      r(j,k[i]){
        if(!j){
         cout<<T[i].l;
          l=T[i].l;
        }
        else {
          cout<<T[l].r;
            l=T[l].r;
        }
        
        if(j!=k[i]-1)cout<<", ";
      }
      cout<<"]"<<endl;
    }
    else cout<<"leaf, []"<<endl; 
  }
}


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

int main(){
  int N, D;
  cin >> N >> D;
  
  int tmp = N;
  int count = 0;
  for(int i = 0; i < 100; i++){
    count++;
    tmp = tmp - (2*D + 1);
    if(tmp <= 0) break;
  }
  cout << count << endl;
}

    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
    


  int main(){
     lint n,m,k;
     cin>>n>>m>>k;
     vector<lint> a(n);
     vector<lint> b(m);
     rep(i,n)cin>>a[i];
     rep(i,m){
         lint x;
         cin>>x;
         b[i]=x;
         if(i!=0)b[i]+=b[i-1];
     }
    lint ans=0;
    lint sum=0;
    auto h=upper_bound(all(b),k);
    ans=h-b.begin();
    rep(i,n){
        sum+=a[i];
        if(k<sum)break;
        auto x=upper_bound(all(b),k-sum);
        lint add=x-b.begin();
        ans=max(ans,i+1+add);
    }
    cout<<ans<<endl;
     }
     

  
 
  
      
      
    
 
  
          
  

Measured memory_bytes: 6380
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<vector<vector<vector<int>>>> vvvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<vector<vector<vector<ll>>>> vvvvl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;



int main() {
  int N;
  cin >> N;
  vvi kyori(N,vi(2));
  for(int i = 0; i < N; i++){
    cin >> kyori[i][0] >> kyori[i][1];
  }
  double goukei = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      double x = (kyori[i][0] - kyori[j][0])*(kyori[i][0] - kyori[j][0]) + (kyori[i][1] - kyori[j][1])*(kyori[i][1] - kyori[j][1]);
      //cout << x <<endl;
    double h = pow(x,0.5);
    //cout << h <<endl;
    goukei += h;
    }
  }
    cout << fixed << setprecision(10) << goukei/N << endl;

}

Measured memory_bytes: 512
n=int(input())
a=list(map(int,input().split()))
b=[];c=1;d=-1
for i in range(1,n):
  if a[i]-a[i-1]<0:b.append(-1)
  elif a[i]-a[i-1]>0:b.append(1)
for j in range(1,len(b)):
  if b[j]*b[j-1]<0 and d!=j-1:
    c+=1
    d=j
print(c)

Measured memory_bytes: 14252
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>

using namespace std;

bool cheacker(vector<int> vec, int a[]) {
	for (int i = 0; i < vec.size(); i++) {
		if (vec[i] != a[i])return false;
	}
	return true;
}

int main() {
	int N;
	cin >> N;
	int a[8];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int b[8];
	for (int i = 0; i < N; i++) {
		cin >> b[i];
	}
	vector<int> num;
	for (int i = 0; i < N; i++) {
		num.push_back(i + 1);
	}
	int count = 1;
	int x, y;
	do {
		if (cheacker(num, a))x = count;
		if (cheacker(num, b))y = count;
		count++;
	} while (next_permutation(num.begin(), num.end()));
	int ans = x < y ? y - x : x - y;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/*
░░░░░░░░░░░░░░░░▄▄█▀▀██▄▄░░░░░░░
░░░░░░░░░░░░░▄█▀▀░░░░░░░▀█░░░░░░
░░░░░░░░░░░▄▀░░░░░░░░░░░░░█░░░░░
░░░░░░░░░▄█░░░░░░░░░░░░░░░█░░░░░
░░░░░░░██▀░░░░░░░▄▄▄░░▄░█▄█▄░░░░
░░░░░▄▀░░░░░░░░░░████░█▄██░▀▄░░░
░░░░█▀░░░░░░░░▄▄██▀░░█████░██░░░
░░░█▀░░░░░░░░░▀█░▀█▀█▀▀▄██▄█▀░░░
░░░██░░░░░░░░░░█░░█░█░░▀▀▄█▀░░░░
░░░░█░░░░░█░░░▀█░░░░▄░░░░░▄█░░░░
░░░░▀█░░░░███▄░█░░░░░░▄▄▄▄█▀█▄░░
░░░░░▀██░░█▄▀▀██░░░░░░░░▄▄█░░▀▄░
░░░░░░▀▀█▄░▀▄▄░▄░░░░░░░███▀░░▄██
░░░░░░░░░▀▀▀███▀█▄░░░░░█▀░▀░░░▀█
░░░░░░░░░░░░▄▀░░░▀█▄░░░░░▄▄░░▄█▀
░░░▄▄▄▀▀▀▀▀█▀░░░░░█▄▀▄▄▄▄▄▄█▀▀░░
░▄█░░░▄██▀░░░░░░░░░█▄░░░░░░░░░░░
█▀▀░▄█░░░░░░░░░░░░░░▀▀█▄░░░░░░░░
█░░░█░░░░░░░░░░░░░░░░░░█▄░░░░░░░*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define mp make_pair
const ll mod = 1000000007;
const ll nmax=2525*1001;
#define int ll
int n, k;
vi v;
int mx;
     
int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
	int a;
	string s;
	cin>>a>>s;
	if(a<3200) cout<<"red";
	else cout<<s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && a==c && b==c){
    cout<<"No \n";
  }else{
    if(a!=b && a!=c && b!=c){
      cout<<"No\n";
    }else{
    cout<<"Yes\n";
  }
  }
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std;
 
const int INF = 0x3f3f3f3f;
const int N = 1e5+20;
const double eps = 1e-8;
 
char mp[1000][1000];
int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
int vis[1000][1000];
int n, m, k;
int bfs(int sx, int sy)
{
    MMF(vis);
    int ans = INF;
    queue<PII>q;
    q.push(MP(sx, sy));
    while(!q.empty())
    {
        PII nw = q.front();
        q.pop();
        int sp = min(min(nw.fi - 1, nw.se - 1), min(n - nw.fi , m - nw.se));
        ans = min(sp / k + ((sp%k)?1:0), ans);
        for(int i = 0; i < 4; i++)
        {
            int nx = nw.fi + dir[i][0];
            int ny = nw.se + dir[i][1];
            if(nx > 0 && ny > 0 && nx <= n && ny <= m && mp[nx][ny] == '.')
            {
                if(!vis[nx][ny] && abs(nx - sx) + abs(ny - sy) <= k)
                    vis[nx][ny] = 1, q.push(MP(nx, ny));
            }
        }
    }
    return ans;
}
 
int main()
{
    while(cin >> n >> m >> k)
    {
        getchar();
        int sx = -1, sy = -1;
        for(int i = 1; i <= n; i++)
        {
            for(int j = 1; j <= m; j++)
            {
                scanf("%c",&mp[i][j]);
                if(mp[i][j] == 'S')
                    sx = i, sy = j;
            }
            getchar();
        }   
        int ans = bfs(sx, sy);
        printf("%d\n", ans + 1);
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  bool first = false;
  rep(i, n) if (a[i] % 2) first = true;
  if (first) cout << "first" << endl;
  else cout << "second" << endl;
  return 0;
}

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

ll X,Y,Z,A,B,C,N;
ll t[MAX],u[MAX],ans[1000];

ll calc(ll h,ll w,ll n){
  ll a=(n<h?1LL:n-h+1);
  ll b=(n<w?n:w-1LL);
  return max(0LL,b-a+1LL);
}

ll sum(ll a,ll b){
  return u[b]-(0<=a-1?u[a-1]:0LL);
}

int main(){
  cin>>X>>Y>>Z>>A>>B>>C>>N;
  t[0]=u[0]=1;
  for(ll i=1;i<X+Y;i++){
    t[i]+=calc(X-A,Y-B,i);
    t[i]+=calc(B+1,X-A,i);
    t[i]+=calc(Y-B,A+1,i);
    t[i]+=calc(A+1,B+1,i);
  }  
  for(int i=1;i<MAX;i++)u[i]=t[i]+u[i-1];
  for(ll i=0,j=0;i<X+Y+Z;i++,j=(j+1==N?0:j+1)){
    ans[j]+=sum(i-C,i);
    ans[j]+=sum(i-(Z-C-1),i);
    ans[j]-=t[i];
  }
  for(ll i=0;i<N;i++){
    if(i)cout<<' ';
    cout<<ans[i];
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 46212
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>
#include <iomanip>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
    int n, sum = 0, ans = 2020202020000000;
    int a[200001] = {};
    cin >> n;

    rep(i, 0, n) cin >> a[i], sum += a[i];
    int tmp = 0;
    rep(i, 0, n - 1) {
        tmp += a[i];
        ans = min(ans, abs(sum - tmp * 2));
     }

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   long long a;
   string s;
    cin>>a>>s;
    long long b;
    b=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
    cout<<(a*b)/100;
    cout<<"\n";
    return 0;
}


Measured memory_bytes: 3616
# -*- coding: utf-8 -*-

def assignColor():
    C = [-1 for i in range(n)]
    for i in range(n):
        if C[i] == -1:
            C = BFS(i, C)
    return C

#@profile
def BFS(start, C):
    Q = [start]
    C[start] = start

    while len(Q) != 0:
        u = Q.pop(0)
        v = [i for i in G[u] if C[i] == -1] # v := ??£??\???????????????????????¢?´¢??????????????????
        
        for i in v:
            Q.append(i)
            C[i] = C[start]
    
    return C

def main():
    
    for i in range(m):
        s, t = list(map(int, input().split()))
        G[s].append(t)
        G[t].append(s)

    C = assignColor()
        
    q = int(input())
    
    for i in range(q):
        s, t = list(map(int, input().split()))
        if C[s] == C[t]:
            print("yes")
        else:
            print("no")
            
if __name__ == "__main__":
    n, m = list(map(int, input().split()))
    G = [[] for i in range(n)]

    main()    

Measured memory_bytes: 32728
//***No one wants to die...yet death is the destiation we all share***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll a[10000002];

int main(){
	ll n,s=0;
	cin>>n;
	for1(i,n){
		for(ll j=i;j<=n;j+=i) a[j]++;
	}
	for1(i,n) s+=(i*a[i]);
	cout<<s;
}

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

using namespace std;

const int maxN = (int)1E5+5;

int n;
int a[maxN];

int main() {
	scanf("%d", &n);
	int res = 1;
	int tp = 0;
	scanf("%d", &a[0]);
	for (int i = 1; i < n; ++i) {
		scanf("%d", &a[i]);
		if ((a[i] > a[i-1] && tp == -1) || (a[i] < a[i-1] && tp == 1)) {
			++res;
			tp = 0;
			continue;
		}
		if (tp == 0) {
			if (a[i] > a[i-1]) tp = 1;
			else if (a[i] < a[i-1]) tp = -1;
		}
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 640
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    a = max([LI() for _ in range(n)])
    return sum(a)


print(main())




Measured memory_bytes: 23556
#include<iostream> 
using namespace std;
int d,n,cnt;
int check(int x)
{
	int t=0;
	while(!(x%100))
	{
		t++;
		x/=100;
	}
	return t;
}
int main()
{
	cin>>d>>n;
	while(true)
	{
		cnt++;
		if(check(cnt)==d)n--;
		if(!n)
		{
			cout<<cnt<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)


def 関数(n):
    ac = 0
    wa = 0
    tle = 0
    re = 0

    for i in range(n):
        keesu = sys.stdin.readline().rstrip()
        if keesu == "AC": 
            ac += 1
        elif keesu == "WA":
            wa += 1
        elif keesu == "TLE":
            tle += 1
        elif keesu == "RE":
            re += 1
        else:
            print("Erreur: ", keesu)

    print("AC x", ac)
    print("WA x", wa)
    print("TLE x", tle)
    print("RE x", re)

def çözmek():
 
    N = int(input())

    関数(N)

if __name__ == "__main__":
    çözmek()


Measured memory_bytes: 9268
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int ma = 0;
        int[] x = new int[n + 1];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            ma = Math.max(a, x[i]);
            x[i] = x[i] - a;
        }
        long[][] dp = new long[n+1][2*n*ma + 1];
        dp[0][n*ma] = 1;
        for (int i = 0; i < n ;i++) {
            for (int j = 0; j <= 2*n*ma; j++) {
                dp[i+1][j] += dp[i][j];
                if (0 <= (j -x[i]) && (j-x[i]) <= 2*n*ma) {
                    dp[i+1][j] = dp[i][j] + dp[i][j-x[i]];
                }
            }
        }
        System.out.println(dp[n][n*ma]-1);
    }
}

Measured memory_bytes: 23252
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),(OUT(YES),1),(OUT(NO),0))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 5010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p998 = 998244353;
const LL p107 = 1000000007;
const LL p = p107;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
//LL A[SIZE],B[SIZE],C[SIZE];
LL solve(){
	cin >> N >> D;
	LL ans=0;
	REP(i,N){
		LL x,y;
		cin >> x >> y;
		if(x*x+y*y<=D*D) ans++;
	}
	return ans;
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	LL T=1;

	REP(i,T){
		DEFAULT;
	}
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


Measured memory_bytes: 15360
#include<iostream>
#include<algorithm>
using namespace std;
int a[100],b[100];
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)cin>>a[i]>>b[i];
	for(int i=0;i<m-1;i++){
		for(int j=m-1;j>i;j--){
			if(a[j]<a[j-1]){
				int tmp=a[j];
				a[j]=a[j-1];
				a[j-1]=tmp;
				tmp=b[j];
				b[j]=b[j-1];
				b[j-1]=tmp;
			}
		}
	}
	int ans=1,top=1;
	bool impossoble=false;
	while(true){
		int best=top;
		bool na=true;
		for(int i=0;a[i]<=top&&i<m;i++)if(best<=b[i])best=b[i],na=false;
		if(na){impossoble=true;break;}
		top=best+1;
		if(top>n)break;
		ans++;
	}
	if(impossoble)cout<<"Impossible"<<endl;
	else cout<<ans<<endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N + 1), ans(N + 1);
  for (int i = 1; i < N + 1; i++) cin >> A.at(i);
  for (int i = N; i >= 1; i--) {
    int sum = 0;
    for (int j = i; j < N + 1; j += i) {
      sum += ans.at(j);
    }
    ans.at(i) = abs(A.at(i) - sum % 2);
  }
  cout << accumulate(ans.begin(), ans.end(), 0) << "\n";
  for (int i = 1; i < N + 1; i++) if (ans.at(i)) cout << i << "\n";
}

Measured memory_bytes: 2432
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	
	ll n,i,j, a[mx], b[mx];
	cin>>n;
	for(i=1; i< n+2 ; i++)
	cin>>a[i];
	
	for(i=1; i<n+1 ; i++)
	cin>>b[i];
	
	ll ans=0;
	for(i=1; i<n+1; i++){
	/*	if(a[i]<= b[i])
		{
			ans+= a[i];
			a[i]= 0;
			b[i]-=a[i];
		}
		else{
			ans+= b[i];
			b[i]=0;
			a[i]-=b[i];
		}
		
		if(a[i+1]<= b[i])
		{
			ans+= a[i+1];
			a[i+1]= 0;
			b[i]-=a[i+1];
		}
		else{
			ans+= b[i];
			b[i]=0;
			a[i+1]-=b[i];
		}*/
		
		ll k1= min(a[i], b[i]);
		a[i]-= k1;
		b[i]-= k1;
		ans+= k1;
		
		 k1= min(a[i+1], b[i]);
		a[i+1]-= k1;
		b[i]-= k1;
		ans+= k1;
	}
	cout<<ans;
    return 0;
}























Measured memory_bytes: 2944
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class CAlchemist {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<double> vec(n);
      rep(i, n) cin >> vec[i];
      sort(all(vec));
      double ans = vec[0];
      for(int i=1; i<n; i++) {
        ans += vec[i];
        ans /= 2;
      }
      cout << setprecision(10) << fixed << ans << endl;
    }
};

signed main() {
  CAlchemist solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

signed main(){
	int N, M, i, S = 0;
	scanf("%d%d", &N, &M);
	for(i = 0; i < M; i++){
		int A;
		scanf("%d", &A);
		S += A;
	}
	printf("%d\n", max(-1, N - S));
	return 0;
}

Measured memory_bytes: 3832
n=int(input())
A=list(map(int,input().split()))

def solve(a,t):
  ans,x=0,0
  for i in a:
    x+=i
    if t==True and x<1:
      ans+=1-x
      x=1
    elif t==False and x>-1:
      ans+=x+1
      x=-1
    t=not t
  return ans
print(min(solve(A,True),solve(A,False)))

Measured memory_bytes: 14332
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;

int main() {
	int N,t=1,ans=0;
	cin >> N;
	vector<int>a(N);
	for (size_t i = 0; i < N; i++)
	{
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());
	for (size_t i = 0; i < N-1; i++)
	{
		if (a.at(i) == a.at(i + 1)) {
			t++;
		}
		else {
			ans += t % 2;
			t = 1;
		}
	}
	ans += (t % 2);
	cout << ans;
}

Measured memory_bytes: 640
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static Long getLong(){return Long.parseLong(getStr());}
        static boolean isNext(){return sc.hasNext();}
        static char[] splitSingle(String str){return str.toCharArray();}//equalsが使えんので要改修
        public static void main(String[] args){
          int N = getInt();
          String P = "";
          String Q = "";
          String first = "";
          for(int i = 0; i < N; i++){
            first += String.valueOf(i+1);
            P += getStr();
          }
          for(int i = 0; i < N; i++){
            Q += getStr();
          }
          int Pno = 0;
          int count = 1;
          if(first.equals(P)){
            Pno = count;
          }
          int Qno = 0;
          if(first.equals(Q)){
            Qno = count;
          }
          myerr(P);
          myerr(Q);
          while(Pno == 0 || Qno == 0){
            count++;
            first = nextPermutation(first);
            if(first.equals(P)){
              Pno = count;
            }
            if(first.equals(Q)){
              Qno = count;
            }
          }
          myout(Math.abs(Pno - Qno));
        }
        //便利メソッド追加枠ここから
static String nextPermutation (String s) {

	ArrayList<Character> list = new ArrayList<>();
	for (int i=0; i<s.length(); i++) list.add(s.charAt(i));

	int pivotPos = -1;
	char pivot = 0;
	for (int i=list.size()-2; i>=0; i--) {
		if (list.get(i) < list.get(i+1)) {
			pivotPos = i;
			pivot = list.get(i);
			break;
		}
	}

	if (pivotPos==-1 && pivot==0) return "Final";

	int L = pivotPos+1, R = list.size()-1;
	int minPos = -1;
	char min = Character.MAX_VALUE;
	for (int i=R; i>=L; i--) {
		if (pivot < list.get(i)) {
			if (list.get(i) < min) {
				min = list.get(i);
				minPos = i;
			}
		}
	}

	Collections.swap(list, pivotPos, minPos);
	Collections.sort(list.subList(L, R+1));

	StringBuilder sb = new StringBuilder();
	for (int i=0; i<list.size(); i++) sb.append(list.get(i));

	return sb.toString();

}
        //便利メソッド追加枠ここまで
}


Measured memory_bytes: 45568
N = int(input())
A = [int(x) for x in input().split()]
C = [0] * (N+1)
sum = 0

for i in range (0,N):
    C[A[i]]+=1

# print(N,"\n",A)
# print(C)

for i in range(1, N+1):
    sum += C[i]*(C[i]-1)/2

sum = int(sum)
# print(sum)

#   a(a-1)/2 - (a-1)(a-2)/2
# = a-1
for i in range(0,N):
    # print("A[i]" ,A[i])
    print(sum - (C[A[i]] -1))


Measured memory_bytes: 26140
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
#define int unsigned long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int h,w;
	cin>>h>>w;
	if(h==1||w==1)
	{
		cout<<1<<endl;
		return 0;
	}
	int ans=0;
	ans+=(h/2)*((w+1)/2);
	ans+=(h/2)*(w/2);
	ans+=(h%2)*((w+1)/2);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
int solve(int n){
	bool ok[50][31]={};
	bool has[50][50]={};
	rep(i,n) has[i][i]=true;
	rep(i,n){
		int f;
		cin>>f;
		rep(j,f){
			int x;
			cin>>x;
			ok[i][x]=true;
		}
	}
	rep(i,31){
		rep(j,n){
			rep(k,n){
				if(j==k||!ok[j][i]||!ok[k][i]) continue;
				rep(s,n) has[j][s]|=has[k][s];
			}
		}
		rep(j,n){
			bool can=true;
			rep(k,n) if(!has[j][k]) can=false;
			if(can) return i;
		}
	}
	return -1;
}
int main(){
	while(true){
		int n;
		cin>>n;
		if(n==0) break;
		cout<<solve(n)<<endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 2;

void solve() {
    ll N, K; cin >> N >> K;
    vector<ll> a(N);
    for(ll i = 0; i < N; ++i) {
        cin >> a[i];
        --a[i];
    }

    vector<ll> used(N, -1);
    ll now = 0, step = 0;
    used[now] = 0;
    for(int i = 1; i <= N; ++i){
        now = a[now];
        if(used[now] != -1){
            step = i;
            break;
        }
        else{
            used[now] = i;
        }
    }
    ll ini = used[now];
    ll cycle = step - used[now];
    ll rem = (K-ini)%cycle;
    ll count = ini + rem;
    if(K < ini) count = K;

    ll ans = 0;
    for (ll i = 0; i < count; ++i) {
        ans = a[ans];
    }
    cout << ans+1 << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
int main()
{
    int A, B;
    cin >> A >> B;
    REP(i, 10000) {
        if(floor(double(i) * 0.08) == A && floor(double(i) * 0.1) == B) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 384
#include <cstdio>


int N, A, B;
char S[100001];

int main() {
    scanf("%d%d%d", &N, &A, &B);
    scanf("%s", S);
    int b = 0, s = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'c') {
            printf("No\n");
            continue;
        }
        if (S[i] == 'a') {
            if (s < A + B) 
                printf("Yes\n");
            else 
                printf("No\n");
        }
        if (S[i] == 'b') {
            if (s < A + B && b < B)
                printf("Yes\n");
            else  {
                printf("No\n");
                continue;
            }
            b++;
        }
        s++;
    }
    return 0;
}

Measured memory_bytes: 640
import heapq
n,m = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(m)]

es = [[] for i in range(n)]
for x,y in src:
    x,y = x-1,y-1
    es[x].append(y)
    es[y].append(x)

INF = float('inf')
ds = [INF] * n
ans = [-1]*(n)

def dijkstra(start, dists):
    dists[start] = 0
    hq = [(0,start)]
    heapq.heapify(hq)
    while hq:
        dist,v = heapq.heappop(hq)
        for to in es[v]:
            if dist+1 >= dists[to]: continue
            dists[to] = dist+1
            ans[to]=v+1
            heapq.heappush(hq, (dist+1,to))

dijkstra(0,ds)

print('Yes')
print(*ans[1:],sep='\n')


Measured memory_bytes: 66296
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL (1LL<<62) // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

void count(map<ll, ll> &cnt, ll num){
    for(ll i=0; i<=40; i++) if(num & (1LL << i)) cnt[i]++;
}

int main(){
    Init();
    ll n, k;
    cin >> n >> k;
    vi a(n), cand;
    rep(i, n) cin >> a[i];

    // 全ての部分列の美しさを求める
    for(ll i=0; i<n; i++){
        ll pre = 0;
        for(ll j=i; j<n; j++){
            pre += a[j];
            cand.emplace_back(pre);
        }
    }

    // 解を求める
    ll ans = 0;
    for(ll i=40; i>=0; i--){
        ll cnt = 0;
        ans += (1LL << i);
        for(ll c=0; c<cand.size(); c++) if((ans&cand[c]) == ans) cnt++;
        if(cnt < k) ans -= (1LL << i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 7372
#!/usr/bin/env python3
# coding:utf-8
# Reverse Polish Notation

def main():
    RPM = input().split()
    stack = []
    operator = ['+', '-', '*']
    
    while len(RPM) > 0:
        value = RPM.pop(0)
        if value not in operator:
            stack.append(value)
        else:
            x, y = str(stack.pop()), str(stack.pop())
            stack.append(eval(y + value + x))
    
    print(stack[0])

if __name__ == "__main__":
    main()
        

Measured memory_bytes: 7496
#include<bits/stdc++.h> 
using namespace std; 
int n,nxt[30][1000006],mp[30],C[1000006][30]; 
long long ans,sz,B[1000006][30];
bool created[1000006];
string s; 
pair <int,string> A[200005]; 
void insert(string tmp) { 
    int v=0;
    vector <int> v1;
    for(int i=0;i<tmp.size();i++) {
        int c=tmp[i]-'a';
        v1.push_back(v);
        if(!created[nxt[c][v]]) { nxt[c][v]=++sz; created[sz]=1; }
        v=nxt[c][v];
    }
    for(int i=v1.size()-1;i>=0;i--) {
        //cout<<v1[i]<<"*"; 
        for(int j=0;j<26;j++) {
            B[v1[i]][j]+=C[i][j];
        }
    }
    //cout<<endl;
}
void search(string tmp){ 
    int v=0;
    for(int i=0;i<tmp.size()-1;i++) {
        int ty=tmp[i]-'a';
       // cout<<v<<" ";
        if(created[nxt[ty][v]]) { v=nxt[ty][v]; }
        else return;
    }
   // cout<<v<<"-"<<B[v][tmp[tmp.size()-1]-'a']<<endl;
    ans+=B[v][tmp[tmp.size()-1]-'a'];
}
int main() { 
    cin>>n; 
    for(int i=1;i<=n;i++) { 
        cin>>s; 
        reverse(s.begin(),s.end()); 
        A[i].first=-s.size(); 
        A[i].second=s; 
    } 
    sort(A+1,A+1+n); 
    s=A[1].second; 
    //cout<<s<<endl;
    for(int i=s.size()-1;i>=0;i--) { 
        if(mp[s[i]-'a']==0) mp[s[i]-'a']++;
        for(int j=0;j<26;j++) { 
            C[i][j]=mp[j]; 
        } 
    } 
    insert(A[1].second); 
    for(int i=2;i<=n;i++) { 
        search(A[i].second); 
        s=A[i].second; 
        //cout<<s<<endl; 
        for(int j=0;j<26;j++) 
        mp[j]=0; 
        for(int j=s.size()-1;j>=0;j--) { 
            if(mp[s[j]-'a']==0) mp[s[j]-'a']++;
            for(int w=0;w<26;w++) { 
                C[j][w]=mp[w]; 
            } 
        } 
        insert(A[i].second); 
    } 
    cout<<ans; 
}

Measured memory_bytes: 448360
N = int(input())

def gen_set(k):
    s = [[0] * k for _ in range(k + 1)]

    for i in range(k + 1):
        if i == 0:
            s[i][0] = 1
            for j in range(1, k):
                s[i][j] = s[i][j - 1] + j    
        elif 1 <= i < k:
            s[i][0] = s[0][i]
            for j in range(1, k):
                if j <= i:
                    # Horizontal
                    s[i][j] = s[i][j - 1] + 1
                else:
                    # Vertical
                    s[i][j] = s[i][j - 1] + j
        else:
            # Diagonal
            s[i][0] = s[0][0]
            for j in range(1, k):
                s[i][j] = s[i][j - 1] + j + 1

    return s


x = 0
k = 0
while x < N:
    k += 1
    x += k

if x == N:
    s = gen_set(k)
    print("Yes")
    print(k + 1)
    for t in s:
        print(k, *t)
else:
    print("No")


Measured memory_bytes: 46812
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;

    cin>>n;
    cout<<n*n*n;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <math.h>
#include <bitset>

using namespace std;

void solve() {
    int n;
    string s;
    cin >> n >> s;
    int count = 0;
    for(int i = 0; i+2 < n; i++){
        if(s.substr(i, 3) == "ABC") count++;
    }
    cout << count;

}

int main() {
    solve();
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int a[110];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	if(n < 3)
		cout << "0\n";
	else if(n == 3){
		if(a[0] + a[1] > a[2])
			cout << "1\n";
		else
			cout << "0\n";
	}
	else{
		int ans = 0;
		for(int i = 0; i < n - 2; i++){
			for(int j = i + 1; j < n - 1; j++){
				if(a[i] == a[j])
					continue;
				for(int k = j + 1; k < n; k++){
					if(a[i] == a[k] || a[j] == a[k])
						continue;
					if(a[i] + a[j] > a[k])
						ans++;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
using namespace std;
int main(void){
    int x,y,i,j;
    while (cin >>x>>y) {
        if(x==0 && y==0)break;
        for (j=0; j<x; j++) {
            
            for (i=0; i<y; i++) {
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;
    }
}

Measured memory_bytes: 1152
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 207
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};


//=============================================ASIFAZAD==============================================//
ll n, k, lst, maxi, mv, mmv, mms;
vll p, c;
bool vis[5005];

void dfs(int nod)
{
    if(vis[nod] || mv == k)
        return;
    mv++;
    vis[nod] = 1;
    lst += c[p[nod]];
    if(lst > maxi)
    {
        maxi = lst;
        mmv = mv;
        mms = p[nod];
    }
//    dbg(nod);
//    dbg(lst);
//    dbg(maxi);
    dfs(p[nod]);
}

int32_t main()
{
    io;
    cin>>n>>k;
    vll temp(n);
    p = temp;
    c  = temp;
    for(int i = 0; i< n;i++)
    {
        int x;
        cin>>x;
        x--;
        p[i] = x;
    }
    for(auto& x: c) cin>>x;
    ll ans = -1*inf;
    for(int i =0 ; i< n;i++)
    {
        memset(vis, 0, sizeof(vis));
        mv = 0;
        lst = 0;
        maxi = -1*inf;
        dfs(i);
        if(mmv < k)
        {
            int rem = k - mmv;
            if(lst > 0)
                maxi = maxi + rem/mv*lst;
            lst = maxi;
            rem = rem%mv;
            for(int a= 0; a< rem; a++)
            {
                lst += c[p[mms]];
                maxi = max(lst, maxi);
                mms = p[mms];
            }
        }
//        dbg(maxi);
//        dbg(mv);
        ans = max(ans, maxi);
    }
    cout<<ans;
    return 0;
}


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

ll GCD(ll x, ll y) {
    return (x ? GCD(y%x, x) : y);
}

int main() {
    //一つ除いた時の最大公約数で最大のものを求める
    ll N;
    cin >> N;
    ll A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    ll MAX = 0;

    vector<ll> left(N, 0), right(N, 0);
    //left[i]は[0, i)での最大公約数right[i]は(i, N-1]での最大公約数
    for (int i = 0; i <= N-2; i++) {
        if (i == 0) left[1] = A[0];
        else left[i+1] = GCD(min(left[i], A[i]), max(left[i], A[i]));
    }
    for (int i = N-2; i >= 0; i--) {
        if (i == N-2) right[N-2] = A[N-1];
        else right[i] = GCD(min(right[i+1], A[i+1]), max(right[i+1], A[i+1]));
    }

    for (int i = 0; i < N; i++) {
        if (i == 0) MAX = max(MAX, right[i]);
        else if (i == N-1) MAX = max(MAX, left[i]);
        else {
            ll g = GCD(left[i], right[i]);
            MAX = max(MAX, g);
        }
    }
    cout << MAX << endl;
    return 0;
}

Measured memory_bytes: 2560
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    long A, B, C;
    scan(A, B, C);
    if ((A & 1) == 0 || (B & 1) == 0 || (C & 1) == 0)
        writeln(0);
    else
        min(A * B, B * C, C * A).writeln();
}


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

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  string s;
  cin >> s;
  char prev = '0';
  ll res1 = 0, res2 = 0;
  for (auto i = 0; i < s.size(); i++)
  {
    if (s[i] == prev) {
      res1++;
    } else {
      res2++;
    }
    prev = prev == '0' ? '1' : '0';
  }

  cout << min(res1, res2) << endl;

  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int A[200];

int main(){
	int i,n;
	int cnt =0;
	int flag = 1;
	
	scanf("%d",&n);
	
	
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	
	while(flag){
		for(i=0;i<n;i++){
			if( (A[i] % 2) == 1){flag = 0; break;}
			else {
				A[i]/=2;
			}
			
		}
		cnt++;
	}
	cnt--;
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
<?php

fscanf(STDIN, "%d %d", $l, $r);


$start = intdiv($l, 2019);
$end = intdiv($r, 2019);

if($start == $end){
    $start_mod = $l % 2019;
    $end_mod = $r % 2019;
    $ans = 2020;
    for($i = $start_mod; $i < $end_mod; $i++){
        $ans = min($ans,($i * ($i+1)) % 2019);
        for($j = $i+1; $j <= $end_mod; $j++){
            $ans = min($ans, $i * $j % 2019);
        }
        if($ans == 0){
            echo $ans;
            exit;
        }
    }
}else{
    $ans = 0;
}
echo $ans;


Measured memory_bytes: 4728
#!/usr/bin/env python
from math import *
def g(x):
	y = (int((1000 * abs(x)) * 2 + 1) // 2) / 1000
	if x < 0:
		y *= -1
	return y
def func(x):
	x1, y1, x2, y2, x3, y3 = x

	vx1 = x2 - x1
	vy1 = y2 - y1
	vx2 = x3 - x1
	vy2 = y3 - y1
	k = (vx2 ** 2 + vy2 ** 2 - vx1 * vx2 - vy1 * vy2) / (vy1 * vx2 - vx1 * vy2) / 2
	x = vx1 / 2 + k * vy1 + x1
	y = vy1 / 2 - k * vx1 + y1
	r = sqrt((x1 - x) ** 2 + (y1 - y) ** 2)
	print("{0:.3f} {1:.3f} {2:.3f}".format(g(x), g(y), g(r)))
n = int(input())
for _ in range(n):
	func(list(map(float, input().split())))


Measured memory_bytes: 5680
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string m;
  cin >> m;
  string s;
  int n;
  n = m.size() - 1;
  s = m.at(n);
  if (s == "s"){
    cout << m << "es" << endl;
  }
  else cout << m << "s" << endl;
 
  
  
}

Measured memory_bytes: 3640
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getInputListInt()

maximum = max(data)

for i in range(n):
    data[i] = maximum - data[i]

flgWhileContinue = True
cnt = 0

while flgWhileContinue:
    flgForBreak = False
    flgWhileContinue = False
    for i in range(n):
        if data[i] == maximum and flgForBreak:
            break

        if data[i] != maximum:
            flgForBreak = True
            flgWhileContinue = True
            data[i] += 1

    if flgWhileContinue:
        cnt += 1

print(cnt)


Measured memory_bytes: 13664