akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n, m;
llint p[605];
bool undiv[605][605];
llint dp[605][605];
llint dfact[605], num[605][605];

llint getlen(llint l, llint r)
{
	return ((r-l)%n+n)%n+1;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	dfact[0] = 1;
	for(int i = 2; i < 605; i+=2) dfact[i] = dfact[i-2] * (i-1) % mod, dfact[i] %= mod;
	
	cin >> n >> m;
	n *= 2;
	for(int i = 0; i < n; i++) p[i] = -1;
	
	llint a, b;
	for(int i = 1; i <= m; i++){
		cin >> a >> b;
		a--, b--;
		p[a] = b, p[b] = a;
	}
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n-1; j++){
			if(i >= j || getlen(i, j) % 2) continue;
			for(int k = 0; k < n; k++){
				if(p[k] == -1) continue;
				if(k >= i && k <= j && (p[k] < i || p[k] > j)){
					llint x = (j+1)%n, y = (i-1+n)%n;
					undiv[i][j] = undiv[x][y] = true;
					break;
				}
			}
		}
	}
	

	for(int i = 0; i < n; i++){
		for(int j = 0; j < n-1; j++){
			if(i >= j || getlen(i, j) % 2) continue;
			for(int k = i; k <= j; k++){
				if(p[k] == -1) num[i][j]++;
			}
			llint x = (j+1)%n, y = (i-1+n)%n, len = getlen(i, j);
			num[x][y] = n-2*m - num[i][j];
		}
	}
	
	for(int i = 0; i < n; i++) dp[i][(i+1)%n] = 1;
	for(int len = 4; len < n; len+=2){
		for(int l = 0; l < n; l++){
			llint r = (l+len-1)%n, sum = 0;
			for(int k = 2; k < len; k+=2){
				if(undiv[l][(l+k-1)%n]) continue;
				sum += dp[l][(l+k-1)%n] * dfact[num[(l+k)%n][r]] % mod, sum %= mod;
			}
			dp[l][r] = dfact[num[l][r]] - sum + mod, dp[l][r] %= mod;
		}
	}
	
	/*for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			cout << num[i][j] << " " ;
		}
		cout << endl;
	}*/
	
	llint ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n-1; j++){
			if(i >= j || getlen(i, j) % 2) continue;
			if(undiv[i][j]) continue;
			llint x = (j+1)%n, y = (i-1+n)%n;
			if(undiv[x][y]) return -1;
			ans += dp[i][j] * dfact[num[x][y]] % mod, ans %= mod;
			//ans += dp[x][y] * dfact[num[i][j]] % mod, ans %= mod;
			//ans += mod - dp[i][j] * dp[x][y] % mod, ans %= mod;
			//cout << i << " " << j << " " << ans << endl;
		}
	}
	ans += dfact[n-2*m], ans %= mod;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 6272
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    int K, S;
    scanf("%d %d\n", &K, &S);

    long long result = 0;
    for (int x = 0; x <= min(K, S); ++x){
        for (int y = 0; y <= min(K, S - x); ++y){
            if (S - (x + y) <= K) ++result;
        }
    }
    printf("%lld\n", result);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int a,b,k;
    cin >> a >> b >> k;
   if(a + b <= k)
   cout << 0 << " " << 0 << endl;
   else if(a + b > k && a < k)
   {
       cout << 0 << " " <<  b - k + a << endl;
   }
   else
   {
       cout << a - k << " " << b << endl;
   }
}

Measured memory_bytes: 256
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pr;

int N, M;
int a[100010], b[100010];
vector<int> used;

