akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

void solve(){
    int N, M, S;
    cin >> N >> M >> S;
    vector<vector<tuple<int, int, int>>> G(N);
    vector<int> C(N), D(N);
    REP(i,M){
        int U, V, A, B;
        cin >> U >> V >> A >> B;
        --U, --V;
        G[U].emplace_back(V, A, B);
        G[V].emplace_back(U, A, B);
    }
    REP(i,N) cin >> C[i] >> D[i];
    vector<vector<ll>> dp(N, vector<ll>(2525, LINF));
    chmin(S, 2524);
    dp[0][S] = 0;
    priority_queue<tuple<ll, int, int>,vector<tuple<ll, int, int>>, greater<tuple<ll, int, int>>> pq; //cost, coins, cur;
    pq.emplace(0, S, 0);
    while(!pq.empty()){
        auto[cost, coins, cur] = pq.top(); pq.pop();
        // cerr << cost << " " << coins << " " << cur << endl;
        // if(dp[cur][coins] < cost) continue;
        // 今いる地点で銀貨にする
        if(chmin(dp[cur][min(2524, coins + C[cur])], cost + D[cur])){
            pq.emplace(dp[cur][min(2524, coins + C[cur])], min(2524, coins + C[cur]), cur);
        }

        for(auto [to, a, b] : G[cur]){
            if(coins < a) continue;
            if(chmin(dp[to][coins-a], cost + b)){
                pq.emplace(dp[to][coins-a], coins - a, to);
            }
        }
    }
    vector<ll> ans(N, LINF);
    for(int i=1;i<N;i++) REP(j,2525) chmin(ans[i], dp[i][j]);
    for(int i=1;i<N;i++) cout << ans[i] << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


Measured memory_bytes: 6264
#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/
 
//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    string ans;
    ll cnt1=0;
    ll cnt2=0;
    rep(i,0,2*n){
        if (i%2==0){
            ans.pb(s[cnt1]);
            cnt1++;
        }
        else{
            ans.pb(t[cnt2]);
            cnt2++;
        }
    }
    cout<<ans<<endl;
}
 
signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int w = sc.nextInt();
		int idx = 0;
		StringBuilder sb = new StringBuilder();
		while (idx < s.length()) {
			sb.append(s.charAt(idx));
			idx += w;
		}
		System.out.println(sb);
	}
}

Measured memory_bytes: 21716
let print_frame h w = (for i = 1 to h do
                         for j = 1 to w do
                           print_char (if 1 < i && i < h && 1 < j && j < w then '.'
                                       else '#')
                         done;
                         print_newline()
                       done) ;;

let rec f() = Scanf.scanf "%d %d\n" (fun h w -> if h > 0 && w > 0 then
                                                  begin
                                                    print_frame h w;
                                                    print_newline();
                                                    f()
                                                  end) ;;
f() ;;


Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1e9+7
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n,m,X,Y;
    cin >> n >> m >> X >> Y;
    vector<int> x(n),y(m);
    rep(i,n) {
        cin >> x[i];
    }
    rep(i,m) {
        cin >> y[i];
    }
    sort(all(x));
    sort(all(y));
    if (x[n-1]>=y[0]) {
        cout << "War" << endl;
        return 0;
    }
    bool check = false;
    REP(i,x[n-1]+1,y[0]+1) {
        if (X<i && i<=Y) {
            check = true;
            break;
        }
        if (check) break;
    }
    if (check) cout << "No War" << endl;
    else cout << "War" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int d;
	cin >> d;
	for(int k=0;k<d;k++){
		char num[8];
		int num2[8];
		for(int i=0;i<8;i++){
			cin >> num[i];
			num2[i] = (int)num[i];
		}
		
		sort(num2,num2+8);
		int max=0,min=0;
		int a=1;
		int b=10000000;
		for(int i=0;i<8;i++){
			max += num2[i]*a;
			min += num2[i]*b;
			a*=10;
			b/=10;
		}
		cout << max-min << endl;
	}
	return 0;

}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    int b = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b ^= a[i];
    }
    debug(b);
    for (int i = 0; i < n; i++) {
        cout << (b ^ a[i]) << " ";
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
#define int long long 
int dp[101][100001];
int n;
int weight[200001];
int value[200001];

int rec(int idx,int knap)
{   
    if(dp[idx][knap]!=-1) return dp[idx][knap];
    if(idx==n) return 0;

    if(knap<0)  return 0;
  //  if(knap==0) return 0;
  // cout<<max(rec(idx+1,knap),(value[idx]+rec(idx+1,knap-weight[idx])));
    //cout<<" "<<"\n";
    if(weight[idx]>knap)  return dp[idx][knap]=rec(idx+1,knap);
    return dp[idx][knap]=max(rec(idx+1,knap),(value[idx]+rec(idx+1,knap-weight[idx])));
   
}


signed main(){ 

   for(int i=0;i<101;i++)
   {
       for(int j=0;j<100001;j++)
        dp[i][j]=-1;
   }
    int w;
    cin>>n>>w;

        for(int i=0;i<n;i++)
        {
        cin>>weight[i]>>value[i];
        }
        //cout<<w;
    cout<<rec(0,w);

}

Measured memory_bytes: 80256
K, S = map(int, input().split())
count = 0
for x in range(0, K+1):
	if (x > S):
		break
	for y in range(0, min(S-x+1, K+1)):
		if (S-x-y >= 0 and S-x-y <= K):
			count = count + 1

print(count)


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int x, y;	cin >> x >> y;
	if (x < y)swap(x, y);
	while (x %= y)
		swap(x, y);
	cout << y << endl;
	return 0;
}

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

