akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    ll K;
    cin>>N>>K;
    int ans;ans=1;
    REP(i,40){
        if(N<K){
            cout<<ans<<endl;
            return 0;
        }else{
            ans++;
            N/=K;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n;
    cin >> n;
    vl a(n);
    ll tot = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        tot += a[i];
    }
    if (n == 1) {
        cout << a[0] << "\n";
        return 0;
    }
    bitset<4000000> dp = 0;
    dp[0]              = 1;
    for (int i = 0; i < n; ++i) {
        dp |= dp << a[i];
    }
    for (int i = tot / 2 + tot % 2; i < tot; ++i) {
        if (dp[i] == 1) {
            cout << i << "\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pb push_back
#define nmax
#define inf
using namespace std;

int main()
{
    int n;
    long long ans = 0;
    cin>>n;
    for (int i=1;i<=n;++i){
        for (int j=1;j<=n;++j){
            int gc = __gcd(i, j);
            for (int k=1;k<=n;++k){
                int gcc = __gcd(gc, k);
                ans += gcc;
            }
        }
    }
    cout<<ans<<'\n';
    return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n * 3);
  for (int i = 0; i < n * 3; i++) {
    cin >> a[i];
  }
  vector<ll> left(n + 1), right(n + 1);
  priority_queue<ll, vector<ll>, greater<ll>> q;
  ll sum = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    q.push(a[i]);
  }
  left[0] = sum;
  for (int i = n; i < n * 2; i++) {
    q.push(a[i]);
    int v = q.top();
    q.pop();
    sum = sum + a[i] - v;
    left[i - n + 1] = sum;
  }
  auto r = priority_queue<ll, vector<ll>, less<ll>>();
  sum = 0;
  for (int i = n * 3 - 1; i >= n * 2; i--) {
    sum += a[i];
    r.push(a[i]);
  }
  right[n] = sum;
  for (int i = n * 2 - 1; i >= n; i--) {
    r.push(a[i]);
    int v = r.top();
    r.pop();
    sum = sum + a[i] - v;
    right[i - n] = sum;
  }
  ll ans = -1e18;
  for (int i = 0; i <= n; i++) {
    ans = max(ans, left[i] - right[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5364
import java.util.*;

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] num = new int[N];
    
    for(int i=0; i<N;i++){
      num[i] = sc.nextInt();
    }
    
    Arrays.sort(num);
    int output = 0;
    
    for(int i=0; i < K; i++){
      output += num[N-1-i];
    }
    
    System.out.println(output);
  }
}



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

int main()
{
	int X, Y;
	for (X = 1; X < 10; X++)
	{
		for (Y = 1; Y < 10; Y++)
		{
			printf("%dx%d=%d\n", X,Y,(X*Y));
		}
	}
	return 0;
}

Measured memory_bytes: 924
import java.io.*;
import java.util.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int n=Integer.parseInt(bu.readLine());
        if(n<2) {System.out.print(0); return;}

        int i; long p10[]=new long[n+1],p8[]=new long[n+1],p9[]=new long[n+1],M=1000000007;
        p10[0]=p8[0]=p9[0]=1;
        for(i=1;i<=n;i++)
        {
            p10[i]=p10[i-1]*10%M;
            p8[i]=p8[i-1]*8%M;
            p9[i]=p9[i-1]*9%M;
        }

        long ans=p10[n]-(p8[n]+(p9[n]-p8[n]+M)*2%M)%M;
        ans=(ans+M)%M;
        System.out.print(ans);
    }
}


