akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <memory>
#include <map>
#include <array>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl
 
//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)
 
 
 
template<typename node_type>
class Node{
public:
    explicit Node(vector<node_type> _children,node_type _parent) : children(_children),parent(_parent){};
    ~Node(){};
    vector<node_type> children=NULL;
    node_type parent;
    int depth = -1;
    int condition_num;
 
    void children_print(){
        if(children.size()==0){
              return;
        }else{
            int n = children.size()-1;
            REP(i,n){
                cout << children[i] << ", ";
            }
            cout << children[n];
        }
    }
};
 
template<typename node_type>
class Tree{
public:
    map<node_type, Node<node_type> > tree;
     
    void parent_set(){
        for(auto x:tree){
            for(auto y :x.second.children){
 
                tree.at(y).parent = x.first;
 
            }
        }
    }
    void depth_set(){
        for(auto &x:tree){
        int tmp = 0;
        node_type tmp_node_key = x.first;
        while(tree.at(tmp_node_key).parent!=tmp_node_key){
            tmp++;
             
            tmp_node_key = tree.at(tmp_node_key).parent;
             
        }
 
        x.second.depth = tmp;
    }
    }
};
 
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
    int n;
    cin >> n;
    Tree<int> t;
 
    int tmp,m,tmp_node_key;
    vector<int> tmp_node_children;
    REP(i,n){
        cin >> tmp_node_key;
         
        cin >> m;
        REP(j,m){
            cin >> tmp;
 
            tmp_node_children.push_back(tmp);
 
        }
        t.tree.insert(make_pair(tmp_node_key, Node<int>(tmp_node_children,tmp_node_key)));
        tmp_node_children.clear();
    }
 
    t.parent_set();
    t.depth_set();
 
    for(auto x:t.tree){
        cout << "node " << x.first << ": parent = "<<((x.second.parent!=x.first) ? x.second.parent : -1);
 
        cout << ", depth = "<<x.second.depth;
        cout << ", ";
 
     
        if(x.second.parent==x.first){
            cout << "root";
        }else{
 
            if(x.second.children.size()==0){
                cout << "leaf";
            }else{
                cout << "internal node";
            }
       }
        cout<< ", [";
        x.second.children_print();
         
        cout <<"]"<<  endl;
    }
 
    return 0;
}


Measured memory_bytes: 13296
#include<iostream>

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


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

long long h[1000000];
int main(int argc, char const *argv[]) {
    long long n, k, cnt=0;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    sort(h,h+n);
    for(int i=0;i<n-k;i++){
        cnt+=h[i];
    }
    cout << cnt << endl;
    return 0;
}




Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

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

  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0;i < N; i++) {
    cin >> a[i];
  }
  int minus = 0 , sum = 0;
  int Mn = inf;
  for(int i = 0; i < N; i++){
    if(a[i] < 0) minus++;
    Mn = min(Mn , abs(a[i]));
    sum += abs(a[i]);
  }

  if(minus % 2) {
    sum -= 2 * Mn;
  }
  cout << sum << '\n';


}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;

	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		
		var amari = p[0] - p[1];
		
		if(p[1] == 1)
		{
			Console.WriteLine(0);
			return;
		}
		Console.WriteLine(amari);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

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

