akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

template <typename T>
struct WUF {
  int n, c;
  vector<int> p;
  vector<T> dw;
  WUF() {}
  WUF(int n) : n(n), c(n), p(n, -1), dw(n) {}
  int find(int x) {
    if (p[x] < 0) return x;
    int r = find(p[x]);
    dw[x] += dw[p[x]];
    return p[x] = r;
  }
  // x から見た y の重みを w に設定する
  int unite(int x, int y, T w) {
    w += weight(x); w -= weight(y);
    x = find(x); y = find(y);
    if (x == y) return w == 0;
    if (p[x] > p[y]) swap(x,y), w = -w;
    p[x] += p[y];
    p[y] = x;
    dw[y] = w;
    c--;
    return 1;
  }
  // 根から見た x の重み
  T weight(int x) {
    find(x);
    return dw[x];
  }
  // x から見た y の重み
  T diff(int x, int y) {
    assert(same(x, y));
    return weight(y) - weight(x);
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  // x を含む集合のサイズ
  int size(int x) {
    return -p[find(x)];
  }
  // 連結成分の個数
  int count() {
    return c;
  }
};

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

  int N,M;
  cin >> N >> M;
  WUF<int> wuf(N);
  bool yes = true;
  REP(i,M) {
    int L,R,D;
    cin >> L >> R >> D;
    L--; R--;
    yes &= wuf.unite(L,R,D);
  }
  cout << (yes ? "Yes" : "No") << endl;