const int pos_inf = 1000000;
const int neg_inf = -1000000;

int main() {
	int w, d, n;
    cin >> w >> d >> n;
    vector<vector<int>> ub(w+1, vector<int>(d+1, pos_inf));
    vector<vector<int>> lb(w+1, vector<int>(d+1, neg_inf));

    while(n--) {
        int x, y, z;
        cin >> x >> y >> z;
        for(int xx=1; xx<=w; xx++) for(int yy=1; yy<=d; yy++) {
            ub[xx][yy] = min(ub[xx][yy], z+abs(x-xx)+abs(y-yy));
            lb[xx][yy] = max(lb[xx][yy], z-abs(x-xx)-abs(y-yy));
        }
    }
    bool ok = true;
    int res = 0;
    for(int xx=1; xx<=w; xx++) for(int yy=1; yy<=d; yy++) {
        if(lb[xx][yy]<=ub[xx][yy]) {
            res += lb[xx][yy];
        } else {
            ok = false;
        }
    }
    if(ok) {
        cout << res << endl;
    } else {
        cout << "No" << endl;
    }

	return 0;
}


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

#define int long long
const int MAX_N = 100000;

int N, A[MAX_N];

void Compress(int a[MAX_N])
{
	vector<int> v;
	for (int i = 0; i < N; i++) v.push_back(a[i]);
	sort(v.begin(), v.end());
	map<int, int> m;
	for (int i = 0; i < N; i++) m[v[i]] = i;
	for (int i = 0; i < N; i++) a[i] = m[A[i]];
}

