akhauriyash/Code-Regression huggingface dataset:
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll d[MAXn], s[MAXn], bit[MAXn];
ii dt[MAXn];
vector<ll> uni;
void ins(ll x, ll k)
{
    while(x < MAXn)bit[x] += k, x += x & -x;
}
ll qr(ll x)
{
    ll ret = 0;
    while(x)ret += bit[x], x -= x & -x;
    return ret;
}


int main()
{
    IOS();
    ll n;
    cin>>n;
    REP(i,n)cin>>d[i];
    REP(i,n)dt[i] = ii(d[i], i);
    sort(dt,dt+n);
    ll l = -1, r = n-1, targ = ((n + 1) * n / 2) / 2 + 1;
    debug(targ);
    while(l != r-1)
    {
        ll h = (l+r)/2;
        FILL(bit, 0);
        uni.clear();
        REP(i,n)s[i] = (ii(d[i], i) <= dt[h]?-1:1);
        for(int i = n-1;i >= 0;i--)s[i] += s[i+1];
        pary(s, s + n);
        REP(i,n+1)uni.pb(s[i]);
        sort(ALL(uni));
        uni.resize(unique(ALL(uni)) - uni.begin());
        REP(i,n+1)s[i] = lower_bound(ALL(uni), s[i]) - uni.begin() + 1;
        ll tt = 0;
        REP(i,n+1)tt += qr(s[i] - 1), ins(s[i], 1);
        debug(h, dt[h], tt);
        if(tt >= targ)r = h;
        else l = h;      
    }
    cout<<dt[r].X<<endl;
}


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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

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

    int n;
    string s;
    cin >> n >> s;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        vt<int> z(n - i);
        for (int j = 1, l = 0, r = 0; i + j < n; j++) {
            if (j <= r) z[j] = min(z[j - l], r - j + 1);
            while (i + j + z[j] < n &&
                    s[i + z[j]] == s[i + j + z[j]]) z[j]++;
            if (j + z[j] - 1 > r) l = j, r = j + z[j] - 1;

            ans = max(ans, min(j, z[j]));
        }
    }

    cout << ans;
}


Measured memory_bytes: 3692
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
typedef long long ll;

using namespace std;

int main()
{
	int a,b,c,d;
	string ans;
	
	cin>>a>>b>>c>>d;
	if(a+b==c+d)
	{
		ans="Balanced";
	}else if(a+b>c+d){
		ans="Left";
	}else{
		ans="Right";
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N ,M = list(map(int, input().split()))
path = [[0]*N for i in range(N)]
visited = [0]*N
visited[0]=1
ans = 0
for i in range(M):
  a, b = list(map(int, input().split()))
  path[a-1][b-1]=1
  path[b-1][a-1]=1
  
def solve(i):
  global ans
  if not 0 in visited:
    ans += 1
    return
  else:
    for j in range(N):
      if path[i][j]==1 and visited[j] == 0:
        visited[j] = 1
        solve(j)
        visited[j] = 0
    return

solve(0)
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
#define MAX 1000000007
ll n,m,i,j,k,t,arr[sz];
int main()
{
    scanf("%lld %lld",&m,&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&arr[i]);
    }
    t=INT_MAX;
    for(i=0;i<n;i++)
    {
      if(i==0)
      {
          j=arr[n-1]-arr[i];
          k=arr[i]+m-arr[i+1];
          k=min(k,j);
          t=min(t,k);
      }
      else if(i==n-1)
      {

          j=arr[i-1]-arr[i]+m;
          k=arr[n-1]-arr[0];
          k=min(k,j);
          t=min(t,k);
      }
      else
      {

          j=arr[i-1]-arr[i]+m;
          k=arr[i]+m-arr[i+1];
          k=min(k,j);
          t=min(t,k);
      }
    }
    printf("%lld\n",t);
}


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

int main() {
	ll a,b,c,d; cin >> a >> b >> c >> d;
	ll ans;
	ll e=a*c;
	ll f=a*d;
	ll g=b*c;
	ll h=b*d;
	ans=max(e,f);
	ans=max(ans,g);
	ans=max(ans,h);
	cout << ans << endl;
}

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

int main() {

  int n,x;
  cin >> n >> x;
  vector<int> t(n);
  
  rep(i,n) cin >> t[i];
  int sum = 0;
  rep(i,n) sum += t[i];
  
  int nokori = x - sum;
  
  sort(t.begin(), t.end());
  
  cout << n + (nokori / t[0]) << endl;
  
  
  
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long n=sc.nextLong();
		long m= sc.nextLong();
		long l=0;
		long price=0;
		Map<Long,Long> map = new TreeMap<>();
		for(int i=0;i<n;i++) {
				long key= sc.nextLong();
				long value = sc.nextLong();
				if(map.containsKey(key)) {
			map.put(key,value+map.get(key));
				}else {
					map.put(key,value);
				}
		}
		for( long nkey: map.keySet()) {
			long k=map.get(nkey);
			m-=k;
			if(m>0) {
			l+=k*nkey;
			}else{
				l+=nkey*(m+k);
				System.out.println(l);
				break;
			}


		}
    }

}


