akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
int a[114514],b[114514];
signed main(){
	char s;
	cin>>s;
	c(char(s+1))
}		

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long N,Y,i,j,k;
    cin>>N>>Y;
    for(i=0;i<N+1;i++){
        for(j=0;j<N+1-i;j++){
            k=N-i-j;
            if(10*i+5*j+k==Y/1000){
                cout<<i<<" "<<j<<" "<<k<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
  int number_n, number_k, i, min = INT_MAX;
  scanf("%d %d", &number_n, &number_k);
  long long int height[number_n];
  for(i = 0; i < number_n; i++) {
    scanf("%lld", &height[i]);
  }
  qsort(height, number_n, sizeof(long long int), asc);
  for(i = 0; i < number_n - number_k + 1; i++) {
    if(min > height[number_k+i-1] - height[i]) {
      min = height[number_k+i-1] - height[i];
    }
  }
  printf("%d\n", min);
  return 0;
}


Measured memory_bytes: 1788
#include<stdio.h>
#define N 2000

int solve(int, int);
int n, A[N];

int main(){
  
  int a, i, q, m;
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &A[i]);
  }
  
  scanf("%d", &q);
  for(i=0; i<q; i++){
    scanf("%d", &a);
    
    if(solve(0, a)==1)
      printf("yes\n");
    else
      printf("no\n");
  }
  return 0;
}

