akhauriyash/Code-Regression huggingface dataset:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

ret = []

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n) + ',' +str(X%n)
    return str(X%n)

def main():
    N = I()

    l = 0
    c = 1
    cur = N
    last = cur
    while True:
        cur -= 26 ** c
        c += 1
        if cur < 0:
            break
        last = cur

    if last == 0:
        l = c - 2
        # print('last=0', l, last)
        d = Base_10_to_n(last, 25).split(',')
        # print(d)

        print(l * 'z')
    else:
        l = c - 1
        ans = []

        last -= 1

        if last == 0:
            print(l * 'a')
            return

        while last > 0:
            # print('last', last)
            r = last % 26
            last //= 26
            # print('last', last)
            # print('r', l_alp[r])
            ans.append(l_alp[r])

        while len(ans) < l:
            ans.append('a')
        ans = ans[::-1]
        temp = ''
        for a in ans:
            temp += a
        print(temp)
    # print(d)

    # for i in range(1, 27):
    #     N = i
    #     while N > 0:
    #         r = N % 26
    #         N = N // 26

            # print('N', N, 'r', r, l_alp[r])

    # for N in range(1, 27):
    #     d = Base_10_to_n(N, 26).split(',')
    #     ans = ''

    #     print(N, d)

    #     for i in d:
    #         ans += l_alp[int(i)]

    #     print(ans)


if __name__ == '__main__':
    main()


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

int gcd(int n,int m){
  if(m==0) return n;
  else return gcd(m,n%m);
}

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  int x[n],y[n];
  x[0]=a[0],y[n-1]=a[n-1];
  for(int i=1;i<n;i++){
    x[i]=gcd(x[i-1],a[i]);
  }
  for(int i=n-2;i>=0;i--){
    y[i]=gcd(y[i+1],a[i]);
  }
  int ans=0;
  ans=max({ans,x[n-2],y[1]});
  for(int i=1;i<n-1;i++){
    ans=max(ans,gcd(x[i-1],y[i+1]));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
macro_rules! scan {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
}

fn luca(n: usize, memo: &mut [i64]) -> i64 {
    if memo[n] > 0 {
        return memo[n];
    }

    if n == 0 {
        memo[0] = 2
    } else if n == 1 {
        memo[1] = 1
    } else {
        memo[n - 2] = luca(n - 2, memo);
        memo[n - 1] = luca(n - 1, memo);
        memo[n] = memo[n - 2] + memo[n - 1]
    }
    memo[n]
}

fn main() {
    let n = scan!(usize);
    let mut memo = [0; 87];
    println!("{}", luca(n, &mut memo))
}


Measured memory_bytes: 4352
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2, sqrt
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush

def is_prime(n):
    for i in range(2, int(sqrt(n))+1):
        if n % i == 0:
            return False

    return True


def solve():
    X = II()

    while 1:
        if is_prime(X):
            print(X)
            return

        X += 1



if __name__ == '__main__':
    solve()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m,v,p;
int a[100005],b[100005],sum[100005];
map<int,int> tr[100005];
void upt(int x,int v,int c){
	while(x<=n) tr[x][v]+=c,x+=(x&-x);
}
int query(int x,int v){
	int res=0;
	while(x) res+=tr[x][v],x-=(x&-x);
	return res;
}
//m judges
//v problems
//first p problems
signed main(){
	cin>>n>>m>>v>>p;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	sort(a+1,a+n+1,greater<int>());
	int ans=0,tot=0;
	for(int i=1;i<=n;++i)
		if(a[i]!=a[i-1]) b[i]=++tot;
		else b[i]=tot;
	v-=(p-1);
	for(int i=1;i<=n;++i) sum[i]=sum[i-1]+a[i];
	//for(int i=1;i<=n;++i)cout<<a[i]<<" ";cout<<endl;
	for(int i=1;i<=n;++i){
		if(a[i]>=a[p]) ++ans;
		else{
			if(a[i]+m<a[p]) continue;
			int tmp1=max(v-(n-i+1),0ll)*m,tmp2=(i-p)*(a[i]+m)-(sum[i-1]-sum[p-1]);
			//cout<<i<<" "<<ans<<" "<<tmp1<<" "<<tmp2<<endl;
			if(tmp1<=tmp2) ++ans;
		}
	}
	cout<<ans;
	return 0;
} 


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
    }
    else if (a > b) {
        cout << "a > b" << endl;
    }
    else {
        cout << "a == b" << endl;
    }
    return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
  long long int N,M,ans,add;
  cin >> N >> M;
  for(;;){
    if(N > 0 && M >= 2){
      if(2*N >= M)
	add = M/2;
      else
	add = N;
      ans += add;
      N -= add;
      M -= add*2;
    }else if(N == 0 && M >= 4){
      add = M/4;
      M -= 2*add;
      N += add;
    }else{
      break;
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
    int n, m;
    while(cin>>n>>m){
        ll ans=0;
        if(n%2==0){
	        for(int i=0; i<m-m/2; ++i){
	        	printf("%d %d\n",i+1, n-i);
	        }
	        for(int i=0; i<m/2; ++i){
	        	printf("%d %d\n",n/2-i-1, n/2+i+1);
			}
        }
        else{
        	for(int i=0; i<m; ++i){
        		printf("%d %d\n",i+1, n-i);
        	}
        }
    }
  return 0;
}




Measured memory_bytes: 3760
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}
pii exgcd(int a,int b){
    if(a%b==0) return pii(0,1);
    pii p=exgcd(b,a%b);
    return pii(p.S,p.F-a/b*p.S);
}
int modinv(int n,int mod,bool prime){
    //if(prime) return fpow(n,mod-2);
    int x=exgcd(n,mod).F;
    return (x+mod)%mod;
}
int fac(int n){
	int ans=1;
	For(i,1,n) ans=(ans*i)%MOD;
	return ans;
}

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int x,y; cin>>x>>y;
	int a=(x*2-y)/3;
	int b=(y*2-x)/3;
	if((x+y)%3 || a<0 || b<0){
		cout<<0<<"\n";
		return 0;
	}
	cout<<((fac(a+b)*modinv(fac(a),MOD,true)%MOD)*modinv(fac(b),MOD,true)%MOD)<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