Measured memory_bytes: 98964
import sys

X, K, D = [int(x) for x in input().strip().split(" ")]

X = abs(X)
k, x = divmod(X, D)

if K <= k:
    print(X - D * K)
    sys.exit(0)

X = x
K -= k

if K % 2 == 0:
    print(abs(X))
    sys.exit(0)

print(abs(X - D))

Measured memory_bytes: 9192
#include<stdio.h>
#define MAX(a,b) ((a)>(b) ?(a) : (b))
#define MIN(a,b) ((a)<(b) ?(a) : (b))
#define ABS(a) ((a)>0 ?(a) : (-a))
int main(void){
 int a;
 scanf("%d",&a);
 if(a){
   printf("0\n");
 }else{
   printf("1\n");
 }
 return 0;
}


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

int main(){
    ll n,k,c;
    scanf("%lld%lld%lld",&n,&k,&c);
    char s[200005];
    scanf("%s",s);
    int ss[200005]={};
    int maps[200005]={};
    REP(i,n){
        if(s[i]=='o')ss[i]=1;
        else ss[i]=0;
    }
    ll dnum=0;
    for(int i=n-1; i>=0;i--){
        while(ss[i]==0){
            i--;
            if(i<0)break;
        }
        if(i<0)break;
        maps[i]=dnum+1;
        //cout<<i<<" "<<maps[i]<<endl;
        
        dnum++;
        i-=c;
    }
    if(dnum!=k){
        return 0;
    }
    dnum=0;
    
    for(int i=0; i<n;i++){
        while(ss[i]==0){
            i++;
            if(i>=n)break;
        }
        if(i>=n)break;
        if(maps[i]>0){
            cout<<i+1<<endl;
        }
        //cout<<"#####"<<i<<endl;
        dnum++;
        i+=c;
    }
}

Measured memory_bytes: 3200
#include<stdio.h>

int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
} 
int right(int i){
  return 2*i+1;
}
int main(){
  int heap_size,i;
  int A[254];
  scanf("%d",&heap_size);
  for(i = 1; i <= heap_size; i++){
    scanf("%d",&A[i]);
  }
  for(i = 1; i <= heap_size; i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i) >= 1) printf("parent key = %d, ",A[parent(i)]);
    if(left(i) <= heap_size) printf("left key = %d, ",A[left(i)]);
    if(right(i) <= heap_size) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}

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


int NumberOfTriangles(int arr[], int n)
{
	int count=0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) { 
			for (int k = j + 1; k < n; k++)
 
				if (
					arr[i] + arr[j] > arr[k]
					&& arr[i] + arr[k] > arr[j]
					&& arr[k] + arr[j] > arr[i]
					&& ((arr[i] != arr[j]) && (arr[j] != arr[k]) && (arr[i] != arr[k])))
					count++;
		}
	}
	return count;
}
int main()
{
	int size, arr[1000];
	cin >> size;
	for (int i = 0;i < size;i++) {
		cin >> arr[i];
	}

	cout << NumberOfTriangles(arr, size);

	return 0;
}


Measured memory_bytes: 3620
// https://atcoder.jp/contests/dp/tasks/dp_b

#include <bits/stdc++.h>

using namespace std;