int solve(int l, int m){
  
  int sum;
  if(m==0) return 1;
  if(l>=n) return 0;
  
  sum=solve(l+1, m) || solve(l+1, m-A[l]);
  return sum;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int mod = 1e9 + 7;
const int N = 3e5 + 11;
LL a[N], ans;
int n;
inline int A(LL x, LL y){
    return x + y - (x + y >= mod ? mod : 0);
}
void deal(int b){
    LL num0 = 0, num1 = 0, base = 1ll << b;
    base %= mod;
    for(int i = n;i >= 1; i--){
        int fl = a[i] >> b & 1;
        if(fl)ans = A(ans, num0 * base % mod), num1++;
        else ans = A(ans, num1 * base % mod), num0++;
    }
}
int main(){
    cin>>n;
    for(int i = 1;i <= n; i++){
        scanf("%lld", &a[i]);
    }
    for(int i = 0;i <= 60; i++){
        deal(i);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0);
  rep(i, n) {
    cin >> a.at(i);
  }

  int m = 1e6 + 1;
  vector<int> cnt(m, 0);
  for (int x : a) {
    if (cnt.at(x) != 0) {
      cnt.at(x) = 2;
      continue;
    }
    for (int j = x; j < m; j += x) {
      cnt.at(j)++;
    }
  }

  int ans = n;
  for (int x : a) {
    if (cnt.at(x) >= 2) ans--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7968
n = int(input())
a = n // 15
# b = (1 + a) * a / 2 * 60
b = a * 60 + (a * (a - 1) / 2 * 120)
# print(a * 60, a * (a - 1) / 2 * 120)
i = a * 15 + 1
while i <= n:
    if i % 3 != 0 and i % 5 != 0:
        b = b + i
    # print("xxx", i)
    i = i + 1
b = int(b)
print(b)

# 60 + 60   + 60
#     15*8   30*8


Measured memory_bytes: 9112
#ifndef LOCAL
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
int s ;
int dp[2005] ;
int dfs(int cur){
    if ( cur == 0 ) {
        return 1 ;
    }
    if ( dp[cur] != -1 ) return dp[cur] ;
    int ans = 0 ;
    for(int i = 3; i <= cur; i++){
        ans += dfs(cur - i) ;
        ans %= MOD ;
    }
    return dp[cur] = ans % MOD ; 
}
signed main(){
    fastio
    memset(dp, -1, sizeof dp) ;
    cin >> s ;
    int ans = dfs(s) ;
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 3660
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>
// #include <atcoder/all>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
// using namespace atcoder;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;
// using mint = modint1000000007;


#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ")
#define print1(v) cout << fixed << setprecision(10) << v << "\n"
#define print2(v1, v2) cout << fixed << setprecision(10) << v1 << " " << v2 << "\n"
#define print3(v1, v2, v3) cout << fixed << setprecision(10) << v1 << " " << v2 << " " << v3 << "\n"
#define printvi(v, n) REP(iiii, n) { cout << v[iiii]; delim(iiii, n); }
#define printvii(v, h, w) REP(iiiii, h) { printvi(v[iiiii], w); }

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; }

const int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 1e5+5;
int n, m;
vi color(3);

vi dx = {-1, 0, 0, 1};
vi dy = {0, -1, 1, 0};

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

    cin >> m;

    int cntc = -1;
    int cnt9 = -1;
    REP(i, m) {
        int d, c; cin >> d >> c;
        cntc += c;
        cnt9 += d*c;
    }
    int ret = cntc + (cnt9/9);
    print1(ret);
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        while(a[i]%2==0){
            a[i]/=2;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    Vec way(n+1,0);
    Vec brk(100005,0);
    rep(i,m){
        ll tmp;
        cin>>tmp;
        brk[tmp]=1;
    }
    ll ans=0;

    way[0]=1;
    if(brk[1]==1){
        way[1]=0;
    }else{
        way[1]=1;
    }

    REP(i,2,n+1){
        if(brk[i]==1){
            way[i]=0;
        }else{
            way[i]=way[i-1]+way[i-2];
            way[i]%=MOD;
        }
    }
    ans = way[n];
    //dbg(way);
    cout<<ans<<endl;
    return  0;
}


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

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

  int N,K; cin >> N >> K;
  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];

  vector<vector<int>> dp(60,vector<int>(2,-(1LL<<60)));
  //dp[桁][K以下が確定している]
  dp[40][0] = 0;
  for(int i = 40; i >= 0; i--){
    int num1 = 0;
    for(int j = 0; j < N; j++){
      if(1LL & A[j] >> i) num1++;
    }
    int num0 = N - num1;

    //K以下が確定していない状態からの遷移
    if(1LL & K >> i){
      //i番目bit==1を採用 -> K以下未確定
      dp[i][0] = max(dp[i][0],dp[i+1][0] + num0*(1LL << i));
      //i番目bit==0を採用 -> K以下確定
      dp[i][1] = max(dp[i][1],dp[i+1][0] + num1*(1LL << i));
    }
    else{
      //i番目bit==1を採用 -> K+1以上確定
      //i番目bit==0を採用 -> K以下未確定
      dp[i][0] = max(dp[i][0],dp[i+1][0] + num1*(1LL << i));
    }

    //K以下が確定している状態からの遷移
    dp[i][1] = max(dp[i][1],dp[i+1][1] + max(num0,num1)*(1LL << i));
  }
  cout << max(dp[0][0],dp[0][1]) << endl;

  return 0;
}


Measured memory_bytes: 1024
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
    string s;
    int q;

    cin >> s;

    cin >> q;
    string s1, s2;

    //for (int i = 0; i < q; i++) {
    //    int a,f;
    //    string c;
    //    cin >> a;

    //    if (a == 1) {
    //        reverse(s.begin(), s.end());
    //    }
    //    else {
    //        cin >> f >> c;

    //        if (f == 1) {
    //            s = c + s;
    //        }
    //        else {
    //            s = s + c;
    //        }
    //    }
    //}
    int flag = 0;
    for (int i = 0; i < q; i++) {
        int a, f;
        string c;
        cin >> a;
        if (a == 1) {
            if (flag == 0) {
                flag = 1;
            }
            else {
                flag = 0;
            }
        }
        else {
            cin >> f >> c;

            if (flag == 0) {
                if (f == 1) {
                    s1 = c + s1;
                }
                else {
                    s2 = s2 + c;
                }
            }
            else {
                if (f == 1) {
                    s2 = s2 + c;
                }
                else {
                    s1 = c+s1;
                }

            }
        }

    }
    if (flag == 0) {
        s = s1 + s + s2;
    }
    else {
        reverse(s.begin(), s.end());
         reverse(s1.begin(), s1.end());
         reverse(s2.begin(), s2.end());
        s = s2 + s + s1;
    }
    cout << s << endl;
    return 0;

}



Measured memory_bytes: 4504
N = int(input())
dic = {}

for i in range(N):
    s = list(input())
    s.sort()
    key = str(s)
    if key in dic:
        dic[key] += 1
    else:
        dic[key] = 1

ans = 0
for value in dic.values():
    ans += value*(value-1) / 2
print(int(ans))


Measured memory_bytes: 21988
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(123456789)
#define LINF (long long int)(123456789012345678)
#define MAX_V 1000
 
 
int main(void){
	int N, K;	cin >> N >> K;
	vector<int> h(N);
	rep(i,N){
		cin >> h[i];
	}
 
	vector<ll> dp(N, LINF);
	dp[0] = 0;
 
	rep(i,N){
		reps(j, K){
			if(i+j < N){
				dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
			}
		}
	}
	cout << dp[N-1] << endl;
	return 0;
}

