akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
const int maxn=1e5+10;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
int a[maxn],fa[maxn];
vector<int> ve[maxn],vc[maxn];
inline int find(int x){
	if(fa[x]==x) return x;
	return fa[x]=find(fa[x]);
}
void merge(int x,int y){fa[find(x)]=find(y);}
int main(){
	int n=read(),m=read();
	REP(i,1,n) a[i]=read(),fa[i]=i;
	while(m--){
		int x=read(),y=read();
		merge(x,y);
	}
	int ans=0;
	REP(i,1,n) ve[find(i)].push_back(i),vc[find(i)].push_back(a[i]);
	REP(i,1,n) if(fa[i]==i){
		sort(vc[i].begin(),vc[i].end());
		REP(j,0,ve[i].size()-1){
			int u=lower_bound(vc[i].begin(),vc[i].end(),ve[i][j])-vc[i].begin();
			if(u!=iend+1 && vc[i][u]==ve[i][j]) ++ans;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

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

   int a=s.size();

   if (s.at(a-1)=='s')
   {
 cout << s <<
 "es"<< endl;
   }else
   {
 cout << s<<"s" << endl;
   }



}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    while(cin >> n, n){
        vector<pair<int, string>> v(n);
        for (int i = 0; i < n; ++i) {
            string s;
            cin >> s;
            int val = n-i;
            for (int j = 0; j < n-1; ++j) {
                int x;
                cin >> x;
                if(x == 0) val += 100000;
                if(x == 1) val -= 100;
            }
            v[i] = {val, s};
        }
        sort(v.begin(),v.end(), greater<>());
        for (int i = 0; i < n; ++i) {
            cout << v[i].second << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 3140
import java.util.Scanner;
public class Main{
	int o,h,s,e;
	double q,w,a;
	String  i,l,k;
	Scanner scan=new Scanner(System.in);
	public void output() {
h=scan.nextInt();
o=h%10;
if(o==2||o==4||o==5||o==7||o==9) {
	System.out.println("hon");
}else if(o==0||o==1||o==6||o==8) {
	System.out.println("pon");
}else {
	System.out.println("bon");
}
	}
	public static void main(String[] args) {
		Main p=new Main();
		p.output();
	}
}

Measured memory_bytes: 35812
from collections import defaultdict,deque
import math
def gcd(a,b):
    return b if not a%b else gcd(b,a%b)
def lcm(a,b):
    return (a*b)//gcd(a,b)

def main():
    a,b,c=map(int, input().split())
    k = int(input())

    cnt = 0
    while(cnt<k):
        if(c<=b):
            c*=2
            cnt+=1
        elif(b<=a):
            b*=2
            cnt+=1
        else:
            cnt+=1

    if(c>b and b>a):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


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

using namespace std;

#define REP(i, N) for (int (i) = 0; (i) < (N); ++(i))
#define READALL(c) for (auto &e : c) { cin >> e; }
#define PRINTALL(c) for (const auto &e : c) { cout << e << "\t"; } cout << "\n";

template <typename T>
using V = vector<T>;

typedef long double ld;

int N;
string S;


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

	cin >> S;
	N = S.size();

	if (N%2 == 0) {
		int bs = 0;
		for (char c : S) bs ^= (1<<(c-'a'));
		if (!bs) {
			cout << 1 << endl;
			return 0;
		}
	}

	V<int> DP(1<<26, 1e9);
	DP[0] = 0;

	int bs = 0, res;

	REP(i, N) {
		bs ^= (1<<(S[i]-'a'));
		int ans = 1e9;
		REP(c, 26) ans = min(ans, DP[bs^(1<<c)]);
		// cout << i << " " << bs << " " << ans+1 << endl;
		DP[bs] = min(DP[bs], ans+1);
		res = ans+1;
	}

	cout << res << endl;
	
}

Measured memory_bytes: 262804
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}


int main() {
  int n,m;
  cin >> n >> m;
  vl k(m);
  vvl s(m,vl(10));
  vl p(m);
  rep(i,m){
    cin >> k[i];
    rep(j,k[i])cin >> s[i][j];
  }
  rep(i,m)cin >> p[i];
  
  int answer=0;
  int pow2=1;
  rep(i,n)pow2*=2;
  rep(ii,pow2){
    bitset<10> ans(ii);
    bool can=true;
    rep(i,m){
      //iの電球調査
      int cnt=0;
      rep(j,k[i]){
        if(ans.test(s[i][j]-1))cnt++;
      }
      if(cnt%2!=p[i]){
        can=false;break;
      }
    }
    if(can)answer++;
  }
  cout << answer << endl;
}

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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int N;
    cin >> N;

    if (N % 2 == 0) {
        print(N);
    } else {
        print(2*N);
    }
}

signed main() {
    solve();
}


Measured memory_bytes: 256
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    private static int n = scanner.nextInt();
    public static void main(String[] args) {
        System.out.println(dfs(""));
    }

    public static int dfs(String s) {
        return !s.isEmpty() && Long.parseLong(s) > n ? 0 : (s.contains("3") && s.contains("5") && s.contains("7") ? 1 : 0) + dfs(s + "3") + dfs(s + "5") + dfs(s + "7");
    }
}