int main(){
    int n;
    cin>>n;
    int a,b;
    vector<pair<int,int>> red,blue;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        red.push_back(make_pair(a,b));
    }
    for(int i=0;i<n;i++){
        cin>>a>>b;
        blue.push_back(make_pair(a,b));
    }

    sort(red.begin(),red.end());
    sort(blue.begin(),blue.end());
    reverse(red.begin(),red.end());
    reverse(blue.begin(),blue.end());

    int ans=0;
    int t=1e5;
    for(int i=0;i<n;i++){
        int k=-1;
        t=1e5;
        for(int j=0;red[i].first<blue[j].first;j++){
            if(red[i].second<blue[j].second && t>blue[j].second-red[i].second){
                k=j;
                t=blue[j].second-red[i].second;
            }
        }
        if(k!=-1){
            ans++;
            blue[k].second=-1;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }

int n;

int dist(int x1, int y1, int x2, int y2) {
    return abs(x1 - x2) + abs(y1 - y2);
}

int main() {
    scanf("%d", &n);
    int t0 = 0, x0 = 0, y0 = 0;

    bool ok = true;
    rep(i, n) {
        int t, x, y; scanf("%d%d%d", &t, &x, &y);
        int d = dist(x0, y0, x, y);
        int dt = t - t0;
        if (d > dt) {
            ok = false; break;
        }
        int df = dt - d;
        if (df % 2 != 0) {
            ok = false; break;
        }
        t0 = t; x0 = x; y0 = y;
    }

    puts(ok ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 256
// 
#include <bits/stdc++.h>
#define endl "\n"
#define _GLIBCXX_DEBUG //配列外参照エラー表示,gcc依存
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ipair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n;
    vector<int> dp(50);
    cin>>n;
    dp[0]=1,dp[1]=1;
    for(int i=2;i<=n;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 3172
fun main(args: Array<String>) {
    val need = intArrayOf(0, 2, 5, 5, 4, 5, 6, 3, 7, 6)
    val arr = readLine()!!.split(" ").map { s -> s.toInt() }
    var n = arr[0]
    val a = readLine()!!.split(" ").map { s -> s.toInt() }.sortedBy { need[it]*10 - it }
    var prev =-1
    a.filter { (prev!=need[it]).apply { prev = need[it] } }

    val maxDigArr = arrayOfNulls<Int>(n+1)
    val maxDigArrN = arrayOfNulls<Int>(n+1)
    maxDigArr[0]=0
    fun maxDig(matchc:Int):Int{
        if(matchc<0)return -1
        if( maxDigArr[matchc]==null){
            maxDigArr[matchc]=-1
            a.forEach{ai->
                maxDig(matchc-need[ai]).let {
                    if(it>maxDigArr[matchc]!!){
                        maxDigArr[matchc]=it
                        maxDigArrN[matchc]=ai
                    }else if(maxDigArr[matchc]!=-1&&it==maxDigArr[matchc]!!&&maxDigArrN[matchc]!!<ai){
                        maxDigArrN[matchc]=ai
                    }
                }
            }
            if(maxDigArr[matchc]!=-1)maxDigArr[matchc]=maxDigArr[matchc]!!+1
        }
        return maxDigArr[matchc]!!
    }
    maxDig(n)
    while(n>0) {
        print(maxDigArrN[n]!!)
        n -= need[maxDigArrN[n]!!]
    }
}

Measured memory_bytes: 43304
#include <stdio.h>

#define N 100

int main(){
  int M[N][N];
  int n, u, k, v, i, j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j] = 0;
    }
  }


  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }


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

  return 0;
}


Measured memory_bytes: 2052
#include <iostream>
#include <list>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
using namespace std;

#define sqr(x) ((x) * (x))
#define INF 10000000

double dptable[1 << 13][13];
double used[1 << 13][13];
double cost[13][13];
int vertex;
int width;

double xdistance(double r1, double r2) {
	if(r1 == 0 || r2 == 0)
		return max(r1, r2);
	return sqrt(sqr(r1 + r2) - sqr(r1 - r2));
}

void pre(string str) {
	vector<int> radius;
	stringstream sstr(str);
	int tmp;

	radius.push_back(0);
	sstr >> width;
	while(sstr >> tmp)
		radius.push_back(tmp);
	vertex = radius.size();

	/* cost */
	for(int i = 0; i < radius.size(); i++) {
		for(int j = 0; j < radius.size(); j++) {
			cost[i][j] = xdistance(radius[i], radius[j]);
		}
		cost[i][i] = 0;
	}

	/* dptable */
	for(int i = 0; i < 1 << 13; i++) {
		for(int j = 0; j < 13; j++) {
			dptable[i][j] = INF;
		}
	}

	/* used */
	for(int i = 0; i < 1 << 13; i++) {
		for(int j = 0; j < 13; j++) {
			used[i][j] = false;
		}
	}

	dptable[(1 << vertex) - 1][0] = 0;
}

double solve(int S, int u) {
	if(!used[S][u]) {
		for(int i = 0; i < vertex; i++) {
			if(!(S & (1 << i))) {
				dptable[S][u] = min(dptable[S][u], solve(S | (1 << i), i) + cost[u][i]);
			}
		}
		used[S][u] = true;
	}

	return dptable[S][u];
}