typedef long long llong;

llong n,*lst;
string *lst_bin;
static const llong MOD = pow(10,9) + 7;

void init(){
    cin>>n;
    lst = new llong[n];
    lst_bin = new string[n];
    for(int i=0;i<n;i++)cin>>lst[i];
}

string to_binString(llong val)
{
    if( !val )
        return string("0");
    string str;
    while( val != 0 ) {
        if( (val & 1) == 0 )  // val は偶数か？
            str.insert(str.begin(), '0');  //  偶数の場合
        else
            str.insert(str.begin(), '1');  //  奇数の場合
        val = val >> 1;
    }
    return str;
}
void solve(){
    llong max_length=0;
    for(int i=0;i<n;i++){
        lst_bin[i] = to_binString(lst[i]);
        max_length = max(max_length,(llong)lst_bin[i].size());
        //size_t型をintへ変換するにはこうする.
    }
    llong cnt_1[max_length] = {}, cnt_0[max_length] = {};
    for(int i=0;i<n;i++){
        string::iterator it = lst_bin[i].end();
        for(int j=1;j<max_length+1;j++){
            if((llong)lst_bin[i].size() < j){
                cnt_0[j-1] += 1;
            }else{
                if(*(it-j) == '1'){
                    cnt_1[j-1] += 1;
                }else{
                    cnt_0[j-1] += 1;
                }
            }
        }
    }
    llong ans=0;
    llong x = 1;
    for(int i=0;i<max_length;i++){
        llong cnt_0_i = cnt_0[i];
        llong cnt_1_i = cnt_1[i];
        ans += (((cnt_0_i * cnt_1_i) % MOD )* x) % MOD ;
        ans %= MOD;
        x = (x * 2) % MOD;
    }
    cout<<ans<<endl;
}