Measured memory_bytes: 34516
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  int i;
  long N,min,max;
  char str[2000],*p;
  
  fgets(str,sizeof(str),stdin);
  N=atol(str);
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  min=atoi(p);
  max=min;
  
  for(i=1;i<N;i++){
    p=strtok(NULL," \n");
    if(atol(p)<min){
      min=atol(p);
    }
    if(atol(p)>max){
      max=atol(p);
    }
  }
  
  printf("%d",max-min);
  
  return 0;
  
}

Measured memory_bytes: 128
import numpy as np

def main():
    N,K = map(int, input().split())
    A = list(map(int, input().split()))
    A = np.array(A)
    A.sort()
    zero = np.count_nonzero(A==0)
    positive = A[A>0]
    negative = A[A<0]
    def count(x): # 積がx以下になるペアの個数を返す
        ans = 0
        if x >= 0:
            ans += N*zero
        ans += np.searchsorted(A, x//positive, side="right").sum()
        ans += N*len(negative) - np.searchsorted(A, -(-x//negative), side="left").sum()
        ans -= np.count_nonzero(A*A <= x) # 同じものはふたつ選べない
        return ans//2
    ok = 10**18
    ng = -ok-1
    while ok-ng>1:
        cur = (ok+ng)//2
        if count(cur)>=K:
            ok = cur
        else:
            ng = cur
    print(int(ok))


    
if __name__ == "__main__":
    main()

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

using namespace std;

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

	vector < pair < pair < string, int >, int >>sp(N);
	for (int i = 0; i < N; i++) {
		string s;
		int p;
		cin >> s >> p;
		sp[i] = make_pair(make_pair(s, -p), i);
	}
	sort(sp.begin(), sp.end());
	for (int i = 0; i < N; i++) {
		cout << sp[i].second + 1 << endl;
	}

	return 0;
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;  typedef pair<int,ll> pii;
typedef vector<int> VI; typedef vector<ll> VL;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI rk(10);
	rep(i, n){
		int a; cin >>a;
		rk[min(a / 400, 8)]++;
	}
	int sm = 0;
	rep(i, 8) if(rk[i] >0) sm++;
	VI as(2);
	if(sm >0) as[0] = sm;
	else if(sm==0 && rk[8]>0) as[0]=1;
	as[1] = sm + rk[8];
	cout <<as[0] <<" "<< as[1] <<endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto A = readln.chomp.to!(char[]);
    long N = A.length;
    long[char] CNT;
    foreach (a; A) {
        if (a !in CNT) CNT[a] = 0;
        ++CNT[a];
    }

    long r = N * (N-1) / 2 + 1;
    foreach (_, c; CNT) {
        r -= (c * (c-1) / 2);
    }
    writeln(r);
}

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

int main() {
  string S, T;
  cin >> S >> T;

  sort(S.begin(), S.end());
  sort(T.begin(), T.end(), greater<char>());

  if (S.size() < T.size() && S == T.substr(0, S.size())) {
    cout << "Yes" << endl;
    return 0;
  }

  for (int i = 0; i < T.size(); i++) {
    if (S[i] < T[i]) {
      cout << "Yes" << endl;
      return 0;
    } else if (S[i] > T[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (T[T.size() - 1] <= S[T.size() -1]) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N = getN()
edges = [[] for i in range(N)]
for i in range(N - 1):
    u, v, d = getNM()
    edges[u - 1].append([v - 1, d])
    edges[v - 1].append([u - 1, d])

def dij(start):
    dist = [float('inf') for i in range(N)]
    dist[start] = 0
    pq = [(0, start)]

    while len(pq) > 0:
        d, now = heapq.heappop(pq)
        if (d > dist[now]):
            continue
        for i in edges[now]:
            if dist[i[0]] > dist[now] + i[1]:
                dist[i[0]] = dist[now] + i[1]
                heapq.heappush(pq, (dist[i[0]], i[0]))
    return dist

ans = [0] * N
dij_list = dij(0)
for i in range(N):
    if dij_list[i] % 2 == 0:
        ans[i] = 0
    else:
        ans[i] = 1
for i in ans:
    print(i)

Measured memory_bytes: 114716
# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end
N, a_list = gets_n_and_i_list

a_list.sort!
total = 0
loop do
  if a_list.length == 1
    total = a_list[0]
    break
  end
  a_list = a_list.each_slice(2).map { |a, b| b ? a * b : a }
end

puts total > 10**18 ? -1 : total


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

#define MAXN (int)(2 * 1e5 + 1)
#define F first
#define S second
#define endl "\n"
#define MOD (lli)(1e9 + 7)
#define lli long long int
#define sz(a) int(a.size())
#define DEBUG if (0) cout << "aqui" << endl;
#define PI 2 * acos(0.0)
typedef pair<int, int> ii;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int dddx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dddy[] = {0, 0, 1, -1, 1, -1, 1, -1};

lli n, a, b, r;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  cin >> n >> b >> r;

  lli qt = 0;
  lli ans = 0;

  if((n%(b+r)) == 0) {
    qt = (n)/(b+r); 
    ans += (qt*b);
  } else {
    lli resto = (n%(b+r));
    qt = n/(b+r);
    ans += (b*qt);
    ans += (min(resto, b));
  }

  cout << ans << endl;


  return 0;
}

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

int main(){
  int n;
  cin >> n;
  int a[n];
  long long sum=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum += a[i];
  }
  long long sunuke=0;
  long long arai=sum;
  long long candidate;
  long long ans = 9223372036854775807;
  for(int i=0;i<n-1;i++){
    sunuke+=a[i];
    arai-=a[i];
    candidate = abs(sunuke - arai);
    ans = min(ans,candidate);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;cin >> n;
int dp[n];
for(int i =0; i < n; i++){
       cin >> dp[i];
}
long long sum = 0;
for(int i = 0; i < n-1; i++){
       for(int j = i+1; j < n; j++){
              sum += dp[i]*dp[j];
       }
}

cout  << sum;
return 0;

}









  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std ;
template< class T > inl T read() {
	T x = 0 ; int f = 1 ; char k = getchar() ;
	for( ; k > '9' || k < '0'; k = getchar() ) if( k == '-' ) f = -1 ;
	for( ; k >= '0' && k <= '9'; k = getchar() ) x = x * 10 + k - '0' ;
	return x * f ;
}
template< class T > inl T read( T &x ) { return x = read<T>() ; }
int _num, _buf[20];
template< class T > il print( T x ) {
   	if( x == 0 ) return putchar( '0' ) ,void() ;
	if( x < 0 ) putchar( '-' ), x = -x ;
	while( x ) _buf[++_num] = x % 10, x /= 10 ;
	while( _num ) putchar( _buf[_num--] + '0' ) ;
}
ll mul( ll a, ll b, ll mod ) { long double c = 1. ; return ( a * b - (ll)( c * a * b / mod ) * mod ) % mod ; }
it qpow( int x, int m, int mod ) {
	int res = 1, bas = x ;
	while(m) {
		if( m & 1 ) res = ( 1ll * res * bas ) % mod ;
		bas = ( 1ll * bas * bas ) % mod, m >>= 1 ;
	}
	return res ;
}
const int N = 2e5 + 5 ;
int n, val[N];
ll ans;
vector<int> G[N];
struct Seg_Tree {
	int tag;
	ll sum;
}T[N << 2];
#define lc ( cur << 1 )
#define rc ( cur << 1 | 1 )
il pushup( int cur ) {
	T[cur].sum = T[lc].sum + T[rc].sum ;
}
il maintain( int cur, int l, int r, int k ) {
	T[cur].tag += k ;
	T[cur].sum += 1ll * k * ( r - l + 1 ) ;
}
il pushdown( int cur, int l, int r ) {
	if( !T[cur].tag )
		return ;
	maintain( lc, l, mid, T[cur].tag ) ;
	maintain( rc, mid + 1, r, T[cur].tag ) ;
	T[cur].tag = 0 ;
}
il Build( int cur, int l, int r ) {
	if( l == r ) {
		T[cur].sum = val[l] ;
		return ;
	}
	Build( lc, l, mid ), Build( rc, mid + 1, r ) ;
	pushup( cur ) ;
}
il Updata( int cur, int l, int r, int L, int R, int k ) {
	if( l >= L && r <= R ) {
		maintain( cur, l, r, k ) ;
		return ;
	}
	pushdown( cur, l, r ) ;
	if( mid >= L )
		Updata( lc, l, mid, L, R, k ) ;
	if( R > mid )
		Updata( rc, mid + 1, r, L, R, k ) ;
	pushup( cur ) ;
}
int main() {
//	freopen( ".in", "r", stdin ) ;
//	freopen( ".out", "w", stdout ) ;
	n = read<int>() ;
	for( ri i = 1; i <= n; ++i )
		val[i] = 1 ;
	for( ri i = 1; i < n; ++i ) {
		int u = read<int>(), v = read<int>() ;
		if( u > v )
			swap( u, v ) ;
		G[u].push_back( v ) ;
		val[v] -= 1 ;
	}
	for( ri i = 1; i <= n; ++i )
		val[i] += val[i - 1] ;
	Build( 1, 1, n ) ;
	ans += T[1].sum ;
	for( ri i = 1; i < n; ++i ) {
		Updata( 1, 1, n, i, n, -1 ) ;
		for( auto x: G[i] )
			Updata( 1, 1, n, x, n, 1 ) ;
		ans += T[1].sum ;
	}
	print( ans ), puts( "" ) ;
	cerr << 1. * clock() / CLOCKS_PER_SEC << "\n" ;
	return 0;
}

Measured memory_bytes: 23656
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll A;
  string B;
  cin >> A >> B;
  ll num_b = 0;
  int cnt = 0;
  for (ll i = 0; i < B.size(); ++i) {
    if (B[i] == '.') {
      continue;
    }
    num_b += (B[i] - '0') * pow(10, 2 - cnt);
    cnt += 1;
  }
  ll ans = A * num_b;
  ans /= 100;
  cout << ans << "\n";
}


Measured memory_bytes: 3756
def main():
    n, k = map(int, input().split())
    lst = list(map(int, input().split()))
    ma = [l-1 for l in lst]
    
    visited = [False for _ in range(n)]
    history = []
    now = 0
    while True:
        if visited[now]:
            history.append(now)
            break
        
        visited[now] = True
        history.append(now)
        
        now = ma[now]
    if k <= len(history)-1:
        print(history[k] + 1)
        return
    
    last = history[-1]
    for i in range(n):
        if history[i] == last:
            roopstart = i
            break
    syokilst = history[:roopstart]
    rooplst = history[roopstart:-1]
    syokilen = len(syokilst)
    rooplen = len(rooplst)
    resi = k - syokilen
    mod = resi%(rooplen)
    print(rooplst[mod] + 1)
main()

Measured memory_bytes: 32380
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

ll myPow(ll x, ll n){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x, n / 2);
  else
    return x * myPow(x, n - 1);
}

int main(void)
{
    string s;
    cin >> s;
    ll k;
    cin >> k;

    ll cur = 0;
    REP(i, s.size()){
        if(s[i]=='1'){
            cur += 1;
        }else{
            pr(s[i]-'0');
            return 0;
        }
        
        if(k <= cur){
            pr(s[i]-'0');
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200009
#define pb push_back
using namespace std;
typedef long long ll;
void slv()
{
    int m;
    cin>>m;
    if(m>=30) puts("Yes");
    else
    {
         puts("No");
    }
    
}
int main()
{
    int t;
    t=1;
    for(int cs=1;cs<=t;cs++)
    {
        //printf("Case #%d: ",cs);
        slv();
    }
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		int a, b, c, n, i;
		
		Scanner scan = new Scanner(System.in);
		
		a = scan.nextInt();
		b = scan.nextInt();
		c = scan.nextInt();
		
		n = 0;
		for(i = a; i <= b; i++) {
			if(c % i == 0) n++;
		}
		
		System.out.println(n);
		
	}

}


Measured memory_bytes: 26272
//author: Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    ll k=0,x=0;
    cin>>k>>x;
    for(ll i=x-k+1;i<=x+k-1;++i)
        cout<<i<<" ";
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int n, m, in;
	cin >> n;
	map<int, int> mpp;
	rep(i, n) {
		cin >> in;
		if (mpp.find(in) != mpp.end())mpp[in]++;
		else mpp[in] = 1;
	}
	bool sw = true;
	cin >> m;
	rep(i, m) {
		cin >> in;
		if (mpp.find(in) != mpp.end()) {
			mpp[in]--;
			if (mpp[in] == -1)sw = false;
		}
		else {
			mpp[in] = 1;
			sw = false;
		}
	}
	cout << (sw ? "YES" : "NO") << endl;

}

Measured memory_bytes: 9600
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	k := getNextInt(scanner)
	if n > k {
		fmt.Fprintln(writer, 0)
		return
	}
	fmt.Fprintln(writer, 1)
}



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

int K, S;

int main() {
    cin >> K >> S;

    int ans = 0;
    for (int x = 0; x <= K; x++) {
        for (int y = 0; y <= K; y++) {
            int z = S-x-y;
            if (0 <= z && z <= K) ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

def parorder(Edge, p):
    N = len(Edge)
    dist = [None]*N
    dist[p] = 0
    par = [0]*N
    par[p] = -1
    stack = [p]
    order = []
    visited = set([p])
    ast = stack.append
    apo = order.append
    while stack:
        vn = stack.pop()
        apo(vn)
        for vf in Edge[vn]:
            if vf in visited:
                continue
            visited.add(vf)
            par[vf] = vn
            dist[vf] = 1+dist[vn]
            ast(vf)
    return par, order, dist

def getcld(p):
    res = [[] for _ in range(len(p))]
    for i, v in enumerate(p[1:], 1):
        res[v].append(i)
    return res


N = int(readline())
S = list(map(int, readline().strip()))
Edge = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, readline().split())
    a -= 1
    b -= 1
    Edge[a].append(b)
    Edge[b].append(a)

INF = 10**9+7
ans = INF
for root in range(N):
    P, L, dist = parorder(Edge, root)
    K = sum(dist[i] for i in range(N) if S[i])
    if K&1:
        continue
    if ans <= K//2:
        continue
    size = S[:]
    cr = []
    for l in L[:0:-1]:
        p = P[l]
        size[p] += size[l]
    
    dp = [0]*N
    for l in L[:0:-1]:
        p = P[l]
        dp[p] += size[l] + dp[l]
        if p == root:
            cr.append((size[l] + dp[l], l))
    
    if cr:
        cm = -1
        cs = 0
        midx = None
        for sz, idx in cr:
            if cm < sz:
                cm = sz
                midx = idx
            cs += sz
        if 2*cm > cs:
            candi = [[] for _ in range(N)]
            cnt = None
            for l in L[:0:-1]:
                p = P[l]
                res = 0
                if candi[l]:
                    cis = sum(candi[l])
                    cim = max(candi[l])
                    if 2*cim > cis:
                        res = 2*cim-cis
                    else:
                        res = 1&cis
                if l == midx:
                    cnt = res + size[l]
                    break
                candi[p].append(res+size[l])
            
            if cs-cm < cnt:
                continue
    ans = K//2
    
if ans == INF:
    ans = -1
print(ans)

Measured memory_bytes: 126008
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  int[string] blue;
  foreach (_; 0..n) {
    blue[readln.chomp]++;
  }
  auto m = readln.chomp.to!int;
  int[string] red;
  foreach (_; 0..m) {
    red[readln.chomp]++;
  }

  int res;
  foreach (k; blue.keys) {
    res = max(blue[k] - red.get(k, 0), res);
  }

  writeln(max(res, 0));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int mod=1e9+7;
const int N=1e3+5;
int grid[N][N];
int what[N][N];
int add(int a,int b)
{
    a+=b;
    if(a>=mod)
        a-=mod;
    return a;
}
int main()
{
    int n,m;
    scanf("%i %i",&n,&m);
    for(int i=0;i<n;i++)
    {
        string s;
        cin >> s;
        for(int j=0;j<m;j++)
        {
            if(s[j]=='.')
                what[i][j]=0;
            else
                what[i][j]=1;
        }
    }
    for(int i=n-1;i>=0;i--)
    {
        for(int j=m-1;j>=0;j--)
        {
            if(i==n-1&&j==m-1)
            {
                grid[i][j]=1;
                continue;
            }
            if(what[i][j]==0)
            {
                grid[i][j]=add(grid[i+1][j],grid[i][j+1]);
            }
        }
    }
    printf("%i\n",grid[0][0]);
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int n; cin>>n;
    vector<int> a(n);
    rep(i,0,n) cin>>a[i];
    bool f=true;
    rep(i,0,n){
        if(a[i]%2==0){
            if(a[i]%3!=0&&a[i]%5!=0) f=false;
        }
    }
    if(f) cout <<"APPROVED"<<endl;
    else cout <<"DENIED"<<endl;
}

Measured memory_bytes: 256
class Facts

  def initialize(mod=10**9+7, n_max=1)
    @mod = mod
    @n_max = n_max
    @fact = [1, 1]
    @inv = [0,1]
    @factinv = [1, 1]
    setup_table(n_max) if 1 < @n_max
  end

  def cmb(n,r)
    return 0 if r < 0 || n < r
    setup_table(n) if @n_max < n
    @fact[n] * (@factinv[r] * @factinv[n-r] % @mod) % @mod
  end

  def factorial(n)
    setup_table(n) if @n_max < n
    @fact[n]
  end

  def prm(n,k)
    setup_table(n) if @n_max < n
    @fact[n] * @factinv[n-k] % @mod
  end
  
  def hom(n,k)
    cmb(n+k-1, k)
  end

  private
    # O(t)
    def setup_table(t)
      (@n_max+1).upto(t) do |i|
        @fact.push( @fact[-1] * i % @mod )
        @inv.push( -@inv[@mod % i] * (@mod / i) % @mod )
        @factinv.push( @factinv[-1] * @inv[-1] % @mod )
      end
      @n_max = t
    end
end

mod = 10 ** 9 + 7

n, k = gets.to_s.split.map{|t|t.to_i}

ans = 0
f = Facts.new

0.upto([n-1, k].min) do |i|
  ans += f.cmb(n, i) * f.hom(n-i, i)
  ans %= mod if ans >= mod
end

puts ans

Measured memory_bytes: 6632
/*
	Author: Ritik Patel
*/
 
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
// #define _GLIBCXX_DEBUG       // Iterator safety; out-of-bounds access for Containers, etc.
// #pragma GCC optimize "trapv" // abort() on (signed) integer overflow.
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LIBRARIES &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#include <bits/stdc++.h>
using namespace std;
 
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; 
*/
//find_by_order()->returns an iterator to the k-th largest element(0-based indexing)
//order_of_key()->Number of items that are strictly smaller than our item
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEFINES &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#define int long long int
// #define ll long long int
#define all(i) i.begin(), i.end()
#define sz(a) (int)a.size()
 
// #define ld long double
// const ld PI  = 3.141592;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEBUG &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#define XOX
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}
 
void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
 
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& CODE &&&&&&&&&&&&&&&&&&&&&&&&&&&


void solve(){
    string S; cin >> S; int ans = 0;
    for(int i = 0; i < sz(S); ++i){
        int len = 0;
        for(int j = i; j < sz(S) and S[j] == 'R'; ++j){
            ++len;
        }
        ans = max(ans, len);
    }
   cout << ans << '\n';
}

int32_t main(){
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout); 
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int T = 1; 
    // cin >> T;
    for(int i = 1; i <= T; ++i){
        // cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}
 
/*
Sample inp
*/

Measured memory_bytes: 3592
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/



//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}

/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);

	return x * y / tmp;
}


int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);


	int k,x;
    cin >> k >> x;
    if(k*500 >= x){
        cout << "Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }

	

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    long long int N,M;
    scanf("%lld %lld",&N,&M);
    if(N==1 || M==1){
        if(M-2>=0){
            printf("%lld\n",M-2);
        }else if(N-2>=0){
            printf("%lld\n",N-2);
        }else{
            printf("1\n");
        }
    }else{
        printf("%lld\n",N*M-(M*2+N*2-4));
    }
    return 0;
    
}

Measured memory_bytes: 128
#include <vector>
#include <iostream>

using namespace std;

int main(void) {
	long long n, k, q; cin >> n >> k >> q;
	vector<int> X(n), A(q);
	for (int i = 0; i < n; i++) {
		X[i] = 0;
	}

	for (int i = 0; i < q; i++) {
		cin >> A[i];
		A[i]--;
		X[A[i]]++;
	}

	for (int i = 0; i < n; i++) {
		if (k - q + X[i] > 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>

int main()
{
	int n,m,i,a,b;
	scanf("%d %d",&n,&m);

	int num[50] ={};

	for (i=0; i<m; i++) {
		scanf("%d %d",&a, &b);
		num[a-1] += 1;
		num[b-1] += 1;
	}

	for (i=0; i<n; i++) {
		printf("%d\n",num[i]);
	}

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int k,n;
int a[5005],dp[5005];
int f(int x)
{
	int i,j;
	memset(dp,0,sizeof(dp));
	for(i=1;i<=n;i++)
	{
		if(i==x) continue;
			for(j=k-1;j>=a[i];j--)
	{
		dp[j] = max(dp[j],dp[j-a[i]]+a[i]);
	}
	}
	return k-dp[k-1];
}
int main()
{
	int i,j;
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a+1,a+1+n);
	int l=1,r=n,mid;
	while(l<=r)
	{
		mid=(r+l)/2;
		if(f(mid)>a[mid]) l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",r);
	return 0;
 } 

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        long x = long.Parse(input[0]);
        long k = long.Parse(input[1]);
        long d = long.Parse(input[2]);

        long total = 0;

        long tmp = Math.Abs(x) / d;
        if (tmp < k && (k - tmp) % 2 == 0)
        {
            total = Math.Abs(x) - (d * tmp);
        }
        else if (tmp < k)
        {
            total = Math.Abs(x) - (d * tmp);
            if (Math.Abs(total + d) < Math.Abs(total - d))
            {
                total += d;
            }
            else
            {
                total -= d;
            }
        }
        else
        {
            total = Math.Abs(x) - (d * k);
        }

        total = Math.Abs(total);

        Console.WriteLine(total);
    }
}

Measured memory_bytes: 27532
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int a,b,c;
int ans;
string s;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> a;
    int r = 1000;
    while(r < a){
        r += 1000;
    }
    cout << r - a << "\n";
    return 0;
}
 

Measured memory_bytes: 3688
import sys

yomikomi_kaisuu = int(input())
no_hantei = 0

for i in range(yomikomi_kaisuu):
#    print(str(i))
    input_list = input().split()
    jikoku = int(input_list[0])
    x_ = int(input_list[1])
    y_ = int(input_list[2])
    if jikoku < x_ + y_:
        no_hantei = no_hantei + 1
#        print("a")
    elif jikoku %2 == 0 and (x_ + y_) % 2 == 1:
        no_hantei = no_hantei + 1
#        print("b")
    elif jikoku %2 == 1 and (x_ + y_) % 2 == 0:
        no_hantei = no_hantei + 1
#        print("c")

if no_hantei == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n;
    ll a[112345];
    ll m;

    int sum[212345];
    memset(sum, 0, sizeof(sum));

    cin >> n >> m;
    REP(i, n)
    {
        cin >> a[i];
        sum[a[i]] += 1;
    }

    sort(a, a + n);

    ll ssum[112345];

    ssum[0] = 0;
    REP(i, n)
    ssum[i + 1] = ssum[i] + a[n - i - 1];

    for (int i = 100010; i >= 0; i--)
        sum[i] += sum[i + 1];

    ll res = 0;

    ll rc = 0;

    int l = 0;
    int r = 200001;

    while (r - l > 1)
    {
        int mid = (r + l) / 2;

        ll cnt = 0;

        ll rr = 0;

        REP(i, n)
        {
            int y = max(0LL, mid - a[i]);

            cnt += sum[y];
            rr += a[i] * sum[y] + ssum[sum[y]];
        }

        if (cnt <= m)
        {
            r = mid;
            res = rr;
            rc = cnt;
        }
        else
        {
            l = mid;
        }
    }

    res += (m - rc) * l;

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 2816
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	s := next()
	ans := 999
	for i := 0; i < len(s)-2; i++ {
		n, _ := strconv.Atoi(s[i : i+3])
		d := abs(n - 753)
		ans = min(ans, d)
	}
	puts(ans)
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}


Measured memory_bytes: 640
module Main where

import           Debug.Trace
import qualified Data.Vector.Unboxed           as VU
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe


getVUIntFromInputLineAtBSC8 :: IO (VU.Vector Int)
getVUIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
getListIntFromInputLineAtBSC8 =
    unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
readInt = fst . fromJust . BSC8.readInt
readIntList = map readInt . BSC8.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main :: IO ()
main = do
    s <- getLine
    --[aM,aN] <- getListIntFromInputLineAtBSC8
    --aP                   <- getVUIntFromInputLineAtBSC8
    --aQ                   <- getVUIntFromInputLineAtBSC8
    --aR                   <- getVUIntFromInputLineAtBSC8

    --vP <- VU.fromList . take aX . reverse . sort <$> getIntList
    --vQ <- VU.fromList . take aY . reverse . sort <$> getIntList
    --vR <- VU.fromList . take (aX + aY) . reverse . sort <$> getIntList
    putStrLn $ if isStrongPalindrome s then "Yes" else "No"


isStrongPalindrome :: [Char] -> Bool
isStrongPalindrome s =
    (isPalindrome (take lFront s)) && (isPalindrome (drop (lBack-1) s)) && isPalindrome s
  where
    isEven = even ((length s) - 1)
    lFront = div (length s - 1) 2 
    -- + if isEven then 0 else 1
    lBack  = div (length s + 3) 2 
    -- + if isEven then 0 else 1

isPalindrome :: [Char] -> Bool
isPalindrome = reverse >>= (==)



Measured memory_bytes: 508
#include <stdio.h>
#define MAX 100001
#define min(a, b) ((a) < (b) ? (a) : (b))

typedef struct process {
    char name[10];
    int time;
} P;


P Q[MAX];
int head, tail;
int finish;


int isEmpty() {
    return head == tail;
}

int isFull() {
    return head == (tail + 1) % MAX;
}

void enqueue(P proc) {
    Q[tail++] = proc;
    tail = tail % MAX;
}

P dequeue() {
    P x;
    x= Q[head++];
    head = head % MAX;
    return x;
}

int main() {

    int n, q, t;

    scanf("%d %d", &n, &q);
    head = 0;
    tail = n;
    finish = 0;
    for (int i = 0; i < n; i++) {
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].time);
    }
    while (!isEmpty()) {
        P x;
        x = dequeue();
        t = min(x.time, q);
        finish += t;
        x.time -= q;
        if (x.time > 0) enqueue(x);
        else printf("%s %d\n", x.name, finish);
    }



    return 0;
}