Measured memory_bytes: 64292
n, m, x, y = map(int, input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
xl.sort()
yl.sort()
ans = False
if x < y and x < xl[n - 1] < yl[0] < y:
    ans = True
    
print("No War" if ans else "War")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define frn(i,a,b) for(ll i=a;i<b;i++)
#define forn(i,a,b) for(ll i=a;i<=b;i++)
#define frt(i,a,b) for(auto it=a;it!=b;it++)
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define SQ(a) (a)*(a)
#define SUM(n) ((n)*(n+1))/2
#define SqSUM(n) ((n)*(n+1)*(2*n+1))/2
#define GMSUM(a,r,n) (a*pow(r,n)-a)/(r-1)
#define ciel(x, y) (((x) / (y)) + ((x) % (y) != 0))
#define tc(tt) \
    int tt;    \
    cin >> tt; \
    for (int _tt = 0; _tt < tt; _tt++)
#define input(v,n) for(ll i = 0 ; i<n ; i++) cin>>v[i]
#define output(v,n) for(ll i = 0 ; i<n ; i++) cout<<v[i]<<" "
#define endl '\n'
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl
#define dbg(x) cerr << #x << "is" << (x) << endl
#define leadzero(a) __builtin_clz(a)      // count leading zeroes
#define trailzero(a) __builtin_ctz(a)     // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
const long long int md = 998244353;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef vector<vector<ll, ll> > vvi;
    // typedef bitset<5> bst;
typedef priority_queue<int, vector<int>, greater<int>> min_heap;
typedef priority_queue<int, vector<int>> max_heap;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
    indexed_set;
const ll MAX = LONG_MAX;
const ll lrg = 1000000007;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll ar[n];
    ll sum=0,m=0,mx=LONG_MAX;
    frn(i,0,n)
    {
        cin>>ar[i];
        if(mx>=ar[i])
            m++;
        mx=min(ar[i],mx);
    }
    cout<<m;
    return 0;
}

Measured memory_bytes: 1792
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	if a == b && b == c {
		fmt.Println("1")
	} else if a != b && b != c && c != a {
		fmt.Println("3")
	} else {
		fmt.Println("2")
	}
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  ll n; cin >> n;
  vector<ll> v(n); cin >> v;
  bool f = true;
  ll ans = 0;
  if(v[0] != 0){
    ans = -1;
    f = false;
  }
  for(ll i = 1; i < n && f; ++i){
    if(v[i-1]+1 < v[i]){
      ans = -1;
      f = false;
      continue;
    }
    if(v[i-1]+1 == v[i]){
      ans++;
      continue;
    }
    if(v[i-1] >= v[i]){
      ans += v[i];
      continue;
    }    
  }
  cout << ans << endl;
  return 0;
}


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