int main(void) {
	string str;

	while(getline(cin, str)) {
		pre(str);
		solve(0,0);

		if(width >= dptable[0][0])
			cout << "OK" << endl;
		else
			cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 2896
#include <iostream>
#include <vector>
#include <list>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <iomanip>
#include <queue>
#include <map>

int main()
{
 
	int K, X;
 
	std::cin >> K >> X;
 
	int min = X-(K-1);
	int max = X+(K-1);

	if(min < -1000000){
		min = -1000000;
	}
	if(max > 1000000){
		max = 1000000;
	}

	for(int i=0;i<max-min+1;i++){
			std::cout <<  min+i << " ";
	}
 
 
}

Measured memory_bytes: 256
participant, initial, quiz = map(int, input().split())
# 初期点-クイズ数を初期点数として正解ごとに点数を足し最終スコアを出す．
point = [initial - quiz]*participant
for i in range(quiz):
  a = int(input())
  point[a-1] += 1
for i in range(participant):
  if point[i] < 1:
    print('No')
  else:
    print('Yes')


Measured memory_bytes: 6596
from sys import stdin, setrecursionlimit, stdout
#setrecursionlimit(1000000) #use "python" instead of "pypy" to avoid MLE
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
#from heapq import heapify, heappop, heappush, heapreplace, heappushpop
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return list(mi())
def si(): return stdin.readline().rstrip()
def lsi(): return list(si())
#mod=1000000007
res=['YES', 'NO']





test_case=1
while test_case:
    test_case-=1




    n=ii()+999
    x=n//1000
    print(x*1000-n+999)

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll A,B;
    bool flg[3];
    mem0(flg);
    cin >> A >> B;
    flg[A-1] = true;
    flg[B-1] = true;
    for (int i = 0; i < 3; i++) {
        if(flg[i] == false){
            cout << i+1 << endl;
        }
    }
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	ll n; cin >> n;
	VI d(n), c(n); REP(i, n) cin >> d[i] >> c[i];
	ll cc = 0,dc = 0;
	REP(i, n) {
		cc += c[i];
		dc += d[i] * c[i];
	}
	cout << (cc - 1) + (dc - 1) / 9;
}

Measured memory_bytes: 3328
#include <iostream>
#define EVER (;;)
using namespace std;

int main() {
    int a, b;
    char op;
    bool flag = false;
    for EVER {
        cin >> a >> op >> b;
        switch (op) {
            case '+':
                cout << a+b << endl;
                break;
            case '-':
                cout << a-b << endl;
                break;
            case '*':
                cout << a*b << endl;
                break;
            case '/':
                cout << a/b << endl;
                break;
            default:
                flag = true;
                break;
        }
    if (flag) break;
    }
    return 0;
}


Measured memory_bytes: 3096
import sys

sys.setrecursionlimit(100000)

def main():
    n = int(input())
    G = [[] for _ in range(n)]
    ID = [dict() for _ in range(n)]
    for i in range(n - 1):
        a, b = map(lambda x: int(x) - 1, input().split())
        G[a].append(b)
        G[b].append(a)
        ID[a][b] = i
        ID[b][a] = i
    m = max(len(g) for g in G)
    ans = [0] * (n - 1)
    def bfs(a, pre = -1, pre_c = -1):
        color = 1
        for b in G[a]:
            if b == pre: continue
            if color == pre_c: color += 1
            ans[ID[a][b]] = color
            bfs(b, a, color)
            color += 1

    bfs(0)
    print(m)
    [print(a) for a in ans]
      
if __name__ == '__main__':
    main()


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

int main() {
  int N, K;
  cin >> N >> K;
  int S;
  
  for(int i = 0; i < N; i++){
    int x;
    cin >> x ;
    if (x < (K + 1) / 2) {
      S += 2 * x;
    }
    else {
      S += 2 * (K - x);
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

const ll mod = 998244353;

int main(){
    int n;
    cin>>n;
    int k;  cin>>k;
    vector<pair<int, int>>dic(k);
    rep(i, k)   cin>>dic[i].first>>dic[i].second;
    vector<ll>dp(n), sdp(n+1);
    dp[0] = 1;
    sdp[1] = 1;
    for(int i = 1; i < n; i++){
        for(auto p : dic){
            int l = max(0, i-p.second);
            int r = max(0, i-p.first+1);
            (dp[i] += (mod + sdp[r] - sdp[l]) % mod ) %= mod;
        }
        (sdp[i+1] = sdp[i] + dp[i]) %= mod;
    }
    cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 6396
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};

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

int t,p,r;

void solve(){
  map<int,PI> app;
  rep(i,t) app[i+1]=mp(0,0);
  map<PI,int> tr;
  set<PI> ok;
  rep(i,r){
    int tid,pi,ti;
    string s;
    cin >> tid >> pi >> ti >> s;
    if(ok.count(mp(tid,pi))) continue;
    if(s[0]=='W'){
      tr[mp(tid,pi)]++;
    }else{
      ++app[tid].F;
      app[tid].S+=ti+tr[mp(tid,pi)]*1200;
      ok.insert(mp(tid,pi));
    }
  }
  vector<pair<PI,int> > team;
  FOR(it,app) team.pb(mp(mp(-it->S.F,it->S.S),it->F));
  sort(ALL(team));
  FOR(it,team) cout << it->S << ' ' << -it->F.F << ' ' << it->F.S << endl;
}

int main(int argc, char *argv[])
{
  while(cin >> t >> p >> r && t|p|r) solve();
  return 0;
}

Measured memory_bytes: 1272
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

int main()
{
	int A, B;
	cin >> A >> B;
	cout << A * B << endl;
	return 0;
}


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

ll ebob(ll a, ll b){
	if(a == 0) return b;
	return ebob(b%a, a);
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	string s, t; cin>>s>>t;
	cout<<t<<s;
	return 0;
}

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

int main(){

    int n,m;
    cin >> n >> m;

    vector<int> a(n);

    rep(i,n)cin >> a[i];

    sort(a.begin(),a.end(),greater<int>());

    vector<pair<int,int>> cb(m);

    rep(i,m){
        cin >> cb[i].second >> cb[i].first ;
    }

    sort(cb.begin(),cb.end(),greater<pair<int,int>>());
    
    vector<int> aa(n,0);
    int id=0;
    for(int i=0;i<a.size();i++){
        aa[i]=cb[id].first;
        cb[id].second--;
        if(cb[id].second==0){
            id++;
        }
        if(id==m)break;
    }

    id=0;
    sort(aa.begin(),aa.end());
    rep(i,n){
        if(aa[i]<=a[id]){
            aa[i]=a[id];
            id++;
        }
    }
    ll su=0;
    rep(i,n){
        su+=aa[i];
    }

    cout << su << endl;

    return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long[] a = new long[3 * N];
    for(int i = 0; i < 3 * N; i++) {
      a[i] = sc.nextLong();
    }
    long[] sumMax = new long[N + 1];
    PriorityQueue<Long> pq1 = new PriorityQueue<Long>();
    for(int i = 0; i < N; i++) {
      sumMax[0] += a[i];
      pq1.add(a[i]);
    }
    for(int i = 1; i < N + 1; i++) {
      pq1.add(a[N - 1 + i]);
      long min = pq1.poll();
      sumMax[i] = sumMax[i - 1] + a[N - 1 + i] - min;
    }
    long[] sumMin = new long[N + 1];
    PriorityQueue<Long> pq2 = new PriorityQueue<Long>(N, Collections.reverseOrder());
    for(int i = 0; i < N; i++) {
      sumMin[0] += a[3 * N - 1 - i];
      pq2.add(a[3 * N - 1 - i]);
    }
    for(int i = 1; i < N + 1; i++) {
      pq2.add(a[2 * N - i]);
      long max = pq2.poll();
      sumMin[i] = sumMin[i - 1] + a[2 * N - i] - max;
    }
    long ans = -(long)Math.pow(10, 15);
    for(int i = 0; i < N + 1; i++) {
      ans = Math.max(ans, sumMax[i] - sumMin[N - i]);
    }
    System.out.println(ans);
  }
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    while (cin >> n)
    {
        int p[2 * n] = {};
        for (int i = 2; i <= (int)sqrt(2 * n); i++)
        {
            if (p[i] == 0)
            {
                for (int j = 2; i * j <= 2 * n; j++)
                {
                    p[i * j] = 1;
                }
            }
        }
        int bp, ap;
        for (int i = n - 1; i >= 2; i--)
        {
            if (p[i] == 0)
            {
                bp = i;
                break;
            }
        }

        for (int i = n + 1; i <= 2 * n; i++)
        {
            if (p[i] == 0)
            {
                ap = i;
                break;
            }
        }
        cout << bp << " " << ap << endl;
    }
    return 0;
}


Measured memory_bytes: 3464
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long c = sc.nextLong();
    long left = 2 * (a * b + b * c + c * a);
    long right = a * a + b * b + c * c;
    if (c - a - b > 0 && left < right) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


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

int main()
{
    int a, h, n;
    scanf(" %d %d", &h, &a);

    if(h>= 1 && a >= 1 && h <= 1E4 && a <= 1E4){
        if(h%a == 0)
            n = h/a;
        else if(h%a != 0)
            n = h/a +1;
        printf("%d", n);
    }
    return 0;
}

Measured memory_bytes: 128
import collections
N = int(input())
A = list(map(int,input().split()))
C = collections.Counter(A).most_common()
CC = sorted(C,key=lambda x: -x[0])
AA = 0
BB = 0
for cc in CC:
    if AA == 0 and cc[1] >= 4:
        AA = cc[0]
        BB = cc[0]
        break
    if AA == 0 and cc[1] >= 2:
        AA = cc[0]
        continue
    if BB == 0 and cc[1] >= 2:
        BB = cc[0]
        break
print(AA*BB)

Measured memory_bytes: 21540
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

struct custom_tf : std::numpunct<char> {
  std::string do_truename() const { return "YES"; }
  std::string do_falsename() const { return "NO"; }
};

struct Initializer {
  Initializer() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(0);
    std::cout << std::fixed << std::setprecision(15) << std::boolalpha;
    std::cout.imbue(std::locale(std::cout.getloc(), new custom_tf));
  }
} initializer;

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename T>
std::ostream &operator<<(std::ostream &os, const std::set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
std::ostream &operator<<(std::ostream &os, const std::map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { std::cout<<'\n'; }
template<class T> inline void print(const T &x) { std::cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { std::cout<<x<<", "; print(y...); }
#define dump(...) std::cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);std::cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }


int main() {
  int n; cin>>n;
  vector<int> d(n); cin>>d;
  int m; cin>>m;
  vector<int> t(m); cin>>t;
  sort(d.begin(), d.end());
  sort(t.begin(), t.end());
  int i=0, j=0;
  while (i<n && j<m) {
    if (d[i]==t[j]) ++i, ++j;
    else ++i;
  }
  if (j==m) print(true);
  else print(false);

  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string s;
int n;
int main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "a", stdout);
    // #endif
    cin >> s;
    n = s.size();
    if(s[n - 1] == 's') s += "es";
    else    s += 's';
    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 3632
# coding: utf-8

class Stack:
    def __init__(self):
        self.data = []

    def push(self, d):
        self.data.append(d)

    def pop(self):
        if not self.data:
            return None
        else:
            return self.data.pop()

    def print(self):
        print(self.data)

s = Stack()

input_data = input()
#input_data = "1 2 +"
#input_data = "1 2 + 3 4 - *"

# push data in stack
for d in input_data.split(' '):
    if d == "+":
        s.push(s.pop() + s.pop())
    elif d == "-":
        tmp1 = s.pop()
        tmp2 = s.pop()
        s.push(tmp2 - tmp1)
    elif d == "*":
        tmp1 = s.pop()
        tmp2 = s.pop()
        s.push(tmp2 * tmp1)
    else:
        s.push(int(d))

print(s.pop())
    




Measured memory_bytes: 5600
class WeightsUnionfind:
  def __init__(self,n):
    self.Tree=[i for i in range(n)]
    self.dWeights=[0]*n
    self.rank=[0]*n
    self.wrong=0

  def find(self,x):
    if x==self.Tree[x]:
      return x
    else:
      root=self.find(self.Tree[x])
      self.dWeights[x]=self.weigh(x)
      self.Tree[x]=root
      return root
  
  def weigh(self,x):
    if x==self.Tree[x]:
      return 0
    else:
      w=self.weigh(self.Tree[x])+self.dWeights[x]
      return w

  def unite(self,x,y,w):
    s1=self.find(x)
    s2=self.find(y)
    if s1==s2:
      if self.weigh(y)-self.weigh(x)!=w:
        self.wrong=1
    else:
      if self.rank[s1]>self.rank[s2]:
        self.Tree[s2]=s1
        self.dWeights[s2]=self.weigh(x)-self.weigh(y)+w
      elif self.rank[s1]<self.rank[s2]:
        self.Tree[s1]=s2
        self.dWeights[s1]=self.weigh(y)-self.weigh(x)-w
      else:
        self.Tree[s2]=s1
        self.rank[s1]+=1
        self.dWeights[s2]=self.weigh(x)-self.weigh(y)+w
          
N,M=map(int,input().split())
wuf=WeightsUnionfind(N)
F=0
for m in range(M):
  l,r,d=map(int,input().split())
  wuf.unite(l-1,r-1,d)
if wuf.wrong==1:
  print("No")
else:
  print("Yes")
    

  
      
    
      
      

Measured memory_bytes: 10016
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,x,y,m=0;
	scanf("%d%d%d%d",&n,&k,&x,&y);
	m += x*k;
	if(n-k>0){
	printf("%d",(n-k)*y + (k*x));	
	}
	else{
		printf("%d",n*x);
	}
}

Measured memory_bytes: 384
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int M = Integer.parseInt(sc.next());
    Map<Integer, List<Integer>> map = new HashMap<>();
    for(int i = 0; i < M; i++){
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      if(map.get(a) == null){
        map.put(a, new ArrayList<>());
        map.get(a).add(b);
      }else{
        map.get(a).add(b);
      }
    }
    
    String ans = "IMPOSSIBLE";
    for(int i = 0; i < map.get(1).size(); i++){
      int n = map.get(1).get(i);
      if(map.get(n) != null){
        if(map.get(n).contains(N)){
          ans = "POSSIBLE";
          break;
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 102316
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REP1(i, n) for (int i = 1; i < n + 1; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    REP(i, 3)
    {
        cout << s[i];
    }
}


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            char[]ss = sc.next().toCharArray();
            Arrays.sort(ss);
            s[i] = new String(ss);
        }
        Map<String,Integer> map = new HashMap<>();
        long ans = 0;
        for(int i = 0; i < n; i++) {
            String key = s[i];
            if(map.containsKey(key)) {
                ans += map.get(key);
                map.put(key, map.get(key) + 1);
            }else {
                map.put(key, 1);
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 67904
#include <stdio.h>
#pragma warning(disable : 4996)
int d[5]; bool p[3];
int main() {
	while (true) {
		for (int i = 0; i < 3; i++) p[i] = false;
		for (int i = 0; i < 5; i++) {
			scanf("%d", &d[i]);
			if (d[i] == 0) break;
			p[d[i] - 1] = true;
		}
		if (d[0] == 0) break;
		if (p[0] && p[1] && p[2]) {
			for (int i = 0; i < 5; i++) {
				printf("3\n");
			}
		}
		else if ((p[0] ? 1 : 0) + (p[1] ? 1 : 0) + (p[2] ? 1 : 0) == 1) {
			for (int i = 0; i < 5; i++) {
				printf("3\n");
			}
		}
		else {
			if (p[0] && p[1]) {
				for (int i = 0; i < 5; i++) {
					if (d[i] == 1) {
						printf("1\n");
					}
					else {
						printf("2\n");
					}
				}
			}
			if (p[1] && p[2]) {
				for (int i = 0; i < 5; i++) {
					if (d[i] == 2) {
						printf("1\n");
					}
					else {
						printf("2\n");
					}
				}
			}
			if (p[2] && p[0]) {
				for (int i = 0; i < 5; i++) {
					if (d[i] == 3) {
						printf("1\n");
					}
					else {
						printf("2\n");
					}
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 2612
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    long long int M=0,N=0,m_counter=0;
    long long int sum=0;
    scanf("%lld %lld",&N,&M);
    long long int A[N];
    for(long long int i=0;i<N;i++){
        scanf("%lld",&A[i]);
        // mx = max(mx,A[i]);
        sum += A[i];
    }
    std::sort(A,A+N);
    for(long long int i=0;i<N;i++){
        if(A[i]>=(sum/(4.0*M))) m_counter++;
    }
    if(m_counter>=M)printf("Yes\n");
    else printf("No\n");
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPEACH(i,k) for(auto& i:k)
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;


signed main() {
	int n,m;
	cin >> n >> m;
	multiset<int> a;

	REP(i,n){
		int tmp;
		cin >> tmp;
		a.insert(tmp);
	}
	REP(i,m){
		auto itr=a.end();
		itr--;
		int tmp=*itr;
		tmp/=2;
		a.erase(itr);
		a.insert(tmp);
	}
	int ans=0;
	REPEACH(i,a){
		ans+=i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <queue>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector <long long> comfort(N);

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

    sort(comfort.begin(), comfort.end(), greater<int>());

    priority_queue <long long> pq;
    pq.push(comfort[0]);
    long long ans = 0;

    for (int i = 1; i < N; ++i) {
        long long topVal = pq.top();
        ans += topVal;
        pq.pop();

        pq.push(comfort[i]);
        pq.push(comfort[i]);
    }

    cout << ans << endl;

    return 0;
}

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

#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)
 
using namespace std;

typedef long long ll;
const ll MOD=1e9+7;
using pear = pair<int,int>;

int main(){
    ll n; cin>>n;
    vector<ll> num(n);
    rep(i,n-1){
        ll now;
        cin>>now; now--;
        num[now]++;
    }
    rep(i,n) cout<<num[i]<<endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<string> city(N);
    vector<int> point(N);
    vector<int> order(N);
    vector<int> answer(N);

    for (int i = 0; i < N; i++) {
        cin >> city.at(i);
        cin >> point.at(i);
    }

    for (int j = 0; j < N; j++) {
        for (int k = 0; k < N; k++) {
            if (j == k) {
                continue;
            }
            if (city.at(j).compare(city.at(k)) == 0) {
                if (point.at(j) < point.at(k)) {
                    order.at(j)++;
                }
            }
            else if (city.at(j).compare(city.at(k)) > 0) {
                order.at(j)++;
            }
        }
        order.at(j)++;
    }
    for (int l = 0; l < N; l++) {
        for (int j = 0; j < N; j++) {
            if (order.at(j) == l + 1) {
                answer.at(l) = j;
            }
        }
        cout << answer.at(l) + 1 << endl;
    }
}

Measured memory_bytes: 256
// When you are using the gcc compiler, you need only the following lines.
// #include <bits/stdc++.h>

// When you are using other compilers, you need the following line instead.
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long


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

	int n, m;
	cin >> n >> m;

	vector<string> A, B;
	REP(ny, n)
	{
		string tmp;
		cin >> tmp;
		A.push_back(tmp);
	}
	REP(my, m)
	{
		string tmp;
		cin >> tmp;
		B.push_back(tmp);
	}

	bool success = false;

	REP(ly, n)
	{
		REP(lx, n)
		{
			if (ly + m - 1 >= n || lx + m - 1 >= n)
				continue;

			bool matched = true;
			REP(y, m)
			{
				REP(x, m)
				{
					if (A[ly + y][lx + x] != B[y][x])
						matched = false;
				}
			}

			if (matched) success = true;
		}
	}

	if (success)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}

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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b;
	cin >> a >> b;
	int ans = -1;
	for (int i = 1;i <= 100000;++i) {
		int x = (i*8)/100;
		int y = (i*10)/100;
		if (x == a && y == b) {
			ans = i;
			break;
		}
	}
	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 3660
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int>>
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long>>
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int main(){
    DRII(N,K);
    int now=1;
    REP(i,N){
        now=min(now*2,now+K);
    }
    cout<<now;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  map<char,int> m;
  cin >> s;
  for (size_t i = 0; i < s.length(); i++) {
    m[s[i]]++;
  }
  bool t=true;
  for(auto x:m){
    if(x.second%2 != 0){
      t=false;
      break;
    }
  }
  if(t){
    cout << "Yes";
  }else{
    cout << "No";
  }
}


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

int main(){
    int a,b,c;
    cin >>a>>b>>c;
    if(a+b+c>=22){
        cout<<"bust"<<endl;
    }else{
        cout<<"win"<<endl;
    }
}

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

int main()
{
  ll n;
  ll sum = 0;

  cin >> n;

  vector<ll> a(n);
  rep(i, n) cin >> a.at(i);

  rep(i, n) sum += a.at(i) - 1;

  cout << sum;
}


Measured memory_bytes: 3600
#include <stdio.h>

#define N 10

int main(void){
  int w[N] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  int i, j, d, ans[N];

  while(scanf("%d", &d) != EOF){
    for(i = N-1; i >= 0; i--){
      if(d >= w[i]){
	ans[i] = 1;
	d -= w[i];
      }else{
	ans[i] = 0;
      }
    }
    j = 0;
    for(i = 0; i < N; i++){
      if(ans[i] == 1){
	if(j > 0){
	  printf(" ");
	}
	printf("%d", w[i]);
	j++;
      }
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
 
int main() {
  int n;
  vector<int>v(3);
  rep(i, 0, 3)cin >> v[i];
  cin >> n;
  sort(v.begin(), v.end(), greater<int>());
  int cnt = 0;
  int m = n/v[0]; 
  rep(i, 0, m+1){
      int tempn = n;
      tempn -= v[0]*i;
      while(tempn >=0){
          if(tempn%v[2]==0){
              cnt++;
              //cout << tempn << endl;
           }
          tempn -= v[1];
        }
    }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d, g; cin >> d >> g;
    vi p(d), c(d);
    for (int i = 0; i < d; i++) { cin >> p[i] >> c[i]; }
    int ans = 1e9;
    for (int i = 0; i < (1 << d); i++) {
        int cnt = 0;
        int sum = 0;
        for (int j = 0; j < d; j++) {
            if (i & (1 << j)) {
                cnt += p[j];
                sum += p[j] * (j + 1) * 100 + c[j];
            }
        }
        if (sum >= g) {
            ans = min(ans, cnt);
            continue;
        }
        for (int j = d - 1; j >= 0; j--) {
            if (i & (1 << j)) continue;
            for (int k = 1; k < p[j]; k++) {
                cnt += 1;
                sum += (j + 1) * 100;
                if (sum >= g) break;
            }
            if (sum >= g) break;
        }
        if (sum >= g) {
            ans = min(ans, cnt);
            continue;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	char s[1003];
	scanf("%s", s);
	int i = 0;
	while (s[i] != '\0')
		i++;
	i--;
	if (s[i] == 's')
		printf("%ses\n", s);
	else
		printf("%ss\n", s);
	return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(){
        int N;
        map<char,bool> used;
        string str="PWGY";
        cin >> N;
        for(int i=0 ; i<N ; i++ ){
                char s;cin >> s;
                used[s]=true;
        }
        int counter=0;
        for(int i=0 ; i<str.size() ; i++ )
                if(used[str[i]])counter++;
        if(counter>=4)
                cout<<"Four"<<endl;
        else
                cout<<"Three"<<endl;
        return 0;
}

Measured memory_bytes: 256
<?php 
$n = fgets(STDIN);
$a = explode(' ', fgets(STDIN));
$b = explode(' ', fgets(STDIN));
$c = explode(' ', fgets(STDIN));
$ans = $b[$a[0]-1];
for($i = 1; $i<$n+1; $i++){
    $A = $a[$i];
    $B = $b[$A-1];
    $ans += $B;
    if($a[$i-1] + 1 == $A){
        $ans += $c[$A-2];
    }
}
echo $ans;

Measured memory_bytes: 3576
import sys
input = sys.stdin.buffer.readline

mod = 998244353
n,s = map(int,input().split())
a = list(map(int,input().split()))


dp = [[0]*(s+1) for i in range(n)]

for i in range(n):
    if i == 0:
        dp[0][0] = 2
        if a[i] < s+1:
            dp[0][a[i]] = 1
        continue

    for j in range(s+1):
        dp[i][j] = dp[i-1][j]*2 %mod
        if j >= a[i]:
            dp[i][j] = (dp[i][j] + dp[i-1][j-a[i]])%mod

print(dp[-1][-1]%mod)
    


Measured memory_bytes: 135356
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ini(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long

int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//ll tt;	cin>>tt;	while(tt--)
	{
		ll n,ans;
		cin>>n;
		ans=0;

		ll x=n/500;
		ans=x*1000;
		n-=500*x;

		ans+=5*(n/5);

		cout<<ans;

 	
 	}
	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
		
		
return 0;
}

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

int main()
{
	int n;
    cin>>n;
    int ac=0,tle=0,wa=0,re=0;
    while(n--)
    {
        string s;
        cin>>s;
        if(s[0]=='A')
            ac++;
        if(s[0]=='T')
            tle++;
        if(s[0]=='R')
            re++;
        if(s[0]=='W')
            wa++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    
	return 0;
}

Measured memory_bytes: 3620