Measured memory_bytes: 1408
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<array>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
#define int long long
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	string str;
	cin>>str;
	for(int i=0;i<str.size();i++)
		if(str[i]!=str[str.size()-i-1]){
			cout<<"No";
			return 0;
		}
	for(int i=0;i<str.size()/2;i++)
		if(str[i]!=str[str.size()/2-i-1]){
			cout<<"No";
			return 0;
		}
	for(int i=0;i<str.size()/2;i++)
		if(str[i+str.size()/2+1]!=str[str.size()-i-1]){
			cout<<"No";
			return 0;
		}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
a_now, a_speed = map(int, input().split(' '))
b_now, b_speed = map(int, input().split(' '))
t = int(input())

# print(a_now, a_speed, b_now, b_speed, t)

# speedの差分と現在の差分で割り切れればOK、割り切れなければダメ
if(a_speed < b_speed):
  caught = 'NO'
else:
  diff = abs(a_now - b_now)
  speed = a_speed - b_speed
  #print("現在の距離差は{0}. スピード差は{1}".format(diff, speed))
  if(diff == 0):
    caught = 'NO'
  elif(speed == 0):
    #print("speedが一緒なので終わらない")
    caught = 'NO'
  else:
    q = diff / speed
    #print("おいつくのは{0}秒後. 余りは{1}".format(q, mod))
    if(q <= t):
      caught = 'YES'
    else:
      caught = 'NO'

print(caught)

Measured memory_bytes: 9060
#include <bits/stdc++.h>
using namespace std;
char s[111111];
int m[111111];
string p[]={"dream",
    "dreamer",
    "erase",
    "eraser"
    };
int f(int i){
    if(m[i]==0){
        for(string &t:p){
            int flag=1;
            for(int j=0;j<t.size();j++){
                if(s[i+j]!=t[j]){
                    flag=0;
                    break;
                }
            }
            if(flag&&f(i+t.size())==1)return m[i]=1;
        }
        m[i]=-1;
    }
    return m[i];
}
int main(){
    scanf("%s",s);
    m[strlen(s)]=1;
    cout<<(f(0)==1?"YES":"NO")<<endl;
    return 0;
}


Measured memory_bytes: 1792
def main():
    N = int(input())
    ans = [0]*(N+1)
    for x in range(1, N+1):
        if N < x**2:
            break
        for y in range(1, N+1):
            if N < x**2 + y**2 + x*y:
                break
            for z in range(1, N+1):
                if N < x**2 + y**2 + z**2 + x*y + y*z + z*x:
                    break
                ans[x**2 + y**2 + z**2 + x*y + y*z + z*x] += 1

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


if __name__ == '__main__':
    main()


Measured memory_bytes: 68148
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
#define all(x) (x).begin(), (x).end()

/**ABC 164*/
int main(){
    set<string> s;
    int n; cin>>n;
    string x;
    while(n--){
        cin>>x;
        s.insert(x);
    }
    cout<<s.size()<<endl;
}


Measured memory_bytes: 19228
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
  int c,k[3];
  cin >> c;
  k[0] = c/100;
  k[1] = c/10 - k[0]*10;
  k[2] = c - (k[0]*100 + k[1]*10);
  cout << (k[0]==k[2]?"Yes":"No") << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <string>


int main() {

	int N, K;
	std::cin >> N >> K;

	std::unordered_map<int, int> counts;

	for (int i = 0; i < K; i++) {
		int count;
		std::cin >> count;

		for (int j = 0; j < count; j++) {
			int a;
			std::cin >> a;
			counts[a]++;
		}
	}


	int count = 0;
	for (int i = 1; i < N+1; i++) {
		if (!counts[i]) {
			count++;
		}
	}

	std::cout << count << std::endl;

}


Measured memory_bytes: 3224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int[] a = new int[6];
		for(int i=0;i<3;i++){
			for(int j=0;j<6;j++){
				a[j]=stdIn.nextInt();
			}
			int h=0,m=0,s=0;
			h=a[3]-a[0];
			m=a[4]-a[1];
			s=a[5]-a[2];
			if(s<0){
				m--;
				s+=60;
			}
			if(m<0){
				h--;
				m+=60;
			}
			System.out.println(h+" "+m+" "+s);
		}
	}
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        N = cin.nextint;
        var A = cin.scanint;
        Array.Sort(A);
        Array.Reverse(A);


        long tate = -1;
        long yoko = -1;
        for (int i = 0; i < N; i++)
        {
            if (i == 0) continue;
            if (A[i] == A[i - 1])
            {
                if (tate == -1)
                {
                    tate = A[i];
                    i++;
                }
                else
                {
                    yoko = A[i];
                    WriteLine(tate * yoko);
                    return;
                }
            }
        }
        WriteLine(0);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main(void){
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i++)
        cin >> d[i];
    sort(d.begin(), d.end());
    cout << d[N/2] - d[N/2-1] << endl;
}