signed main()
{
	vector<int> u, v;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	Compress(A);
	int ans = 0;
	for (int i = 0; i < N; i += 2)
	{
		if (A[i]&1) ans++;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8052
H,W=map(int, input().split())
a = [input() for i in range(H)]

ans=0
cnt=0
 
for i in range(H-1):
    for j in range(W-1):
        if a[i][j] == '#' and a[i+1][j] == '#' and  a[i][j+1] == '#':
            cnt+=1
        elif a[i][j] == '#' and a[i+1][j] == '.' and  a[i][j+1] == '.':
            cnt+=1

            
for i in range(1,H):
    for j in range(1,W):
        if a[i][j] == '#' and a[i-1][j] == '.' and  a[i][j-1] == '.':
            cnt+=1

        
print('Impossible' if cnt>0 else 'Possible')

Measured memory_bytes: 9232
#include <iostream>

using namespace std;

int F[10][10];
int T[10][10];
int P[10];

bool check() {
    for (int i = 0; i < 10; i++)
        for (int j = 0; j < 10; j++)
            if (T[i][j]) return false;
    return true;
}

bool solve(int c, int n) {
    for (int i = 0; i < 10; i++) {
        if (n & (1<<i)) {
            if (c-1 >= 0) T[c-1][i] = !T[c-1][i];
            if (i-1 >= 0) T[c][i-1] = !T[c][i-1];
            T[c][i]   = !T[c][i];
            if (i+1 < 10) T[c][i+1] = !T[c][i+1];
            if (c+1 < 10) T[c+1][i] = !T[c+1][i];
        }
    }
    P[c] = n;
    if (c == 9) return check();
    int next = 0;
    for (int i = 0; i < 10; i++) {
        if (T[c][i]) {
            next |= (1<<i);
        }
    }
    return solve(c+1, next);
}

int main() {
    int n;
    cin >> n;
    while (n--) {
        for (int i = 0; i < 10; i++) 
            for (int j = 0; j < 10; j++)
                cin >> F[i][j];
        for (int i = 0; i < (1<<10); i++) {
            for (int k = 0; k < 10; k++) for (int j = 0; j < 10; j++) T[k][j] = F[k][j];
            if (solve(0, i)) 
                break;
        }
        for (int i = 0; i < 10; i++) {
            cout << (P[i] & 1);
            for (int j = 1; j < 10; j++) {
                cout << ' ' << (P[i] & (1<<j) ? 1 : 0);
            }
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1160
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def cross3(O, A, B):
    ox, oy = O; ax, ay = A; bx, by = B
    return (ax - ox) * (by - oy) - (bx - ox) * (ay - oy)
def cross_point(p0, p1, q0, q1):
    x0, y0 = p0; x1, y1 = p1
    x2, y2 = q0; x3, y3 = q1
    dx0 = x1 - x0; dy0 = y1 - y0
    dx1 = x3 - x2; dy1 = y3 - y2
    s = (y0-y2)*dx1 - (x0-x2)*dy1
    sm = dx0*dy1 - dy0*dx1
    if -EPS < sm < EPS:
        return None
    return x0 + s*dx0/sm, y0 + s*dy0/sm
EPS = 1e-9
def convex_cut(P, line):
    q0, q1 = line
    N = len(P)
    Q = []
    for i in range(N):
        p0 = P[i-1]; p1 = P[i]
        cv0 = cross3(q0, q1, p0)
        cv1 = cross3(q0, q1, p1)
        if cv0 * cv1 < EPS:
            v = cross_point(q0, q1, p0, p1)
            if v is not None:
                Q.append(v)
        if cv1 > -EPS:
            Q.append(p1)
    return Q
def polygon_area(P):
    s = 0
    N = len(P)
    for i in range(N):
        p0 = P[i-1]; p1 = P[i]
        s += p0[0]*p1[1] - p0[1]*p1[0]
    return abs(s) / 2
def solve():
    N = int(readline())
    P = [list(map(int, readline().split())) for i in range(N)]
    Q = int(readline())
    for i in range(Q):
        x0, y0, x1, y1 = map(int, readline().split())
        P0 = convex_cut(P, ((x0, y0), (x1, y1)))
        write("%.16f\n" % polygon_area(P0))
solve()


Measured memory_bytes: 5648
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int ans = 0, a = 0, b = 0, ba = 0;
        for(int i = 0; i < n; i++){
            string s;
            cin >> s;
            for(int i = 1; i < s.length(); i++){
                if(s[i - 1] == 'A' and s[i] == 'B'){
                    ans++;
                }
            }
            if(s[s.length() - 1] == 'A' and s[0] == 'B'){
                ba++;
            }else if(s[s.length() - 1] == 'A'){
                a++;
            }else if(s[0] == 'B'){
                b++;
            }
        }
        if(ba == 0){
            ans += min(a, b);
        }else{
            ans += ba - 1;
            if(a > 0){
                ans++;
                a--;
            }
            if(b > 0){
                ans++;
                b--;
            }
            ans += min(a, b);
        }
        cout << ans << '\n';
    }
}

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

#define int long long
#define pb emplace_back
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);

int32_t main(){
	fast;
	int a;
	cin >> a;
	int ans = 3*a*a;
	cout << ans;
}







Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

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

  long long ans = 0;
  vector <long long> binary(N);

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

  for (int i = 0; i < N; i++){
    ans += binary[i] / 2;
    if (i == N - 1){
      break;
    }else if (binary[i] % 2 != 0){
      if (binary[i + 1] >= 1){
        ans++;
        binary[i + 1]--;
      }
    }
  }
  
  cout << ans << endl;
  


  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

vector<int> vec[5010];

int main(){
    
    
    int n,m,a,b,x,ans;
    
    cin >> n >> m;
    
    for(int i=0;i<n;i++){
        for(int j=0;j<=i;j++) vec[i].push_back(0);
    }
    
    for(int i=0;i<m;i++){
        cin >> a >> b >> x;
        vec[a-1][b-1] = x+1;
    }
    
    for(int i=0;i<n-1;i++){
        for(int j=0;j<=i;j++){
            vec[i+1][j] = max(vec[i+1][j],vec[i][j]-1);
            vec[i+1][j+1] = max(vec[i+1][j+1],vec[i][j]-1);
        }
    }
    
    ans = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=i;j++){
            if(vec[i][j] > 0) ans++;
        }
    }
    
    cout << ans << endl;
    return(0);
}


Measured memory_bytes: 64592
#include <bits/stdc++.h>
using namespace std;
#define k 1000000000000000000