int main(){
    init();
    solve();
    return 0;
}

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

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

    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N+1);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int Q;
    cin >> Q;
    vector<int> v(Q), d(Q), c(Q), ans(N+1, 0);
    for (int i = 0; i < Q; i++) cin >> v[i] >> d[i] >> c[i];
    vector<vector<bool>> used(N+1, vector<bool>(11, false));
    for (int i = Q - 1; i >= 0; i--) {
        if (used[v[i]][d[i]]) continue;
        queue<pair<int, int>> que;
        que.push({v[i], d[i]});
        while (!que.empty()) {
            auto p = que.front();
            que.pop();
            int u = p.first, dist = p.second;
            if (!ans[u]) ans[u] = c[i];
            for (int k = 0; k <= dist; k++) used[u][k] = true;
            if (!dist) continue;
            for (int w : G[u]) {
                if (used[w][dist - 1]) continue;
                que.push({w, dist - 1});
            }
        }
    }
    for (int i = 1; i <= N; i++) cout << ans[i] << '\n';
}

Measured memory_bytes: 18556
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;

namespace mp = boost::multiprecision;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  int N;
  int A, B;
  vector<int> P;
  cin >> N;
  cin >> A >> B;
  int K[3]; memset(K,0,sizeof(K));
  REP(n,N) {
    int p; cin >> p; P.emplace_back(p);
    if(p<=A) {
      K[0]++;
    } else if(p<=B) {
      K[1]++;
    } else {
      K[2]++;
    }
  }

  cout << min(K[0], min(K[1], K[2])) << endl;

  return 0;
}

Measured memory_bytes: 256
//#define anjn
//      Anjan Agarwala - anjn98

//#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, 
                  tree_order_statistics_node_update> ordered_set;

//ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

#define PR(x) cout<<#x<<": "<<x<<"\n";
#define PR1(x,y) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"\n";
#define PR2(x,y,z) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"  |  "<<#z<<": "<<z<<"\n";
#define ED cout<<'\n';

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define endl            '\n'
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define PB              push_back
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007


const int N=3e3+99;
int n,m;
int a[N],b[N];
ll dp[N][N];


int32_t main() 
{
    IO
 

    memset(dp,0,sizeof(dp));

    cin>>n>>m;
    fr(n) cin>>a[i+1];
    fr(m) cin>>b[i+1];
        




    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        {
                
                if(a[i]==b[j])
                    dp[i][j]=(1LL+dp[i-1][j]+dp[i][j-1])%mod;
                else
                    dp[i][j] = (dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1]+mod+mod)%mod;
        }

    cout<<(dp[n][m]+1)%mod<<endl;



}




 
    

Measured memory_bytes: 75264
#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
int a[N], f[N], n;
long long s[N], ss[N];
int main() {
	scanf("%d", &n); scanf("%d", &a[1]); ss[1] = s[1] = a[1];
	for(int i = 2; i <= n; ++i) {
		char k; scanf("%c", &k);
		while (k != '+' && k != '-') scanf("%c", &k);
		f[i] = k == '-' ? -1 : 1;
		scanf("%d", &a[i]);
		s[i] = s[i - 1] + a[i] * f[i];
		ss[i] = ss[i - 1] + a[i];
	}
	int lst = -1; long long ans = LLONG_MIN;
	for(int i = n; i >= 1; --i) if(f[i] == -1) {
		ans = max (ans, s[i] - (s[n] - s[i]));
		if (lst > 0)
			ans = max (ans, s[i] - (s[lst] - s[i]) + ss[n] - ss[lst]);
		lst = i;
	}
	printf ("%lld\n", max (ans, s[n]));
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A,B;
    string s;

    cin>>A>>B;
    cin>>s;

    bool flag=1;

    for(int i=0;i<A;i++){
        if(!(s[i]>='0'&&s[i]<='9')){
            flag=0;
            break;
        }    
    }
    if(s[A]!='-')flag=0;

    for(int i=A+1;i<=A+B;i++){
        if(!(s[i]>='0'&&s[i]<='9')){
            flag=0;
            break;
        }    
    }

    cout<<(flag?"Yes":"No")<<"\n";
    
    return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);

    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);

    long a[] = new long[100004];
    s = r.readLine();
    sl = s.split(" ");

    boolean f = false;
    long m = Long.MAX_VALUE;
    long ss = 0;
    for (int i = 0; i < n; i++)
    {
      if(Long.parseLong(sl[i]) < 0)
      {
        f = !f;
      }
      a[i] = Math.abs(Long.parseLong(sl[i]));
      ss += a[i];
      m = Math.min(m, a[i]);
    }

    System.out.println(ss - (f ? 2 * m : 0));

  }

  public static int gcd(int m, int n)
  {
    if (m < n)
      return gcd(n, m);
    if (n == 0)
      return m;
    return gcd(n, m % n);
  }

}