int main()
{
	cin >> N >> M;
	used.resize(N + 1);
	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i];
		used[a[i]]++;
		used[b[i]]++;
	}
	sort(used.begin(), used.end());

	for (int i = 1; i <= N-1; i++) {
		if (used[i] % 2 != 0) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 1408
/*Author--Vishwas Agrawal*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define pb push_back
#define test ll t; cin>>t; while(t--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007LL
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define inc(i,a,n) for (ll i=a;i<n;i++)
#define dec(i,a,n) for (ll i=n-1;i>=a;i--)

int main()
{
   ll n;
   cin>>n;
   vll arr;
   ll count=0;
   inc(i,0,n)
   {
      ll x;
      cin>>x;
      arr.pb(x);
   }
   sortall(arr);
   dec(i,2,n)
   {
      inc(j,0,i-1)
      {
         inc(m,j+1,i)
         {
           
            if(!(arr[i]==arr[j]||arr[j]==arr[m]||arr[i]==arr[m]))
            {
                if(arr[j]+arr[m]>arr[i])
                {
                   count++;
                }
            }
         }
      }
   }
   cout<<count<<endl;
  
   return 0;
}

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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007
#define PI 3.141592653589793238462643383

signed main()
{
	init();
	solve();
}

int n;
string p, s;

void init()
{
	cin >> n >> p >> s;
}

bool check(int x)
{
	string res = p;
	rep(i, x) {
		res += s[i + n - x];
	}
	rep(i, n) {
		if (res[i+x] != s[i]) return false;
	}
	return true;
}

void solve()
{
	rep(i, n+1) {
		if (check(i)) {
			cout << i + n << endl;
			return;
		}
	}
}



Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll N;
    cin >> N;
    if(N % 1000 == 0){
        cout << 0;
        return 0;
    }
    ll a = 1000 - N % 1000;
    cout << a;
}

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

using namespace std;

#define sz(v) (int)v.size()
#define rep(i, a, b) for(int i = (a); i<(b); ++i)
typedef vector<long long> vi;
const long long inf = 1e17;
struct Node {
	Node *l = 0, *r = 0;
	long long lo, hi, mset = inf, madd = 0, val = -inf;
	Node(int lo,int hi):lo(lo),hi(hi){} // Large interval of -inf
	Node(vi& v, int lo, int hi) : lo(lo), hi(hi) {
		if (lo + 1 < hi) {
			int mid = lo + (hi - lo)/2;
			l = new Node(v, lo, mid); r = new Node(v, mid, hi);
			val = max(l->val, r->val);
		}
		else val = v[lo];
	}
	long long query(int L, int R) {
		if (R <= lo || hi <= L) return -inf;
		if (L <= lo && hi <= R) return val;
		push();
		return max(l->query(L, R), r->query(L, R));
	}
	void set(int L, int R, long long x) {
		if (R <= lo || hi <= L) return;
		if (L <= lo && hi <= R) mset = val = x, madd = 0;
		else {
			push(), l->set(L, R, x), r->set(L, R, x);
			val = max(l->val, r->val);
		}
	}
	void add(int L, int R, long long x) {
		if (R <= lo || hi <= L) return;
		if (L <= lo && hi <= R) {
			if (mset != inf) mset += x;
			else madd += x;
			val += x;
		}
		else {
			push(), l->add(L, R, x), r->add(L, R, x);
			val = max(l->val, r->val);
		}
	}
	void push() {
		if (!l) {
			int mid = lo + (hi - lo)/2;
			l = new Node(lo, mid); r = new Node(mid, hi);
		}
		if (mset != inf)
			l->set(lo,hi,mset), r->set(lo,hi,mset), mset = inf;
		else if (madd)
			l->add(lo,hi,madd), r->add(lo,hi,madd), madd = 0;
	}
};

int main() {
  // W is a tricky segtree (RMQ) problem
  // dp[i] = max value for prefix of 0 through i with ith
  // position on, and then the recurrence is:
  // and then dp[i] = max over all j<i of dp[j] + the total
  // reward of all intervals starting in [j+1, i] and ending in
  // [i, ...]

  cin.tie(0);
  cin.sync_with_stdio(0);
  int n, m; cin >> n >> m;
  priority_queue<pair<int, pair<long long, int> > > start, end;
  for(int i = 0; i<m; ++i) {
    int l, r; long long a;
    cin >> l >> r >> a;
    //l--; r--;
    start.push(make_pair(-l, make_pair(a, r)));
    end.push(make_pair(-r, make_pair(a, l)));
  }
  vector<long long> v(n+1, 0);
  Node rmq(v, 0, n+1);

  long long ret = 0;
  for(int i = 1; i<=n; ++i) {
    while(start.size() && start.top().first == -i) { // lots of dots
      // Entering an interval
      long long a = start.top().second.first;
      int l = -start.top().first;
      start.pop();
      rmq.add(0, l, a);
    }

    ret = max(ret, rmq.query(0, i));
    rmq.set(i, i+1, rmq.query(0, i));

    while(end.size() && end.top().first == -i) { // lots of dots
      // Exiting an interval
      long long a = end.top().second.first;
      int l = end.top().second.second;
      end.pop();
      rmq.add(0, l, -a);
    }
  }
  ret = max(ret, rmq.query(0, n));
  cout << ret << endl;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

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

void solve() {

}

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> vec(n);
  rep(i,n) cin >> vec[i];
  sort(ALL(vec));
  int sum = 0;
  rep(i,k) sum += vec[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int n = 0;
 
  for (int i = A; i <= B; i++){
    int a1, a2, a3, a4, a5;
    a1 = i / 10000;
    a2 = (i % 10000) / 1000;
    a3 = (i % 1000) / 100;
    a4 = (i % 100) / 10;
    a5 = i % 10;
    
    if (a1 == a5 && a2 == a4){
      n++;
    }
  }
  
  cout << n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
int f,p;
string s;
map<char,int>m;
int bns1();
int g_A(){
  int r=0;
  if(s[p]=='('){
    p++;
    r=bns1();
    p++;
  }
  else{
    while(isdigit(s[p])){
      r=r*10+(s[p]-'0');
      p++;
    }
  }
  return r;
}
int bns3(){
  int res=g_A();
  while(m[s[p]]==3){
    int t=p++;
    if(s[t]=='+')res+=g_A();
    if(s[t]=='-')res-=g_A();
    if(s[t]=='*')res*=g_A();
  }
  return res;
}
int bns2(){
  int res=bns3();
  while(m[s[p]]==2){
    int t=p++;
    if(s[t]=='+')res+=bns3();
    if(s[t]=='-')res-=bns3();
    if(s[t]=='*')res*=bns3();
  }
  return res;
}
int bns1(){
  int res=bns2();
  while(m[s[p]]==1){
    int t=p++;
    if(s[t]=='+')res+=bns2();
    if(s[t]=='-')res-=bns2();
    if(s[t]=='*')res*=bns2();
  }
  return res;
}
int dfs(){
  int res=LLONG_MIN;
  r(i,3)r(j,3)r(k,3){
    m['+']=i+1;
    m['-']=j+1;
    m['*']=k+1;
    p=0;
    res=max(res,bns1());
  }
  return res;
}
main(){
  cin>>s;s[(int)s.size()+1]='(';
  cout<<dfs()<<endl;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;
/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  /*int n, i;
  cin >> n;
  vector<int> D(n);
  rep(i, n) cin >> D[i];*/
  int a, b;
  cin >> a >> b;
  cout << max(a-2*b, 0) << endl; 
}