int main(){
  int N; cin>>N;
  map<int,int> mp;
  int A[N];
  rep(i,N){
    cin>>A[i];
    mp[i-A[i]]++;
  }
  ll ans=0;
  rep(i,N){
    mp[i-A[i]]--;
    ans+=mp[A[i]+i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 21312
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,h,w;
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1)<<endl;
    return 0;
}

Measured memory_bytes: 256
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    k, n = MI()
    A = LI()

    path = [A[i] - A[int1(i)] for i in range(1, len(A))]
    l = A[-1] - A[0]
    path.append(min(l, k - l))
    # print(path)

    ans = sum(path)
    if len(path) > 2:
        ans = ans - max(path)
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 26444
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b);
long long lcm(int a,int b);
int main(){
    int a,b;
    cin>>a>>b;
    cout<<lcm(a,b)<<endl;
    return 0;
}
int gcd(int a,int b){
    if(b==0)return a;
    else return gcd(b,a%b);
}
long long lcm(int a,int b){
    return (long long)a/gcd(a,b)*b;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long 
 
int main() {
  vector<vector<int>>kazu (3,vector<int>(3));
  rep(i,3){
    rep(j,3){
      cin >>kazu[i][j];
    }
  }
  int b12nosa=kazu[0][1]-kazu[0][0];
  int b23nosa=kazu[0][2]-kazu[0][1];
  int a12nosa=kazu[1][0]-kazu[0][0];
  int a23nosa=kazu[2][0]-kazu[1][0];
  if(kazu[1][1]-kazu[1][0]!=b12nosa){
    cout<<"No"<<endl;
    return 0;
  }
  if(kazu[2][1]-kazu[2][0]!=b12nosa){
    cout<<"No"<<endl;
    return 0;
  }
  if(kazu[1][2]-kazu[1][1]!=b23nosa){
    cout<<"No"<<endl;
    return 0;
  }
  if(kazu[1][2]-kazu[1][1]!=b23nosa){
    cout<<"No"<<endl;
    return 0;
  }
  if(kazu[1][1]-kazu[0][1]!=a12nosa){
    cout<<"No"<<endl;
    return 0;
  }
  if(kazu[1][2]-kazu[0][2]!=a12nosa){
    cout<<"No"<<endl;
    return 0;
  }  
  if(kazu[2][1]-kazu[1][1]!=a23nosa){
    cout<<"No"<<endl;
    return 0;
  }
  if(kazu[2][2]-kazu[1][2]!=a23nosa){
    cout<<"No"<<endl;
    return 0;
  }
  cout <<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000000)

n,m =  map(int,input().split())

visited = [-1 for i in range(n)]

edge = [[]for i in range(n)]

flag = True


def dfs(p,color):
    global flag
    if visited[p] == -1:
        visited[p] = color
        for next in edge[p]:
            dfs(next,color^1)
    elif visited[p] != color:
        flag = False




for i in range(m):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

dfs(0,0)


if(flag):
    cnt = 0
    for i in range(n):
        if(visited[i] == 1): cnt += 1
    print(cnt*(n-cnt)-m)

else:
    print(n*(n-1)//2 - m)

Measured memory_bytes: 43836
N = int(input())
A = list(map(int,input().split()))
x = list()
x0 = 0
for i in range(N):
    if i % 2==0:
        x0 += A[i]
    else:
        x0 -= A[i]
x.append(x0)
for i in range(1,N):
    xp = x[i-1]
    xi = (A[i-1]-xp//2)*2
    x.append(xi)
print(*x)

Measured memory_bytes: 69988
#include<bits/stdc++.h>
#include<stdio.h>
#include<string>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
#define INF 1e5

int dp[5005][5005];
int main(){
	int n;
	cin>>n;
	vi a(n);
	rep(i,n) cin>>a[i];
	vi v=a;
	sort(All(v));
	int f=v.back();
	v.pop_back();
	int s=v.back();
	rep(i,n){
		if(a[i]==f) cout<<s<<endl;
		else cout<<f<<endl;
	}

}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int a[s.size()], k, ans=0;
	cin >> k;int p=k;
	for(int i=0;i<s.size();i++)
		a[i]=s[i]-48;
	for(int i=0;i<s.size();i++)
	{
		if(k==1)
		{
			cout<<a[0]<<endl;
			return 0;
		}
		if(a[i]!=1)
		{
			ans=a[i];
			break;
		}
		else p--;
	}
	if(p<=0)
	{
		cout<<1<<endl;
		return 0;
	}
	if(ans==0)
	{
		cout<<1<<endl;
		return 0;
	}
	else cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int n = sc.nextInt();
		int[] t = new int[n + 1];
		int[] x = new int[n + 1];
		int[] y = new int[n + 1];

		for (int i = 1; i <= n; i++) {
			t[i] = sc.nextInt();
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}

		String msg = "Yes";

		for (int i = 1; i <= n; i++) {
			int dxdy = Math.abs(x[i] - x[i - 1]) + Math.abs(y[i] - y[i - 1]);
			int dt = t[i] - t[i - 1];
			if (dxdy > dt || dxdy % 2 != dt % 2) {
				msg = "No";
				break;
			}
		}

		System.out.println(msg);

		sc.close();
	}
}

Measured memory_bytes: 90972
/*I - Poisonous Cookies*/

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

int main(){

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

	int a, b, c;

	int ans = 0;

	cin >> a >> b >> c;

	if( c <= a){
		ans += c;
		ans += b; 
	}
	else{
		
		ans = a;
		c-= a;

		if(c <= b){
			ans += c + b;
		}
		else{
			ans += (b * 2);
			c -= b;

			if (c > 0)
				ans++;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3564
public class Main {
  private static void solve() {
    int a = ni();
    int b = ni();
    
    System.out.println(a - 1 + (a <= b ? 1 : 0));
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}




Measured memory_bytes: 21460
# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>
 
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
 
int main(){
  long n,len,priv,cur;
  vector<long> v;
  vector<long>::iterator low;
  len = 0;
  priv = -1;
  cin >> n;
  rep(i,n){
  	cin >> cur;
  	if(cur>priv){
  		v.push_back(cur);
  		len++;
  	}else{
  		low = lower_bound(v.begin(), v.end(), cur);
  		*low = cur;
  		//cout << *low << endl;
  	}
  	priv = *(v.end()-1);
	//cout << priv << endl;
  }
  /*for(auto itr=v.begin(); itr<v.end();itr++){
  	cout<< *itr << " ";
  }
  cout << endl;*/
  cout << len << endl;
}

Measured memory_bytes: 3712
N,Ma,Mb=map(int,input().split())
a=[0 for i in range(N)]
b=[0 for i in range(N)]
c=[0 for i in range(N)]
M=401
dp=[[[10**4 for cb in range(M)]for ca in range(M)]for i in range(N+1)]
for i in range(N):
    a[i],b[i],c[i]=map(int,input().split())
dp[0][0][0]=0
for i in range(N):
    for ca in range(M):
        for cb in range(M):
            if ca+a[i]<M and cb+b[i]<M:
                dp[i+1][ca+a[i]][cb+b[i]]=min([dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]])
            dp[i+1][ca][cb]=min([dp[i][ca][cb],dp[i+1][ca][cb]])
ans=10**4
for i in range(1,M):
    for j in range(1,M):
        if i*Mb==j*Ma:
            if dp[N][i][j]<ans:
                ans=dp[N][i][j]
if ans!=10**4:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 97500
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;
int main(){
    int a;
    cin >> a;
    string s;
    cin >> s;
    a >= 3200 ? cout <<s << endl: cout << "red" << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        string s = sc.Next();
        var a = s.Any(c => c == 'A');
        var b = s.Any(c => c == 'B');;
        if (a && b)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11220
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    y = [-1 for i in range(N)]
    y[0] = sum([A[i] if i%2 == 0 else (-1) * A[i] for i in range(N)])
    for i in range(0, N-1):
        y[i+1] = 2 * A[i] - y[i]
    result = [str(i) for i in y]
    print(' '.join(result))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 29804
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

dish = [a, b, c, d, e]
ans = 1000

def return_time(t):
    time = t//10 * 10
    mod = t%10
    if mod != 0:
        time += 10
    return time

for v in itertools.permutations(dish, 5):
    t1, t2, t3, t4, t5 = v[0], v[1], v[2], v[3], v[4]
    total = 0
    for t in [t1, t2, t3, t4]:
        total += return_time(t)
    total += t5
    ans = min(ans, total)

print(ans)

Measured memory_bytes: 3064
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]

li.sort(key=lambda x: x[2])
a,b,c = li[-1]
for x in range(101):
    for y in range(101):
        h = abs(x-a) + abs(y-b) + c
        if all(k == max(h-abs(x-i)-abs(y-j),0) for i,j,k in li):
            print(x,y,h)
            exit()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long INF = 1e9 + 7;
using namespace std;
typedef long long ll;
map<int, int> mp;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	int s = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			char tmp;
			cin >> tmp;
			if (tmp == '#') s++;
		}
	}
	if (h + w - 1 == s) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        String result = "Odd";
        if (a*b % 2 == 0) result = "Even";

        System.out.println(result);
    }
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(auto& i : v) cin >> i;
    sort(all(v));
    int ans = inf;
    FOR(i, v[0], v[n-1]+1){
        int sum = 0;
        REP(j, n){
            sum += (i - v[j]) * (i - v[j]);
        }
        chmin(ans, sum);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define NIL (-1)
#define M 1000000
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key%(M-1)); }