Measured memory_bytes: 640
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

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

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

//Degree <-> Radian
double toRad(double d){ double rad; rad=d*PI/180; return rad; }
double toDegree(double rad){ double d; d=rad*180/PI; return d; }
//The least common multiple : lcm
ll lcm(int a,int b){ return a*b/__gcd(a,b); }
//素数判定
bool isPrime(int n){
    int i; 
    if(n<2) return 0;
    else if(n==2) return 1;
    if(n%2==0) return 0;
    for(i=3;i*i<=n;i+=2) if(n%i==0) return 0;
    return 1;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    char c;
    cin >> c;
    cout << char(c+1) ENDL;
    
    return 0;
}

Measured memory_bytes: 3540
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60


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

    vector<ll> a(N);
    REP(i, N) {
        cin >> a[i];
    }

    int idx = -1;
    REP(i, N-1) {
        if(a[i] + a[i+1] >= L) {
            idx = i+1;
            break;
        }
    }

    if(idx == -1) {
        cout << "Impossible" << endl;
        return 0;
    }

    cout << "Possible" << endl;
    FOR(i, 1, idx-1) {
        cout << i << endl;
    }

    FORR(i, N-1, idx+1) {
        cout << i << endl;
    }

    cout << idx << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct niku { double x; double y; double c; };

int main() {
  int N; cin >> N;
  niku n[N];
  rep(i,N) {
    double x, y; cin >> x >> y;
    n[i] = {x,y,1};
  }
  double l = 0, r = 5000;
  while(r-l>=1e-8) {
    double mid = (l+r)/2;
    bool ok = false;
    rep(i,N) repr(j,i,N) {
      if (i==j) {
        int count = 0;
        rep(k,N) if (pow(n[k].x-n[i].x,2)+pow(n[k].y-n[i].y,2)<=pow(mid/n[k].c,2)) count++;
        if (count==N) ok = true;
      }
      else {
        double ri = mid/n[i].c, rj = mid/n[j].c;
        if (pow(n[i].x-n[j].x,2)+pow(n[i].y-n[j].y,2)>pow(ri+rj,2)) continue;
        if (pow(n[i].x-n[j].x,2)+pow(n[i].y-n[j].y,2)<pow(ri-rj,2)) continue;
        double vx = n[i].x-n[j].x, vy = n[i].y-n[j].y;
        double vl = sqrt(vx*vx + vy*vy);
        vx /= vl; vy /= vl;
        double dl = (ri*ri-rj*rj+vl*vl) / (2*vl);
        double rx = n[i].x - vx*dl, ry = n[i].y - vy*dl;
        double rx1 = rx - vy * sqrt(ri*ri-dl*dl), ry1 = ry + vx * sqrt(ri*ri-dl*dl);
        double rx2 = rx + vy * sqrt(ri*ri-dl*dl), ry2 = ry - vx * sqrt(ri*ri-dl*dl);
        int count1 = 0, count2 = 0;
        rep(k,N) if (pow(n[k].x-rx1,2)+pow(n[k].y-ry1,2)<=pow(mid/n[k].c,2)+1e-6) count1++;
        rep(k,N) if (pow(n[k].x-rx2,2)+pow(n[k].y-ry2,2)<=pow(mid/n[k].c,2)+1e-6) count2++;
        if (count1==N||count2==N) ok = true;
        // cout << mid << " " << i << " " << j << " " << rx1 << " " << ry1 << " " << count1 << endl;
        // cout << mid << " " << i << " " << j << " " << rx2 << " " << ry2 << " " << count2 << endl;
      }
    }
    // cout << l << " " << mid << " " << r << endl;
    if (ok) r = mid;
    else l = mid;
  }

  double result = l;
  cout << setprecision(10) << result << endl;
  return 0;
}

Measured memory_bytes: 256
// problem: "https://atcoder.jp/contests/abc123/tasks/abc123_a"

#include<iostream>

using namespace std;

int main()
{
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;

    if(e-a<=k)
        cout<<"Yay!";
    else
        cout<<":(";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
		long long n;
		cin>>n;
		long long tot=0;
		long long a[n];
		for(long long i=0;i<n;i++){
			cin>>a[i];
			tot^=a[i];
		}
		long long temp=tot;
		for(long long i=-0;i<n;i++){
			long long g=temp^a[i];
			cout<<g<<" ";
		}
		cout<<endl;
		
	
return 0;
}

Measured memory_bytes: 5056
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int M = 1e9 + 7;

int mx[1000006];

int qpow(int a, int b) {
	if(b == 0) return 1;
	int t = qpow(a, b/2);
	if(b&1) return t * t % M * a % M;
	else return t * t % M;
}