#define ll long long 
#define REP1(i,n) for(ll i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 1000010;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
#define LOOP 10000000
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 入力
int H, W;
vector<string> field;
int result = 100;
int dfs_res = 0;

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


 
int main() {
 
    string s, t;
    cin >> s;
    cin >> t;
    string ans = "";

    ll dp[s.length()+1][t.length()+1];
    REP(i, s.length()+1){
        REP(j, t.length()+1){
            dp[i][j] = 0;
        } 
    }


    REP(i, s.length()){
        REP(j, t.length()){
            if (s[i] == t[j]) {
                chmax(dp[i+1][j+1], dp[i][j] + 1);
                ans += s[i];
            }
            chmax(dp[i+1][j+1], dp[i+1][j]);
            chmax(dp[i+1][j+1], dp[i][j+1]);
        }

    }


    // 復元
    string res = "";
    int i = (int)s.size(), j = (int)t.size();
    while (i > 0 && j > 0)
    {
        // (i-1, j) -> (i, j) と更新されていた場合
        if (dp[i][j] == dp[i-1][j]) {
            --i; // DP の遷移を遡る
        }

        // (i, j-1) -> (i, j) と更新されていた場合
        else if (dp[i][j] == dp[i][j-1]) {
            --j; // DP の遷移を遡る
        }

        // (i-1, j-1) -> (i, j) と更新されていた場合
        else {
            res = s[i-1] + res; // このとき s[i-1] == t[j-1] なので、t[j-1] + res でも OK
            --i, --j; // DP の遷移を遡る
        }
    }
    cout << res << endl;

 
    return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/




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

int main() {

    string s;
    cin >> s;

    vector<pair<char, ll>> v;
    v.emplace_back(s[0], 1);
    REP(i, 1, s.length()){
        if(v.back().first == s[i]){
            v.back().second++;
        }
        else{
            v.emplace_back(s[i], 1);
        }
    }

    ll ans = 0;
    rep(i, v.size()){
        if(i == 0 && v[i].first == '>'){
            ans += (v[i].second + 1) * v[i].second / 2;
            continue;
        }
        if(i == v.size()-1 && v[i].first == '<'){
            ans += (v[i].second + 1) * v[i].second / 2;
            continue;
        }
        
        if(v[i].first == '<' && v[i+1].first == '>'){
            ll mx = max(v[i].second, v[i+1].second);
            ll mn = min(v[i].second, v[i+1].second);
            ans += (mx + 1) * mx / 2;
            ans += (mn - 1) * mn / 2;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6264
college = Array.new(4).map { Array.new(3).map { ['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } }

input = []

gets.to_i.times do
  input << gets.split(' ').map(&:to_i)
end

input.each do |e|
  b, f, r, v = e
  college[b - 1][f - 1][r] += v
end

college.each_with_index do |ary, i|
  puts ary.map{ |e| e.join(' ') }.join("\n")
  break if college.size - 1 == i
  puts '#' * 20
end

Measured memory_bytes: 8752
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.valueOf(sc.nextInt());
		int a[] = new int[N];
		int i;

		for(i=0; i<N; i++){
			a[i] = sc.nextInt();
		}

		int judge=0;
		i = 0;
		int count=0;
		while(judge != 2){
			judge = a[i];
			count++;
			i = judge-1;
			if(count > N) break;
		}
		if(count<N){
			System.out.println(count);
		}
		else{
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 52676
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;




int main()
{
    int n;
    cin >> n;
    vvll MAP(2, vll(n));
    rep(i, 2) rep(j, n) cin >> MAP[i][j];
    vll s1(n + 1, 0);
    rep(i, n) s1[i + 1] = s1[i] + MAP[0][i];
    vll s2(n + 1, 0);
    repr(i, n - 1, -1) s2[i] = s2[i + 1] + MAP[1][i];
    ll ans=0;
    rep(i, n) ans = max(ans, s1[i + 1] + s2[i]);
    cout << ans << endl;

}


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

#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
const LL mod=1e9+7;
int n,k,f[N],g[N];
void P(){
	f[0]=1;
	for(int i=1;i<=2000;i++)f[i]=(1ll*f[i-1]*i)%mod;
	g[2000]=powmod(f[2000],mod-2,mod);
	for(int i=1999;i>=0;i--)g[i]=(1ll*g[i+1]*(i+1))%mod;
}
int get(int x,int y){
	if(x<y)return 0;
	return 1ll*f[x]*g[y]%mod*g[x-y]%mod;
}
int main(){
	ios::sync_with_stdio(false);
	P();
	cin>>n>>k;
	for(int i=1;i<=k;i++)cout<<1ll*get(k-1,i-1)*get(n-k+1,i)%mod<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>


using namespace std;

int main(){

  int m, n;


  while(1){

    cin >> n >> m;

    if(n == 0 && m == 0)break;

    int data[n];

    for(int i = 0; i < n; i++){
      cin >> data[i];
    }

    sort(data, data+n);
    reverse(data, data+n);


    for(int i = m-1; i < n - (n%m); i+=m){
      data[i] = 0;
    }
    int sum = 0;

    for(int i = 0; i < n; i++){
      sum += data[i];
    }

    cout << sum << endl;

  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
//const ll p = 1e9 + 7;
//const ll p = 998244353;
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

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

	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	while (a > 0 && c > 0) {
		c -= b;
		if (c <= 0) {
			Yes();
			return 0;
		}
		a -= d;
		if (a <= 0) {
			No();
			return 0;
		}
	}
}


Measured memory_bytes: 3596
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<db> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 
typedef vector<pd> vpd; 

#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend() 
#define rsz resize
#define ins insert 
#define ft front() 
#define bk back()
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define lb lower_bound 
#define ub upper_bound 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MX  = 2e5+5; 
const int MOD = 1e9+7; // 998244353;
const ll  INF = 1e18; 
const ld  PI  = acos((ld)-1);

const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 

template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; 
}
template<class T> bool ckmax(T& a, const T& b) { 
	return a < b ? a = b, 1 : 0; 
} 

constexpr int pct(int x) { return __builtin_popcount(x); } // number of ones 
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x)) 
template<class T> T cdiv(T a, T b) { return a/b+!(a<0||a%b == 0); } // division of a by b rounded up, assumes b > 0 

int fstTrue(function<bool(int)> f, int lo, int hi) {
	hi++; assert(lo <= hi); // assuming f is increasing
	while (lo < hi) { // find first index such that f is true 
		int mid = (lo+hi)/2; 
		f(mid) ? hi = mid : lo = mid+1; 
	} 
	return lo;
}

template<class T> void remDup(vector<T>& v) { 
	sort(all(v)); v.erase(unique(all(v)),end(v)); 
}

// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << h; if (sizeof...(t)) cerr << ", ";
	DBG(t...); 
}
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)

// FILE I/O
void setIn(str S) { freopen(S.c_str(),"r",stdin); }
void setOut(str S) { freopen(S.c_str(),"w",stdout); }
void setIO(str S = "") {
	ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(S)) { setIn(S+".in"), setOut(S+".out"); } // for USACO
}

int32_t main() { 
	
	setIO();

    str S; cin >> S;

    int res = 0, cnt = 0;
    F0R(i,sz(S)) {
        if (S[i] == 'R') cnt++;
        else cnt = 0;
        res = max(res,cnt);
    }

    cout << res << "\n";

}

Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());

            var ans = long.MaxValue;

            for (var i = 1L; i * i <= N ; i++)
            {
                if(N % i == 0)
                {
                    ans = Math.Min(Math.Max(i.ToString().Length, (N / i).ToString().Length), ans);
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27420
//	Sha3ban_El-Bay
#include<bits/stdc++.h>
using namespace std ;
//======================================================
#define El_Bay ios_base::sync_with_stdio(false);cin.tie(NULL);
#define forn(i,n)  for (int i = 0; i < (int)(n); ++i)
#define for1(i,n)  for (int i = 1; i <=(int)(n); ++i)
#define all(v)     (v).begin(),(v).end()
#define ull        unsigned long long
#define PI         3.14159265359
#define ll         long long
#define sz(v)	   v.size()
#define pb         push_back
#define pp         pop_back
#define S          second
#define bgn        begin
#define F          first
#define N	100000+5
#define MOD	1e9+7
#define inf 1e9
//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
	while (b--) ret = (ret * a);
	return ret;}
//======================================================
ll n;
ll a[N];
ll dp[N];
ll Frog(int i)
{
	if(i>=n) return 0;
	if(dp[i]!=-1) return dp[i];
	ll c1=inf,c2=inf;
	if(i+1<=n)c1=Frog(i+1)+abs(a[i]-a[i+1]);
	if(i+2<=n)c2=Frog(i+2)+abs(a[i]-a[i+2]);
	return dp[i]=min(c1,c2);
}

int main()
{
	El_Bay
	cin >> n;
	memset(dp,-1,sizeof dp);
	for(int i=1 ; i<=n ; i++)
		cin >> a[i];
	ll ans=Frog(1);
	cout << ans;
	return 0;
}


Measured memory_bytes: 9820
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int,P>PP;

int modpow(int a, int x, int mod) {
	int res = 1;
	while (x) {
		if (x & 1)res = res*a%mod;
		a = a*a%mod;
		x >>= 1;
	}
	return res;
}
int c[200006];
int d[200006];
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> c[i];
	sort(c, c + n); reverse(c, c + n);
	d[0] = modpow(2, n - 1, mod);
	rep(i, n - 1)d[i + 1] = (d[i] + modpow(2, n - 2, mod)) % mod;
	int res = 0;
	rep(i, n)res = (res + c[i] * d[i]) % mod;
	res = res*modpow(2, n, mod) % mod;
	cout << res << endl;
}

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

int main()
{
    int a,b;
    cin >>a>>b;


    if(a < b){
        cout<<"a < b"<<endl;
    }
    else if(a > b){
        cout<<"a > b"<<endl;
    }
    else if(a == b){
        cout<<"a == b"<<endl;
    }

 return 0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;


//ここから

void solve(){
  int n;
  cin>>n;
  double t,a;
  cin>>t>>a;
  vector<double>h(n);
  rep(i,n)cin>>h[i];
  double ans=1e9;
  int id=0;
  rep(i,n){
    if(chmin(ans,abs(t-h[i]*0.006-a)))id=i;
  }
  cout<<id+1;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


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

int main(void){

    int W, a, b;

    scanf("%d%d%d", &W, &a, &b);

    if(a+W < b){
        printf("%d\n", b - (a + W));
    }else if(a <= b){
        printf("0\n");
    }else if(a < b + W){
        printf("0\n");
    }else{
        printf("%d\n", a - (b + W));
    }

    return 0;
}

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

long long N;

int digit( long long x )
{
	int res = 0;
	while( x > 0 ) {
		x /= 10;
		res++;
	}
	return res;
}

int F( long long a, long long b )
{
	return max( digit( a ), digit( b ) );
}

int main() {
	cin >> N;

	long long mi = INT64_MAX;
	for( long long a = 1; a * a <= N; a++ ) {
		if( N % a ) {
			continue;
		}
		long long b = N / a;
		long long v = max( a, b );
		mi = min( mi, v );
	}
	int ans = F( mi, N / mi );

	cout << ans << endl;

	return 0;
}


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

int main(){
    string W,T;
    int count=0;
    cin>>W;
    while(1){
        cin>>T;
        if(T=="END_OF_TEXT"){
            break;
        }
        for(int i=0;i<T.size();i++){
            if(isupper(T[i])){
                T[i]=tolower(T[i]);
            }
        }
        if(W==T)count+=1;
    }
    cout<<count<<endl;
}


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

using namespace std;
typedef long long ll;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n));

void fast() {

    cin.tie(0);
    cin.sync_with_stdio(0);
}

int dp[100 + 9][100000 + 9], v[100 + 9][100000 + 9], a[100 + 9], b[100 + 9], n, w;

ll maxi(ll i, ll k) {
    if (k <= 0)return 0;
    if (i == n) {
        return 1e9+9;
    }
    if (~dp[i][k])return dp[i][k];
    dp[i][k] = min(maxi(i + 1, k), a[i] + maxi(i + 1, k - b[i]));
    return dp[i][k];
}


int main() {
    fast();
    cin >> n >> w;
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }

    clr(dp, -1);
    for (int j = 1e5 + 1; j >= 1; --j) {
        // cout<<maxi(0,j)<<" ";
        if (maxi(0, j) <= w) {
            cout << j << endl;
            break;
        }
    }


    //    dp[0] = 0;
//    int s = 12;
//    int arr[3] = {1, 3, 5};
//    for (int i = 1; i < s; ++i) {
//        for (int j = 0; j < 3; ++j) {
//            if(arr[j]<=i&&dp[i-arr[j]]+1<dp[i])dp[i]=dp[i-arr[j]]+1;//1 stand for the rest 3
//        }
//        cout<<dp[i]<<" ";
//    }
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll x;
    cin>>x;
    x=x%10;
    if(x==2||x==4||x==5||x==7||x==9)
        cout<<"hon\n";
    else if(x==0||x==1||x==6||x==8)
        cout<<"pon\n";
    else
        cout<<"bon\n";
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int N,M,AC=0,WA=0,a; string b;
int cnt[100001], condi[100001];
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>N>>M;
	for(int i=1;i<=M;i++){
		cin>>a>>b;
		if(condi[a]) continue;
		if(b[0]=='A') condi[a]=1;
		else cnt[a]++;
	}
	for(int i=1;i<=N;i++){
		if(condi[i]){
			AC++;
			WA+=cnt[i];
		}
	}
	cout<<AC<<' '<<WA;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main() {
	string s;
  ll k;
  cin>>s>>k;
  char ans='1';
  for(int i=0;i<s.size();i++){
    if(s[i]!='1'){
      if(i<k)ans=s[i];
      break;
    }
  }
  cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n, k = gets.split.map &:to_i
ps = gets.split.map &:to_i

max = (0...k).sum { |i| 1+ps[i] }
prev = max
(n-k).times do |i|
  prev += ps[i+k] - ps[i]
  max = [max, prev].max
end

p max*0.5

Measured memory_bytes: 26952
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a_sum = [0]
for i in range(len(A)):
    a_sum.append(a_sum[-1]+A[i])
    
b_sum = [0]
for i in range(len(B)):
    b_sum.append(b_sum[-1]+B[i])

max_time = 0
b_idx = M
for i in range(len(a_sum)):
    if a_sum[i] > K:
        break
    for j in range(b_idx, -1, -1):
        if a_sum[i]+b_sum[j] <= K:
            max_time = max(max_time, i + j)
            b_idx = j
            break
print(max_time)

Measured memory_bytes: 126812
import java.util.*

fun main(args:Array<String>):Unit{
    repeat(readLine()!!.toInt()){
        val cellar = Cellar()
        readLine()!!.forEach {
            cellar.push(it.toString().toInt())
        }
        println(cellar.displayed())
    }
}
class Cellar{
    private val mButton:Array<Button> = arrayOf(Button.One, Button.Two, Button.Three, Button.Four, Button.Five, Button.Six, Button.Seven, Button.Eight, Button.Nine)
    private var mCurrent:Int = 0
    private val mDisplay: Stack<Char> = Stack()
    fun push(number:Int):Unit {
        if (number == 0){
            confirm()
        }else{
            mCurrent = number
            mButton[mCurrent - 1].push()
        }
    }
    private fun confirm():Unit {
        if (mCurrent != 0){
            mDisplay.push(mButton[mCurrent - 1].confirm())
            mCurrent = 0
        }
    }
    fun displayed():String = mDisplay.joinToString("")
}
sealed class Button(private val mChars:String){
    private var mIndex:Int = 0
    fun push():Unit {
        ++mIndex
    }
    fun confirm():Char {
        val res = mChars[(mIndex - 1)% mChars.length]
        mIndex = 0
        return res
    }
    object One:Button(".,!? ")
    object Two:Button("abc")
    object Three:Button("def")
    object Four:Button("ghi")
    object Five:Button("jkl")
    object Six:Button("mno")
    object Seven:Button("pqrs")
    object Eight:Button("tuv")
    object Nine:Button("wxyz")
}


Measured memory_bytes: 31756
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define M 1000000007
typedef long long ll;
int main() { 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t,a[1000000],n,i,x,y;
    cin>>x>>y>>n;
    if(x>y){
        swap(x,y);
    }
    if(n%y)
    cout<<n/y+1;
    else
    cout<<n/y;
    
    return 0;
}


Measured memory_bytes: 256
from sys import stdin

def main():
    N = int(input())
    T, A = map(int, input().split())
    H = map(int, input().split())

    temp = [T - x * 0.006 for x in H]
    diff = float('inf')
    ans = 0
    for i, a in enumerate(temp, start=1):
        b = abs(A - a)
        if not b:
            print(i)
            return
        elif diff > b:
            ans, diff = i, b
    print(ans)

input = lambda: stdin.readline()
main()


Measured memory_bytes: 3188
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,x,y,z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

template <std::int_fast64_t Modulus> class modint {
  using u64 = std::int_fast64_t;
public:
  u64 a;
  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};
typedef modint<MOD> m;
#pragma endregion

int main() {
  cin >> N >> M;
  if(N <= M) cout << "Yes";
  else cout << "No";
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

int main()
{
	ull n, m;
	cin >> n >> m;
	vector<pair<ull, ull>> vec(n);
	REP(i, n)
	{
		cin >> vec[i].first >> vec[i].second;
	}
	sort( ALL( vec ) );
	
	ull ans = 0;
	for( auto& v : vec )
	{
		if( m > v.second )
		{
			ans += v.first * v.second;
			m -= v.second;
		}
		else
		{
			ans += v.first * m;
			break;
		}
		
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define mod 993244853
#define ll long long
#define debug(x) printf("\n'x is: %lld'\n\n",x);
#define lp(i,l,r) for(ll i=l;i<r;i++)
//VECTOR
#define pb push_back
#define pop pop_back
//PAIR
#define fst first
#define snd second
#define mp make_pair

ll invmod(ll a,ll b)
{
  ll i=1, m=b-2;

  while(m)
  {
    if(m&1)(i=i*a)%b;

    m>>=1;
    a=(a*a)%b;
  }
return i;
}

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

ll n,k,a[105],dp[100020]={0};

  cin>>n>>k;

 lp(i,0,n)
   cin>>a[i];

  lp(i,0,100020)
  {
    if(dp[i]==0)
    {
      lp(j,0,n)
        if(i+a[j]<100020)dp[i+a[j]]=1;      
    }
  }

  if(dp[k]==0)
  cout<<"Second\n";
  else
  cout<<"First\n";

return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
	public static void main(final String[] args) {

        Scanner sc = new Scanner(System.in);

        // 参加回数
        int joinNum = sc.nextInt();
        // 表示レーティング
        int dispRating = sc.nextInt();

        // 内部レーティング判定
        if (joinNum >= 10) {

            System.out.println(dispRating);
        } else {

            System.out.println(dispRating + (100 * (10 - joinNum)));
        }
    }
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll a,b,c,i,j,k,l,m,n,ans,tmp,hoge,fuga,piyo;
ll x[10010],y[10010];
string s,str;
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
int main(){
  cin>>n;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      for(int k=1;k<=n;k++){
        ans+=gcd(i,gcd(j,k));
      }
    }
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
 
int main() {
    int n;
    cin>>n;
    if(n%2){
        cout<<(double)(n/2+1)/(double)n<<endl;
    }else{
        cout<<"0.5000000000"<<endl;
    }
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int a = sc.nextInt();
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.x = sc.nextInt();
			o.h = sc.nextInt();
			arr[i] = o;
		}
		sc.close();

		Arrays.sort(arr, (o1, o2) -> o1.x - o2.x);
		long ans = 0;
		long rem = 0;
		TreeMap<Long, Long> map = new TreeMap<>();
		for (Obj o : arr) {
			int time = (o.h + a - 1) / a;
			Map<Long,Long> hm = map.headMap((long) o.x);
			for (long l : hm.values()) {
				rem += l;
			}
			long val = ans - rem;
			val = Math.max(time - val, 0);
			ans += val;
			hm.clear();
			map.put((long) o.x + 2 * d, val);
		}
		System.out.println(ans);
	}

	static class Obj {
		int x, h;
	}
}


Measured memory_bytes: 172084
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;

template <typename T>
class RMQ {
private:
	vector<T> _dat;
	int _n;
	T _initial;

public:
	RMQ(int n, T initial) {
		init(n, initial);
	}

	void init(int n, T initial) {
		_initial = initial;
		_n = 1;
		while(_n < n) _n *= 2;
		_dat.resize(_n*2-1, _initial);
	}

	void update(int x, T y) {
		x += _n-1;
		_dat[x] += y;
		while(x > 0) {
			x = (x-1) / 2;
			_dat[x] += y;
		}
	}

	T query(int a, int b) {
		return query(a, b, 0, 0, _n);
	}

	T query(int a, int b, int k, int l, int r) {
		if(b<=l || r<=a) return _initial;
		if(a<=l && r<=b) return _dat[k];
		return query(a,b,k*2+1,l,(l+r)/2) + query(a,b,k*2+2,(l+r)/2,r);
	}
};

int main() {
	int n, q;
	cin >> n >> q;
	RMQ<int> rmq(n, 0);
	rep(i, q) {
		int c, x, y;
		cin >> c >> x >> y;
		if(c) {
			x--; y--;
			cout << rmq.query(x, y+1) << endl;
		} else {
			x--;
			rmq.update(x, y);
		}
	}
	return 0;
}

Measured memory_bytes: 2064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

ll lcm(int n) {
    return 2LL / __gcd(2, n) * n;
}

int main() {
    int n; cin >> n;
    ll ans = lcm(n);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long int;

ll gcd(ll a, ll b)
{
    if (a < b) {
        ll tmp = a;
        a = b;
        b = tmp;
    }

    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    
    ll t1 = b - b / c - b / d + b / lcm(c, d); 
    ll aa = a - 1;
    ll t2 = aa - aa / c - aa / d + aa / lcm(c, d);

    cout << t1 - t2 << endl;

    return 0;
}

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

using namespace std;

#define li long long int
#define ld long double

const int N 	= 1e2 + 3;
const int M 	= 1e5 + 5;
const int mod 	= 1e9 + 7;

int n, k;
int a[N];
int dp[M];

int go(int val) {
	if (val <= 0) return 0;
	if (dp[val] != -1) return dp[val];
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (val - a[i] >= 0) ans |= !go(val - a[i]);
	}
	return dp[val] = ans;
}

void solve() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	memset(dp, -1, sizeof(dp));
	int ans = go(k);
	ans ? cout << "First" : cout << "Second";
} 

int main() {
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














string S; int Q;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> S >> Q;

	deque<char> deq;
	fore(c, S) deq.push_back(c);
	bool isRev = false;

	rep(_, 0, Q) {
		int t; cin >> t;
		if (t == 1) isRev = !isRev;
		else {
			int f; char c; cin >> f >> c;

			if (f == 1) {
				if (isRev) deq.push_back(c);
				else deq.push_front(c);
			}
			else {
				if (isRev) deq.push_front(c);
				else deq.push_back(c);
			}
		}
	}

	string ans = "";
	if (isRev) {
		while (!deq.empty()) {
			ans += deq.back();
			deq.pop_back();
		}
	}
	else {
		while (!deq.empty()) {
			ans += deq.front();
			deq.pop_front();
		}
	}

	cout << ans << endl;
}







Measured memory_bytes: 1368
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n; cin>>n;
    vector<int> ans(n+1,0);
    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                int d=x*x+y*y+z*z+x*y+y*z+z*x;
                if(d<=n) ans[d]++;
            }
        }
    }
    rep(i,n) cout<<ans[i+1]<<endl;
}

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