Measured memory_bytes: 50636
import math

N = int(input())
A_list = [int(i) for i in input().split()]

ans = 1
is_zero = False
is_over = False
for i in A_list:
    if i == 0:
        is_zero = True
        break
    if ans > 10**18:
        is_over = True

    if is_over:
        pass
    else:
        ans *= i

if is_zero:
    print(0)
elif is_over or ans > 10**18:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 22656
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>

#define ll long long
#define Int ll
#define loop(__x, __start, __end) for(Int __x = __start; __x < __end; __x++)
#define loopdown(__x, __start, __end) for(Int __x = __start; __x > __end; __x--)
#define rep(__n) for(Int __x = 0; __x < __n; __x++)
#define span(__a,__x,__y) __a.begin()+__x,__a.begin()+__y
#define span_all(__a) __a.begin(),__a.end()
#define len(__x) (__x.size())
#define last(__x) (__x[__x.size()-1])

using namespace std;

struct Point {
  Int x, y;
  Point(Int x, Int y): x(x), y(y) {}
  Point(): x(0), y(0) {}

  bool operator< (const Point &p1) const {
    return x < p1.x && y < p1.y;
  }
};
ostream & operator << (ostream & out, Point const & v) {
  out << "Point(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Point & v) {
  Int x, y;
  in >> x; in >> y; v.x = x; v.y = y;
  return in;
}

// Geometry

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N, Q;
vector<vector<Int> > G(200001);
vector<Int> A(200001, 0);

void input() {
  cin >> N >> Q;
  Int a, b, p, x;
  rep(N-1) {
    cin >> a >> b;
    a--;b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  rep(Q) {
    cin >> p >> x;
    p--;
    A.at(p) += x;
  }
}

void dfs(Int n = 0, Int parent = -1) {
  for (auto &u: G.at(n)) {
    if (u == parent) continue;
    A.at(u) += A.at(n);
    dfs(u, n);
  }
}

void solve() {
  dfs();

  for (Int n=0; n<N; n++) {
    if (n!=0) cout << " ";
    cout << A.at(n);
  }
  cout << endl;
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 24320
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;

fn main() {
    let mut prime_table = vec![true; 55556];
    let mut prime = vec![];
    let mut ans = vec![];
    let k: usize;
    input!(k);
    prime_table[0] = false;
    prime_table[1] = false;
    for z in 2..55556 {
        if prime_table[z] {
            prime.push(z);
            let mut i = z * 2;
            while i <= 55555 {
                prime_table[i] = false;
                i += z;
            }
        }
    }
    for z in prime {
        if z % 5 == 1 {
            ans.push(z);
        }
    }

    for z in ans.iter().take(k) {
        print!("{} ", z);
    }
    println!("");
}

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scaner sc = new Scaner();
        write wr = new write();

        string s=sc.Str;
        int pnum=0;
        int gnum=0;
        int winnum=0;
        int losenum=0;
        for(int i=0;i<s.Length;++i){
            if(pnum==gnum){
                gnum++;
                if(s[i]=='p'){
                    losenum++;
                }
            }
            else {
                pnum++;
                if(s[i]=='g'){
                    winnum++;
                }
            }
        }
        wr.wri(winnum-losenum);

    }


    static int factmod(int X){
        int ret=1;
        for(int i=1;i<=X;++i){
            ret*=i;
            ret%=MOD;
        }
        return ret;
    }
}





class Scaner
{
    public string Str => Console.ReadLine();

    public string[] StrArr => Str.Split(' ');

    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public char[] CharArr => Str.ToArray();
    public long Long1 => LongArr[0];
    public int Int1 => IntArr[0];
    
}



class write
{
    public  void wri<T>(T x)
    {
        Console.WriteLine(x);
    }
}



Measured memory_bytes: 11232
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using vec_i = std::vector<int>;
using vec_ll = std::vector<ll>;
using vec_ld = std::vector<ld>;