Measured memory_bytes: 3416
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 N, X;
  std::cin >> N >> X;
  std::vector<i64> L;
  tools::read(L, N);

  i64 D_i = 0;
  i64 answer = 1;
  for (const i64& L_i : L) {
    D_i += L_i;
    if (D_i <= X) ++answer;
  }

  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 256
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
from collections import deque
con = 10 ** 9 + 7; INF = float("inf")

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

class Graph(object):
	def __init__(self):
		self.graph = defaultdict(list)

	def __len__(self):
		return len(self.graph)

	def add_edge(self, a, b):
		self.graph[a].append(b)

def DFS(G, W, Wlist, visit, node):
	for i in G.graph[node]:
		if visit[i] == 0:
			visit[i] = 1
			DFS(G, W, Wlist, visit, i)
			W[node] += W[i]
			Wlist.append(W[i])

class BFS(object):
	def __init__(self, graph, s, N):
		self.g = graph.graph
		self.Q = deque(); self.Q.append(s)
		self.dist = [INF] * N; self.dist[s] = 0
		self.prev = [None] * N; self.prev[s] = -1
		self.order = []
		while self.Q:
			v = self.Q.popleft()
			self.order.append(v)
			for i in self.g[v]:
				if self.dist[i] == INF:
					self.dist[i] = self.dist[v] + 1
					self.prev[i] = v
					self.Q.append(i)