int main(){
        long long int N;
        vector<long long int> A;
        cin >> N;
        for(int i = 0; i < N; i++){
                long long int x;
                cin >> x;
                A.push_back(x);
        }
        for(int i = 0; i < N; i++){
                if(A[i] == 0){
                        cout << 0 << endl;
                        return 0;
                }
        }

        long long int ans = 1;
        for(int i = 0; i < N; i++){
                if(ans > k / A[i]){
                        cout << -1 << endl;
                        return 0;
                } else {
                        ans *= A[i];
                }
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 4320
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	int n, k;
	cin >> n >> k;
	
	if (n % k)
		cout << 1 << endl;
	else
		cout << 0 << endl;
}

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

	solve();
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

int main()
{
  int n;
  std::cin >> n;
  const int gray = 0;
  const int god = 8;
  const int rateCount = 9;
  std::vector<int> rates(rateCount);
  for (int i = 0; i < n; ++i)
  {
    int a;
    std::cin >> a;
    int rate = a / 400;
    rate = std::min(rate, god);
    ++rates[rate];
  }
  int humansColorNum = 0;
  for (int i = gray; i < god; ++i)
  {
    if (rates[i] > 0)
    {
      ++humansColorNum;
    }
  }

  if (humansColorNum == 0)
  {
    std::cout << 1;
  }
  else
  {
    std::cout << humansColorNum;
  }
  
  std::cout << " " << humansColorNum + rates[god] << std::endl;
  return 0;
}

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

#define N 100

void push(int);
int pop(void);

int S[N];
int top=0;

int main()
{
    char s[N];
    int m,n;

    while(scanf("%s",s) != EOF ){
        if(s[0]=='+'){
            m=pop();
            n=pop();
            push(m+n);
        }
        else if(s[0]=='-'){
            m=pop();
            n=pop();
            push(n-m);
        }
        else if(s[0]=='*'){
            m=pop();
            n=pop();
            push(m*n);
        }
        else{
            push(atoi(s));
        }
    }

    printf("%d\n",S[top]);

return 0;
}        



void push(int x){
    top++;
    S[top]=x;
}

int pop(){
    top--;
    return S[top+1];
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
#include "atcoder/all"
#define rep(i,n)for(int i=0;i<(int)(n);i++)
using namespace std;
using namespace atcoder;
#define all(a) a.begin(),a.end()
typedef long long ll;
#define vi vector<ll>
typedef pair<ll,ll>P;
const ll inf=1ll<<61;

signed main(){
	ll n;cin>>n;
	if(n==1){
		cout<<1<<endl;return 0;
	}
	if(n==2){
		cout<<3<<endl;return 0;
	}
	if(n==3){
		cout<<2<<endl;return 0;
	}
	map<ll,int>M;
	vi m;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0){
			ll x=1;
			while(n%i==0){
				n/=i;
				x*=i;
			}
			if(i==2)x*=2;
			m.push_back(x);
		}
	}
	if(n>1)m.push_back(n);

	vi r(m.size());
	ll ans=inf;
	rep(i,1<<(m.size())){
		rep(j,m.size()){
			if(i&(1<<j))r[j]=0;
			else r[j]=m[j]-1;
		}
		P p=crt(r,m);
		ll x=p.first;if(!x)x=p.second;
		ans=min(ans,x);
	}
	cout<<ans<<endl;
}

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

#define FOR(i, a, b)  for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << "\n"
#define _ << " _ " <<
#define ll long long

using namespace std;

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

  int n;
  cin >> n;
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a > b) swap(a, b);

  n -= 1;

  for (int mi = (n % 2); mi <= n; mi += 2) {
    bool fl = 0;
    ll tr = abs((b - a) - (mi * c));
    if (tr == 0) fl = 1;
    ll num1 = n + 1;
    if (d - c > 0) {
      num1 = tr / (d - c);
      if (tr % (d - c)) num1++;
    }
    if (num1 <= (n - mi) / 2) fl = 1;


    tr = abs((b - a) - (mi * d));
    if (tr == 0) fl = 1;
    num1 = n + 1;
    if (d - c > 0) {
      num1 = tr / (d - c);
      if (tr % (d - c)) num1++;
    }
    if (num1 <= (n - mi) / 2) fl = 1;

    if (fl) {
      //cout << mi << endl;
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";

  return 0;
}



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

using namespace std;

static void inputArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cin >> A[i];
   }
}

static void printArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cout << ((i != 0) ? " " : "") << A[i];
  }
  cout << endl;
}

static vector<int> C(10000 + 1, 0);
static inline void countingSort(int A[], int B[], int num) {
  for (int i = 0; i < num; i++) {
    C[A[i + 1]]++;
  }
  for (int i = 1; i <= 10000; i++) {
    C[i] = C[i] + C[i - 1];
  }
  for (int i = num; i > 0; i--) {
//  for (int i = 1; i <= num; i++) {
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
}  

static vector<int> A(2000000 + 1), B(2000000 + 1);

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

  inputArray(&A[1], n);

  countingSort(&A[0], &B[0], n);

  printArray(&B[1], n);
    
  return 0;
}



Measured memory_bytes: 18216
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var abcxy = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var a = abcxy[0];
        var b = abcxy[1];
        var c2 = Min(abcxy[2] * 2, a + b);
        var X = abcxy[3];
        var Y = abcxy[4];
        Console.WriteLine(Min(Max(X, Y) * c2, Min(X, Y) * c2 + (X < Y ? (Y - X) * b : (X - Y) * a)));
    }
}

Measured memory_bytes: 13396
MOD = 10**9 + 7

N = int(input())
S1 = input()
S2 = input()
pattern = []
i = 0
while i < N:
    if i == N - 1 or S1[i] != S1[i+1]:
        pattern.append(1)
        i += 1
    else:
        pattern.append(2)
        i += 2
