akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX / 2;
const ll MOD = 1e9 + 7;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    string T = "CODEFESTIVAL2016";
    ll ans = 0;
    for(int i = 0; i < 16; i++) {
        ans += S[i] != T[i];
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
	int k;
	vector<int> a(5);
	for(int i(0);i<5;++i) cin >> a[i];
	cin >> k;
	sort(a.begin(),a.end());
	if(a[4]-a[0] > k){
		cout << ":(" << endl;
	}else{
		cout << "Yay!" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  long long x,y;
  bool operator < (const P &a )const{
    //if(y!=a.y)
    return y<a.y;
  };
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[200101];
int l[1];
int j[1];

long long x,y,z,mod=1000000007;
//string r;
char r[3];

P u[2][600101];
queue<P> q;
stack<int> s;
//set<int> s;
map<int,int> p;

vector<int> v[3];


bool as(P a,P b)
{
  if(a.x!=b.x)
  return a.x<b.x;
  return a.y>b.y;
}

void ini(int i,int n,int m)
{
  u[0][i].x=u[1][i].x=mod*mod;
  if(n!=m)
  {
    ini(i*2,n,(n+m)/2);
    ini(i*2+1,(n+m)/2+1,m);
  }
}

void rr(int i,int n,int m,int p)
{
  if(n==m)
  return;
  u[p][i*2].x+=u[p][i].y;
  u[p][i*2+1].x+=u[p][i].y;
  u[p][i*2].y+=u[p][i].y;
  u[p][i*2+1].y+=u[p][i].y;
  u[p][i].y=0;
}

void pp(int i,int n,int m,int c,long long d,int p)
{
  rr(i,n,m,p);
  if(n>c||m<c) return;
  if(n==m)
  {
    u[p][i].x=min(u[p][i].x,d);
    return;
  }
  pp(i*2,n,(n+m)/2,c,d,p);
  pp(i*2+1,(n+m)/2+1,m,c,d,p);
  u[p][i].x=min(u[p][i*2].x,u[p][i*2+1].x);
}

void ss(int i,int n,int m,int c,int d,long long x,int p)
{
  rr(i,n,m,p);
  if(n>d||m<c) return;
  if(c<=n&&m<=d)
  {
    u[p][i].x+=x;
    u[p][i].y+=x;
    return;
  }
  ss(i*2,n,(n+m)/2,c,d,x,p);
  ss(i*2+1,(n+m)/2+1,m,c,d,x,p);
  u[p][i].x=min(u[p][i*2].x,u[p][i*2+1].x);
}

long long f(int i,int n,int m,int c,int d,int p)
{
  if(c>d) return mod*mod;
  rr(i,n,m,p);
  if(d<n||m<c) return mod*mod;
  if(c<=n&&m<=d) return u[p][i].x;
  return min(f(i*2,n,(n+m)/2,c,d,p),f(i*2+1,(n+m)/2+1,m,c,d,p));
}

void ad(int i,int n,int m,int c,long long x,int p)
{
  rr(i,n,m,p);
  if(n>c||m<c) return;
  if(n==m)
  {
   u[p][i].x=min(x,u[p][i].x);
  return;
  }
  ad(i*2,n,(n+m)/2,c,x,p);
  ad(i*2+1,(n+m)/2+1,m,c,x,p);
  u[p][i].x=min(u[p][i*2].x,u[p][i*2+1].x);
}

int main()
{
  scanf("%d %d %d %d",&a,&b,&c,&d);
  ini(1,1,a);
  o[0]=d;
  pp(1,1,a,c,-c,0);
  pp(1,1,a,c,c,1);
  for(int t=1;t<=b;t++)
  {
    scanf("%d",&e);
    x=min(f(1,1,a,1,e-1,0)+e,f(1,1,a,e,a,1)-e);
    ss(1,1,a,1,a,abs(d-e),0);
    ss(1,1,a,1,a,abs(d-e),1);
    ad(1,1,a,d,x-d,0);
    ad(1,1,a,d,x+d,1);
    d=e;
  }
  x=mod*mod;
  for(int t=1;t<=a;t++)
  {
    x=min(x,min(f(1,1,a,t,t,0)+t,f(1,1,a,t,t,1)-t));
  }
  printf("%lld",x);
}
//4




Measured memory_bytes: 18688
#include<cstdio>
const int N = 5e3+5;
struct Edge{
    int u,v,c;
};
Edge e[N];
int start[N];
int end[N];
int d[N];

int max(int a,int b){ return a>b?a:b; }

int main(){
    int n,m,p;
    scanf("%d%d%d",&n,&m,&p);
    for(int i = 0; i < m; i++){
        scanf("%d%d%d",&e[i].u,&e[i].v,&e[i].c);
        e[i].c -= p;
    }
    d[1] = 0; 
    start[1] = 1, end[n] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(end[e[j].v]) end[e[j].u] = 1;
            if(start[e[j].u]){ 
                if(!start[e[j].v]){
                     start[e[j].v] = 1;
                     d[e[j].v] = d[e[j].u]+e[j].c;
                }
                else d[e[j].v] = max(d[e[j].v],d[e[j].u]+e[j].c);
            }
        }
    }
    int ok = 1;
    for(int i = 0; i < m; i++){
        //存在可达终点的正环才行
        if(d[e[i].v]<d[e[i].u]+e[i].c && end[e[i].v] && start[e[i].u]){
            ok = 0;
            break;
        }
    }
    if(ok && start[n]) printf("%d\n",max(0,d[n]));
    else printf("-1\n");
    return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 30000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main(){
	int n;
	cin >> n;
	vector<int> geko;
	REP(i, n) {
		int a;
		cin >> a;
		geko.push_back(a);
	}
	long long ans = 10000000;
	long long now_a = 0;
	long long now_b = 0;
	REP(i, geko.size()) {
		now_b += geko[i];
	}
	for (int i = 0; i < geko.size(); ++i) {
		now_b -= geko[i];
		now_a += geko[i];
		ans = min(ans, abs(now_a - now_b));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>  
using namespace std; 
// Recursive function to return gcd of a and b  
class gfg 
{ 
 public : long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
  
   
// Function to return LCM of two numbers  
  long long int lcm(long long int a, long long int b)  
 {  
    return (a*b)/gcd(a, b);  
 }  
} ; 
// Driver program to test above function  
int main()  
{  
    gfg g; 
    long long int a, b;
    cin>>a>>b;
    cout<<g.lcm(a, b);  
    return 0;  
}  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define pb                  push_back
#define arr                 vector<ll>
#define mem(x,val)          memset(x,val,sizeof(x))
#define vp                 vector<pair<ll,ll>>
#define matrix              vector<vector<ll> >
#define digit(x)            floor(log10(x))+1
#define debug(x)            cerr << #x << " is " << x << endl;
#define all(a)              a.begin(),a.end()
#define fixed               setprecision(15)
// ll dx[]={-1,1,0,0},dy[]={0,0,-1,1}; 4 Sides
//ll dx[]={-1,1,-1,1,0,0,-1,1} , dy[]={-1,1,0,0,-1,1,1,-1};    8 Sides
using namespace std;
arr read(ll n){
    arr a;
    for (ll i=0;i<n;i++){
        ll x;
        cin>>x;
        a.pb(x);
    }
    return a;
}
  int main(){
       string s;
       cin>>s;
       ll sum = 0;
       for (ll i=0;i<s.size();i++){
           sum += int(s[i]-48)%9;
       }
       if (sum%9==0){
           cout<<"Yes"<<endl;
       }else{
           cout<<"No"<<endl;
       }
        return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>

using namespace std;

int main(void)
{
    int N, M, C, B[21], i, j, A[21][21], ans=0, sum;

    cin >> N >> M >> C;

    for(i=1; i<=M; i++){
        cin >> B[i];
    }

    for(i=1; i<=N; i++){
        sum = 0;

        for(j=1; j<=M; j++){
            cin >> A[i][j];

            sum += A[i][j] * B[j];
        }

        if(sum + C > 0){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		int N = S.length();
		for( int i=0; i<N; i++ ){
			System.out.print("x");
		}
	}
}

Measured memory_bytes: 23124
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <cmath>
#include <utility>
#include <numeric>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i=0;(i)<(n);(i)++)
#define repi(i, n) for (int i=0;(i)<=(n);(i)++)
#define repr(i, n) for (int i=n;(i)>=0;(i)--)
#define print(x) (cout<<(x)<<"\n")

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n, m; cin>>n>>m;
    vector<bool> route(n);
    rep(i, m) {
        int a, b; cin>>a>>b;
        a--; b--;
        if (a==0) {
            if (route[b]==true) {
                print("POSSIBLE");
                return 0;
            }
            route[b] = true;
        } else if (b==n-1) {
            if (route[a]==true) {
                print("POSSIBLE");
                return 0;
            }
            route[a] = true;
        }
    }
    print("IMPOSSIBLE");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef float fl;
#define input ll t;cin>>t;while(t--)
#define fast() ios_base::sync_with_stdio(false),cin.tie(NULL);
#define mod 1000000007
#define pb push_back

int main(void) {
    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
def selectWhich(A,i,c):
    #print(A)
    #print(i)
    #print(c)
    if c < 1:
        return
    if int(i/c) == 1:
        A.append(1)
        i = i%c
    else:
        A.append(0)
    selectWhich(A,i,c/2)


n = int(input())
A = list(map(int,input().split()))
q = int(input())
m = list(map(int,input().split()))
p = []

for i in range(2**n):
    l = []
    selectWhich(l,i,2**n)
    tmp = [ x*y for (x,y) in zip(A,l[1:])]
    p.append(sum(tmp))
#print(p)
for query in m:
    #flag = False
    #for d in p:
    #    if(query==d):
    #        flag = True
    #        break
    if query in p:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 43088
#include<stdio.h>
#include<stdlib.h>

int main()
{
  int a,b,c,d,x;
  char s[4];
  scanf("%s",s);
  x=atoi(s);
  d=x%10;
  c=(x%100)/10;
  b=(x%1000)/100;
  a=x/1000;
  if(a+b+c+d==7) printf("%d+%d+%d+%d=7",a,b,c,d);
  else if(a+b+c-d==7) printf("%d+%d+%d-%d=7",a,b,c,d);
  else if(a+b-c+d==7) printf("%d+%d-%d+%d=7",a,b,c,d);
  else if(a+b-c-d==7) printf("%d+%d-%d-%d=7",a,b,c,d);
  else if(a-b+c+d==7) printf("%d-%d+%d+%d=7",a,b,c,d);
  else if(a-b+c-d==7) printf("%d-%d+%d-%d=7",a,b,c,d);
  else if(a-b-c+d==7) printf("%d-%d-%d+%d=7",a,b,c,d);
  else if(a-b-c-d==7) printf("%d-%d-%d-%d=7",a,b,c,d);
  return 0;
}


Measured memory_bytes: 1700
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
 
class Main {
	public static void main(String[] args) {
		new Main().run();
	}
 
	void run() {
		Scanner sc = new Scanner(System.in);
		long[] p1 = { sc.nextLong(), sc.nextLong() };
		long[] p2 = { sc.nextLong(), sc.nextLong() };
		if (p1[0] > p2[0]) {
			long[] tmp = p1;
			p1 = p2;
			p2=tmp;
		}
		int coe = 1;
		if (p1[1] > p2[1]) {
			coe = -1;
			p1[1] *= coe;
			p2[1] *= coe;
		}
		int n = sc.nextInt();
		long[][] p = new long[n][2];
		for (int i = 0; i < n; ++i) {
			p[i][0] = sc.nextLong();
			p[i][1] = sc.nextLong() * coe;
		}
		Arrays.sort(p, new Comparator<long[]>() {
			@Override
			public int compare(long[] o1, long[] o2) {
				return Long.compare(o1[0], o2[0]);
			}
		});
		int sz = 0;
		for (int i = 0; i < n; ++i) {
			if (p1[0] <= p[i][0] && p[i][0] <= p2[0] && p1[1] <= p[i][1] && p[i][1] <= p2[1])
				++sz;
		}
		long[] a = new long[sz];
		sz = 0;
		for (int i = 0; i < n; ++i) {
			if (p1[0] <= p[i][0] && p[i][0] <= p2[0] && p1[1] <= p[i][1] && p[i][1] <= p2[1]) {
				a[sz++] = p[i][1];
			}
		}
		long lis = LIS(a.length, a);
		double ans = (p2[0] - p1[0] + p2[1] - p1[1]) * 100 + (Math.PI * 5 - 20) * lis;
		if (lis == Math.min(p2[0] - p1[0] + 1, p2[1] - p1[1] + 1))
			ans += Math.PI * 5;
		System.out.println(String.format("%.20f", ans));
	}
 
	long LIS(int n, long[] a) {
		long[] f = new long[n];
		int sz = 0;
		for (int i = 0; i < n; ++i) {
			if (sz == 0) {
				f[sz] = a[0];
				++sz;
			} else {
				int ok = -1;
				int ng = sz;
				while (ng - ok > 1) {
					int middle = (ok + ng) / 2;
					if (f[middle] < a[i]) {
						ok = middle;
					} else {
						ng = middle;
					}
				}
 
				f[ok + 1] = a[i];
				if (ok + 1 == sz)
					++sz;
			}
		}
		return sz;
	}
 
	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

const int N=100010;
int n, m, dis[N];
vector<int> adj[N];


int dfs(int u){
  if(dis[u]!=-1)return dis[u];
  dis[u]=0;
  for(auto v:adj[u])dis[u]=max(dis[u], 1+dfs(v));
  return dis[u];
}
int main(){
  memset(dis, -1, sizeof dis);

  scanf("%d%d", &n, &m);

  for(int i=0;i<m;i++){
    int a,b;scanf("%d %d", &a, &b);
    a--;b--;
    adj[a].emplace_back(b);
  }
  int ans=0;
  for(int i=0;i<n;i++)
    ans=max(ans, dfs(i));
  printf("%d\n", ans);
}


Measured memory_bytes: 7424
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int A, B;

int main()
{
  scanf( "%d%d", &A, &B );

  repi( C, 1, 4 ) if( (A*B*C)%2 )
  {
    puts( "Yes" );

    return 0;
  }

  puts("No");

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const int INF = 1 << 30;
// const ll INF = 1LL << 62;
// --------------------------------------------------------


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);

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

    int MAX_K = (N - 1) * (N - 2) / 2;
    if (K > MAX_K) {
        cout << -1 << '\n';
        return 0;
    }

    VP E;
    FOR(i, 1, N) E.push_back(make_pair(i, N));
    bool is_end = false;
    int num = MAX_K;
    FOR(i, 1, N - 1) {
        if (is_end) break;
        FOR(j, i + 1, N) {
            if (num == K) {
                is_end = true;
                break;
            }
            num--;
            E.push_back(make_pair(i, j));
        }
    }

    int M = SZ(E);
    cout << M << '\n';
    for (auto uv : E) {
        cout << uv.first << " " << uv.second << '\n';
    }

    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>

using namespace std;

int n;
vector<int> vec[35];
bool have[55][55];

void exchange(int s, int t)
{
  for(int i = 1; i <= n; i++){
    have[s][i] = have[t][i] = (have[s][i] | have[t][i]);
  }
}

int main(void)
{
  while(1){
    cin >> n;
    if(n == 0) break;

    int f, d;
    for(int i = 1; i <= 30; i++) vec[i].clear();
    for(int i = 1; i <= n; i++){
      cin >> f;
      for(int j = 0; j < f; j++){
        cin >> d;
        vec[d].push_back(i);
      }
    }

    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= n; j++){
        have[i][j] = false;
        if(i == j) have[i][j] = true;
      }
    }
    for(int i = 1; i <= 30; i++){
      for(int j = 0; j < vec[i].size(); j++){
        for(int k = 0; k < vec[i].size(); k++){
          if(j >= k) continue;
          exchange(vec[i][j], vec[i][k]);
        }
      }
      for(int j = 1; j <= n; j++){
        bool flag = true;
        for(int k = 1; k <= n; k++) flag &= have[j][k];
        if(flag){
          cout << i << endl;
          goto end;
        }
      }

    }

    cout << -1 << endl;
    end:;
  }
  return 0;
}



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

int main() {
  //-1made全部足す 1+2+...+n-1
  ll n;
  cin>>n;
  cout<<n*(n-1)/2<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
 
int main() {
	int t = 0,s = 0;
	string ss;
	cin >> ss;
	for(int i = 0;i < ss.size();i++){
		if(ss[i] == 'S'){
			s++;
		}
		if(ss[i] == 'T'){
			if(s > 0) s--;
			else t++;
		}
	}
	cout << s + t << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> 
#define ll long long
#define F first
#define S second
#define FF first.first
#define FS first.second
#define pb push_back
using namespace std;
const ll N=1000006, INF=1e10, MOD=998244353;
     
int n, q=1, a[N], b[N], c[N], f[N], m, o=3, h, w, mx, mn, ans, Ans;
string s, S;
vector <ll> v[N];
pair<ll, ll> p[N];


main(){ios_base::sync_with_stdio(false), cin.tie(0);
                    
    cin>>n;
    for(int x=1; x<=n; x++){
    	for (int y=1; y<=n; y++){
    		for (int z=1; z<=n; z++){
    			ans+=__gcd(x, __gcd(y, z));
			}
		}
	}
	cout<<ans;
}

Measured memory_bytes: 27000
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const A = parseInt(arg[0].split(" ")[0]);
    const V = parseInt(arg[0].split(" ")[1]);
    const B = parseInt(arg[1].split(" ")[0]);
    const W = parseInt(arg[1].split(" ")[1]);
    const T = parseInt(arg[2].split(" ")[0]);

    if(W >= V) {
        console.log("NO");
        return;
    }

    
    if(Math.abs(W - V) * T < Math.abs(A - B)) {
        console.log("NO");
        return;
    }
    
    console.log("YES");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29624
N, Q = gets.split.map(&:to_i)
graph = Array.new(N) { [] }
(N - 1).times do
  u, v = gets.split.map(&:to_i)
  u -= 1
  v -= 1
  graph[u].push(v)
  graph[v].push(u)
end
counters = Array.new(N, 0)
Q.times do
  u, x = gets.split.map(&:to_i)
  u -= 1
  counters[u] += x
end

def bfs(graph, counters)
  res = Array.new(N, 0)
  res[0] = counters[0]
  queue = [[0, nil]]
  while !queue.empty?
    u, parent = queue.shift
    c = res[u]
    graph[u].each do |v|
      next if v == parent
      new_c = c + counters[v]
      res[v] = new_c
      queue.push([v, u])
    end
  end
  res
end

res = bfs(graph, counters)
puts res.join(' ')


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

int main() {
  int n, W;
  cin >> n >> W;
  int w, v;
  vector<vector<long>> dp(n+1, vector<long>(W+1));
  rep(i, n+1) {
	if (i == 0) continue;
    cin >> w >> v;
    rep (j, W+1) {
      if (j < w) dp[i][j] = dp[i-1][j];
      else dp[i][j] = max(dp[i-1][j], dp[i-1][j-w] + v);
    }
  }
  cout << dp[n][W];

}


Measured memory_bytes: 80256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,K;
ll P[5010];
ll C[5010];
ll CircleStart(ll s){
    ll n=s;
    bool f[5010]={};
    f[s]=true;
    for(ll cnt=0;cnt<N;cnt++){
        n=P[n];
        if(f[n]) return n;
        f[n]=true;
    }
    return -1;
}
vector<ll> CircleVec(ll s){
    vector<ll> ret;
    ll n=P[s];
    ll nCost=C[n];
    while(n!=s){
        ret.push_back(nCost);
        n=P[n];
        nCost+=C[n];
    }
    ret.push_back(nCost);
    return ret;
}
ll CircleBest(ll s,ll k){
    vector<ll> v=CircleVec(s);
    ll circleCost=v[v.size()-1];
    ll ret=-INF;
    if(circleCost>0){
        ll circleSize=v.size();
        ll tmp=0;
        for(ll i=1;i<=min(k,(ll)v.size());i++){
            if(k%circleSize >= i){
                tmp = k/circleSize * circleCost;
            }else{
                tmp = (k/circleSize -1) * circleCost;
            }
            ret=max(ret,tmp+v[i-1]);
        }
    } else{
        for(ll i=1;i<=min(k,(ll)v.size());i++){
            ret=max(ret,v[i-1]);
        }
    }
    return ret;
}

ll Calc(ll s,ll k){
    ll circleStart=CircleStart(s);
    if(circleStart!=s){
        ll now=s;
        ll nCost=0;
        ll ret=-INF;
        while(now!=circleStart){
            k--;
            now=P[now];
            nCost+=C[now];
            ret=max(ret,nCost);
        }
        return max(ret,nCost+CircleBest(now,k));
    }
    return CircleBest(s,k);
}

int main(){
    cin>>N>>K;
    for(ll i=1;i<=N;i++)cin>>P[i];
    for(ll i=1;i<=N;i++)cin>>C[i];
    ll ans=-INF;
    for(ll i=1;i<=N;i++){
        ans=max(ans,Calc(i,K));
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
	long long h;
	cin >> h;

	long long ret = 1;
	h /= 2;
	long long temp = 1;
	while (0 < h) {
		h /= 2;
		temp *= 2;
		ret = ret + temp;
	}
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
/*author : Yashvardhan
Thursday, May 07, 2020
6:12 PM
*/

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

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}


signed main()
{

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

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int x,y,z,k;
	cin >> x >> y >> z >> k;
 
	vi arr1(x);
	for(int i = 0; i < x; i++) cin >> arr1[i];
	sort(arr1.rbegin(),arr1.rend());
 
	vi arr2(y);
	for(int i = 0; i < y; i++) cin >> arr2[i];
	sort(arr2.rbegin(),arr2.rend());
 
	vi arr3(z);
	for(int i = 0; i < z; i++) cin >> arr3[i];
	sort(arr3.rbegin(),arr3.rend());

	vi arr;
	for(int i = 0; i < x; i++){
		for(int j = 0; j < y; j++){
			for(int it = 0; it < z; it++){
				if((i + 1) * (j + 1) * (it + 1) > k) break;
				arr.pb(arr1[i] + arr2[j] + arr3[it]);
			}
		}
	}

	sort(arr.rbegin(), arr.rend());

	for(int i = 0; i < k; i++){
		cout << arr[i] << endl;
	}
	

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



Measured memory_bytes: 1660
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		//int tc = scan.nextInt();
		int rd = 1;
		while(scan.hasNextInt()) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			int lcd = 0;
			int gcd = 0;
			lcd = LCD(a, b);
			gcd = GCD(a, b);
			System.out.println(lcd + " " + gcd);
		}
	}
	public static int LCD(int a, int b) {
		int z = Integer.min(a, b);
		
		for(int i = z; i >= 1; i--) {
			if(a%i == 0 && b%i == 0)
				return i;
		}
		return 1;
	}
	
	public static int GCD(int a, int b) {
		int c = a;
		int d = b;
		while(a != b) {
			if(a < b)
				a+=c;
			else
				b+=d;
		}
		return a;
	}
}

Measured memory_bytes: 26424
#include<stdio.h>
int main()
{
    int n,a,b,c,count=0;
    scanf("%d", &n);
    for(a=1;a<=n;a++){
      for(b=1;b<=n/a;b++){
          if(a*b != n){
            count++;
//          	printf("%d x %d + %d\n",a,b,n-(a*b));
          }
      }
    }
    // 出力
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 1736
package main 

import (
    "bufio"
    "fmt"
    "os"
    )
    
    var r = bufio.NewReader(os.Stdin)
    
    func main() {
        var a int
        var b int 
        var c int
        fmt.Fscan(r, &a, &b, &c)
        
        if (a < b && b < c) {
            fmt.Println("Yes")
        } else {
            fmt.Println("No")
        }
    }


Measured memory_bytes: 1168
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
  int X, Y;
  cin >> X >> Y;
  if(X>=13) cout << Y << endl;
  else if(X>=6) cout << Y/2 << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
vector<ll> v;

struct C
{
    ll x, y, h;
};
int cnt = 0;
int N;
void dfs(ll x)
{
    if (x > N)
        return;

    ll t = x;

    bool f3 = false, f5 = false, f7 = false;

    while (t)
    {
        if (t % 10 == 3)
            f3 = true;
        if (t % 10 == 5)
            f5 = true;
        if (t % 10 == 7)
            f7 = true;
        t /= 10;
    }
    if (f3 && f5 && f7)
        cnt++;
    x = x * 10 + 3;
    dfs(x);
    x /= 10;
    x = x * 10 + 5;
    dfs(x);
    x /= 10;
    x = x * 10 + 7;
    dfs(x);
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    //cout << fixed << setprecision(15);

    cin >> N;

    dfs(3);
    dfs(7);
    dfs(5);

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int n, m;
    scanf("%d%d", &n, &m);
    ll sum = 0;
    int i;
    for (i = 0; i < m; i++) {
        int tmp;
        scanf("%d", &tmp);
        sum += tmp;
    }
    if (n < sum) {
        printf("-1\n");
    }
    else {
        printf("%lld\n", (ll)n - sum);
    }



    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 1688
#include <iostream>
#include <string>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    string str;
    while(cin >> str) {
        for(string::const_iterator it = str.begin(); it != str.end(); ++it) {
            if(*it == '@') {
                ++it;
                int n = *it - '0';
                ++it;
                while(n--) cout << *it;
            } else {
                cout << *it;
            }
        }
        cout << endl;
    }
    return 0;
}

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

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var a = Console.ReadLine().Split(' ').Select(long.Parse);

            Console.WriteLine($"{a.Min()} {a.Max()} {a.Sum()}");
        }
    }
}



Measured memory_bytes: 18408
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}


int main(){
	double n, t, a;
	cin >> n >> t >> a;
	vector<double> h(n);
	vector<double> temp(n);
	for (int i = 0; i < n; i++){
		cin >> h[i];
		temp[i] = t - h[i]*0.006;
	}
	double temp_ans = MOD;
	int ans;

	for (int i = 0; i < n; i++){
		if (temp_ans > max(a - temp[i], -a + temp[i])){
			temp_ans = max(a - temp[i], -a + temp[i]);
			ans = i;
		}
	}
	cout << ans + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
let id x = x
let (n,m) = Scanf.scanf "%d %d\n" (fun x y -> (x,y))

let rec pow2 n =
  if n = 0 then 1 else 2 * pow2 (n-1)
  
let ans = (1900 * m + 100 * (n-m)) * (pow2 m)

let () =
  Printf.printf "%d\n" ans

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

int main() {
	int n; string s; cin>>n>>s;
	stack<char> stk; stk.push(s[0]);
	for (char ch : s)
		if(stk.top()!=ch)
			stk.push(ch);
	cout<<stk.size()<<"\n";
	return 0;
}

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

int main(){
  int n, T;
  cin >> n >> T;
  vector<int> t(n);
  rep(i,n) cin >> t[i];
  ll res = 0;
  rep(i,n) {
    if (i == 0) res += T;
    else {
      res += min(0,t[i] - (T + t[i-1]));
      res += T;
    }
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

class union_find {
    private:
        vector<int> par;
        vector<int> ran;
        vector<ll> size;
    public:
        union_find(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    rep(i,n) par[i] = i;
    rep(i,n) ran[i] = 0;
    rep(i,n) size[i] = 1;
};

int union_find::find(int x) {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if(ran[x] < ran[y]){
        par[x] = y;
        //size[y] += size[x];
    }
    else{
        par[y] = x;
        //size[x] += size[y];
        if(ran[x] == ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if(par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    union_find uf(n);
	int ans = n;
    rep(i,m){
		int x, y, z;
		cin >> x >> y >> z;
		x--; y--;
		if(!uf.same(x, y)){
			ans--;
			uf.unite(x, y);
		}
    }
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <vector>
#include <cstddef>

struct union_find {
    using size_type = std::size_t;
private :
    size_type _size;
    std::vector<int> node;
public :
    union_find (size_type n) : node(n, -1), _size(n) { }

    bool unite (size_type x, size_type y) noexcept {
        if ((x = root(x)) == (y = root(y))) return false;
        if (node[x] > node[y]) std::swap(x, y);
        node[x] += node[y];
        node[y] = x;
        _size--;
        return true;
    }

    bool same (size_type x, size_type y) noexcept {
        return (root(x) == root(y));
    }

    size_type root (size_type x) noexcept {
		if (node[x] < 0) return x;
		return node[x] = root(node[x]);
    }

    size_type size (size_type x) noexcept {
        return (size_type(-node[root(x)]));
    }

    const size_type &size () const noexcept {
        return _size;
    }

};


#include <iostream>
//#include <atcoder/dsu>

using usize = std::size_t;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	usize n, q;
	std::cin >> n >> q;
	union_find uf(n);
	for (usize i = 0; i < q; i++) {
		usize type, u, v;
		std::cin >> type >> u >> v;
		if (type == 0) uf.unite(u, v);
		else std::cout << uf.same(u, v) << '\n';
	}
	return 0;
}

Measured memory_bytes: 3960
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.nio.Buffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class Main {
    public static Scanner r=new Scanner(System.in);
    public static void main(String[] args) {
        String ch=r.next();
        char c=ch.charAt(0);
        if(c>='a'&&c<='z') System.out.println('a');
        else System.out.println('A');
    }
}


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

int main(void){
    int N;
    while(cin >> N, N){
        if(N == 1){
            cout << "1 1" << endl;
            continue;
        }
        vector<int> x(N);
        vector<int> y(N);
        int maxx =  0, maxy = 0;
        int minx =  0, miny = 0;
        x[0] = 0; y[0] = 0;
        for(int i=1; i <= N-1; i++){
            int n, d;
            cin >> n >> d;
            if(d == 0){
                x[i] = x[n] - 1;
                y[i] = y[n];
            }
            if(d == 1){
                y[i] = y[n] - 1;
                x[i] = x[n];
            }
            if(d == 2){
                x[i] = x[n] + 1;
                y[i] = y[n];
            }
            if(d == 3){
                y[i] = y[n] + 1;
                x[i] = x[n];
            }
            maxx = max(maxx, x[i]);
            minx = min(minx, x[i]);
            maxy = max(maxy, y[i]);
            miny = min(miny, y[i]);
        }
        cout << maxx - minx + 1 << " " << maxy - miny + 1 << endl;
    }
}

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

int main() {
    int n;
    cin >> n;
    int s = 0, t = 0, u = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        int tmp = 0;
        while (a % 2 == 0) a /= 2, tmp++;
        if (tmp == 0) s++;
        if (tmp == 1) t++;
        if (tmp >= 2) u++;
    }
    cout << (s - u <= 0 || ((s - u == 1) ^ (t > 0)) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc,char* argv[]){
  
  char s;
  while(scanf("%c",&s) != EOF){
    if(s >= 'a' && s <= 'z'){
      printf("%c",s + ('A' - 'a'));
    }else{
      printf("%c",s);
    }
    
  }
  
  return 0;
  
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x) 
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define fo(i, a, b) for (int i = a; i <= b; ++i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, c; cin >> n >> c;
    int w[n], v[n];
    rep(i, n) cin >> w[i] >> v[i];

    ll dp[n+1][c+1];
    fill(dp[n], dp[n]+c+1, 0);
    for (int i = n-1; i >= 0; --i) {
        for (int x = 0; x <= c; ++x) {
            dp[i][x] = dp[i+1][x];
            if (w[i] <= x) dp[i][x] = max(dp[i][x], dp[i+1][x-w[i]]+v[i]);
        }
    }
    cout << dp[0][c] << '\n';
}



Measured memory_bytes: 79232
import itertools
N = int(input())
L = list(map(int, input().split()))
if N < 3:
    print(0)
    exit()
cnt = 0
Ns = [i for i in range(len(L))]
com = itertools.combinations(Ns, 3)
# print(list(com))
for ns in itertools.combinations(Ns, 3):
    # print(ns)
    if (L[ns[0]] != L[ns[1]] and L[ns[1]] != L[ns[2]] and L[ns[2]] != L[ns[0]]) and (L[ns[0]] + L[ns[1]] > L[ns[2]]) and (L[ns[1]] + L[ns[2]] > L[ns[0]]) and (L[ns[2]] + L[ns[0]] > L[ns[1]]):
        # print(L[ns[0]], L[ns[1]], L[ns[2]])
        cnt += 1

print(cnt)

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
H=LIST()

for i in range(N-2, -1, -1):
    if H[i]>H[i+1]:
        H[i]-=1

for i in range(N-1):
    if H[i]>H[i+1]:
        No()
        exit()
Yes()


Measured memory_bytes: 14396
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n,m) for(int i=n;i<m;i++)
int main()
{
    int A, B, C; cin >> A >> B >> C;
    cout << (A ^ B ^ C) << endl;
    return 0;
}


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

int pollock[190]; //(i+1)の正四面体数
int dp[2][1000001]; //jのポロック数を作る最小四面体数個数
int main()
{
	for(int i=0;i<190;i++)
		pollock[i]=(i+1)*(i+2)*(i+3)/6;
	fill(dp[0],dp[2],1e8-1);
	dp[0][0]=0;
	//start dp
	for(int i=0;i<190;i++)
	{
		for(int j=0;j+pollock[i]<1000001;j++)
		{
			dp[0][j+pollock[i]]=min(dp[0][j+pollock[i]],dp[0][j]+1);
		}
	}
	dp[1][0]=0;
	for(int i=0;i<190;i++)
	{
		if((pollock[i]&1)==0)
			continue;
		for(int j=0;j+pollock[i]<1000001;j++)
		{
			dp[1][j+pollock[i]]=min(dp[1][j+pollock[i]],dp[1][j]+1);
		}
	}
	int n;
	while(1)
	{
		cin>>n;
		if(n==0)
			break;
		cout<<dp[0][n]<<" "<<dp[1][n]<<endl;
	}
	return 0;
}


Measured memory_bytes: 10800
#include<bits/stdc++.h>
using namespace std;
long long min_cost(int n,int *h)
{
	long long dp[n];

	dp[1]=0;
	for(int i=2;i<=n;i++)
	{
        i>2 ? dp[i]=min((abs(h[i]-h[i-1])+dp[i-1]),(abs(h[i]-h[i-2])+dp[i-2])):dp[i]=abs(h[i]-h[i-1]);
	}
   return dp[n];
}
int main()
{
	int n;
	cin>>n;
	int h[n+1];
	for(int i=1;i<=n;i++)
	{
	cin>>h[i];
	}

	cout<<min_cost(n,h);

	return 0;
}

Measured memory_bytes: 4724
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define int long long
#define ll long long
#define pp pair<int,int>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int max(int x, int y)
{
    return x>y ? x : y;
}
int min(int x, int y)
{
    return x<y ? x : y;
}
void _(int&a , int b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
ll cl(ll a,ll b)
{
    return (a/b)+(!(!(a%b)));
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m;cin >> n >> m;bool vis[n];memset(vis,0,sizeof(vis));
    vector<ll> e[n];
    for (int i = 0; i < m; ++i)
    {
        ll u,v;cin >> u >> v;u--;v--;e[u].push_back(v);e[v].push_back(u);
    }
    ll p[n];p[0]=-1;vis[0]=1;queue<ll> q;q.push(0);
    while(!q.empty())
    {
        int x=q.front();q.pop();
        for(auto j : e[x])
        {
            if(!vis[j])
            {
                p[j]=x;vis[j]=1;q.push(j);
            }
        }
    }
    cout << "Yes\n";
    for (int i = 1; i < n; ++i)
    {
        cout << p[i]+1 << "\n";
    }
    }

Measured memory_bytes: 13160
// atcoder.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>

// A function to merge the two half into a sorted data.
void Merge(long long* a, int low, int high, int mid)
{
	// We have low to mid and mid+1 to high already sorted.
	int i, j, k;
	long long* temp = new long long[high - low + 1];
	i = low;
	k = 0;
	j = mid + 1;

	// Merge the two parts into temp[].
	while (i <= mid && j <= high)
	{
		if (a[i] < a[j])
		{
			temp[k] = a[i];
			k++;
			i++;
		}
		else
		{
			temp[k] = a[j];
			k++;
			j++;
		}
	}

	// Insert all the remaining values from i to mid into temp[].
	while (i <= mid)
	{
		temp[k] = a[i];
		k++;
		i++;
	}

	// Insert all the remaining values from j to high into temp[].
	while (j <= high)
	{
		temp[k] = a[j];
		k++;
		j++;
	}


	// Assign sorted data stored in temp[] to a[].
	for (i = low; i <= high; i++)
	{
		a[i] = temp[i - low];
	}
}

// A function to split array into two parts.
void MergeSort(long long* a, int low, int high)
{
	int mid;
	if (low < high)
	{
		mid = (low + high) / 2;
		// Split the data into two half.
		MergeSort(a, low, mid);
		MergeSort(a, mid + 1, high);

		// Merge them to get sorted output.
		Merge(a, low, high, mid);
	}
}

int main(void) {
	int N = 0;
	int K = 0;
	std::cin >> N >> K;
	long long* array = new long long[N];
	for (int i = 0; i < N; i++) {
		std::cin >> array[i];
	}
	if (N <= K) {
		std::cout << "0" << std::endl;
		return 0;
	}
	MergeSort(array, 0, N-1);
	long long sum = 0;
	for (int i = 0; i < N-K; i++) {
		sum += array[i];
	}
	std::cout << sum << std::endl;
	return 0;
}


Measured memory_bytes: 32000
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    int four = 0, two = 0, one = 0;
    REP(i, 0, N) {
        int a; cin >> a;
        if (a % 4 == 0) {
            four++;
        } else if (a % 2 == 0) {
            two++;
        } else {
            one++;
        }
    }
    
    if (two == 0) {
        if (one > four + 1) {
            cout << "No" << endl;
            return 0;
        }
    } else {
        if (one > four) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        int M = sc.nextInt();

        TreeMap<Long, Integer> priceToStock = new TreeMap<>();

        for (int i = 0; i < N; i++) {
            long price = sc.nextLong();
            int stock = sc.nextInt();
            if (priceToStock.containsKey(price)) {
                int prevStock = priceToStock.get(price);
                priceToStock.put(price, stock + prevStock);
            } else {
                priceToStock.put(price, stock);
            }
        }
        long ans = 0;
        for (Map.Entry<Long, Integer> entry: priceToStock.entrySet()) {
            long price = entry.getKey();
            int stock = entry.getValue();
            if (M > stock) {
                //終わらない
                M -= stock;
                ans += price * (long) stock;
            } else {
                //終わり
                ans += price * M;
                break;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 97820
H,W = map(int,input().split())
L = [input() for _ in range(H)]
for i in range(H):
    for j in range(W):
        if L[i][j] == '#':
            if i != 0 and L[i-1][j] == '#':
                continue
            if i != H-1 and L[i+1][j] == '#':
                continue
            if j != 0 and L[i][j-1] == '#':
                continue
            if j != W-1 and L[i][j+1] == '#':
                continue
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 65864
//package atcoder;
 
import java.util.*;
//import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String str[] = new String[S.length()-2];
		for(int i=0;i<S.length()-2;i++) {
		 str[i] = S.substring(i,i+3);
		// System.out.println(str[i]);
	}
		
		
		System.out.println(getRandom(str));
	//System.out.println(generateRandomChars(
	//            str,3));	

		
	}
/*	public static String generateRandomChars(String candidateChars, int length) {
	    StringBuilder sb = new StringBuilder();
	    Random random = new Random();
	    for (int i = 0; i < length; i++) {
	        sb.append(candidateChars.charAt(random.nextInt(candidateChars
	                .length())));
	    }

	    return sb.toString();
	}*/

	
	
	public static String getRandom(String[] array) {
	    int rnd = new Random().nextInt(array.length);
	    return array[rnd];
	}
	
}

Measured memory_bytes: 35688