#define in(i) int i; cin >> i
#define in_ll(i) ll i; cin >> i
#define in_ld(i) ll i; cin >> i
#define in_c(c) char c; cin >> c
#define in_str(s) std::string s; cin >> s

#define vec_in(v, n)    auto v=vec_i(n); for(auto &x:v){cin>>x;}
#define vec_in_ll(v, n) auto v=vec_ll(n);for(auto &x:v){cin>>x;}
#define vec_in_ld(v, n) auto v=vec_ld(n);for(auto &x:v){cin>>x;}

#define print(x)   cout << x
#define println(x) cout << x << "\n"

#define rep(i, n) for (auto i = 0; i < n; ++i)

using namespace std;
int main () {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    in(N);
    in(K);
    vec_in(P, N);
    sort(P.begin(), P.end());
    int cnt = 0;
    rep(i, K) cnt += P[i];
    println(cnt);
    return 0;
}


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

using matrix = vector<vector<int>>;

void matmul_assign(matrix& A, const matrix& B, int mod) {
    int N = int(A.size());
    matrix C(N, vector<int>(N));
    rep(k, N) rep(i, N) rep(j, N) {
        if ((C[i][j] += A[i][k] * B[k][j] % mod) >= mod) C[i][j] -= mod;
    }
    A.swap(C);
}

void matpow_assign(matrix& A, int e, int mod) {
    int N = int(A.size());
    matrix B(N, vector<int>(N));
    rep(i, N) B[i][i] = 1;
    for (; e > 0; e >>= 1, matmul_assign(A, A, mod)) if (e & 1) matmul_assign(B, A, mod);
    A.swap(B);
}

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

    for (int N, M, A, B, C, T;
         cin >> N >> M >> A >> B >> C >> T, N | M | A | B | C | T;) {
        vector<int> S(N);
        for (int& e : S) cin >> e;
        matrix R(N, vector<int>(N));
        rep(i, N) {
            if (i > 0) R[i][i - 1] = A;
            R[i][i] = B;
            if (i < N - 1) R[i][i + 1] = C;
        }
        matpow_assign(R, T, M);
        rep(i, N) {
            if (i) cout << ' ';
            int s = 0;
            rep(j, N) if ((s += R[i][j] * S[j] % M) >= M) s -= M;
            cout << s;
        }
        cout << endl;
    }
}

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

const int INF = (int)1.01e9;

int main() {
#ifdef HOME
    freopen("in", "r", stdin);
#endif

    string ss;
    while (cin >> ss) {
        string Z = "AKIHABARA";
        function<bool(string)> rec = [&](string s) {
            if (s == Z) return true;
            if (s.length() >= Z.length()) return false;
            for (int i = 0; i <= s.length(); i++) {
                if (rec(s.substr(0, i) + "A" + s.substr(i))) return true;
            }
            return false;
        };
        puts(rec(ss) ? "YES" : "NO");
    }


#ifdef HOME
    cerr << clock() / (double)CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

Measured memory_bytes: 764
#include <stdio.h>
#include <string.h>

#define M 1046527/* your task*/
#define NIL (-1)
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
	else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return 1+(key%(M-1)); }

int find(char str[]){
    /* your task */
	long long key,i,h;
	key =getKey(str);
	for(i=0;;i++){
		h=(h1(key)+i*h2(key))%M;
		if(strcmp(H[h],str)==0){
			return 1;
		}else if(strlen(H[h])==0){
			return 0;
		}
	}
	return 0;
}

int insert(char str[]){
    /* your task */
	long long key ,i,h;
	key = getKey(str);
	for (int i=0;;i++){
		h=(h1(key)+i*h2(key))%M;
		if(strcmp(H[h],str)==0){
			return 1;
		}else if(strlen(H[h])==0){
			strcpy(H[h],str);
			return 0;
		}
	}

}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
		scanf("%s %s", com, str);
	
		if ( com[0] == 'i' ){
	    	insert(str);
		} else {
	    	if (find(str)){
				printf("yes\n");
	    	} else {
				printf("no\n");
	   		}
		}
    }

    return 0;
}


Measured memory_bytes: 16040
#include<stdio.h>
#define N 100000