int main(){
  int S;  cin >> S;
  int A = S/100;
  int B = S - A*100;
  if(1 <= A && A <= 12){
    if(1 <= B && B <= 12){
      cout << "AMBIGUOUS" << endl;
    }else if(0 <= B && B <= 99){
      cout << "MMYY" << endl;
    }
  }else{
    if(1 <= B && B <= 12){
      cout << "YYMM" << endl;
    }else{
      cout << "NA" << endl;
    }
  }
}


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

ll sum[100005],s[100005],t[100005];
int main(){
    ll T,si,ti;
    int n;
    cin>>T>>n;
    rep(i,n){
        cin>>si>>ti;
        s[i]=si;
        t[i]=ti;
        sum[i+1]=ti-si;
    }
    rep(i,n+1){
        sum[i+1]+=sum[i];
    }
    s[n]=LLONG_MAX;
    ll mx=0;
    rep(i,n){
        int cur=lower_bound(s,s+n+1,s[i]+T)-s;
        --cur;
        ll sub=sum[cur]-sum[i];
        mx=max(mx,sub+min(T+s[i],t[cur])-s[cur]);
    }
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 5424
'use strict';

function Main(INPUT) {
    const N = Number(INPUT.split("\n")[0]);
    const ary =[111, 222, 333, 444, 555, 666, 777, 888, 999];

    for (let i = 0; i < ary.length; i++) {
        let tmp = ary[i] - N;
        if (tmp >= 0) {
            console.log(ary[i]);
            break;
        }
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
	ll a,b,c,k,ans;
	cin >> a >> b >> c >> k;
	if (k<=a) ans = k;
	else if (k<=a+b) ans = a;
	else ans = a - (k-a-b);

	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.txt", "r", stdin);
		//freopen("b.txt", "w", stdout);
	#endif

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

	int n;
	cin >> n;
	vector<int> a(n+1);
	for (auto &i : a) cin >> i;

	ll ans = 0;
	for (int i = 0, x; i < n; ++i)
	{
		cin >> x;
		int c = min(x, a[i]);
		ans += c;
		x -= c;
		c = min(x, a[i+1]);
		ans += c;
		a[i+1] -= c;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 640
#coding:utf-8
S = input()
flag = 0
#一文字目がA
if S[0] == 'A':
    flag += 1
#Sの先頭から3文字目と末尾から2文字目の間（両端含む）に大文字のCがちょうど1個
if S[2:len(S)-1].count('C') == 1:
    flag += 1
#以上の A, C を除く S のすべての文字は小文字(大文字は2文字目以降に1つだけ)
up_case = 0
for i in range(1, len(S)):
    if S[i].isupper() == True:
        up_case += 1

if up_case == 1:
    flag += 1

#条件が全部合えばAC
if flag == 3:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3064
#include <stdio.h>
void merge(int *,int,int,int);
void mergesort(int *,int,int);
#define N 500000
#define banpei 2000000000
int count =0;

int main(){
  int A[N];
  int i,n,left,right,mid,j;
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergesort(A,0,n);
  for(i=0;i<n-1;i++)printf("%d ",A[i]);
  printf("%d",A[n-1]);
  
  printf("\n");
  printf("%d\n",count);
  
  return 0;
}

void merge(int A[],int left,int mid,int right){
  int i,j,n1,n2,k;
  
  n1 = mid - left;
  n2 = right - mid;
  int L[n1], R[n2];
  
 for(i =0;i<=n1-1;i++)L[i] = A[left + i];

 for(i=0;i<=n2-1;i++)R[i] = A[mid + i];

 L[n1] = banpei;
 R[n2] = banpei;
 i = 0;
 j = 0;

 for(k=left;k<=right-1;k++){count++;
    if(L[i]<=R[j]){
      A[k] = L[i];
      i = i + 1;
    }
    
    else{
      A[k] = R[j];
      j = j + 1;
    }
  }

}

void mergesort(int A[],int left,int right){

  if(left+1<right){
 int   mid = (left+right)/2;
    mergesort(A,left,mid);
    mergesort(A,mid,right);
    merge(A,left,mid,right);
  }
}



Measured memory_bytes: 5612
# 7
from collections import Counter
import collections
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
d = LI()
mod = 998244353
if d[0] != 0:
    print(0)
    exit(0)

# 頂点 i に隣接する頂点のうち、頂点 1 に近い頂点を pi とすると
# d_pi = d_i - 1 となる
# 各 i (i >= 2) について上の条件を満たす pi の個数の総乗を求める
c = Counter(d)
counts = [0] * (max(d)+1)
for k, v in c.items():
    counts[k] = v
if counts[0] > 1:
    print(0)
    exit(0)
ans = 1
for i in range(1, len(counts)):
    ans *= pow(counts[i-1], counts[i])
    ans %= mod

print(ans)


Measured memory_bytes: 24388
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()




using namespace std;





int main(){
    int N,K; cin>>N>>K;
    vector <int> sunuke(N,0);
    REP(i,K){
        int d; cin>>d;
        REP(j,d){
            int a; cin>>a;
            sunuke[a-1]++;
        }
    }

    int ans = 0;
    REP(i,N){
        if(sunuke[i] == 0) ans++;
    }

    cout<<ans<<endl;


 



  return 0;
}

Measured memory_bytes: 3628