Measured memory_bytes: 256
//"BISMILLAHIR RAHMANIR RAHIM"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const long long M = 1e8 ;
int main()
{
        string s;
        cin>>s;
        ll ans=0;
        ll l= s.length();
        for(ll i=0;i<l;i++){
           int k= s[i]-'0';
           ans+=k;
        }
        if(ans%9==0)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;

    return 0;
}



Measured memory_bytes: 3684
import sys

N, K = map(int, input().split())
A = list(map(int, input().split()))
B = [0]*len(A)

i = 0
c = 0
while K > 0:
    if B[i] == 0:
        B[i] = c
        j = A[i] - 1
        i = j
        K -= 1
        c += 1
    else:
        x = c - B[i]
        K = K % x
        B = [0]*len(A)

print(j + 1)

Measured memory_bytes: 92288
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MOD = 1000000007;

int main(){
  int K,X;
  cin >> K >> X;
  for(int i=X-K+1;i<X+K;i++){
    cout << i << " ";
  }
}


Measured memory_bytes: 256
//#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
 
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
 
#define boost ios::sync_with_stdio(0); cin.tie(0)
 
#define fi first
#define se second
 
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
 
const int N = 1e6 + 5;
const int MOD1 = 1934559071;
const int MOD2 = 1544907697;
const int B = 257707;
 
/***************************************************************************/
 
ll power(ll a, ll n, ll m) {
	if(n == 0) return 1;
	ll p = power(a, n>>1, m);
	p = (p * p) % m;
	if(n & 1) p = (p * a) % m;
	return p;
}
 
string S;
pii powB[N];
 
inline pii& pow(int n) {
	if(n < 0) n += N;
	return powB[n];
}
 
map<ll, int> M;
 
int main() {
 
	boost;
	int N; cin>>N;
	cin>>S;
 
	pow(-B) = pii(power(power(B, B, MOD1), MOD1-2, MOD1), power(power(B, B, MOD2), MOD2-2, MOD2));
	for(int i=-B+1; i<=B; i++) {
		pow(i) = pii((B * 1LL * pow(i-1).fi) % MOD1, (B * 1LL * pow(i-1).se) % MOD2);
	}
 
	ll phas1, phas2, chas1, chas2;
	phas1 = phas2 = chas1 = chas2 = 0;
 
	int p = 0;
	for(auto it : S) {
		if(it == '+') phas1 += pow(p).fi, phas2 += pow(p).se;
		else if(it == '-') phas1 -= pow(p).fi, phas2 -= pow(p).se;
		else if(it == '>') p++;
		else p--;
	}
 
	phas1 %= MOD1; if(phas1 < 0) phas1 += MOD1;
	phas2 %= MOD2; if(phas2 < 0) phas2 += MOD2;
 
	ll ans = 0;
	M[(phas1 << 32) | phas2]++;
    p = 0;
 
	for(auto it : S) {
		if(it == '+') chas1 = (chas1 + pow(p).fi) % MOD1, chas2 = (chas2 + pow(p).se) % MOD2;
		else if(it == '-') chas1 = (chas1 - pow(p).fi + MOD1) % MOD1, chas2 = (chas2 - pow(p).se + MOD2) % MOD2;
		else if(it == '>') p++;
		else p--;
 
		ans += M[(chas1 << 32) | chas2];
		
		ll has1 = (chas1 + pow(p).fi * phas1) % MOD1;
		ll has2 = (chas2 + pow(p).se * phas2) % MOD2;
 
		M[(has1 << 32) | has2]++;
	}
 
	cout<<ans<<"\n";
 
	return 0;
}

Measured memory_bytes: 37524
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input=sys.stdin.readline
from random import randint
##import numpy as np
#sys.setrecursionlimit(10**7)
mo=10**9+7
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
def pref(a,n,f):             
    pre=[0]*n
    if(f==0):         ##from beginning
        pre[0]=a[0]
        for i in range(1,n):
            pre[i]=a[i]+pre[i-1]
    else:              ##from end
        pre[-1]=(a[-1])%mo
        for i in range(n-2,-1,-1):
            pre[i]=(pre[i+1]+a[i])%mo
    return pre
for _ in range(1):
    n=inin()
    a=ain()
    post=pref(a,n,1)+[0]
    
    s=0
    for i in range(n):
        s=(s+(a[i]*post[i+1])%mo)%mo
    print(s)
    
    
            
    
    
        
    

        
        
        
    
    
    

        
    

        
        
    
        
    
    
            
    
        
    
    
    

                    
                    
                    
                    
                    
        
    
    
    
    
            
        
    

            
            
            
            
        
        
                
                
    

    
    
    
    
    

                    
                
    

    

        


    
        

    
    
    
    
    
    
    
    
        
    
    
    
    
    
    
        
        
    
    
    
    


    