int find(char str[]){
  long long key, i,h;
  key = getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if (strlen(H[h])==0)return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key, i,h;
  key = getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if (strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

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

int main(){
    int A,B;
    cin>>A>>B;
    bool flag = false;
    int start = (A/0.08);
    while(1){
        if(start*0.1 > 100) break;
        if((int)(start*0.08) == A && (int)(start*0.1) == B){
            flag  = true;
            break;
        } 
        start++;
    }

    if(flag)cout<<start<<endl;
    else cout<<-1<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int N; cin >> N;
    string s; cin >> s;

    rep(i, s.size()){
        char c = s[i]+N;
        int a = c;
        if(a > 90) a = 64 + (a - 90);
        c = a;
        s[i] = c;
    }

    cout << s << endl;
    
    return 0;
}

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

signed main(void)
{
	int n; 
	cin >> n;
	vector<int> g[n];
	vector<pair<int, int>> ans;
	rep(i, n - 1)
	{
		int a, b;
		cin >> a >> b;
		--a; --b;
		g[a].push_back(b);
		ans.push_back(make_pair(a, b));
	}
	rep(i, n) sort(g[i].begin(), g[i].end());
	queue<pair<int, int>> que;
	map<pair<int, int>, int> mp;
	int pre = -1;
	int cnt, k;

	que.push(make_pair(0, pre));
	cnt = k = 0;
	while(!que.empty())
	{
		auto now = que.front();
		que.pop();
		cnt = 1;
		for(int u : g[now.first])
		{
			if (now.second == cnt)
				cnt++;
			mp[make_pair(now.first, u)] = cnt;
			pre = cnt;
			k = max(k, cnt);
			que.push(make_pair(u, pre));
			cnt++;
		}
	}
	cout << k << endl;	
	for(auto p : ans) cout << mp[p] << endl;
	return 0;
}


Measured memory_bytes: 11508
#include<iostream>
    #include<algorithm>
    #include<string>
    #include<string.h>
    using namespace std;
    string i;
    int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a;
    cin >>a;
    if(a>=1200) cout <<"ARC\n";
    else cout <<"ABC\n";
    return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <deque>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end() //定義すると楽。

int main() {
  string s; cin >> s;//string限定＋元のS含む
  string t;//string限定＋別のtで管理
  int q; cin >> q;
  while (q--) {
    int type; cin >> type;
    if (type == 1) {
      swap(s, t);
    } else {
      int f; char c; cin >> f >> c;
      if (f == 1) {
        t.push_back(c);
      } else {
        s.push_back(c);
      }
    }
  }
  reverse(range(t));
  cout << t+s << endl;
}



Measured memory_bytes: 1248
#include <iostream>

using namespace std;

int main(void){
    int x, y;
    cin >> x >> y;
    const int group[] = {1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    if(group[x-1] == group[y-1]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define pb push_back
#define all(v) v.begin(),v.end()
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int main(){
	string s;
	int n=0;
	cin>>s;
	rep(i,s.size())n+=(int)(s[i]-'0');
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 256
from math import floor, ceil


def solve(A, B):
    candidates = set()
    for i in range(10):
        _A = A + i * 0.1
        x = _A / 0.08
        candidates.add(floor(x))
        candidates.add(ceil(x))
    # print(candidates)

    for i in range(10):
        _B = B + i * 0.1
        x = _B / 0.1
        candidates.add(floor(x))
        candidates.add(ceil(x))
    # print(candidates)

    ans = -1
    for c in candidates:
        if floor(c * 0.08) == A and floor(c * 0.1) == B:
            ans = min(ans, c) if ans != -1 else c

    print(ans)


if __name__ == '__main__':
    A, B = map(int, input().split())
    solve(A, B)


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

int main(){
bool A = true;
int d[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
string S;
  cin >> S;
  
  for(int i = 0;i < S.size();i++){
  if(S.at(i) == 'a') d[0]++;
    else if(S.at(i) == 'b') d[1]++;
    else if(S.at(i) == 'c') d[2]++;
    else if(S.at(i) == 'd') d[3]++;
    else if(S.at(i) == 'e') d[4]++;
    else if(S.at(i) == 'f') d[5]++;
    else if(S.at(i) == 'g') d[6]++;
    else if(S.at(i) == 'h') d[7]++;
    else if(S.at(i) == 'i')d[19]++;
    else if(S.at(i) == 'j') d[8]++;
    else if(S.at(i) == 'k') d[9]++;
  else if(S.at(i) == 'l') d[10]++;
    else if(S.at(i) == 'm') d[11]++;
    else if(S.at(i) == 'n') d[12]++;
    else if(S.at(i) == 'o') d[13]++;
    else if(S.at(i) == 'p') d[14]++;
    else if(S.at(i) == 'q') d[15]++;
    else if(S.at(i) == 'r') d[16]++;
    else if(S.at(i) == 's') d[17]++;
    else if(S.at(i) == 't') d[18]++;
     else if(S.at(i) == 'u') d[20]++;
    else if(S.at(i) == 'v') d[21]++;
    else if(S.at(i) == 'w') d[22]++;
    else if(S.at(i) == 'x') d[23]++;
    else if(S.at(i) == 'y') d[24]++;
    else if(S.at(i) == 'z') d[25]++;
      }
  
  for(int i = 0;i < 26;i++){
  if(d[i] >1) A = false;
  }
  
  if(A) cout << "yes" << endl;
  else cout << "no" << endl;
}

Measured memory_bytes: 256
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll N,M;
	cin >> N>>M;
	P LR[M];
	for (ll i = 0; i < M; ++i){
		ll l,r;cin>>l>>r;--l;--r;
		LR[i] = make_pair(l,r);
	}
 
	// 解法
	ll lmax = 0;
	ll rmin = N;
	REP(i,M){
		if (LR[i].first>lmax) lmax = LR[i].first;
		if (rmin>LR[i].second) rmin = LR[i].second;
	}
	ll ans = rmin-lmax+1;
	if (ans<0) ans = 0;
	//出力
	cout << ans << endl;
}


Measured memory_bytes: 1792
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, -1, 1};

int main() {
  int n, ans = 0;
  
  REP(i, 10) {
    cin >> n;
    ans += n;
  }
  cout << ans << endl;  
}

Measured memory_bytes: 1160
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n := io.NextInt()
	a := io.NextInts(n - 1)
	cnt := map[int]int{}
	for i := range a {
		cnt[a[i]]++
	}
	for i := 1; i <= n; i++ {
		io.Println(cnt[i])
	}
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// NextInts returns n integers from stdin
func (io *Io) NextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = io.NextInt()
	}
	return ret
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

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

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A[i];
    }

    ll Q;
    cin >> Q;

    while(Q--){
        ll k;
        cin >> k;

        ll index = lower_bound(ALL(A), k) - A.begin();

        ll index2 = upper_bound(ALL(A), k) - A.begin();
    
        p2(index, index2);
    }

    return 0;
}


Measured memory_bytes: 3532
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC055A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a,x,y;
			x = 0;
			a = int.Parse(Console.ReadLine());
			x = 800 * a;
			y = a / 15 * 200;
			Console.WriteLine(x - y);
			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 11092
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)
#define int long long

using namespace std;
typedef pair<int, int> pii;


signed main() {
	int a,b;
    cin>>a>>b;
    if(a+b>=10){
        cout<<"error"<<endl;
    }
    else{
        cout<<a+b<<endl;
    }
	
	
	return 0;
}


Measured memory_bytes: 256
"use strict";

const main = arg => {
    const A = parseInt(arg.split("\n")[0].split(" ")[0]);
    const B = parseInt(arg.split("\n")[0].split(" ")[1]);
    const K = parseInt(arg.split("\n")[0].split(" ")[2]);
    const list = [];
    
    for(let i=1; i<=Math.min(A,B); i++) {
        if(A % i == 0 && B % i == 0) {
            list.push(i);
        }
    }
    
    console.log(list[list.length - K]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    long long N,K,R,S,P;
    string T;
    cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;
   
    long long ans=0;

    long long b[N];

    for(long long i=0;i<N;i++){
        b[i]=0;
    }

    for(long long i=0;i<K;i++){
        if(T[i]=='r'){
            ans = ans + P;
            b[i]=1;
        }else{
            if(T[i]=='s'){
                ans = ans + R;
                b[i]=1;
            }else{
                ans = ans + S;
                b[i]=1;
            }
        }
    }


    for(long long i=K;i<N;i++){
        if(i-2*K<0){
            if(T[i]!=T[i-K] ){
                if(T[i]=='r'){
                    ans = ans + P;
                    b[i]=1;
                }else{
                    if(T[i]=='s'){
                        ans = ans + R;
                        b[i]=1;
                    }else{
                        ans = ans + S;
                        b[i]=1;
                    }
                }
            }else{
            }
        }else{
            if((T[i]!=T[i-K]) || (T[i]==T[i-K] && b[i-K]==0) ){
                if(T[i]=='r'){
                   ans = ans + P;
                   b[i]=1;
                }else{
                    if(T[i]=='s'){
                        ans = ans + R;
                        b[i]=1;
                    }else{
                        ans = ans + S;
                        b[i]=1;
                    }
                }
            }else{             
            }
        }
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define SZ(a) (int)(a).size()
typedef long long ll;

int main() {
	cin.sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	for (auto& x: a) {
		cin >> x;
	}
	sort(begin(a), end(a));
	auto sum = 0ll;
	auto mx = 0;
	for (auto i = 0; i < n; i++) {
		auto x = (ll)a[i];
		if (2*sum < x) {
			mx = max(mx, i);
		}
		sum += x;
	}
	auto ans = n-mx;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
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;}
const ll MOD=1e9+7;

int N;
int M;
bool pushed[214514];
char S[214514];
set<int> es[214514][2];

int main() {
  scanf("%d%d", &N, &M);
  scanf(" %s", S);
  rep(i, M) {
    int u, v;
    //scanf("%d%d", &as[i], &bs[i]);
    scanf("%d%d", &u, &v);
    --u;
    --v;
    int c = S[u]-'A';
    int d = S[v]-'A';
    es[u][d].insert(v);
    es[v][c].insert(u);
  }

  queue<int> que;
  rep(v, N) {
    if (es[v][0].empty() || es[v][1].empty()) {
      //printf("v: %d\n", v);
      que.push(v);
    }
  }

  while (!que.empty()) {
    int v = que.front(); que.pop();
    int d = S[v] - 'A';
    for (int u : es[v][0]) {
      if (u == v) continue;
      es[u][d].erase(v);
      if (!pushed[u] && es[u][d].empty()) {
        pushed[u] = true;
        que.push(u);
      }
    }

    for (int u : es[v][1]) {
      if (u == v) continue;
      es[u][d].erase(v);
      if (!pushed[u] && es[u][d].empty()) {
        pushed[u] = true;
        que.push(u);
      }
    }
  }

  rep(v, N) {
    if (!(es[v][0].empty() || es[v][1].empty())) {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
}


Measured memory_bytes: 39168