  return 0;
}

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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N; cin >> N;
    int a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    long long ans=1;
    int r=0,b=0,g=0;
    for(int i=0;i<N;i++){
        int cnt=0;
        if(a[i]==r) cnt++;
        if(a[i]==b) cnt++;
        if(a[i]==g) cnt++;
        ans*=cnt;
        ans%=MOD;
        if(a[i]==r){
            r++;
        }else if(a[i]==b){
            b++;
        }else if(a[i]==g){
            g++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
from math import pi, cos, sqrt
a, b, h, m = list(map(int, input().split()))

angleMin = (m/60) * 2 * pi
angleMax = ((60*h+m)/(60*12)) * 2 * pi

diff = min(abs(angleMax-angleMin), 2*pi-abs(angleMax-angleMin))

dist = sqrt(a**2 + b**2 - 2*a*b*cos(diff))
print(dist)

Measured memory_bytes: 9292
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
typedef long long int ll;

struct UnionFind{
    vector<int> par,num;
    vector<bool> done;
    UnionFind(int n):par(n),num(n,1),done(n,false){
        iota(par.begin(),par.end(),0);  //include<numeric>
    }
    int find(int v){
        return (par[v]==v)?v:(par[v]=find(par[v]));
    }
    void unite(int u,int v){
        u=find(u),v=find(v);
        if(u==v)return;
        if(num[u]<num[v])swap(u,v);
        num[u]+=num[v];
        par[v]=u;
        done[u]=done[u]|done[v];
    }
    bool same(int u,int v){
        return find(u) == find(v);
    }
    bool ispar(int v){
        return v=find(v);
    }
    int size(int v){
        return num[find(v)];
    }
};

int main(){
	ll n,m; cin >> n >> m;
	UnionFind uf(2*n);
	for(int i=0;i<m;i++){
		int a,b; cin >> a >> b;
		a--; b--;
		uf.unite(a,b+n);
		uf.unite(a+n,b);
	}
	if(uf.same(0,n)){ //二部グラフでない場合
		ll ans=n*(n-1)/2-m;
		cout << ans << endl;
	}
	else{
		ll cnt=0;
		for(int i=0;i<n;i++){
			if(uf.same(0,i)){
				cnt++;
			}
		}
		ll ans=cnt*(n-cnt)-m;
		cout << ans << endl;
	}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main()
{
    ll N, A, B,ans=0;
    cin >> N >> A >> B;
    if((B-A)%2 == 0)
    {
        ans=(B-A)/2;
    }
    else
    {
        ll s = A - 1, t = B - 1, r = N - A, q = N - B;
        ll a = A, b = B;
        ll ans1 = 0,ans2=0;
        ans1 += s+1;
        a = 1;
        b -= (s+1);
        ans1 += (abs(b - a) / 2);

        a = A;
        b = B;
        ans2 += q+1;
        b = N;
        a += q+1;
        ans2 += (abs(b - a) / 2);
        ans = min(ans1, ans2);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    a, b, c, d = in_nn()

    ans = max(a * c, a * d, b * c, b * d)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61924
#include <stdio.h>
int primeNumber(int a)
{
    int i=2;
    while(1)
    {
        if(i * i > a){
            return 1;
            break;
        } else  if(a % i == 0){
            return 0;
            break;
        } else {
            i++;
        }
    }
}
 
int main()
{
  int j, n, c;
  int A[10000]={0};
  int cnt=0;
    scanf("%d", &n);
    for(j=0; j<n; j++){
        scanf("%d", &A[j]);
    }
    for(j=0; j<n; j++){
        c = primeNumber(A[j]);
        cnt += c;
    }
    printf("%d\n", cnt);
    return 0;
}



Measured memory_bytes: 2128
K = int(input())

A, B = [int(x) for x in input().split()]

yes = False
if A % K == 0 or B % K == 0:
    print("OK")

elif A == B:
    print("NG")


else:

    if int(A/K) == int(B/K):
        print("NG")

    else:
        print("OK")


Measured memory_bytes: 9084
#include<bits/stdc++.h> //ABC 166_a
#define ll long long
using namespace std;
string s;
int main(){
	cin>>s;
	for(int i=0;i<3;i++){
		if(s[i]=='B')
			cout<<"ARC";
		else if(s[i]=='R')
			cout<<"ABC";
	}
	return 0;
}

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

int main() {
  int64_t N, X, Y;
  cin >> N >> X >> Y;

  vector<vector<int64_t>> table(N + 1);
  for (int64_t i = 1; i <= N; i++) {
    table[i].resize(N + 1);
    for (int64_t j = i + 1; j <= N; j++) {
      table[i][j] = abs(j - i);
    }

    for (int64_t j = i + 1; j <= N; j++) {
      if (i <= X && j >= Y) {
	table[i][j] = (X - i) + 1 + (j - Y);
      }

      else if (i <= X && j >= X) {
	table[i][j] = min((X - i) + 1 + (Y - j), table[i][j]);
      }

      else if (i >= X) {
	table[i][j] = min((i - X) + 1 + abs(Y - j), table[i][j]);
      }
    }
  }

  vector<int64_t> cnt(N, 0);
  for (int64_t i = 1; i <= N; i++) {
    for (int64_t j = i + 1; j <= N; j++) {
      cnt[table[i][j]]++;
    }
  }

  for (int64_t k = 1; k < N; k++) {
    cout << cnt[k] << endl;
  }

  return 0;
}


Measured memory_bytes: 31616
import java.util.*;
import java.math.BigInteger;

public class Main{
  static BigInteger lcm(BigInteger a, BigInteger b){
    return a.divide(a.gcd(b)).multiply(b);
  }

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

    while(true){
      int n = sc.nextInt();
      if(n == 0) break;

      BigInteger[] p = new BigInteger[n];
      BigInteger[] q = new BigInteger[n];

      BigInteger lm = BigInteger.ONE;

      for(int i = 0; i < n; i++){
        p[i] = sc.nextBigInteger();
        q[i] = sc.nextBigInteger();
        lm = lcm(q[i], lm);
      }

      BigInteger lm2 = BigInteger.ONE;

      for(int i = 0; i < n; i++){
        lm2 = lcm(lm2, p[i].multiply(lm.divide(q[i])));
      }

      for(int i = 0; i < n; i++){
        System.out.println(lm2.divide(p[i].multiply(lm.divide(q[i]))));
      }
    }
  }
}

Measured memory_bytes: 13000
// Author:: MUKUL KUMAR RAI
// Institution:: Jalpaiguri Government Engineering College
//If you are not doing well now just stick to it and learn new things one day you will be...
//Compete with yourself 
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
///*template{{{
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
#define trav(a,x) for(auto &a:x)
#define fr(i,a,b)  for(ll i=a;i<=b;i++)
#define fr1(i,a)   for(ll i=0;i<a;i++)
#define frr(i,a,b) for(ll i=b;i>=a;i--)
#define frr1(i,a)   for(ll i=a-1;i>=0;i--)
#define sorta(a,n) sort(a,a+n)
#define sortd(a,n) sort(a,a+n,greater<ll>())
#define sortva(a) sort(a.begin(),a.end())
#define sortvd(a) sort(a.begin(),a.end(),greater<ll>())
#define tc(t) while(t--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
using vi= vector<ll>;
using vvi= vector<vi>;
using vb =vector<bool>;
using vc =vector<char>;
using vs =vector<string>;
using vld =vector<ld>;
using pii =pair<ll,ll>;
using psi =pair<string,ll>;
using pci =pair<char,ll>;
using vpii =vector<pii>;
//}}}template*/
ll mod=1e9+7;
ll const maxn=1e3;
ll const inf=1e18;
bool ss(const pair<ll,ll> &a, const pair<ll,ll> &b) { 
    return a.first*b.second+a.second<b.first*a.second+b.second;
}
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll modinverse(ll a, ll m){
    return powm(a,m-2,m);
}
bool prime(ll x){
    if(x<=1)return false;
    for(int i=2;i<=sqrt(x);i++)if(x%i==0)return false;
    return true;
}
ll divisor(ll x){
    ll cnt=0;
    for(int i=1;i<=sqrt(x);i++){
        if(x%i==0){
            if(i!=x/i)cnt+=2;
            else cnt+=1;
        }
    }
    return cnt;
}
vector<ll> sieve(ll n) {     
    bool prim[n+1]; 
    memset(prim, true, sizeof(prim)); 
  
    for (ll p=2; p*p<=n; p++) {
        if (prim[p] == true) { 
            for (int i=p*p; i<=n; i += p) 
                prim[i] = false; 
        } 
    }
    vector<ll>v;
    for(int i=2;i<=n;i++)if(prim[i])v.push_back(i);
    return v; 
}
// vvi adj(maxn);
// vb vis(maxn,false);
// ll ans;
// ll dfs(ll u,ll x){
//     vis[u]=true;
//     for(auto v:adj[u]){
//         if(!vis[v]){
//             ans++;
//             if(ans==x)return v;
//             dfs(u,x);
//         }
//     }
//     return -1;
// }
ll fact(ll x){
    ll ans=1;
    fr(i,1,x)ans*=i;
    return ans;
}
ll ncr(ll n,ll r){
    if(r>n)return 0;
    ll ans=fact(n);
    ans/=fact(r);
    ans/=fact(n-r);
    return ans;
}
int main(){
    
    fio;

    ll n;
    cin>>n;
    fr(i,1,9){
        fr(j,1,9){
            if(i*j==n){
                cout<<"Yes\n";
                return 0;
            }
        }
    }
    cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)
using namespace std;
typedef long long ll;
const int MAXN = 5 + 100000;
const int MOD = 1000000000 + 7;

int memo[MAXN][2], p[MAXN], N;
vector<int> t[MAXN];

int dp(int u, bool f) { /// f = true -> u es negro,  f = false -> u es blanco
    int& ans = memo[u][f];
    if(ans == -1) {
        if(f) { /// u es negro, todos los hijos deben ser blancos
            ans = 1;
            for(const int& v : t[u]) {
                ans = (1LL * ans * dp(v, false)) % MOD;
            }
        } else { /// u es blanco, todos los hijos pueden ser blancos o negros, da igual
            ans = 1;
            for(const int& v : t[u]) {
                int res = (dp(v,0) + dp(v,1));
                if(res >= MOD) res -= MOD;
                ans = (1LL * ans * res) % MOD;
            }
        }
    }
    return ans;
}

void dfs(int u) {
    for(const int& v : t[u]) {
        if(v == p[u]) continue;
        p[v] = u;
        dfs(v);
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> N;
    foi(i,0,N-1) {
        int u,v; cin >> u >> v;
        t[--u].emplace_back(--v);
        t[v].emplace_back(u);
    }
    p[0] = -1;
    dfs(0);
    foi(i,1,N) {
        assert(find(t[i].begin(), t[i].end(), p[i]) != t[i].end());
        t[i].erase(find(t[i].begin(), t[i].end(), p[i]));
        assert(find(t[i].begin(), t[i].end(), p[i]) == t[i].end());
    }
    memset(memo, -1, sizeof memo);
    int ans = dp(0,0) + dp(0,1);
    if(ans >= MOD) ans -= MOD;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 12416
#include<stdio.h>
#include<string.h>
int main()
{
	char strA[256];
	char strB[256];
	char strC[256];
	scanf("%s %s %s",strA, strB, strC);

//	printf("%s ", strA);
//	printf("%s ", strB);
//	printf("%s\n", strC);

	bool isShiritori = false;
	
	int strLenA = strlen(strA);
	int strLenB = strlen(strB);
	int strLenC = strlen(strC);
//	printf("%d ", strLenA);
//	printf("%d ", strLenB);
//	printf("%d\n", strLenC);
	char lastA = strA[strLenA - 1];
	char firstB = strB[0];
	char lastB = strB[strLenB - 1];
	char firstC = strC[0];
	if(lastA == firstB && lastB == firstC){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200001

int dp[maxn],N,K,C;
string S;
int dp2[maxn];

bool qry(int i){
	int a,b;
	if (i - C - 1 < 0) a = 0;
	else a = dp[i - C - 1];
	
	if (i + C + 1 >= N) b = 0;
	else b = dp2[i + C + 1];
	return a + b == K - 1;
}

set <int> st;
int main(){
	fast;
	
	cin>>N>>K>>C>>S;
	
	if (dp[0] == 'x') dp[0] = 0;
	else dp[0] = 1, st.insert(0);
	
	FOR(i,1,N-1){
		if (S[i] == 'x'){
			dp[i] = dp[i - 1];
		}else{
			st.insert(i);
			if (i - C - 1 < 0) dp[i] = max(dp[i-1],1);
			else dp[i] = max(dp[i - 1], dp[i - C - 1] + 1);
		}
	}
	
	if (dp2[N - 1] == 'x') dp2[N - 1] = 0;
	else dp2[N - 1] = 1;
	
	DEC(i,N - 2,0){
		if (S[i] == 'x'){
			dp2[i] = dp2[i + 1];
		}else{
			if (i + C + 1 >= N) dp2[i] = max(dp2[i+1],1);
			else dp2[i] = max(dp2[i + 1], dp2[i + C + 1] + 1);
		}
	}
	vi ans;
	FOR(i,0,N-1){
		if (S[i] == 'o'){
			
			if (!qry(i)) continue;
			
			auto it = st.upper_bound(i);
			int a = -1;
			if (it != st.end()) a = *it;
			if (a >= 0 && qry(a) && abs(a - i) <= C) continue;
			
			it = st.lower_bound(i);
			
			if (it != st.begin()){
				it--;
				a = *it;
			}
			
			
			if (a >= 0 && qry(a) && abs(a - i) <= C) continue;
			
			ans.pb(i+1);
		}
	}
	
	aFOR(i,ans){
		cout<<i<<'\n';
	}
}



Measured memory_bytes: 14472
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.Math;

class Main {
	public static void main(String[] args){
		try {
			
			/* 入力 */
			BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
			String str[] = (br.readLine()).split("\\s+");
			int P = Integer.parseInt(str[0]); 
			int Q = Integer.parseInt(str[1]);
			int R = Integer.parseInt(str[2]);

			PrintWriter pw = new PrintWriter(System.out);		
			
			// 標準出力
			pw.println(Math.min(P+Q,Math.min(Q+R,R+P)));
			
			pw.flush();
			
		} catch(IOException e) { System.out.println("Exception :" + e); }
	}
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
ll a[125252];
ll b[125252];
ll k[125252];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%lld",a+i);
  if(n==1){
    puts("YES");
    return 0;
  }
  a[n] = a[0];
  REP(i,n)b[i] = a[i+1]-a[i];
  b[n] = b[0];
  FORR(i,0,n){
    if((b[i+1]-b[i])%n!=0){
      puts("NO");
      return 0;
    }
    k[i] = (b[i+1]-b[i])/n + k[i+1];
  }
  ll mn = *min_element(k,k+n);
  if(mn<0)REP(i,n)k[i]-=mn;
  // a[0]
  REP(i,n)a[0]-=k[i]*(n-i);
  ll yoyo = (ll)n*(n+1)/2;
  if(a[0]>=0 && a[0]%yoyo==0){
    puts("YES");
  }else{
    puts("NO");
  }
  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int selection(int a[], int n)
{
	int sw = 0;
	for (int i = 0; i < n - 1; i++) {
		int minj = i;
		for (int j = i + 1; j <= n - 1; j++)
		{
			if (a[j] < a[minj])
			{
				minj = j;
			}
		}
		swap(a[i], a[minj]);
		if (i != minj)sw++;
	}
	return sw;
}
int main()
{
	int a[100], n, sw;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	sw = selection(a, n);
	for (int i = 0; i < n; i++)
	{
		if (i)cout << " ";
		cout << a[i];
	}
	cout << endl;
	cout << sw << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int N;
  cin >> N;
  int cur=1;
  int t;
  for(int i=0;i<N;i++){
    cin >> t;
    if(t==cur) cur++;
  }

  if(cur==1){
    cout << -1 << endl;
  }else{
    cout << N-cur+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
using namespace std;
 
int main() {
	int n;
	double t,a;
	cin>>n>>t>>a;
	double h[n];
	double min=10000;
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>h[i];
		if(abs(a-(t-h[i]*0.006))<min){
			min=abs(a-(t-h[i]*0.006));
			ans=i;
		}
	}
	cout<<ans+1<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        String s1 = sc.next();
        String s2 = sc.next();
        String s3 = sc.next();
        String sum ="";
        sum = "" + s1.charAt(0) + s2.charAt(0) + s3.charAt(0);
        sum = sum.toUpperCase();
        System.out.println(sum);
    }
}

Measured memory_bytes: 22100
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}


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


int sieve[1003];


int main(){

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

    for(int i=2;i<=1000;i++)
        if(!sieve[i])
            for(int j=2*i;j<=1000;j+=i)
                sieve[j] = 1;

    int n;
    cin>>n;

    ll ans = 1;
    for(int i=2;i<=n;i++)
        if(!sieve[i]){
            int cnt = 0;
            for(int j=i;j<=n;j++){
                int temp = j;
                while(temp % i == 0){
                    temp /= i;  cnt++;
                }
            }
            ans = (ans * (cnt+1)) % MOD;
        }

    cout<<ans;
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0;
	long long d,x,y;
	cin>>n>>d;
	for(int i=1;i<=n;i++){
		cin>>x>>y;
		if(d*d>=x*x+y*y){
			ans++;
		}
		
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 3604
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)

int main(){
	ll n,ans=0;
	cin >> n;

	for(ll i=1;i<10;i++){
		ans = n/i;
		if(n % i == 0 && ans < 10){
			cout << "Yes" << endl;
			return 0;
		}

	}

	cout << "No" << endl;
	return 0;

}

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

double n, t[102], v[102];
double s[102], ss[102], ans = 0;

int main(){
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> t[i];
	}
	for (int i = 1; i <= n; i++) {
		cin >> v[i];
	}

	for (int i = n; i >= 0; i--) {
		ss[i] = min(v[i], ss[i + 1] + t[i]);
		//cout << "ss[" << i << "]:" << ss[i] << endl;
	}

	for (int i = 1; i <= n; i++) {
		double maxspeed = min(s[i] + t[i], v[i]);
		maxspeed = min(maxspeed, s[i] + (t[i] + ss[i + 1] - s[i]) / 2.0);

		double up = maxspeed - s[i];
		double updis = s[i] * up + up*up / 2;
		double down = max(maxspeed - ss[i + 1], 0.0);
		double downdis = maxspeed*down + -down*down / 2;

		double middis = 0;
		if (maxspeed == v[i]) {
			middis += (t[i] - (up + down))*v[i];
		}

		//cout << "s[" << i << "]:"<< s[i] << " maxxpeed:" << maxspeed << " updis:" << updis << " middis:" << middis << " downdis:" << downdis << endl;
		s[i + 1] = maxspeed - down;
		ans += updis+middis+downdis;
	}

	//cout << ans << endl;
	printf("%.12f", ans);
}

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

class Main {
	/*
	 * 10????????´??°??????best3?????????
	 */
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[] heightArray = new int[10];

		for (int i = 0; i < 10; i++) {
			heightArray[i] = Integer.parseInt(br.readLine());
		}

		Arrays.sort(heightArray);

		for (int i = 9; i >= 7; i--) {
			System.out.println(heightArray[i]);
		}

	}
}

Measured memory_bytes: 17004
var
  a:array[1..200000] of longint;
  b,c,i,j,k,t,n,m,x,y:longint;
  s:ansistring;
begin
  readln(s);
  n:=length(s);
  k:=0;
  for i:=1 to n-1 do
  if s[i]='1' then if s[n-i]='0' then k:=1;
  if s[1]='0' then k:=1;
  if s[n]='1' then k:=1;
  if k=1 then writeln('-1') else
  begin
    x:=1;
    for i:=1 to n-1 do
    begin
      writeln(x,' ',i+1);
      if s[i]='1' then x:=i+1;
    end;
  end;
end.


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

int N, M, Q;
vector<vector<int>> T(50, vector<int>(4));
int ans = 0;

void dfs(int n, vector<int> A, int tail) {
  if (n == N) {
    int tmp = 0;
    for (int i = 0; i < Q; i++) {
      if (A.at(T.at(i).at(1)) - A.at(T.at(i).at(0)) == T.at(i).at(2)) {
        tmp += T.at(i).at(3);
      }
    }
    ans = max(ans, tmp);
    return;
  }
  for (int i = tail; i <= M; i++) {
    A.at(n) = i;
    dfs(n+1, A, i);
  }
}

int main() {
  cin >> N >> M >> Q;
  for (int i = 0; i < Q; i++) {
    cin >> T.at(i).at(0) >> T.at(i).at(1) >> T.at(i).at(2) >> T.at(i).at(3);
    T.at(i).at(0)--;
    T.at(i).at(1)--;
  }
  vector<int> A(N);
  dfs(0, A, 1);
  cout << ans << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    for(int N, Q; cin >> N >> Q, N || Q; ) {
        map<int, int> m;
        for(int i = 0; i < N; i++) {
            int k; cin >> k;
            for(int j = 0; j < k; j++) {
                int v; cin >> v;
                m[v]++;
            }
        }

        int key = 0;
        int val = 0;
        for(map<int, int>::iterator it = m.begin(); it != m.end(); ++it) {
            if(it->second >= Q && it->second > val) {
                val = it->second;
                key = it->first;
            }
        }

        cout << key << endl;
    }
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
typedef long double ld;

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int k, t = 0;
	cin >> k;
	for (int i = 1; i <= k; i++)
		for (int j = 1; j <= k; j++)
			for (int l = 1; l <= k; l++)
				t += __gcd(__gcd(i, j), l);
	cout << t << '\n';
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 N;
  cin >> N;
  vector<int64> A(N);
  REP(i, N) cin >> A[i];

  int64 res = 1;
  bool out = 0;
  REP(i, N) {
    if (A[i] != 0 && (res > INF_LL || res > INF_LL / A[i])) {
      out = 1;
    }
    if (!out || A[i] == 0)
      res *= A[i];
  }
  if (out && res != 0)
    cout << -1 << endl;
  else
    cout << res << endl;
}


Measured memory_bytes: 3976
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
typedef long long ll;
int n;
vector<int> adj[maxn];
int dep[maxn],len[maxn],anc[maxn][22];
void dfs(int u,int fa){
	dep[u]=dep[fa]+1;
	anc[u][0]=fa;
	for (int i=1;i<=20;i++){
		anc[u][i]=anc[anc[u][i-1]][i-1];
	}
	for (int i=0;i<adj[u].size();i++){
		int v=adj[u][i];
		if (v==fa) continue;
		dfs(v,u);
		len[u]=max(len[u],len[v]+1);
	}
}
int lca(int a,int b){
	if (dep[a]<dep[b]) swap(a,b);
	for (int i=20;i>=0;i--){
		if (dep[anc[a][i]]>=dep[b]) a=anc[a][i];
	} 
	if (a==b) return a;
	for (int i=20;i>=0;i--){
		if (anc[a][i]!=anc[b][i]){
			a=anc[a][i];
			b=anc[b][i];
		}
	}
	return anc[a][0];
}
int dis(int u,int v){
	int z=lca(u,v);
	return dep[u]+dep[v]-dep[z]*2;
}
int a,b;
int main(){
	cin>>n>>a>>b;
	for (int i=1;i<=n-1;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	dfs(b,0);
	//cout<<"P DUS "<<dis(2,4)<<endl;
	int ans=0;
	for (int i=1;i<=n;i++){
		if (b==i) continue;
		int dis1=dis(i,a);
		int dis2=dep[anc[i][0]]-dep[b];
		int cur=0;
		//cout<<"P DIS i "<<i<<' '<<dis1<<' '<<dis2<<endl;
		if (dis1>dis2) continue;
		//if ((dis2-dis1)%2==1) continue;
		//cout<<"P PASS "<<endl;
		cur=dis2;
		cur+=len[i];
		ans=max(ans,cur);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 21504
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define END return 0
typedef int64_t ll;
const int mod7 = 1e9 + 7;
const int mod9 = 1e9 + 9;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a % b) : abs(a);}
template<typename T> T lcm(T a, T b) {return a / gcd(a, b) * b;}
template<typename T> bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template<typename T> bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) {fill((T*)array, (T*)(array+N), val);}

int main() {
    int a[3][3];
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    int n;
    cin >> n;
    rep(i, n) {
        int b;
        cin >> b;
        rep(j, 3) rep(k, 3) if(a[j][k] == b) a[j][k] = 0;
    }
    rep(i, 3) {
        bool bingo = true;
        rep(j, 3) if(a[i][j] != 0) bingo = false;
        if(bingo) {cout << "Yes" << endl; END;}
    }
    rep(i, 3) {
        bool bingo = true;
        rep(j, 3) if(a[j][i] != 0) bingo = false;
        if(bingo) {cout << "Yes" << endl; END;}
    }
    bool bingo = true;
    rep(i, 3) if(a[i][i] != 0) bingo = false;
    if(bingo) {cout << "Yes" << endl; END;}
    bingo = true;
    rep(i, 3) if(a[i][2-i] != 0) bingo = false;
    if(bingo) {cout << "Yes" << endl; END;}
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;
map <int,int> w;
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=='-'?o=-1:0,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return o*x;
}
int main() {
    int n,ans=0;
    cin>>n;
    for(int i=1;i<=n;i++) ++w[gi()];
    for(int i=1<<30;i>1;i>>=1) {
	int j=i>>1;
	for(auto p:w) {
	    int x=p.first;
	    if(x>=j&&x<i) {
		int &A=w[x],&B=w[i-x],t=min(A,B);
		if(x==i-x) t>>=1;
		A-=t,B-=t,ans+=t;
	    }
	}
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 64256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S, K):
    ans = 0
    S = [c for c in S]
    if K < 4:
        S = S * K
        for i in range(len(S)-1):
            if S[i] == S[i+1]:
                ans += 1
                S[i+1] = '-'
        return ans
    
    N = len(S)
    S = S * (4 if K % 2 == 0 else 5)
    a = [0] * (4 if K % 2 == 0 else 5)
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            a[(i+1)//N] += 1
            S[i+1] = '-'

    o = math.ceil((K-2) / 2)
    e = (K-2) // 2
    return a[0] + a[-1] + a[1] * o + a[2] * e


def main():
    S = read_str()
    K = read_int()
    print(slv(S, K))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6724
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,m;
    cin >> n >> m;
    cout << (n < m ? 0 : 10)<< endl;
    return 0;
}

Measured memory_bytes: 384
N = input()
n = int(N)
N_len = len(N)

count = 0
for i in range(1, N_len+1):
    if i % 2 == 0:
        continue
    else:
        if i == N_len:
            count += (n - 10**(N_len-1) + 1)
        elif i == 1:
            count += 9
        else:
            count += (10**(i) - 10**(i-1))
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main(){
  int n;
  cin>>n;

  vector<pair<int,int>> p(n);
  rep(i,n){
    cin>>p[i].se>>p[i].fi;
  }
  sort(all(p));
  reverse(all(p));

  vector<pair<int,int>> q(n);
  rep(i,n){
    cin>>q[i].fi>>q[i].se;
  }
  sort(all(q));

  vector<bool> r(n,true);
  int ans=0;
  rep(i,n){
    rep(j,n){
      if(r[j] && q[i].fi>p[j].se&&q[i].se>p[j].fi) {
        ans++;
        r[j]=false;
        break;
      }
    }
  }

  cout << ans << endl;

}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,k; cin>>n>>k;
	int cur=1;
	while(n--)
		cur=min(cur*2,cur+k);
	cout << cur << endl;
	return 0;
}


Measured memory_bytes: 256
X, N = list(map(int, input().split()))
P = list(map(int, input().split()))

ans = float('inf')
cnt = 0
while ans == float('inf'):
  ans_plus = X + cnt
  ans_minus = X - cnt
  if not ans_plus in P:
    ans = ans_plus
  if not ans_minus in P:
    ans = min(ans, ans_minus)
  cnt += 1

print(ans)

Measured memory_bytes: 9124
a = input()
b = input()
c = input()
ch = 'a'
while True:
    if ch == 'a':
        if len(a) == 0:
            print('A')
            exit()
        ch = a[0]
        a = a[1:]
    elif ch == 'b':
        if len(b) == 0:
            print('B')
            exit()
        ch = b[0]
        b = b[1:]
    elif ch == 'c':
        if len(c) == 0:
            print('C')
            exit()
        ch = c[0]
        c = c[1:]

Measured memory_bytes: 9024
#include  <iostream>
#include  <stdio.h>
using namespace std;


int main(){
    int N;
    int Q;
    string S;

    cin >> N;
    cin >> Q;
    cin >> S;


    int li;
    int ri;
    int count[Q];
    int pre_count[N];
    int flag;

    int si;
    pre_count[0]=0;
    string target;
    for(si=1;si< N;si++){
        target = S.substr(si - 1,2);
        pre_count[si] = pre_count[si - 1];
        if(target=="AC"){
            pre_count[si] = pre_count[si] + 1;
        }
     }
    for(int qi=0;qi<Q;qi++){
        cin >> li;
        cin >> ri;
        li = li - 1;
        ri = ri - 1;
        count[qi] = pre_count[ri] - pre_count[li];
    }

    for(int qi=0;qi<Q;qi++){
        cout << count[qi] << endl;
    }
    return 0;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cerr << (*begin) << " ";
    *begin++;
  }
  cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cerr << " " << Array[i][j];
    }
    cerr << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

int N;

signed main() {
  cin >> N;

  int ans = 0;

  for (int x = 1; x*x <= N; x++) {
    if ((N-x) % x != 0) continue;
    int m = (N - x) / x;
    // if (m == 1) flg = 1;
    // dbg2(x, m)
    // print(x, m, N/m, x+x);
    if (m >= 1 and (N/m)*2 == 2*x) {
      // dbg2(N/m, x+x)
      ans += m;
    }
  }

  cout << ans << endl;

  return 0;
}

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using ld = long double; using vll = vector<ll>; using vvll = vector<vll>; using vld = vector<ld>;
using vi = vector<int>; using vvi = vector<vi>;
using P = pair<ll, ll>;

template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) {  o << "(" << v.first << ", " << v.second << ")"; return o; }
template<size_t...> struct seq{}; template<size_t N, size_t... Is> struct gen_seq : gen_seq<N-1, N-1, Is...>{}; template<size_t... Is> struct gen_seq<0, Is...> : seq<Is...>{};
template<class Ch, class Tr, class Tuple, size_t... Is>
void print_tuple(basic_ostream<Ch,Tr>& os, Tuple const& t, seq<Is...>){ using s = int[]; (void)s{0, (void(os << (Is == 0? "" : ", ") << get<Is>(t)), 0)...}; }
template<class Ch, class Tr, class... Args>
auto operator<<(basic_ostream<Ch, Tr>& os, tuple<Args...> const& t) -> basic_ostream<Ch, Tr>& { os << "("; print_tuple(os, t, gen_seq<sizeof...(Args)>()); return os << ")"; }
ostream &operator<<(ostream &o, const vvll &v) { rep(i, v.size()) { rep(j, v[i].size()) o << v[i][j] << " "; cout << endl; } return o; }
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]";  return o; }
template <typename T>  ostream &operator<<(ostream &o, const set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T, typename U>  ostream &operator<<(ostream &o, const map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T, typename U>  ostream &operator<<(ostream &o, const unordered_map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it; o << "]";  return o; }
#define VN(v) # v
#define print(a) cout << a << "#" << VN(a) << endl;
#define ldout fixed << setprecision(40) 

static const double EPS = 1e-14;
static const long long INF = 1e18;
static const long long mo = 1e9+7;

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

    ll n; cin >> n;
    vll a(n); rep(i, n) cin >> a[i];

    vll dp;
    rep(i, n) {
        auto it = lower_bound(all(dp), a[i]);
        if (it == dp.end())
            dp.pb(a[i]);
        else
            *it = a[i];
    }

    cout << dp.size() << endl;
    return 0;
}

Measured memory_bytes: 4468
N = int(input())
A = [int(x) for x in input().split()]
B = []
ans = []
for i in range(N):
    B.append([A[i],i])
B.sort()
for i in range(N):
    ans.append(str(B[i][1]+1))
ANS = " ".join(ans)
print(ANS)

Measured memory_bytes: 28456
#include<iostream>
#include<bits/stdc++.h>
#define N 100005
using namespace std;
typedef long long ll;
ll n,a[N];
ll sum[N],k;
ll ans;
ll Count(int x)
{
    ll kq = 0;
    for(int i=1;i<=n;i++){
        int h = lower_bound(a+i,a+1+n,x-a[i]) - a;
        if (h!=i) kq += 2*(n-h+1); else kq += 2*(n-h)+1;
    }
    return kq;
}
int main()
{
    //freopen("input.txt","r",stdin);
    cin >> n >> k;
    for(int i=1;i<=n;i++) cin >> a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++) sum[i] = sum[i-1] + a[i];
    ll kmin = 2;
    ll kmax = a[n] + a[n-1] + 1;
    while(kmax-kmin>1){
        ll mid = (kmin+kmax)/2;
        if (Count(mid)>=k) kmin = mid; else kmax = mid;
    }
    ll d = (Count(kmin)-k);
    for(int i=1;i<=n;i++){
        ll h = lower_bound(a+i,a+1+n,kmin-a[i]) - a;
        if (a[i]+a[h]<kmin) continue;
        if (h!=i)
            ans += a[i] * ((n-h+ll(1))*ll(2)) + (sum[n]-sum[h-1])*ll(2); else ans += (a[i])*(n-h)*ll(2) + a[i]*ll(2) + (sum[n]-sum[h])*ll(2);
    }
    cout << ans - (d*kmin) << endl;

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define pb push_back
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

signed main(){
	fast;
	int a;
	string s;
	cin>>a;
	cin>>s;
	if(a>=3200) cout<<s;
	else cout<<"red";
}

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

int main(){
   int N,M;
   int p_temp;
   int sum_correct = 0;
   int sum_penalty = 0;
   char result[2];
    
   scanf("%d %d",&N,&M);
   vector<int> is_correct(N,0);
   vector<int> penalty(N,0);
   
   for(int i = 0;i < M;i++){
       scanf("%d %s",&p_temp,result);
       if(result[0]=='A') is_correct[p_temp-1] = 1;
       else if (result[0]=='W' && is_correct[p_temp-1] == 0) penalty[p_temp-1] += 1;
   }
   
   for(int j = 0;j < N;j++){
       sum_correct += is_correct[j];
       if(is_correct[j] == 1) sum_penalty += penalty[j];
   }
   printf("%d %d\n",sum_correct,sum_penalty);
   
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int h,m,hh,mm,k;
    cin >> h >> m >> hh >> mm>>k;
    ll mae = h*60+m;
    ll usi = hh*60+mm;
    usi-=mae;
    usi-=k;
    cout<< usi << endl;
}
    



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

int main() {
  int n,x;
  cin >> n;
  x = 0;
  vector<int> l(n);
  for(int i = 0; i<n ; i++){
    cin >> l.at(i);
    x += l.at(i);
  }
  
  sort(l.begin(), l.end());
  x -= 2*l.at(n - 1);
  
  if(x > 0){
    cout << "Yes" << endl;
  }
  else { 
    cout << "No" << endl;
  }
}
  

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc061/tasks/abc061_b

import itertools
import collections
import bisect

def main():
    N, M = map(int, input().split())
    ans = [0] * N
    for _ in range(M):
        a, b = map(int, input().split())
        ans[a-1] += 1
        ans[b-1] += 1
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256