##def msb(n):n|=n>>1;n|=n>>2;n|=n>>4;n|=n>>8;n|=n>>16;n|=n>>32;n|=n>>64;return n-(n>>1) #2 ki power
##def pref(a,n,f):             
##    pre=[0]*n
##    if(f==0):         ##from beginning
##        pre[0]=a[0]
##        for i in range(1,n):
##            pre[i]=a[i]+pre[i-1]
##    else:              ##from end
##        pre[-1]=a[-1]
##        for i in range(n-2,-1,-1):
##            pre[i]=pre[i+1]+a[i]
##    return pre
##maxint=10**24 
##def kadane(a,size): 
##    max_so_far = -maxint - 1
##    max_ending_here = 0
##       
##    for i in range(0, size): 
##        max_ending_here = max_ending_here + a[i] 
##        if (max_so_far < max_ending_here): 
##            max_so_far = max_ending_here 
##  
##        if max_ending_here < 0: 
##            max_ending_here = 0   
##    return max_so_far
##def power(x, y):
##    if(y == 0):return 1
##    temp = power(x, int(y / 2))%mo
##    if (y % 2 == 0):return (temp * temp)%mo 
##    else:
##        if(y > 0):return (x * temp * temp)%mo 
##        else:return ((temp * temp)//x )%mo


Measured memory_bytes: 102836
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int n,k;
	int l[50];
	int ans=0;
	
	cin>>n>>k;
	for(int i=0;i<n;i++)
		cin>>l[i];
	
	sort(l,l+n);
	reverse(l,l+n);
	for(int i=0;i<k;i++)
		ans+=l[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<long long, long long>
#define ff first
#define ss second

main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N; int a[N];
    for(int i = 0; i < N; i++) cin >> a[i];
    int DP[N]; fill(DP, DP+N, INT_MAX);
    DP[0] = 0;
    for(int i = 0; i < N; i++){
        if(i + 1 < N) DP[i + 1] = min(DP[i + 1], DP[i] + abs(a[i] - a[i + 1]));
        if(i + 2 < N) DP[i + 2] = min(DP[i + 2], DP[i] + abs(a[i] - a[i + 2]));
    }
    cout << DP[N-1];
}

Measured memory_bytes: 4392
fun main() {
    // 文字列
//    var k = readLine()!!.toInt()
//    val x: String = readLine()!!
    // 数値
//    val int =readLine()!!.toInt()
    // 行
//    val list = readLine()!!.split(" ").map (String::toInt )
    var (a, b, c) = readLine()!!.split(" ").map(String::toInt)
    var k = readLine()!!.toInt()

//    val xys = List(n) {
////        readLine()!!.split(" ").map(String::toLong)
//        readLine()!!.toDouble()
//    }

    var flag=false
    for (i in 0 until k) {
        if (a >= b) {
            b = b * 2
        } else if (b >=c) {
            c = c * 2
        }
        if (a < b && b < c) {
            flag=true
            break
        }

    }
    if (flag) {
        print("Yes")
    } else {
        print("No")
    }
}

Measured memory_bytes: 36356
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int main (){
    int mx = -INF;
    int idx = 0;
    for(int i=0; i<3; i++){
        int r; cin >> r;
        if(r>mx){
            mx = r;
            idx = i;
        }
    }
    
    string S = "ABC";
    cout << S[idx] << endl;
    return 0;
}




Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  ll n;
  cin>>n;
  if(n==0){
    cout<<0<<endl;
    return;
  }
  string ans="";
  ll x=0;
  ll num=2;
  while(n!=0){
    // cout<<n<<endl;
    if(abs(n)%num!=0){
      if(x%2==0) n-= num/2;
      else n+= num/2;
      ans+="1";
    }
    else ans+="0";
    num*=2;
    x++;
  }
  reverse(all(ans));
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


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