typedef struct{
  int parent;
  int left;
  int right;
  int depth;
}node;

node T[N];

int main(){
  int n, i, j;
  int id, k, c, p, q;

  scanf("%d\n",&n);
  for(i = 0 ; i < n ; i++){
    T[i].parent = -1;
    T[i].left = -1;
    T[i].right = -1;
    T[i].depth = 0;
  }

  for(i = 0 ; i < n ; i++){
    scanf("%d%d", &id,&k);
    
    for(j = 0 ; j < k ; j++){
      scanf("%d",&c);
      if( j == 0 ){
	T[id].left = c;
	T[c].parent = id;
      }
      else{
	T[p].right = c;
	T[c].parent = id;
      }
      p = c;
    }
  }
  
  for(i = 0 ; i < n ; i++){
    j = i;
    while(1){
      p = T[j].parent;
      if(p == -1) break;
      j = p;
      T[i].depth++;
    }
 
    printf("node %d: parent = %d, depth = %d,",i, T[i].parent, T[i].depth);
    if(T[i].parent == -1){
      printf(" root, [");
      if( (p = T[i].left) != -1) printf("%d",T[i].left);
 
      if( p != -1){
	while(T[p].right != -1){
          p = T[p].right;
          printf(", %d",p);
        }
      }
      printf("]\n");
    }
    else if(T[i].left != -1){
      printf(" internal node, [");
 
      if( (p = T[i].left) != -1) printf("%d",T[i].left);
 
      while(T[p].right != -1){
	p = T[p].right;
	printf(", %d",p);
      }
      printf("]\n");
    }
    else{
      printf(" leaf, []\n");
    }
  }
  return 0;
}

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

using namespace std;