dp = [1 for _ in range(len(pattern) + 1)]
for i in range(len(pattern)):
    if i == 0:
        if pattern[0] == 1:
            dp[i+1] = 3
        else:
            dp[i+1] = 6
    elif pattern[i-1] == 1:
        dp[i+1] = (dp[i] * 2) % MOD
    elif pattern[i-1] == pattern[i] == 2:
        dp[i+1] = (dp[i] * 3) % MOD
    else:
        dp[i+1] = dp[i]
print(dp[-1])

Measured memory_bytes: 3064
import java.util.Scanner;

//Middle-Square Method
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int Case = 1;
		int t = sc.nextInt();
		while(t--!=0){
			System.out.println("Case " + Case++ + ":");
			int x = sc.nextInt();
			x*=x;
			for(int i=0;i<10;i++){
				String s = x+"";
				while(s.length()<8)s="0"+s;
				x = Integer.parseInt(s.substring(2,6));
				System.out.println(x);
				x*=x;
			}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
vector<vector<int> > G;
int n, k;

ll dfs(int i, int par){
    int colorpat;
    if(par == -1) colorpat = k-1;
    else colorpat = k-2;

    if(k < (int)G[i].size()) return 0;
    ll patt = 1;
    for(auto e : G[i]) {
        if(e == par) continue;
        (patt *= colorpat) %= MOD;
        --colorpat;
    }
    for(auto e : G[i]) {
        if(e == par) continue;
        (patt *= dfs(e, i)) %= MOD;
    }
    return patt;
}

int main(){

    cin >> n >> k;
    G.resize(n);

    for(int i = 0; i < n-1; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    cout << k*dfs(0, -1)%MOD << endl;

    return 0;
}


Measured memory_bytes: 10368
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	int A,B,C,X,count=0;
	while(cin>>A>>B>>C>>X)
	{
		int i,j,k;
		for(i=0;i<=A;i++)
			for(j=0;j<=B;j++)
				for(k=0;k<=C;k++)
					if(i*500+j*100+k*50==X)
						count++;
		cout<<count;
		count=0;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

a.sort()

max_a = a[-1]
is_available = [True] * (max_a + 1)

ans = 0

for i, x in enumerate(a[:-1]):
    if is_available[x]:
        if not a[i+1] == x:
            ans += 1
        for b in range(x, max_a + 1, x):
            is_available[b] = False

if is_available[a[-1]]:
    ans += 1

print(ans)

Measured memory_bytes: 107572
if __name__ == '__main__':
    while True:
        N, K = list(map(int, input().strip().split()))
        if N == 0 and K == 0:
            break

        lims = list(map(int, input().strip().split()))
        totals = [ 0 for _ in range(K) ]
        
        for _ in range(N):
            arr = list(map(int, input().strip().split()))
            for i in range(K):
                totals[i] += arr[i]
        
        tarimasu = True
        for i in range(K):
            if totals[i] > lims[i]:
                tarimasu = False
                break
        
        print("Yes" if tarimasu else "No")


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

using namespace std;
const int IINF = INT_MAX;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000000000
int main(){
    int x,n,p; 
    cin >> x >> n;
    vector<bool> a(110,false);
    
    rep(i,n){
    	cin >> p;
    	a[p] = true;
    }
    
    int pointer = x;
    int ans1,ans2 = x;
    
   while(true){
   		if(a[pointer]){
   			pointer++;
   		}else{
   			ans1 = pointer;
   			break;
   		}
   }
   pointer = x;
    while(true){
     	if(pointer < 0){ ans2 = -1; break; }
   		if(a[pointer] == false){
   			ans2 = pointer;
   			break;
   		}else{
   			pointer--;
   		}
   }
   if(ans1 - x < x -ans2)  cout << ans1 << endl;
   else if(ans1 - x >= x - ans2) cout << ans2 << endl;
    return 0;	
}

Measured memory_bytes: 3580
line = input().split(" ")

fruit_obj = int(line[0])
buy_obj = int(line[1])

line2 = input().split(" ")

urine = []
for j in range(len(line2)):
    urine.append(int(line2[j]))

urine.sort()

price = 0
for i in range(buy_obj):
    price = price + int(urine[i])

print(price)

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────

int main() {
	ll n, k;
	cin >> n >> k;
	vi a(n);
	rep(i, n) cin >> a[i];

	ll ans = INF;
	for (int bit = 0; bit < (1 << n); ++bit) {
		map<int, bool> mp;
		rep(i, n) {
			if (bit & (1 << i)) mp[i] = true;
		}

		ll num = 0;
		ll c = 0;
		ll mx = a[0];
		rep(i, n - 1) {
			if (num == k - 1) continue;
			else if (mx < a[i + 1]) {
				num++;
				mx = a[i + 1];
			}
			else if (mp[i + 1] == true) {
				c += mx + 1 - a[i + 1];
				mx++;
				num++;
			}
		}
		if (num == k - 1) {
			ans = min(ans, c);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e18) + 1;
const int mod = 479001599;
const int maxn = 1e5 + 111;
        
using namespace std;          

int n, m, a[maxn];
vector <int> g[maxn];

void solve(){
	cin >> n >> m;

	for (int i = 1; i <= n; i++)
		cin >> a[i];

	for (int i = 1; i <= m; i++){
		int x, y;
		cin >> x >> y;
		g[x].pb(a[y]);
		g[y].pb(a[x]);
	}

	int ans = 0;

	for (int i = 1; i <= n; i++){
		sort(all(g[i]));
		if (sz(g[i]) == 0){
			ans++;
			continue;
		}
		if (a[i] > g[i][sz(g[i]) - 1])
			ans++;
	}

	cout << ans;
}   
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;

    //cin >> q;

    while (q--){
        solve();
    }
}

Measured memory_bytes: 10276
def checker(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0 :
        return False
    for i in range(2,int(x**0.5)+1):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Measured memory_bytes: 7744
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

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

}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using Graph = vector<vector<int> >;//隣接リスト
 
vector<bool> seen;
void dfs(Graph &G, int v) {
    seen[v] = true;
    for (auto next_v: G[v]) {
        if (seen[next_v]) continue;
        dfs(G, next_v);
    }
}

int main() {
    ll N, M;
    cin >> N >> M;

    vl H(N+1);
    rep(i, 1, N+1) {
        cin >> H[i];
    }

    Graph G(N+1);

    for (int i = 0; i < M; ++i) {
        ll a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    ll ans = 0;
    rep(i, 1, N+1) {
        bool flag = true;
        rep(j, 0, G[i].size()) {
            if (H[i] > H[G[i][j]]) {
            } else {
                flag = false;
                break;
            }
        }
        if (flag) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 9068
#解説見ながら

n = int(input())

ans = n

for i in range(n+1) :
    c = 0
    a = n-i
    while a>0 :
        c += a%6
        a = a//6
    a = i
    while a>0 :
        c += a%9
        a = a//9
    if c<ans :
        ans = c

print(ans)

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

int main(){
  string S;
  cin >> S;
  int N = S.size();
  long long ans = 0;
  for(int bit=0; bit<(1<<(N-1));++bit){
    long long tmp = 0;
    for(int i=0; i<N-1;++i){
      tmp *= 10;
      tmp += S[i] - '0';
      if(bit & (1<<i)) ans += tmp, tmp = 0;
    }
    tmp *= 10;
    tmp += S.back() - '0';
    ans += tmp;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
#define MOD 1000000007
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<lint, lint>;

// cout << fixed << setprecision(12)

lint modpow(lint a, lint n, lint m = MOD){
  lint ans = 1;
  while(n>0){
    if(n%2==1) ans *= a; 
    ans %= m;
    a *= a; 
    a %= m;
    n /= 2;
  }
  return ans;
}

lint inv(lint a, lint m = MOD){
  return modpow(a, m-2, m);
}

///////////////////////////////////

int main(){
  lint N; cin>>N;
  vi A(N),B(N);
  vi Aidx(200020,-1), Bidx(200020,-1);

  for(lint i=0; i<N; i++){
    lint a;
    cin >> a;
    A[i] = a;
    Aidx[a] = i;
  }
  for(lint i=0; i<N; i++){
    lint b;
    cin >> b;
    B[i] = b;
    Bidx[b] = i;
  }
  for(lint i=1; i<N; i++){
    if(Aidx[i] < Aidx[i-1]) Aidx[i] = Aidx[i-1];
    if(Bidx[i] < Bidx[i-1]) Bidx[i] = Bidx[i-1];
  }
    
  
  vi D1(N+1);
  for(lint i=1; i<=N; i++){
    D1[i] = Aidx[i-1] - Bidx[i];
  }
  sort(ALL(D1));
  
  vi D2(N+1);
  for(lint i=1; i<=N; i++){
    D2[i] = Aidx[i] - Bidx[i-1];
  }
  sort(ALL(D2));
  
  lint left = D1[0];
  lint right = D2[N];
  
  left = abs(left);
  
  vi cnt(200020,0);
  
  for(lint i=0; i<N; i++){
    cnt[A[i]]++;
    cnt[B[i]]++;
  }
  
  bool yes = true;
  
  for(lint i=1; i<=200020; i++){
    if(cnt[i]>N){
      yes = false;
      break;
    }
  }
  

  
  if(yes){
    // cout << "Yes" << endl;
    vi C1(N);
    vi C2(N);
    /////
    
    for(lint i=0; i<N-left; i++){
      C1[i] = B[left+i];
    }
    for(lint i=0; i<left; i++){
      C1[N-left+i] = B[i];
    }
    
    for(lint i=0; i<N-right; i++){
      C2[i+right] = B[i];
    }
    for(lint i=0; i<right; i++){
      C2[i] = B[N-right+i];
    }
    
    bool Cone = true;
    bool Ctwo = true;
   
    for(lint i=0; i<N; i++){
      if(C1[i]==B[i]) Cone = false;
    }
    for(lint i=0; i<N; i++){
      if(C2[i]==B[i]) Ctwo = false;
    }
    
    if(Cone){
      cout << "Yes" << endl;
      for(lint i=0; i<N-1; i++){
        cout << C1[i] << ' ';
      }
      cout << C1[N-1] << endl;
    }
    else{
      cout << "Yes" << endl;
      for(lint i=0; i<N-1; i++){
        cout << C2[i] << ' ';
      }
      cout << C2[N-1] << endl;
    }
   
    /////
  }
  else{
    cout << "No" << endl;
  }
}
    
      
      
  
  

Measured memory_bytes: 17240
#include <iostream>
#include <bits/stdc++.h>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

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

long long int INF = 1e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define line cout << "----------" << endl;


ll mod = 1000000007;
ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){

    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){

    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){

    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
void Yay(bool condition){

    if(condition){
        p("Yay!");
    }else{
        p(":(");
    }
    return;
}

//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
	rfact[800000] = rui(fact[800000],mod - 2);
	for(ll i=800000; i>=1; i--){
	   rfact[i-1] = rfact[i] * i;
	   rfact[i-1] %= mod;
	}
	return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/

ll n,m,num,ans,a,b,c,d,e,g,h,w,i,j,k,q;
char s[10];
ll x[300005],y[300005],z[100005];
ll dp[5505][5505];


int main(){
	cin >> s;
	for(i=0;i<4;i++){
		x[s[i] - 'A']++;
	}
	sort(x,x+26);
	reverse(x,x+26);
	Yes(x[0] == 2 && x[1] == 2 && x[2] == 0);
	

	return 0;
}


Measured memory_bytes: 14592
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main(void) {

	int n, k, x[100];

	cin >> n >> k;
	
	int num = 0;

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

	for (int i = 0; i < n; i++)
	{
		num += 2 * min(x[i], k - x[i]);
	}

	cout << num << "\n";

	return 0;
}

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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] time = new int[3];
       
        for(int i = 0;i<3;i++) {
        	time[i] = sc.nextInt();
        }
        Arrays.sort(time);
        System.out.println(time[0]+time[1]);
    }
}

Measured memory_bytes: 23124
arr = input().split()
n = int(arr[0])
m = int(arr[1])
a = [0] * n
b = [0] * n
for i in range(n):
    tmp = input().split()
    tmp = list(map(int,tmp))
    a[i] = tmp[0]
    b[i] = tmp[1]

c = [0] * m
d = [0] * m
for i in range(m):
    tmp = input().split()
    tmp = list(map(int,tmp))
    c[i] = tmp[0]
    d[i] = tmp[1]

def calc_dist(a,b,c,d):
    return abs(a-c) + abs(b-d)
    
for i in range(n):

    line = 10000000000
    index = 0
    for k in range(m):
        now = calc_dist(a[i],b[i],c[k],d[k])
        if line > now:
            line = now
            index = k
    print(index+1)


Measured memory_bytes: 3064
def f(x):
    if x%2 == 1:
        return 3*x + 1
    else:
        return x//2

s=int(input())
a=[]
a.append(s)
for i in range(1,100000):
    b = f(a[i-1])
    if b in a:
        print(i+1)
        break
    else:
        a.append(b)

Measured memory_bytes: 3060
#include<iostream>
typedef long long ll;
using namespace std;

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    int sum = y+z;
    int ans=0;
    x=x-z;
    while(x>=0){
        x=x-sum;
        if(x>=0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    let mut hs = Vec::with_capacity(n);
    for _ in 0..n {
        let hi: usize = read!();
        hs.push(hi);
    }

    let mut ans = 0;
    let mut highest = 0;

    for &h in &hs {
        if h >= highest {
            ans += 1;
            highest = h;
        }
    }
    
    println!("{}", ans);
}


Measured memory_bytes: 2072
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d;
     cin>>n>>t;a=1005;
     while(n--){

        cin>>c>>x;
        if(x<=t){
            a=min(c,a);
        }

     }if(a==1005){
            cout<<"TLE"<<endl;
        }
        else{
            cout<<a<<endl;
        }

     return EXIT_SUCCESS;
}





Measured memory_bytes: 256
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
const ll N = 1e6+1;
void solve(){
	ll a , b ;
	cin>>  a >> b ;
	cout<<a*b<<endl;
	
}
int main(){
	//mahakal(),fast;
	ll t=1 ;
	// cin>> t;
	while(t--)solve();

	return 0;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

struct Node {
  vector<int> to;
  vector<int> cost;
  vector<p> detail;
  bool done = false;
  int minCost = INT_MAX;
  int from_node = -1;
};

map<p, bool> used;

void shortest_route();

int djikstra(vector<Node> v, int start, int goal){
  int nodeNum = int(v.size());
  v[start].minCost = 0;
  int now = start;
  while(true) {
    v[now].done = true;
    if(now == goal) {
      int i = now;
      while(true){
        if(v[i].from_node == -1) break;
        used[{i, v[i].from_node}] = true;
        used[{v[i].from_node, i}] = true;
        i = v[i].from_node;
      }
      return v[now].minCost;
    }
    int edgeNum = int(v[now].to.size());
    for (int i = 0; i < edgeNum; i++) {
      int nextNodeIndex = v[now].to[i];
      if(v[nextNodeIndex].minCost > v[now].minCost + v[now].cost[i]){
        v[nextNodeIndex].minCost = v[now].minCost + v[now].cost[i];
        v[nextNodeIndex].from_node = now;
      }
    }

    int minNodeIndex = -1;
    int minNodeCost = INT_MAX;
    for (int i = 0; i < nodeNum; i++) {
      if(i == now) continue;
      if(minNodeCost > v[i].minCost && !v[i].done){
        minNodeIndex = i;
        minNodeCost = v[i].minCost;
      }
    }
    now = minNodeIndex;
  }
}

int res = 0;

int main(){
  int node_num, edge_num;
  cin >> node_num >> edge_num;
  vector<Node> v(node_num);
  for (int i = 0; i < edge_num; i++) {
    int to, from, cost;
    cin >> from >> to >> cost;
    to--;from--;
    v[from].to.push_back(to);
    v[from].cost.push_back(cost);
    v[to].to.push_back(from);
    v[to].cost.push_back(cost);
  }

  for (int i = 0; i < node_num - 1; i++) {
    for (int j = i + 1; j < node_num; j++) {
      if(i == j) continue;
      djikstra(v, i, j);
    }
  }
  cout << edge_num - int(used.size()) / 2 << endl;

}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <unordered_map>
#include <assert.h>
using namespace std;

#define ran(i, a, b) for ((i) = (a); (i) < (b); (i)++)
#define rep(i, a) ran ((i), 0, (a))
#define rep1(i, a) ran ((i), 1, (a)+1)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
#define _0 first
#define _1 second
#define _pb(x) push_back(x)
#define _mp(x, y) make_pair(x, y)
#if defined(SHIROKO1_LOCAL) && !defined(NDEBUG)
#define DEBUG(...) fprintf(stderr, "[DEBUG] " __VA_ARGS__)
#else
#define DEBUG(...) ((void)0)
#endif



int main()
{
	int N, M, R;
	static ll D[256][256];
	cin >> N >> M >> R;
	vi r;
	int i, j, k;
	while (R--){
		int x;
		cin >> x;
		r._pb(x);
	}
	rep1 (i, N)
	rep1 (j, N)
		D[i][j] = 1LL<<60;;
	while (M--) {
		int a, b, c;
		cin >> a >> b >> c;
		D[a][b] = c;
		D[b][a] = c;
	}
	rep1 (k, N)
	rep1 (i, N)
	rep1 (j, N)
		D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
	sort(r.begin(), r.end());
	ll ans = 1LL<<60;
	do {
		int p = -1;
		ll s = 0;
		for (int i : r) {
			if (p != -1)
				s += D[p][i];
			p = i;
		}
		ans = min(ans, s);
	} while (next_permutation(r.begin(), r.end()));
	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
    int n, ans = 0;
    cin >> n;
    string st[4] = {"AC", "WA", "TLE", "RE"};
    map<string, int> mp;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        mp[s] += 1;
    }
    for(int i = 0; i < 4; i++){
        cout << st[i] << " x " << mp[st[i]] << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int maxt(int x){
  return (x+9)/10*10;
}
int ret(int x){
  return maxt(x)-x;
}
int main(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  int sum = maxt(a)+maxt(b)+maxt(c)+maxt(d)+maxt(e);
  sum -= max({ret(a),ret(b),ret(c),ret(d),ret(e)});
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  string s[N];
  int sz[N];
  for(int i=0;i<N;i++){
    cin >> s[i];
    sz[i] = s[i].size();
  }

  int cntAB = 0;
  for(int i=0;i<N;i++){
    for(int j=0; j<sz[i] - 1; j++){
      if(s[i][j] == 'A' && s[i][j+1] == 'B') cntAB++;
    }
  }

  int sB = 0;
  int eA = 0;
  int sBeA = 0;
  for(int i=0;i<N;i++){
    if(s[i][0] == 'B' && s[i][sz[i]-1] == 'A') sBeA++;
    else if(s[i][0] == 'B') sB++;
    else if(s[i][sz[i]-1] == 'A') eA++;
  }

  int ans = cntAB;
  if(sBeA == 0){
    ans += min(sB, eA);
  }
  else{
    if(sB == 0 && eA == 0){
      ans += sBeA - 1;
    }
    else if(sB == 0 || eA == 0){
      ans += sBeA;
    }
    else{
      ans += sBeA + 1;
      ans += min(sB - 1, eA - 1);
    }
  }

  cout << ans << endl;
  return 0;




}


Measured memory_bytes: 896