int main(){
	int n, t, c, t_tmp;;
	int min = INT_MAX;
	scanf("%d %d\n", &n, &t);
	for(int i=0; i<n; i++){
		scanf("%d %d\n", &c, &t_tmp);
		if(t_tmp <= t && c < min) min = c;
	}
	if(min == INT_MAX) printf("TLE\n");
	else printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 128
def grade(m, f, r):
    if m == -1 or f == -1:
        return 'F'

    if 80 <= m+f:
        return 'A'

    if 65 <= m+f < 80:
        return 'B'

    if 50 <= m+f < 65:
        return 'C'

    if 30 <= m+f < 50:
        if 50 <= r:
            return 'C'
        else:
            return 'D'

    return 'F'

while True:
    m, f, r = map(int, input().split())

    if m == f == r == -1:
        break

    print(grade(m, f, r))


Measured memory_bytes: 5600
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE
void solve(void)
{
  int N,X;
  cin>>N>>X;
  vector<int> vec(N+1,0);

  for (int i = 1; i <= N; i++)
  {
    cin>>vec[i];
  }
  for (int i = 0; i < N; i++)
  {
    vec[i+1] += vec[i];
  }
  // DEBUG(vec);
  
  cout<<-1*distance(upper_bound(ALL(vec),X),vec.begin())<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector< set<int> >q(30);

int main(){
    int n,i,j,t,l,r,k,u,ans;
    string s;
    char c;
    cin>>n>>s;
    for(int i=0;i<26;i++) q[i]={n};
    for(int i=0;i<n;i++) q[s[i]-'a'].insert(i);
    cin>>t;
    while(t--){
        cin>>u;
        if(u==1){
            cin>>k>>c;k--;
            if(s[k]!=c) q[s[k]-'a'].erase(k);
            s[k]=c;
            q[c-'a'].insert(k);
        }
        else{
            ans=0;
            cin>>l>>r;l--;r--;
            for(int j=0;j<26;j++) if(*q[j].lower_bound(l)<=r) ans++;
            cout<<ans<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 24196
<?php
$N=+fgets(STDIN);
$a=explode(" ",fgets(STDIN));
$ans=1145141919;
$sum=0;
for($i=0;$i<$N;$i++)$sum+=$a[$i];
$now=0;
for($i=0;$i+1<$N;$i++)
{
  $now+=$a[$i];
  $tmp=$sum-$now*2;
  if($tmp<0)$tmp=-$tmp;
  if($ans>$tmp)$ans=$tmp;
}
echo $ans;


Measured memory_bytes: 4468
#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; }
//---------------------------------------------------------------------------------------------------
vector<int> makePrimes(int n) { // [2,n]
    vector<int> res, pr(n + 1, 1);
    pr[0] = pr[1] = 0;
    rep(p, 2, sqrt(n) + 2) if (pr[p]) for (int x = p * 2; x <= n; x += p) pr[x] = 0;
    rep(p, 2, n + 1) if (pr[p]) res.push_back(p);
    return res;
}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





int N;
ll ans[505][505];
//---------------------------------------------------------------------------------------------------
void _main() {
    auto vp = makePrimes(51010);
    cin >> N;

    if (N == 2) {
        printf("4 7\n23 10\n");
        return;
    }

    rep(y, 0, N) rep(x, 0, N) if ((x + y) % 2 == 0) {
        int u = (x + y) / 2;
        int v = (x - y) / 2 + N / 2 + 1;

        ans[y][x] = 1LL * vp[u] * vp[1010 - v];
    }

    rep(y, 0, N) rep(x, 0, N) if ((x + y) % 2 == 1) {
        ll c = 1;
        if (0 <= y - 1) c = lcm(c, ans[y - 1][x]);
        if (y + 1 < N) c = lcm(c, ans[y + 1][x]);
        if (0 <= x - 1) c = lcm(c, ans[y][x - 1]);
        if (x + 1 < N) c = lcm(c, ans[y][x + 1]);
        ans[y][x] = c + 1;
    }

    rep(y, 0, N) {
        rep(x, 0, N) {
            if (x) printf(" ");
            printf("%lld", ans[y][x]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 5176
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
  
using namespace std;

#define pi 3.141592653589793

int rotation(int x, int y, int i, int n)
{
	int cos_r[4] = {1, 0, -1, 0};
	int sin_r[4] = {0, 1, 0, -1};
	if(n == 0) return x * cos_r[i] - y * sin_r[i];
	else return x * sin_r[i] + y * cos_r[i];
}

bool issame(int temple_x[], int temple_y[], int comp_x[], int comp_y[], int m)
{
	int dx[2] = {1, -1};
	int dy[2] = {1, -1};
	int cnt = 0;
	int tmpvec_x[10], tmpvec_y[10], compvec_x[10], compvec_y[10];
	for(int i = 0; i < m - 1; i++){
		tmpvec_x[i] = temple_x[i + 1] - temple_x[i];
		tmpvec_y[i] = temple_y[i + 1] - temple_y[i];
		compvec_x[i] = comp_x[i + 1] - comp_x[i];
		compvec_y[i] = comp_y[i + 1] - comp_y[i];
	}
	for(int i = 0; i < 2; i++){
		cnt = 0;
		while(cnt < m - 1){
			if(tmpvec_x[cnt] * dx[i] == compvec_x[cnt] && tmpvec_y[cnt] * dy[i] == compvec_y[cnt]){
				cnt++;
			}
			else{
				break;
			}
		}
		if(cnt == m - 1) return true;
		cnt = 0;
		while(cnt < m - 1){
			if(tmpvec_x[m - 2 - cnt] * dx[i] == compvec_x[cnt] && tmpvec_y[m - 2 - cnt] * dy[i] == compvec_y[cnt]){
				cnt++;
			}
			else{
				break;
			}
		}
		if(cnt == m - 1) return true;
	}
	
	return false;
}

int main()
{
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int vertice_x[51][10], vertice_y[51][10];
		int m[51];
		for(int i = 0; i < n + 1; i++){
			cin >> m[i];
			for(int j = 0; j < m[i]; j++){
				cin >> vertice_x[i][j] >> vertice_y[i][j];
			}
		}
		int rotatedtmp_x[4][10], rotatedtmp_y[4][10];
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < m[0]; j++){
				rotatedtmp_x[i][j] = rotation(vertice_x[0][j], vertice_y[0][j], i, 0);
				rotatedtmp_y[i][j] = rotation(vertice_x[0][j], vertice_y[0][j], i, 1);
			}
		}
		for(int i = 1; i < n + 1; i++){
			for(int j = 0; j < 4; j++){
				if(m[i] != m[0]) break;
				if(issame(rotatedtmp_x[j], rotatedtmp_y[j], vertice_x[i], vertice_y[i], m[i])){
					cout << i << endl;
					break;
				}
			}
		}
		cout << "+++++" << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;

    int ans = 0;
    for(int i = 1; i < N; i++) {
        bool A[26] = {};
        for(int j = 0; j < i; j++) {
            A[(int)s[j] - (int)'a'] = true;
        }
        bool B[26] = {};
        for(int j = N - 1; j >= i; j--) {
            B[(int)s[j] - (int)'a'] = true;
        }
        int tmp = 0;
        for(int j = 0; j < 26; j++)
            if(B[j] && A[j]) tmp++;
        ans = max(ans, tmp);
    }
    cout << ans << "\n";
    return 0;
}

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

int main(){
    int N;
    char l[30];
    int n[30];

    long long ans = 1;

    //input
    cin >> N;

    char S[N + 1];
    cin >> S;

    for(int i = 0; i < 27; i++){
        l[i] = '0';
        n[i] = 0;
    }
    for(int i = 0; i < N; i++){
        int j = 0;
        while(l[j] != S[i]){
            if(l[j] == '0'){
                l[j] = S[i];
            }else{
                j++;
            }
        }
        n[j]++;
    }

    for(int i = 0; i < 27; i++){
        if(n[i] != 0){
            ans = ans * (n[i] + 1);
            if(ans > 1000000007){
                ans %= 1000000007;
            }
        }
    }
    ans--;
    ans %= 1000000007;

    cout << ans << endl;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"

using namespace std;

const int MOD = 1e9+7;

int dp[1<<17], nx[1<<17], sum[1<<17], nxtbits[10][1<<17], ng[10][1<<17];
deque<int> used[1<<17];

long power(long e, long x)
{
	if (x == 0) return 1;
	long res = (x & 1 ? e : 1);
	long tmp = power(e, x>>1);
	return (res *= tmp * tmp % MOD) %= MOD;
}

void solve()
{
	int N, X, Y, Z, S = 0;
	cin >> N >> X >> Y >> Z;
	S = X + Y + Z;
	long ans = power(10, N);
	dp[0] = 1;

	for (int bit = 0; bit < 1<<S; bit++)
	{
		int subbit = bit;
		while (__builtin_popcount(subbit))
		{
			int b = subbit & (-subbit);
			//cout << subbit << ' ' << b << endl;
			int x = log2(b) + 1;
			sum[bit] += x;
			used[bit].push_front(x);
			subbit >>= x;
		}
		for (int a = 1; a <= 10; a++)
		{
			deque<int> used2 = used[bit], used3 = used[bit];
			int as[] = {Z-a, Y, X}, sum2 = sum[bit];
			for (int c = 0; c < 3; c++)
			{
				while (as[c] > 0 && !used2.empty())
				{
					as[c] -= used2.back();
					used2.pop_back();
				}
				if (as[c] != 0) break;
				if (c == 2) ng[a-1][bit] = 1;
			}
			if (ng[a-1][bit]) continue;

			while (sum2 + a >= S)
			{
				int x = used3.front();
				used3.pop_front();
				sum2 -= x;
			}
			used3.push_back(a);
			int nxtbit = 0;
			for (int x : used3)
			{
				nxtbit <<= 1;
				nxtbit |= 1;
				nxtbit <<= x - 1;
			}
			nxtbits[a-1][bit] = nxtbit;
		}
	}

	for (int i = 0; i < N; i++)
	{
		memset(nx, 0, sizeof(nx));
		for (int bit = 0; bit < 1<<S; bit++)
		{
			if (!dp[bit]) continue;
			for (int a = 1; a <= 10; a++)
			{
				if (ng[a-1][bit]) continue;
				nx[nxtbits[a-1][bit]] += dp[bit];
				nx[nxtbits[a-1][bit]] %= MOD;
				//cout << bitset<17>(bit) << ' ' << bitset<17>(nxtbits[a-1][bit]) << ' ' << a << ' ' << nx[nxtbits[a-1][bit]] << endl;
			}
		}
		swap(dp, nx);
	}
	for (int bit = 0; bit < 1<<S; bit++)
	{
		ans += MOD - dp[bit];
		ans %= MOD;
	}
	cout << ans << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 167680
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;



int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);
string n;
cin >> n;
for(int i=0; i<n.length()-1; i++){
	if(n[i]==n[i+1]){
		cout << "Bad";
		return 0;
	}
}
cout << "Good";
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(void)
{
  int N;
  scanf("%d",&N);
  int v[N];
  int c[N];
  int cost=0;
  for(int i=0;i<N;i++){
    scanf("%d",&v[i]);
  }
  for(int i=0;i<N;i++){
    scanf("%d",&c[i]);
  }
  for(int i=0;i<N;i++){
    if(v[i]-c[i]>0){
      cost+=v[i]-c[i];
    }
  }
  printf("%d\n",cost);

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N;
  cin>>N;
  
  vector<int64_t> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  sort(A.begin(),A.end());
  
  int64_t ans=1;
  
  for(int i=0;i<N;i++){
    if(A[i]==0){
      ans=0;
      break;
    }
    else{
      if(A[i]>1000000000000000000/ans){
        ans=-1;
      }
      else{
        ans*=A[i];
      }
    }
  }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 4016
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    n, m = nm()
    h = nl()
    ab = []

    for _ in range(m):
        temp = nl()
        ab.append(temp)

    ans = [True] * n

    for a, b in ab:
        if h[a-1] <= h[b-1]:
            ans[a-1] = False
        if h[a-1] >= h[b-1]:
            ans[b-1] = False

    print(ans.count(True))
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 33368
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int n,a[N];
map<int,int>v;
int main() {
  ios::sync_with_stdio(false);
  cin>>n;
  for(int i=1;i<=n;i++)cin>>a[i];
  //a[i] + a[x] = i-x
  //a[i]-i=-a[x]-x
  LL ans=0;
  for(int i=1;i<=n;i++){
    ans+=v[a[i]-i];
    v[-a[i]-i]++;
  }
  cout<<ans<<'\n';
  return 0;
}

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

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

    int n;
    cin >> n;
    int h[n];
    rep(i, n) cin >> h[i];
    
    int big = 0;
    int ans = 0;
    
    rep(i, n){
        if(big <= h[i]){
            ans++;
            big = h[i];
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  string a;
  int b;
  cin>>a>>b;
  for(int i=0;i<a.size();i+=b)
    cout<<a[i];
  cout<<' '<<endl;
}


Measured memory_bytes: 256
/*
 * Problem Description: Disjoint Set: Union Find Tree
 * Category: Set
 * Author: Khan
 * Date: 21th October, 2017
 */

#include <iostream>
#include <vector>

using namespace std;

class DisjointSet
{
public:
    vector<int> rank, p;

    DisjointSet() {}
    
    DisjointSet(int size)
    {
        rank.resize(size, 0);
        p.resize(size, 0);
        for (int i = 0; i < size; ++i)
            makeSet(i);
    }

    void makeSet(int x)
    {
        p[x] = x;
        rank[x] = 0;
    }

    bool same(int x, int y)
    {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y)
    {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y)
    {
        if(rank[x] > rank[y])
            p[y] = x;
        else
        {
            p[x] = y;
            if(rank[x] == rank[y])
                rank[y]++;
        }
    }

    int findSet(int x)
    {
        if(x != p[x])
            p[x] = findSet(p[x]);
        return p[x];
    }
};

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    int n, a, b, q;
    int t;

    cin >> n >> q;
    DisjointSet ds = DisjointSet(n);

    for (int i = 0; i < q; ++i)
    {
        cin >> t >> a >> b;
        if(t == 0)
            ds.unite(a, b);
        else if(t == 1)
        {
            if(ds.same(a, b))
                cout << 1 << endl;
            else
                cout << 0 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3200
n,k=map(int,input().split())
l=[0]*(10**5+1)
for _ in range(n):
  a,b=map(int,input().split())
  l[a]+=b
for i in range(10**5+1):
  k-=l[i]
  if k<=0:
    print(i)
    break

Measured memory_bytes: 5736
/*
            _ _  ___            __ _ _  _       _     
 _   _  ___| | |/ _ \__      __/ _| | || |  ___| |__  
| | | |/ _ \ | | | | \ \ /\ / / |_| | || |_/ __| '_ \ 
| |_| |  __/ | | |_| |\ V  V /|  _| |__   _\__ \ | | |
 \__, |\___|_|_|\___/  \_/\_/ |_| |_|  |_| |___/_| |_|
 |___/                 

*/

#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define debug(x) cout<<#x<<": "<<x<<endl
#define For(i, st, en) for(ll i=st; i<en; i++)
#define rfor(i, st, en) for(ll i=st; i>=en; i--)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define printv(x) For(i, 0, x.size()){cout<<x[i]<<" ";} cout<<endl;
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define ll long long
#define int long long
#define F first
#define S second
#define pb push_back
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector< vector<int> > vvi;
typedef vector< pair<int, int> > vpi;
#define MAXN 300005
#define MOD 1000000007
#define INF 1000000000000000007


signed main(){
	fast
	string s;
	cin>>s;
	int i=1;
	int ans =1;
	int n = s.size();
	string last = s.substr(0, 1);
	while(i<n){
		if(last.size()==2){
			ans++;
			last = s.substr(i, 1);
		}else{
			if(last[0]==s[i]){
				if(i<n-1){
					ans++;
					last = s.substr(i, 2);
					i++;
				}
			}else{
				last = s.substr(i, 1);
				ans++;
			}
		}
		i++;
	}
	cout<<ans<<endl;
    return 0;
}
    



Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main(){
    int n; cin >> n;
    long long ans=1;
    for (int i=1; i<=n; i++){
        ans=ans*i%MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 764
fun main(){
    val (a,b, c, k) = readLine()!!.split(" ").map { it.toLong() }
    var ans:Long = 0
    if (k <= a + b){
        if (k <= a){
            ans = k
        } else {
            ans = a
        }
    } else {
        val x = k - a - b
        ans = a - x
    }
    println(ans)
}

Measured memory_bytes: 36416
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  double sum = 0.0;
  for (int i = 0; i < n; ++i) {
    sum += (1.0 / (1.0 * a[i]));
  }
  printf("%.10f\n", 1.0 / sum);
  return 0;
}

Measured memory_bytes: 3740
S=input()
l=len(S)
pow2=[1]
pow3=[1]
mod=10**9+7

for i in range(l+10):
    pow2.append(pow2[-1]*2%mod)
    pow3.append(pow3[-1]*3%mod)
    
if l==1:
    if S=="0":
        print(1)
    else:
        print(3)

else:
    ans=pow3[l-1]
    cnt=1 #現在の桁とその左側の1の数
    for i in range(l-1):
        if i==l-2:
            if S[i+1]=="1":
                ans+=pow2[cnt]*3%mod
            else:
                ans+=pow2[cnt]%mod
        else:
            if S[i+1]=="1":
                ans+=pow2[cnt]*pow3[l-i-2]%mod
                cnt+=1                                                  
    print(ans%mod)

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

int main() {
int N;
cin >> N;
string S;
cin >> S;
long long ans = 0;
long long a, b, c;
a = 0;
b = 0;
c = 0;
    for (auto d : S) {
        if (d == 'R') ++a;
        else if (d == 'G') ++b;
        else ++c;
    }
ans = a*b*c;
long long hoge = 0;
for(int i = 0; i < N; ++i){
for(int j = i+1; j < N; ++j){
    if(S[i] == S[j]) continue;

    long long k = j*2-i;
    if(S[k] == S[i] || S[k] == S[j] || k >= N) continue;
    hoge++;
}

}


cout << ans-hoge << endl;
}


Measured memory_bytes: 3624
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>

using namespace std;

const int MAX_N = 1e5;
int a, b, q;
long s[MAX_N], t[MAX_N], x[MAX_N];

int main() {
    scanf("%d %d %d", &a, &b, &q);
    for (int i = 0; i < a; i++) scanf("%ld", &s[i]);
    for (int i = 0; i < b; i++) scanf("%ld", &t[i]);
    for (int i = 0; i < q; i++) scanf("%ld", &x[i]);

    sort(s, s + a);
    sort(t, t + b);

    for (int i = 0; i < q; i++) {
        int mas = min(lower_bound(s, s + a, x[i]) - s, static_cast<long>(a - 1));
        int mat = min(lower_bound(t, t + b, x[i]) - t, static_cast<long>(b - 1));
        int mis = max(mas - 1, 0);
        int mit = max(mat - 1, 0);
        long ans = abs(x[i] - s[mis]) + min(abs(s[mis] - t[mit]), abs(t[mat] - s[mis]));
        ans = min(ans, abs(x[i] - t[mit]) + min(abs(s[mis] - t[mit]), abs(s[mas] - t[mit])));
        ans = min(ans, abs(s[mas] - x[i]) + min(abs(s[mas] - t[mat]), abs(s[mas] - t[mit])));
        ans = min(ans, abs(t[mat] - x[i]) + min(abs(s[mas] - t[mat]), abs(t[mat] - s[mis])));
        printf("%ld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define    all(x)           x.begin(), x.end()
#define    unq(v)           sort(all(v)),v.erase(unique(all(v)),v.end())
#define fr(i,n) for(i=0;i<n;i++)
#define ll long long
#define pb push_back
#define in insert
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
vector<int> vi;
vector<ll> vll;
const ll mod = 1000000007;
const double pi = acos(-1.0);
int pos[2000003];
#include<bits/stdc++.h>
using namespace std;
int main()
{
    _ios
    ll x,n,i,j,t;
    ll a,b,d,c;
    cin>>x;
    a=(x*(x+1))/2;
    cout<<a-x<<endl;
    return 0;
}


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

int main() {
   int N;
   cin >> N;
   vector<ll> A(N);

   ll ans = 1;

   for(int i=0;i<N; i++) {
      cin >> A[i];
      if(A[i] == 0) {
         cout << 0 << endl;
         return 0;
      }
   }

   for(int i=0; i<N; i++) {
      //掛けた桁数が18桁を超える場合は-1を出力
      if(log10(ans) + log10(A[i]) > 18) {
         cout << -1 << endl;
         return 0;
      }
      ans *= A[i];
      if(ans > 1000000000000000000) {
         cout << -1 << endl;
         return 0;
      }
   }
   cout << ans << endl;
}

Measured memory_bytes: 4152
/**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ii pair<int, int>
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
#define set_vect(a,n); vector<int>a(n); for(int i=0;i<n;i++)cin>>a[i];
#define db(x) cerr << #x << " = "  << (x) << ' ';
const int N = 200005;

int n,x,t;
void solve(){
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    
    int t = 1; //cin >> t;
    while(t--){solve();}
    return 0;
}

// Code By Pain (Bao Trung)

Measured memory_bytes: 3620
N = int(input())
s = []
for i in range(N):
    s.append(input())
M = int(input())
t = []
ans = 0
for i in range(M):
    t.append(input())
for i in range(N):
    target = s[i]
    ans = max(ans,s.count(target)-t.count(target))
print(ans)

Measured memory_bytes: 9108
#include <algorithm>
#include <iostream>
#include <tuple>
#include <vector>

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

    std::vector<std::tuple<std::string, int, int>> restaurants(n);

    for (int i = 0; i < n; i++) {
        std::string name;
        std::cin >> name;

        int point;
        std::cin >> point;

        restaurants[i] = make_tuple(name, point, i + 1);
    }

    std::sort(restaurants.begin(), restaurants.end(),
        [](std::tuple<std::string, int, int> a, std::tuple<std::string, int, int> b) -> int {
            if (std::get<0>(a) != std::get<0>(b)) {
                return std::get<0>(a) < std::get<0>(b);
            }
            return std::get<1>(a) > std::get<1>(b);
        });

    for (int i = 0; i < n; i++) {
        std::cout << std::get<2>(restaurants[i]) << std::endl;
    }
}


Measured memory_bytes: 256