int main() {
    int n = 0, count = 0;
    char c;
    while ((c = (char)getchar()) == '0' || c == '1') {
        if (c - '0' == n%2) count++;
        n++;
    }
    printf("%d\n", min(count, n-count));
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
n = int(input())
M = [tuple(list(map(int, input().split()))) for i in range(n)]

# best[i][i + j] : M_i * M_i+1 * ... * M_i+j?????????cost??¨??????
best = [[float('inf') for j in range(n)] for i in range(n)]
for j in range(0, n):
    for i in range(n - j):
        l = []
        for k in range(j):
            c1 = best[i][i + k]
            c2 = best[i + k + 1][i + j]
            c3 = M[i][0] * M[i + k][1]  * M[i + j][1]
            l.append(c1 + c2 + c3)
        best[i][i + j] = 0 if len(l) == 0 else min(l)
print(best[0][n-1])

Measured memory_bytes: 7896
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N, M;
    string s;
    cin >> N;
    map<string, int> m;
    REP(i, N) {
        cin >> s;
        m[s]++;
    }
    cin >> M;
    REP(i, M) {
        cin >> s;
        m[s]--;
    }
    int res = 0;
    for (auto x : m) {
        amax(res, x.second);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace ABC044_D
{
    class Program
    {
        static long n, s;
        
        static long f(long b, long n)
        {
            if (n < b) return n;
            return f(b, n / b) + (n % b);
        }
        static void Main(string[] args)
        {
            n = long.Parse(ReadLine());
            s = long.Parse(ReadLine());
            if (n == s) WriteLine(n + 1);
            else if (n < s) WriteLine(-1);
            else solve();
        }
        static void solve()
        {
            // 2 <= b <= sqrt(n)
            long b;
            bool flag = false;
            for(b = 2; b * b <= n; b++)
            {                
                if(f(b, n) == s)
                {
                    WriteLine(b);
                    flag = true;
                    break;
                }
            }
            if (flag) return;


            // sprt(n) < b <=  n
            var T = new SortedSet<long>();
            var g = n - s;
            for (b = 1; b * b <= g; b++)
            {
                if(g % b == 0)
                {
                    T.Add(b + 1);
                    T.Add(g / b + 1);
                }
            }
            foreach (var t in T)
            {
                if(f(t, n) == s)
                {
                    WriteLine(t);
                    flag = true;
                    break;
                }
            }
            if (flag) return;
            WriteLine(-1);
        }
    }
}


Measured memory_bytes: 3160
class UnionFind
	def initialize(n)
		@parent = (0..n).to_a
		@rank = [0] * (n+1)
	end

	def root(i)
		return i if @parent[i] == i
		@parent[i] = root(@parent[i])
	end	

	def union(i, j)
		u = root(i)
		v = root(j)
		return if u == v
		if @rank[u] > @rank[v]
			@parent[v] = u
		elsif @rank[v] > @rank[u]
			@parent[u] = v
		else
			@parent[u] = v
			@rank[v] += 1
		end
	end

	def same?(i, j)
		root(i) == root(j)
	end
end

n, m = gets.split.map &:to_i

edges = []
cost = (0..n).map{ (0..n).map{ Float::INFINITY} }

(1..m).each do
	i, j, c = gets.split.map &:to_i
	e = [i, j]
	edges << e
	cost[i][j] = cost[j][i] = c
end
edges.sort_by!{|i, j| cost[i][j]}

mst = []
uf = UnionFind.new(n)

history = {}

edges.each do |e|
	i, j = e
	next if uf.same?(i, j)
	history[e] = [Marshal.load(Marshal.dump(uf)), mst.map{|i,j| cost[i][j]}.inject(0, :+)]
	mst << e
	uf.union(i, j)
end

C = mst.map{|i,j| cost[i][j]}.inject(:+)

k = 0
s = 0
mst.each.with_index do |deleted, t0|
	e = nil
	e = edges.shift until e == deleted
	uf, c = history[e]
	t = t0

	edges.each do |e|
		i, j = e
		next if uf.same?(i, j)
		uf.union(i, j)
		c += cost[i][j]
		t += 1
	end

	if c > C || t < n - 1
		k += 1
		s += cost[deleted[0]][deleted[1]]
	end
end

puts [k, s] * ' '

Measured memory_bytes: 21352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    map<char, char>D;
    D['A'] = 'T';
    D['T'] = 'A';
    D['G'] = 'C';
    D['C'] = 'G';
    char x;
    R x;
    co(D[x]);
}


Measured memory_bytes: 256
n = int(input())
now=0
a=[]
t=[0]
x=[0]
y=[0]

a = [input().split() for l in range(n)]
for i in range(n):
    t.append(a[i][0])
    x.append(a[i][1])
    y.append(a[i][2])

for i in range(1,n+1):
    time = int(t[i])-int(t[i-1])
    next2 = int(x[i])+int(y[i])
    if time >= next2-now and (time-(next2-now))%2 == 0:
       now = int(x[i])+int(y[i])
    else:
        print('No')
        exit()
    
print('Yes')

Measured memory_bytes: 34640
a,b,c=map(int,input().split())

if a<c:
    if b<c:
        print(a,b,c)
    elif c<b:
        print(a,c,b)
    else:
        print(b,a,c)
else:
    if a<b:
        print(c,a,b)
    elif b<c:
        print(b,c,a)
    else:
        print(c,b,a)



Measured memory_bytes: 5596
h, w = map(int, input().split())
A = []
res_w = []
for i in range(h):
    line = [s for s in input()]
    c = []
    for j in range(len(line)):
        if line[j] == '#':
            c.append(j)
            if (len(c) > 1) and (c[-2] - c[-1] > 1):
                print('Impossible')
                exit()
            if j not in res_w:
                res_w.append(j)
            else:
                if max(res_w) > j:
                    
                    print('Impossible')
                    exit()
print('Possible')




Measured memory_bytes: 3064
lst=[]
while True:  
    try:
        n=int(input())
        lst.append(n)
    except EOFError:
        break
        continue
import collections
c = collections.Counter(lst)  
freqCheck = c.most_common()
mode =[freqCheck[0][0]]
maxCount = freqCheck[0][1] 
count = 1
while maxCount == freqCheck[count][1]:
    mode.append(freqCheck[count][0])
    count = count + 1
mode.sort()
for i in mode:
    print(i)


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

int main() 
{

	int h,w;
	cin>>h>>w;
	char arr[h+2][w+2];
	memset(arr,'#',sizeof(arr));
	for(int i=1;i<=h;i++)
	{
	    for(int j=1;j<=w;j++)
	    {
	        cin>>arr[i][j];
	    }
	}
	for(int i=0;i<=h+1;i++)
	{
	    for(int j=0;j<=w+1;j++)
	    {

	        cout<<arr[i][j];
	    }
	    cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
flag=0
count=0
for i in range(N):
    s,t=map(int,input().split())
    if s==t:
        count=count+1
    else:
        count=0
    if count==3:
        flag=1
if flag==1:
    print('Yes')
else:
    print('No')


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

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }


int main() {
    int n, x, t;
    cin >> n >> x >> t;

    int ans = 0;
    while (n > 0) {
        n -= x;
        ans += t;
    }

    prt(ans);

    return 0;
}


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

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    if(2 * x >= a * a * b) {
        cout << fixed << setprecision(10)
        << atan((a * a * b - x) * 2 / (a * a * a)) * 180 / M_PI << endl;
    } else {
        cout << fixed << setprecision(10)
        << atan(a * b * b / (2 * x)) * 180 / M_PI << endl;
    }
}

Measured memory_bytes: 256
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

min = min(a)+min(b)

for i in range(M):
    c =list(map(int,input().split()))
    s = a[c[0]-1]+b[c[1]-1]-c[2]
    min = (s if s < min else min)

print(min)

Measured memory_bytes: 18612
//written by libra9z
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <valarray>
#include <utility>
#include <numeric>
#include <memory>
#include <functional>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <complex>
#include <locale>
using namespace std;
#define Debug(x) cerr << #x << " = " << x << endl
#define Debug22(x,y) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<endl;
#define Debug2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define Debug3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<")\n";
#define Debug_arr(v,n) for(int i=0;i<n;++i) cerr<<#v<<"["<<i<<"]"<<" = "<<v[i]<<endl;
#define SET(p,v) fill((__typeof(**p)*)p,(__typeof(**p)*)p+sizeof(p),v);
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define prl cerr << "called: " << __LINE__ << endl
#define all(s) s.begin(),s.end()
int main()
{
	string s;
	cin>>s;
	if (s.substr(0,4)=="YAKI") puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	int N, H;
	cin >> N >> H;
	deque<P> que;
	que.push_back(P(0, H));
	long long int S = 1;
	for(int loop = 0; loop < N - 1; loop++){
		long long int Di, Hi;
		cin >> Di >> Hi;
		while(que.size() >= 2){
			P p2 = que.back();
			que.pop_back();
			P p = que.back();
			que.pop_back();
			if((p2.second - p.second) > Hi * (p2.first - p.first)){
				que.push_back(p);
				que.push_back(p2);
				break;
			}
			que.push_back(p);
		}
		P p3 = que.back();
		long long int num = (S + H - 1 - p3.second) / Hi;
		P p4 = P(p3.first + num, p3.second + num * Hi);
		P p5 = P(p4.first + 1, p4.second + (S + H - 1 - p3.second) % Hi);
		que.push_back(p4);
		que.push_back(p5);
		S += Di;
		while(S > que.front().second){
			P p = que.front();
			que.pop_front();
			if(S <= que.front().second){
				P p2 = que.front();
				long long int h = (p2.second - p.second) / (p2.first - p.first);
				num = (S - p.second) / h;
				if(p.second + h * num < S){
					num += 1;
				}
				que.push_front(P(p.first + num, p.second + num * h));
			}
		}
	}
	cout << que.front().first << endl;
	return 0;
}


Measured memory_bytes: 3160
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
template<typename T>bool maxup(T& a, T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T& b) { if (a > b) { a = b; return true; }; }

#define X first
#define Y second

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
signed main() {
	int n, t; cin >> n >> t;
	V as(n); input(as);
	vector<int> mxs(n);
	mxs[n - 1] = as[n - 1];
	for (int i = n - 2; i >= 0; i--) mxs[i] = max(mxs[i + 1], as[i]);

	int sa = 0, ps = 0, ans = 0;
	rep(i, n) {
		ps = sa;
		if (mxs[i] - as[i] >= sa) {
			sa = mxs[i] - as[i];
			if (ps == sa) ans++;
			else ans = 1;
		}
	}
	cout << ans << endl;
	system("pause");
}

Measured memory_bytes: 2040