#処理内容
def main():
	#入力
	N = int(input())
	G = Graph()
	Nedge = [0] * N
	for i in range(N - 1):
		a, b = getlist()
		a -= 1; b -= 1
		G.add_edge(a, b)
		G.add_edge(b, a)
		Nedge[a] += 1; Nedge[b] += 1

	W = [1] * N
	#葉の場合の処理
	# for i in range(N):
	# 	if Nedge[i] == 1:
	# 		W[i] = 1

	BF = BFS(G, 0, N)

	for i in range(N - 1, 0, -1):
		v = BF.order[i]
		W[BF.prev[v]] += W[v]

	Wlist = []
	for i in range(N):
		for j in G.graph[i]:
			if j != BF.prev[i]:
				Wlist.append(W[j])
	for i in range(N):
		Wlist.append(N - W[i])

	pow2 = pow(2, N - 1, con)
	ans_up = N * (pow2 - 1)
	for i in Wlist:
		ans_up -= pow(2, i, con) - 1
		ans_up %= con

	ans = ans_up * pow(pow2 * 2, con - 2, con)
	print(ans % con)

if __name__ == '__main__':
	main()

Measured memory_bytes: 122556
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;


int main()
{
	char b;
	cin >> b;
	switch (b) {
	case 'A':
		cout << 'T' << endl;
		break;
	case 'T':
		cout << 'A' << endl;
		break;
	case 'C':
		cout << 'G' << endl;
		break;
	case 'G':
		cout << 'C' << endl;
		break;
	}

	return 0;
}

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

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

    int count = 0;

    for (int i = 0; i < n - 2; i++) {
        if ('A' == s.at(i)) {
            if ('B' == s.at(i + 1)) {
                if ('C' == s.at(i + 2)) {
                    count++;
                }
            }
        }
    }
    
    cout << count << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            decimal iX = decimal.Parse(sS[0]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            decimal iYear = 0M;
            decimal iN = 100M;
            while (true)
            {
                iN += Math.Truncate(iN / 100M);
                iYear += 1;
                if (iN >= iX) { break; }
            }

            // 出力
            System.Console.WriteLine("{0}", iYear.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 27624
import numpy as np

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

s = list(map(int,input().split()))

s.append(x)

s.sort()

l = set([])

for i in range(len(s)-1):
    l.add(s[i+1]-s[i])
    
l = list(l)
    
print(np.gcd.reduce(l))

Measured memory_bytes: 38096