int inv(int x) {
	return qpow(x, M-2);
}

signed main()
{
	IO_OP;
	
	int n;
	cin >> n;
	int l = 0;
	for(int i=0;i<n;i++) {
		int t;
		cin >> t;
		l = (l + inv(t)) % M;
		for(int i=2;i*i<=t;i++) {
			if(t % i) continue;
			int cnt = 0;
			while(t % i == 0) t /= i, cnt++;
			mx[i] = max(mx[i], cnt);
		}
		if(t != 1) mx[t] = max(mx[t], 1LL);
	}
	for(int i=2;i<1000006;i++)
		l = l * qpow(i, mx[i]) % M;
	cout << l << endl;

}





Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define ll long long
const ll base = 31;
const ll MOD = 1e9+9;
const ll  maxN = 1e6+9;

using namespace std ;

int32_t main()
{   int n ;
    cin >> n;
    if ( n % 2 ==0) cout<<n/2 ; else cout<<n/2+1;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>

using namespace std;


int main() {
    int n;
    map<string, int> s;
    cin >> n;

    for (int i=0; i<n; i++) {
        string stmp;
        cin >> stmp;
        s[stmp] = 1;
    }
    
    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 19180
#include <bits/stdc++.h>
#define inf 0x7fffffff
#define ll long long
#define REP(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

int main() {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
        // Code Starts...
        ll n,k;
        cin>>n>>k;
        vector<ll > v(n);
        for (int i=0;i<n;i++)
            cin>>v[i];
        vector<ll > dp(n,inf); // it stores the min cost incurred so far...
        dp[0] = 0; // cost at stone 1 is 0...
        for (int i=1;i<n;i++)
        {
            for (int j=1;j<=k;j++)
                if (i>=j)
                    dp[i] = min(dp[i],dp[i-j]+abs(v[i] - v[i-j]));
        }
        cout<<dp[n-1]<<endl;
        // Code Ends...
        return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
  int n,w;
  int a[100];
  int i,j;
  
  scanf("%d",&n);
  scanf("%d",&w);
  
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  
  int k,l;
  
  for(k=0;k<n-1;k++){
    for(l=n-1;l>k;l--){
      if(a[l-1]<a[l]){
        int temp=a[l];
        a[l]=a[l-1];
        a[l-1]=temp;
      }
    }
  }
  
  int x=0;
  int m;
  
  for(m=0;m<w;m++){
    x+=a[m];
  }
   printf("%d",x);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
////////////////////////////////////////////////
int main()
{
    string s;
    cin >> s;
    if (s == "Sunny")
        cout << "Cloudy" << endl;
    if (s == "Cloudy")
        cout << "Rainy" << endl;
    if (s == "Rainy")
        cout << "Sunny" << endl;
}

Measured memory_bytes: 3600
def enq(a,x)
  b = a[i=-1]
  until b.frozen?
    return a << x  if x >= (a=b)[-1]
    return a.unshift x  if x <= a[0]
    b = a[i = a.bsearch_index{|y| x < (y.frozen? ? y: y[0])}-1]
  end  if b && b=a
  return a.insert i+1, x  unless a[i+9]
  i>0 ? a[i]=[b,x] : enq(a[i+=1].to_a,x)  rescue a[i]=[x,a[i]]
end
def deq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end
NS = 6; NM = (1<<NS)-1
SS = 13;SM = (1<<SS)-1
F =-> {gets.split.map &:to_i}
N,M,S = F[]
V = Array.new N
E = V.map { [] }
M.times {
  u,v,a,b = F[]
  u -= 1; v -= 1
  E[u] << [v,a,b]
  E[v] << [u,a,b]
}
X = V.map { c,d = F[]; [d, [c,2500].min] }
R,Q = [], [[S,2500].min]
while R.size < N
  t = deq Q
  s = SM & t; t >>= SS
  n = NM & t; t >>= NS
  (v = V[n]&.&SM) ? (next if v>=s || v>2500) : R << [n,t]
  V[n] = (t<<SS) + s
  x = X[n]
  enq Q, (t-x[0]<<NS+SS) + (n<<SS) + s+x[1]
  E[n].each {|n,a,b| enq Q, (t-b<<NS+SS) + (n<<SS) + s-a  if s >= a }
end
puts R.sort![1,N].map{|i,t| -t}

Measured memory_bytes: 14432
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int mod;
inline ll inv(ll a){
	ll b = mod, x = 1, y = 0;
	while(b){
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		x -= t * y;
		swap(x, y);
	}
	return (mod + x % mod) % mod;
}
vi mul(const vi &a, const vi &b){
	vi c(a.size() + b.size() - 1);
	rep(i, a.size()) rep(j, b.size()) c[i + j] += (ll)a[i] * b[j] % mod;
	rep(i, c.size()) c[i] %= mod;
	while(c.size() > 1 && c.back() == 0) c.pop_back();
	return c;
}
vi add(const vi &a, const vi &b, int k){
	vi c(max(a.size(), b.size()));
	rep(i, c.size()){
		if(i < a.size()) c[i] += a[i];
		if(i < b.size()) c[i] += (ll)k * b[i] % mod;
		c[i] = (c[i] % mod + mod) % mod;
	}
	while(c.size() > 1 && c.back() == 0) c.pop_back();
	return c;
}
vi div(vi a, const vi &b){
	assert(b.size() == 2 && b[1] == 1);
	vi c;
	for(int i = a.size() - 1; i > 0; i--){
		c.pb(a[i]);
		a[i - 1] += mod - a[i] * b[0] % mod;
		a[i - 1] %= mod;
	}
	assert(a[0] == 0);
	reverse(all(c));
	return c;
}

int apply(const vi &a, int x){
	ll res = 0;
	rep(i, a.size()){
		res = res * x % mod;
		res = (res + mod + a[a.size() - 1 - i] % mod) % mod;
	}
	return res % mod;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	cin >> mod;
	
	vi poly(1, 1);
	rep(i, mod){
		vi v = {mod - i, 1};
		poly = mul(poly, v);
	}
	
	vi res(1);
	rep(i, mod){
		int a; cin >> a;
		if(!a) continue;
		vi v = {mod - i, 1};
		vi expr = div(poly, v);
		int x = (apply(expr, i) + mod) % mod;
		//dbg(i, x, inv(x), expr[0]);
		vi nres = add(res, expr, a ? a * inv(x) % mod : 0);
		res = nres;
	}
	res.resize(mod);
	rep(i, mod) cout << (res[i] % mod + mod) % mod << (i==mod-1?"\n":" ");
	/*
	rep(i, mod){
		int ans = apply(res, i);
		cout << (ans % mod + mod) % mod << endl;
	}
	*/
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
typedef long long ll;

int N, a;
multiset<int> s;

void rip () {
        puts("Impossible");
        exit(0);
}

void take (int i) {
        if (s.find(i) == s.end()) {
                rip();
        }
        s.erase(s.find(i));
}

int main () {
        scanf("%d", &N);
        fo(i, 0, N) scanf("%d", &a), s.insert(a);

        int m = *s.begin();

        if (s.count(m) > 2) {
                rip();
        }
        if (s.count(m) == 2) {
                fo(i, m, 2*m) take(i), take(i);
                if (s.size() && *s.rbegin() >= 2*m) rip();
        } else {
                fo(i, m, 2*m+1) take(i);
                fo(i, m+1, 2*m+1) take(i);
                if (s.size() && *s.rbegin() > 2*m) rip();
        }
        puts("Possible");
        return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;
 
int n,flag[100100][20],ans;
struct edge
{
    int v;
    edge *nxt;
} pool[200100],*tp=pool,*fst[100100];
 
void dfs(int x,int fa)
{
    for (edge *i=fst[x]; i; i=i->nxt)
        if (i->v!=fa)
            dfs(i->v,x);
    int w=0;
    repu(i,0,ans)
        if (flag[x][i]>1)
            w=i+1;
    for (; flag[x][w]; ++w);
    ans=max(ans,w),++flag[fa][w];
    repu(i,w+1,ans)
        if (flag[x][i])
            ++flag[fa][i];
}
 
int main()
{
    scanf("%d",&n);
    repu(i,1,n-1)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        *tp=(edge){v,fst[u]},fst[u]=tp++;
        *tp=(edge){u,fst[v]},fst[v]=tp++;
    }
    dfs(1,0);
    printf("%d\n",ans);
    return 0;
}

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

int main(){
  int N, K, x, sum = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (K - x < x) {
      sum += 2 * (K - x);
    }
    else {
      sum += 2 * x;
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}

int main() {
  int K;
  cin >> K;
  queue<ll> q;
  ll ans = 0;
  rep(i,9){
    q.push(i+1);
    ans++;
    if(ans == K){
      cout << i+1 << endl;
      return 0;
    }
  }

  while(1){
    ll num = q.front();
    q.pop();
    ll m = num%10;
    if(m != 0){
      q.push(10*num + m - 1);
      ans++;
    }
    if(ans == K){
      cout << 10*num + m -1 << endl;
      return 0;
    }

      
    q.push(10*num + m);
    ans++;
    if(ans == K){
      cout << 10*num + m << endl;
      return 0;
    }



    
    if(m%10 != 9){
      q.push(10*num + m + 1);
      ans++;
    }
    if(ans == K){
      cout << 10*num + m  + 1 << endl;
      return 0;
    }
  }
 
  return 0;
}



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

bool all_even(int N, int A[]){
    int i;
    for (i=0; i<N; i++){
        if (A[i]%2==1) return false;
    }
    return true;
}


int main(int argc, char const *argv[])
{
    int N;
    int A[210]; // 1 <= N <= 200 なので余裕を持って210
    int i;

    cin >> N;
    for (i=0; i<N; i++) cin >> A[i];

    int total = 0;
    while (all_even(N, A)){
        for (i=0; i<N; i++)  A[i] /= 2;
        total++;
    }

    cout << total << endl;

    return 0;
}

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

using namespace std;
using ii = pair<int, int>;

const int MAX { 100010 };

vector<int> adj[MAX];
int dist[MAX];
set<ii> found;

struct Info { int n, s, k; };

int solve(int S, int T)
{
    memset(dist, -1, sizeof dist);
    dist[S] = 0;

    queue<Info> q;
    q.push(Info { S, S, 3 });
    found.insert(ii(S, 3));

    while (not q.empty())
    {
        auto i = q.front();
        q.pop();

//cout << "=== Procesando n = " << i.n << ", s = " << i.s << ", k = " << i.k << endl;
        if (i.k == 0)
        {
//cout << "Found a path from " << i.s << " to " << i.n << endl;
            if (dist[i.n] >= 0)
                continue;

            dist[i.n] = dist[i.s] + 1;

//cout << "dist = " << dist[i.n] << " (from d = " << dist[i.s] << ")" << endl;
            if (i.n == T)
                break;

            if (found.count(ii(i.n, 3)) == 0)
            {
                q.push(Info { i.n, i.n, 3});
                found.insert(ii(i.n, 3));
            }
        } else
        {
            for (auto v : adj[i.n])
            {
//cout << "--- verificando aresta (" << i.n << ", " << v << "), v = " << v << ", k = " << i.k - 1 << ", found = " << found.count(ii(v, i.k - 1)) << endl;

                if (found.count(ii(v, i.k - 1)) == 0)
                {
//cout << "+++ Adicionando v = " << v << ", s = " << i.s << ", k = " << i.k - 1<< endl;
                    q.push(Info { v, i.s, i.k - 1 } );
                    found.insert(ii(v, i.k - 1));
//cout << "Estado v = " << v << ", k = " << i.k - 1 << " encontrado" << endl;
                }
            }
        }
    }

    return dist[T];
}

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

    int N, M;
    cin >> N >> M;

    while (M--)
    {
        int u, v;
        cin >> u >> v;

//cout << "*** aresta (" << u << ", " << v << ")" << endl;
        adj[u].push_back(v);
    }

    int S, T;
    cin >> S >> T;

    auto ans = solve(S, T);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 25216
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}


int main(){
    ll c,x,y,n,r,g,m,p,h,k,max=-10000000,min=1000000000,ans=0,sum=0;
    string s;
    bool f=true;
    cin >> n >> c >> k;
    VI t(n);
    rep(i,n){
        cin >> t[i];
	}
    sort(ALL(t));
    while(sum < n){
        x=0;
        ll time = t[sum];
        while(sum < n && x < c && t[sum] <= time + k){
            sum++;
            x++;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#!/Users/takahiro.kida/git/atcorder/venv/bin/python

import numpy as np
import scipy

from collections import defaultdict
from pprint import pprint

N, M = [int(x) for x in input().split(" ")]
lines = []
for i in range(N - 1 + M):
    a,b = [int(x) for x in input().split(" ")]
    lines.append([a,b])

in_num = [0 for x in range(N)]
out = [[] for x in range(N)]

for line in lines:
    A = line[0]
    B = line[1]
    in_num[B-1] += 1
    out[A-1].append(B-1)

roots = {} # root[i] = parent
for i in range(N):
    if in_num[i] == 0:
        roots[i] = -1
        break

ans = [-1 for x in range(N)]
for i in range(N):
    for j in roots:
        ans[j] = roots[j]
    new_roots = {}
    for root in roots:
        for out_of_root in out[root]:
            in_num[out_of_root] -= 1
            if in_num[out_of_root] == 0:
                new_roots[out_of_root] = root
    roots = new_roots

for i in ans:
    print(i+1)

Measured memory_bytes: 50688
import math
A,B,H,M = map(int, input().split())
C = (H * 30 + M * 0.5) - (M * 6)
Radians = math.radians(C)
COS= math.cos(Radians)
ans = (A**2) + (B**2) - 2*(A*B)*COS
print(ans**0.5)

Measured memory_bytes: 9516
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
struct mset {
    map<long long, long long> m;
    void remove(long long x) {
        auto t = m.find(x);
        t->second--;
        if (t->second == 0) {
            m.erase(t);
        }
    }
    void add(long long x) {
        auto t = m.find(x);
        if (t == m.end()) {
            m[x] = 1;
        } else {
            t->second++;
        }
    }

    bool empty() {
        return m.empty();
    }
};
int main() {
    int n, q;
    cin >> n;
    mset m;
    long long s = 0;
    for (int i = 0; i < n; i++) {
        long long a;
        cin >> a;
        m.add(a);
        s += a;
    }
    cin >> q;
    for (int i = 0; i < q; i++) {
        long long b, c;
        cin >> b >> c;
        auto p = m.m.find(b);
        if (p == m.m.end()) {
            cout << s << endl;
        } else {
            s = s + c * p->second - p->first * p->second;
            cout << s << endl;
            auto q = m.m.find(c);
            if (q == m.m.end()) {
                m.m[c] = p->second;
            } else {
                q->second += p->second;
            }
            m.m.erase(p);
        }
    }
}


Measured memory_bytes: 7576
#include <stdio.h>
#include <iostream>
#include <sstream>
using namespace std;
typedef long long Int;

string tos(Int k) {
    ostringstream o;
    o << k;
    return o.str();
}

Int ct(Int k, int d) {
    if (k == 0) return 0;
    return (k-1)/d;
}

Int dig(Int k, int d) {
    Int s = 0;
    for (Int a = 1, w = 1; a < k; a*=10, w++) {
        s += w*(ct(min(a*10, k), d)-ct(a, d));
    }
    return s;
}

Int f(Int k) {
    Int ans = dig(k, 1);
    ans -= dig(k, 3) + dig(k, 5);
    ans += dig(k, 15);
    ans += 4 * (ct(k, 3) + ct(k, 5));
    return ans;
}

int main() {
    Int n;
    cin >> n;
    Int r = 1;
    while (f(r) < n) r*=2;
    Int l = 0;
    while (r-l > 1) {
        const Int mid = (l+r)/2;
        if (f(mid) < n) l = mid; else r = mid;
    }
    const Int b = f(l);
    string s;
    for (Int k = l; b + s.size() < n+30; k++) {
        if (k%3 && k%5) s += tos(k);
        else {
            if (k%3 == 0) s += "Fizz";
            if (k%5 == 0) s += "Buzz";
        }
    }
    cout << s.substr(n-1-b, 20) << endl;
    return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#define fast ios::base_sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define M 1000000007
#define pie 3.141592653589793238
using namespace std;


signed main(){
    int n,m; cin >> n >> m;
    if(n == m){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		for(int x=0;x<100000;x++){
			int y = (int)(x * 1.08);
			if(N == y){
				Console.WriteLine(x);
				return;
			}
		}
		Console.WriteLine(":(");
	}
	int N;
	public Sol(){
		N = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main() {
	string s[3];
	cin >> s[0] >> s[1] >> s[2];

	cout << (char)(s[0][0] - 32) << (char)(s[1][0] - 32) << (char)(s[2][0] - 32) << endl;
	
	return 0;
}

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

int GCD(int a, int b){
	if(b == 0){
		return a;
	}
	else{
		return GCD(b, a % b);
	}
}

int main(){
	int N, A, i, g = 0;
	scanf("%d", &N);
	for(i = 0; i < N; i++){
		scanf("%d", &A);
		g = GCD(g, A);
	}
	printf("%d\n", g);
	return 0;
}

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

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	if (B - A + 1 > K * 2) {
		for (int i = 0; i < K; i++) {
			cout << A + i << endl;
		}
		for (int i = 0; i < K; i++) {
			cout << B - K + i + 1 << endl;
		}
	}
	else {
		for (int i = A; i <= B; i++) {
			cout << i << endl;
		}
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ss[] = s.split("");
    int ans = 0;
    for (int i = 0; i < s.length(); i++){
      if (ss[i].equals("1")) ans++;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 35528
#include<iostream>

using namespace std;

int main() {

    int n,max,min;
    long int sum = 0;
  

    cin >> n;
    int a[10000];

    for (int i = 0; i < n; i++) {
        cin >> a[i] ;
     
        if (i == 0) {
            max = a[0];
            min = a[0];
        }
        sum += a[i];

        if ( max < a[i]) {
            max = a[i];
        }
        else if(min > a[i]) {
            min = a[i];
        }

    }
    cout << min << " " << max << " " << sum << endl;
    
    return 0;
}


Measured memory_bytes: 3120