akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
using namespace std;

typedef long long ll;


constexpr int MAX_N = 500003;
constexpr ll mod = 998244353;
ll fact[MAX_N], inv[MAX_N];

ll powm(ll x, ll p) {
	if (p == 0) return 1;
	ll res = powm(x, p / 2);
	res *= res;
	res %= mod;
	if (p % 2LL == 1) {
		res *= x;
		res %= mod;
	}
	return res;
}

void init_fact() {
	fact[0] = inv[0] = 1;
	for (ll i = 1; i < MAX_N; i++) {
		fact[i] = fact[i - 1] * i;
		fact[i] %= mod;
		inv[i] = powm(fact[i], mod - 2);
	}
}

// aCb
ll C(ll a, ll b) {
	ll res = fact[a];
	res *= inv[b];
	res %= mod;
	res *= inv[a - b];
	return res%mod;
}


int main() {
	ll n, A, B, K; cin >> n >> A >> B >> K;
	init_fact();
	ll ans = 0;
	for (ll i = 0; i <= n; i++) {
		if (K < i*A) continue;
		if ((K - i*A) % B != 0) continue;
		ll j = (K - i*A) / B;
		if (j > n) continue;
		ans += C(n, i)*C(n, j) % mod;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <stdio.h>

typedef long long ll;

using namespace std;

#define rep(i,n) for(int i=0;i!=(n);++i)



int main(int argc, const char * argv[]) {
    
    int L,R,d;
    cin>>L>>R>>d;
    
    int count=0;
    
    for(int i=L;i<=R;++i){
        if(i%d==0){
            ++count;
        }
    }
    
    cout<<count<<endl;
 
    return 0;
}


Measured memory_bytes: 3588
d,g=map(lambda x: int(x), input().split())
p=[0]*d
c=[0]*d
for i in range(d):
    p[i],c[i]=map(lambda x: int(x), input().split())

scr_comp=[0]*d
scr_no_comp=[0]*d
for i in range(d):
    scr_comp[i]=p[i]*(i+1)*100+c[i]
    scr_no_comp[i]=(p[i]-1)*(i+1)*100

ans=sum(p)
for i in range(2**d):
    scr_tmp=0
    num_tmp=0
    for j in range(d):
        if i&(2**j):
            scr_tmp+=scr_comp[j]
            num_tmp+=p[j]
    if scr_tmp >= g:
        ans=min(ans, num_tmp)
        continue
    for j in range(d-1, -1, -1):
        if i&(2**j):
            continue
        if scr_tmp + scr_no_comp[j] >= g:
            num_tmp+=(g-scr_tmp)//((j+1)*100)
            num_tmp+=1 if ((g-scr_tmp)%((j+1)*100)!=0) else 0
            ans=min(ans, num_tmp)
        else:
            scr_tmp+=scr_no_comp[j]
            num_tmp+=p[j]-1
print(ans)

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

#define lld long long
#define pi pair<int,int>
#define pl pair<lld,lld>
#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>())

int main() {
    int X,N;
    bool flg[110];
    cin >> X >> N;
    mem0(flg);
    for (int i = 0; i < N; i++) {
        int p;
        cin >> p;
        flg[p] = true;
    }
    int ans;
    int now = X;
    while(1){
        if(flg[now] == false){
            ans = now;
            break;
        }
        now--;
    }
    now = X;
    while(1){
        if(flg[now] == false){
            if(abs(X-ans) > abs(now-X)){
                ans = now;
            }
            break;
        }
        now++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
  #include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
  using namespace std;
using namespace __gnu_pbds;
  #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define double long double
  #define all(v) v.begin(),v.end()
  #define rep(i,a,b) for(int i = a; i <=b; i++)
  #define rep2(i,a,b) for(int i = a; i>=b; i--)
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const double PI = acos(-1);
  const int N = 200005;
  int mod = 1e9 + 7;
     

    
int32_t main()
{
       


     int a,b;
     cin >> a>> b;
     cout << a* b/(__gcd(a,b));

     
   return 0;
}       

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string w;
  string t;
  cin >> w;
  int i;
  for(i=0;i<w.size();i++) {
    if('A'<=w[i]&&w[i]<='Z') w[i]+='a'-'A';
  }
  int o=0;
  cin >> t;
  while(t!="END_OF_TEXT"){
  
    for(i=0;i<t.size();i++) {
      if('A'<=t[i]&&t[i]<='Z') t[i]+='a'-'A';
    }
    if(w==t) o++;
    cin >> t;
  }
  cout << o << endl;
}


Measured memory_bytes: 3204
#include<iostream>
using namespace std;
int main(){
    int count=0;
    int N,H,W;
    cin>>N>>H>>W;
    for(int i=1;i<=N;++i){
        int A,B;
        cin>>A>>B;
        if(A>=H&&B>=W){
            ++count;
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		long N = long.Parse(str);
		string[] str2 = Console.ReadLine().Split();
		long[] A = new long[N];
		long[] B = new long[N];
		long sum = 0;
		for(var i=0;i<N;i++){
			A[i] = long.Parse(str2[i]);
			sum += A[i];
			B[i] = sum;
		}
		long ans = 999999999999999999;
		long sum1 = 0;
		long sum2 = 0;
		long sum3 = 0;
		long sum4 = 0;
		long a1 = 0;
		long a2 = 1;
		long a3 = 2;
		while(true){
			while(true){
				sum1 = B[a1];
				sum2 = B[a2]-B[a1];
				sum3 = B[a3]-B[a2];
				sum4 = B[N-1]-B[a3];
				if(a1+1 == a2){
					break;
				} else if(sum1 < sum2-A[a1+1]){
					a1 += 1;
				} else {
					break;
				}
			}
			while(true){
				sum1 = B[a1];
				sum2 = B[a2]-B[a1];
				sum3 = B[a3]-B[a2];
				sum4 = B[N-1]-B[a3];
				if(a3+1 == N-1){
					break;
				} else if(sum3 < sum4-A[a3+1]){
					a3 += 1;
				} else {
					break;
				}
			}
			sum1 = B[a1];
			sum2 = B[a2]-B[a1];
			sum3 = B[a3]-B[a2];
			sum4 = B[N-1]-B[a3];
			ans = Math.Min(ans,Math.Max(Math.Max(Math.Max(sum1,sum2),sum3),sum4) - Math.Min(Math.Min(Math.Min(sum1,sum2),sum3),sum4));
			if(a2 == N-3){
				break;
			} else {
				a2 += 1;
				if(a3==a2){
					a3 += 1;
				}
			}
		}
		Console.WriteLine(ans);
	}
}

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

using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define clr(x) x.clear()
#define LOG(x) std::cout << x << std::endl;

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265359;

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

int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    string s="";
    int v=abs(d-b),h=abs(c-a),tot=h+v;
    for(int i=0;i<v;++i){
        s+="U";
    }
    for(int i=0;i<h;++i){
        s+="R";
    }
    for(int i=0;i<tot;++i){
        if(s[i]=='U'){
            s+="D";
        }
        if(s[i]=='R'){
            s+="L";
        }
    }
    string t="";
    t+="L";
    for(int i=0;i<=v;++i){
        t+="U";
    }
    for(int i=0;i<=h;++i){
        t+="R";
    }
    t+="DR";
    for(int i=0;i<=v;++i){
        t+="D";
    }
    for(int i=0;i<=h;++i){
        t+="L";
    }
    t+="U";
    cout<<s+t<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{

	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();

		if((x + r > W || x - r < 0) || (y + r > H || y - r < 0)) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

}


Measured memory_bytes: 26352
from sys import stdin
input = stdin.readline


class PrimeComb:
  def __init__(self, MAX=510000, MOD=1000000007):
    self.MAX  = MAX
    self.MOD  = MOD
    self.fac  = [0]*MAX
    self.inv  = [0]*MAX
    self.finv = [0]*MAX
    self.fac[0]  = self.fac[1] = 1
    self.finv[0] = self.finv[1] = 1
    self.inv[1]  = 1
    for i in range(2, MAX):
      self.fac[i]  = self.fac[i-1] * i % MOD
      self.inv[i]  = MOD - self.inv[MOD % i] * int(MOD / i) % MOD
      self.finv[i] = self.finv[i-1] * self.inv[i] % MOD

  def com(self, n, k):
    # compute -> nCk % self.P
    if (n < k): return 0
    if (n < 0 or k < 0): return 0
    return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.MOD) % self.MOD


def prime_fatorization(n):
  from collections import defaultdict
  # a = []
  a = defaultdict(int)
  while not(n % 2):
    # a.append(2)
    a[2] += 1
    n //= 2
  f = 3
  while f * f <= n:
    if not(n % f):
      # a.append(f)
      a[f] += 1
      n //= f
    else:
      f += 2
  if n != 1:
    # a.append(n)
    a[n] += 1
  return a


def main():
  N, M = list(map(int, input().split()))

  PC = PrimeComb(200000)
  P = prime_fatorization(M)
  ans = 1
  for k in P.values():
    ans *= PC.com(N-1+k, k)
    # print(N-1+k, 'C', k, PC.com(N-1+k, k))
  print(ans % 1000000007)


if(__name__ == '__main__'):
  main()

Measured memory_bytes: 72972
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int N;
vector<vector<int>> graph(100000), ko(100000);
vector<int> oya(100000, -1), deaph(100000);

void KI(int n) {
    for (int v : graph[n]) {
        if (v != oya[n]) {
            oya[v] = n;
            ko[n].push_back(v);
            deaph[v] = deaph[n] + 1;
            KI(v);
        }
    }
    return;
}

int SIZE(int n) {
    int ans = 1;
    for (int v : ko[n]) {
        ans += SIZE(v);
    }
    return ans;
}

int main() {
    cin >> N;
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        graph[a - 1].push_back(b - 1);
        graph[b - 1].push_back(a - 1);
    }
    
    deaph[0] = 0;
    KI(0);
    int x = deaph[N - 1] - 1;
    int n = N - 1;
    rep(i, x / 2) n = oya[n];
    
    int SNUKE = SIZE(n);
    int FENNEC = N - SNUKE;
    if (FENNEC > SNUKE) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
    return 0;
}


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

int64_t comb(int a, int b)
{
    if (b == 0)
        return 1;

    return comb(a - 1, b - 1) * a / b;
}

int main()
{
    cin.tie(0);

    int n, p;
    cin >> n >> p;

    int odd = 0, even = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a % 2 == 0)
            even++;
        else
            odd++;
    }

    int64_t ans = 0;

    for (int o = p % 2; o <= odd; o += 2) {
        for (int e = 0; e <= even; e++) {
            ans += comb(odd, o) * comb(even, e);
        }
    }

    cout << ans << endl;

    return 0;
}


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

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

	ld ans = 0;
	rep(i, n) {
		string u;
		ld x;
		cin >> x >> u;
		if (u == "JPY") ans += x;
		else ans += x * 380000;
	}
	cout << setprecision(10);
	cout << ans << endl;
}

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

using namespace std;

int addTax(int base, int tax)
{
  return base * (100 + tax) / 100;
}
int sumPrice(int item1, int item2, int tax)
{
  return addTax(item1, tax) + addTax(item2, tax);
}

int main()
{
  int x, y, s;
  while(cin >> x >> y >> s, x || y || s){
    int ans = 0;
    for(int p = 1; p <= s; p++){
      for(int q = 1; q <= s; q++){
	//cout << p << " " << q << " " << sumPrice(p, q, x) << endl;
	if(sumPrice(p, q, x) == s) ans = max(ans, sumPrice(p, q, y));
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
N,Y = map(int,input().split())
Y_prime = Y - 1000*N
a_max = Y_prime//9000
Y_rest = 0
for a in range(a_max+1):
    Y_rest = Y_prime-9000*a
    if Y_rest%4000 == 0:
        b = Y_rest//4000
        c = N - a - b
        if c >= 0:
            print(a,b,c)
            break
else:
    print('-1 -1 -1')

Measured memory_bytes: 3064
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

//#define int long long
//#define endl "\n"
#define fi first
#define se second
#define fr front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}




int main() {
	map<char, int>m;
	char c1='0', c2;
	string s;
	cin >> s;
	rep(i, 4) {
		if (!m.count(s[i])) {
			m[s[i]] = 1;
			c1 == '0' ? c1 = s[i] : c2 = s[i];
		}
		else {
			m[s[i]]++;
		}
	}
	if (m.size() == 2 && m[c1] == 2 && m[c2] == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}



Measured memory_bytes: 256
s=input()
n=len(s)-1
ans=0

for i in range(2**n):
  bag=['']*n
  for j in range(n):
    if (i>>j)&1:
      bag[j]='+'

  shiki=''
  for i,j in zip(s,bag+['']):
    shiki+=(i+j)
  
  ans+=eval(shiki)

print(ans)

Measured memory_bytes: 3188
package main
import "fmt"
var  (N int
     t[100000] int
      M int
      P [100]int
      X [100]int
     )
func main(){
  fmt.Scanln(&N)
  sum := 0
  for i:=0;i< N;i++{
    fmt.Scan(&t[i])
    sum += t[i]
  }
  fmt.Scanln(&M)
  for i:=0;i<M;i++{
    fmt.Scan(&P[i],&X[i])
    fmt.Println(sum - t[P[i] - 1]+X[i])
  }
  
  
	

}

Measured memory_bytes: 512
N, W = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(N)]

# Wの最大が大きすぎて計算間に合わないので最大最小変換を行う
# dp[i+1][j]：i番目までのアイテムをナップザックに入れられるとき、価値がjとなる最小の重み
dp = [{} for i in range(N+1)]
dp[0][0] = 0


for i, (w,v) in enumerate(wv):
    for v0, w0 in dp[i].items(): # dictのキーと値に対してfor、i-1番目までのアイテムについて考える
        if v0 in dp[i+1]: # 
            dp[i+1][v0] = min(dp[i+1][v0], w0) # 同じ価値でさらに軽いものがある場合はそれを最小の重みに指定
        else:
            dp[i+1][v0] = w0 # 価値v0のものが今までのアイテムになければ、それを最小の重みに指定
        
        if w0+w > W: # 或る価値に対する最小重みに、現在のアイテムの重みを足して上限を超える場合は、今の価値についてそのアイテムは選択対象外
            continue # 
        if v0+v in dp[i+1]: # 今までの価値+新しく選んだものの価値 がi番目までのアイテムを選んだ時に既に存在する場合
            dp[i+1][v0+v] = min(dp[i+1][v0+v], w0+w)
        else:
            dp[i+1][v0+v] = w0+w


print(max(dp[-1].keys())) # 全部選んでいいときに価値として起こりうるものの最大

Measured memory_bytes: 286856
import sys
import collections
import bisect


def main():
    n = int(input())
    A = list(map(int, input().split()))
    B = [0] * n
    for i in range(n):
        B[A[i] - 1] = str(i + 1)
    print(" ".join(B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
using namespace std;
long long INF = 1000000009;
map<int, int> mp;
int main()
{
	string s;
	cin >> s;
	int n = s.size();
	int ans = 999;
	for (int i = 0; i <= n - 3; i++) {
		int num = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + s[i + 2] - '0';
		ans = min(ans, abs(num - 753));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define ll long long
#define P pair<int, int>

using namespace std;
int mod = 1000000007;

int W, H, N;
int main() {
  cin >> W >> H >> N;
  int x1, x2, y1, y2;
  x1 = 0;
  x2 = W;
  y1 = 0;
  y2 = H;
  rep(i, N) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a==1) {
      x1 = max(x, x1);
    } else if (a==2) {
      x2 = min(x, x2);
    } else if (a==3) {
      y1 = max(y, y1);
    } else {
      y2 = min(y, y2);
    }
  }

  int xx = max(0, x2-x1);
  int yy = max(0, y2-y1);
  cout << xx*yy << endl;
}


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

int gcd(int a, int b){
    while(a != b){
        if(a > b) a -= b;
        else b -= a;
    }
    return a;
}

int main(void){
    int k, res = 0;
    cin >> k;
    for(int i = 1; i <= k; ++i){
        for(int j = 1; j <= k; ++j){
            for(int l = 1; l <= k; ++l){
                res += gcd(gcd(i, j), l);
            }
        }
    }   
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll a, b, dp[2100][2100], x[2100], y[2100];
int main() {
	cin >> a >> b;
	REP(i, a)cin >> x[i];
	REP(i, b)cin >> y[i];
	REP(i, a) {
		REP(j, b) {
			dp[i + 1][j + 1] += dp[i][j + 1] + dp[i + 1][j];
			if (x[i] == y[j]) dp[i + 1][j + 1]++;
			else dp[i + 1][j + 1] -= dp[i][j];
			dp[i + 1][j + 1] = (dp[i + 1][j + 1] + MOD * 3) % MOD;
		}
	}
	cout << dp[a][b] + 1 << endl;
}


Measured memory_bytes: 33152
use proconio::{fastout, input};
use std::collections::BTreeSet;

#[fastout]
fn main() {
    input! {
        x: i32,
        n: usize,
        p: [i32; n],
    }

    let set: BTreeSet<_> = p.iter().collect();

    let mut ans = None;
    for i in 0.. {
        if !set.contains(&(x - i)) {
            ans = Some(x - i);
            break;
        }
        if !set.contains(&(x + i)) {
            ans = Some(x + i);
            break;
        }
    }

    println!("{}", ans.unwrap());
}


Measured memory_bytes: 2208
program codefestival2016qualb
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,a,b,i
    integer(int32):: qualifier, foregin_qualifier
    character(:),allocatable:: s
    logical:: yes

    read*, n,a,b
    allocate(character(n):: s)
    read*, s
    qualifier = 0
    foregin_qualifier = 0

    do i=1,n
        if (qualifier >= a+b) then
            yes = .false.
        else if (s(i:i) == 'a') then
            yes = .true.
            qualifier=qualifier+1
        else if (s(i:i) == 'b') then
            if (foregin_qualifier >= b) then
                yes = .false.
            else
                yes = .true.
                qualifier=qualifier+1
                foregin_qualifier=foregin_qualifier+1
            end if
        else
            yes = .false.
        end if

        if (yes) then
            print'(a)', 'Yes'
        else
            print'(a)', 'No'
        end if
    end do
end program codefestival2016qualb

Measured memory_bytes: 1384
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main(void){
    while (true){
        int h, w;
        cin >> h >> w;
        if (h == 0 || w == 0) break;
        for (int i = 0; i < h; i++){
            for (int j = 0; j < w; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int cnt = 0;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '+') cnt++;
        else cnt--;
    }
    cout << cnt;
}

Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1]*n
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x,y = y,x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)


N, M = map(int, input().split())
uf = UnionFind(N+1)
for i in range(M):
  x, y, z = map(int, input().split())
  uf.union(x, y)

ans = 0
for i in range(1, N+1):
  if uf.parents[i] < 0:
    ans += 1
print(ans)

Measured memory_bytes: 69720
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdlib.h>
#define ll long long
#define MOD_P 1000000007
using namespace std;



int main()
{
	string str;

	cin >> str;

	if (str[2] == str[3] && str[4] == str[5]) {
		printf("Yes");
	} else {
		printf("No");
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int n_3 = n / 100;
    if(n % 10 <= n_3 && (n / 10) % 10 <= n_3) {
      System.out.println(n_3 * 100 + n_3 * 10 + n_3);
    }else {
      System.out.println((n_3 + 1) * 100 + (n_3 + 1) * 10 + (n_3 + 1));
    }
  }

}


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

int main() {
	int h, w;
	while (true) {
		cin >> h >> w;

		if (h == 0 && w == 0) break;

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i == 0 || i == h - 1 || j == 0 || j == w - 1) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3076
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include<iostream>
using namespace std;

typedef long long ll;

const int maxn = 1e6;

ll qmul(ll n, ll m, ll p) {
    ll res = 0;
    while (m) {
        if (m & 1) res = (res + n) % p;
        n = n * 2 % p;
        m >>= 1;
    }
    return res;
}

ll qpow(ll x, ll n, ll p) {
    ll res = 1;
    while (n) {
        if (n & 1) res = qmul(res, x, p);
        n >>= 1;
        x = qmul(x, x, p);
    }
    return res;
}

ll phi(ll n) {
    ll ans = n;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            ans = ans / i * (i - 1);
            while (n % i == 0) n /= i;
        }
    }
    if (n > 1) ans = ans / n * (n - 1);
    return ans;
}

ll gcd(ll n, ll m) {
    return m == 0 ? n : gcd(m, n % m);
}


ll solve(ll p, ll mod) {
    int ans = 0;
    ll s = sqrt(1.0 * p);
    for (ll i = 1; i <= s; i++) {
        if (p % i == 0) {
            if (qpow(10ll, i, mod) == 1) {
                return i;
            }
        }
    }

    for (ll i = s - 1; i >= 1; i--) {
        if (p % i == 0) {
            if (qpow(10ll, p / i, mod) == 1) {
                return p / i;
            }
        }
    }
    return 0;
}

int main() {
    ll L;
    int kase = 0;
    while (cin>>L) {
        ll d = gcd(L, 7);
        ll mod = 9 * L / d;
        ll p = phi(mod);

        if (gcd(mod, 10) != 1) {
            cout << "-1\n";
            continue;
        }
        ll ans = solve(p, mod);
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N;
	long long sum;
	cin>>N;
	vector<long long>a(N);
	for(int i=0;i<N;i++) cin>>a[i];
	vector<long long>dp(N+1);
	sum=a[0];
	for(int i=2;i<=N;i++)
		if(i%2==0) dp[i]=max(a[i-1]+dp[i-2],sum);
		else {
			dp[i]=max(a[i-1]+dp[i-2],dp[i-1]);
			sum+=a[i-1];
		}
	cout<<dp[N]<<"\n";
	return 0;
}

Measured memory_bytes: 6240
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
  int n,k;
 cin>>n>>k;
int arr[n];
for(int i=0;i<n;i++)
{
	cin>>arr[i];

}
int dp[n];
if(k>=n)
{
  cout<<arr[n-1]-arr[0]<<endl;
  return 0;
}

for(int i=1;i<=k;i++)
{
	dp[i]=abs(arr[i]-arr[0]);
}
for(int i=k+1;i<n;i++)
{  dp[i]=INT_MAX;
	for(int j=1;j<=k;j++)
	{
		int temp=abs(arr[i]-arr[i-j])+dp[i-j];
		dp[i]=min(temp,dp[i]);
	}
}
cout<<dp[n-1]<<endl;

return 0;

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;

signed _main(){
  int A,B,N; cin >> A >> B >> N;
  cout << A*min(N,B-1)/B << endl;
  return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < (n);i++)
#define lint long long
const lint mod=1e9+7;
const lint inf=2.19e15+1;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
struct Edge {
    long long to;
};
using Graph = vector<vector<Edge>>;



signed main(){
    int n;
    cin >> n;
    int cnt = 0;
    bool flag = true;
    REP(i,n){
        int x, y;
        cin >> x >> y;
        if (x==y){
            cnt += 1;
        }
        else{
            cnt = 0;
        }
        if (cnt==3){
            cout << "Yes" << endl;
            flag = false;
        }
    }
    if (flag)
        cout << "No" << endl;
}

Measured memory_bytes: 3620
from itertools import product

INF = 1000000007

def mat2_mul(X, Y):
	z = [[0, 0], [0, 0]]
	for (i, j, k) in product(range(2), range(2), range(2)):
		z[i][j] += X[i][k] * Y[k][j]
	return z

def mat2_pow(X, n):
	if n == 0:
		return [[1, 0], [0, 1]]
	elif n % 2:
		return mat2_mul(X, mat2_pow(X, n - 1))
	else:
		half_pow = mat2_pow(X, n / 2)
		return mat2_mul(half_pow, half_pow)

def fib(n):
	if n == 0:
		return 0
	else:
		f = [[0, 1], [1, 1]]
	return mat2_pow(f, n - 1)[1][1]


N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
ans, start = 1, 0
tmp = []

for i in range(len(a)):
	if a[i] - a[i - 1] == 1:
		print(0)
		exit()

for k in a:
	ans *= fib(k - start)
	ans %= INF
	start = k + 1

ans *= fib(N - start + 1)
print(ans % INF)


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

ll k(ll x){
  ll kk=0;
  while(x>0){
    kk++;
    x/=10;
  }
  return kk;
}

ll f(ll a,ll b){
  return max(k(a),k(b));
}

int main(){
  ll n,ans=100100100100100;cin>>n;
  for(ll i=1;i*i<=n;i++){
    if(n%i) continue;
    ans=min(ans,f(i,n/i));
  }
  
  cout<<ans;
}

Measured memory_bytes: 256
import heapq
inf = 10**18
def dijkstra(s, n, G):#スタート, 頂点数, グラフ:[[(cost, v)], ...]
    dist = [inf]*n
    edges = []#(sからvまでのコストの候補, v)
    dist[s] = 0
    for e in G[s]:
        heapq.heappush(edges, e)
    while edges:
        cost, v = heapq.heappop(edges)
        if dist[v] != inf:
            continue
        dist[v] = cost
        for c, nv in G[v]:
            if dist[nv] == inf:
                heapq.heappush(edges, (cost + c, nv))
    return dist
mx = 5005
n, m, s = map(int, input().split())
g = [[] for _ in range(n*mx)]
for i in range(m):
    u, v, a, b = map(int, input().split())
    u-=1
    v-=1
    for j in range(mx):
        if j>=a:
            g[u*mx+j].append((b, v*mx+j-a))
            g[v*mx+j].append((b, u*mx+j-a))
for i in range(n):
    c, d = map(int, input().split())
    for j in range(mx-c):
        g[i*mx+j].append((d, i*mx+j+c))
dist = dijkstra(min(s, mx-1), len(g), g)
for i in range(1, n):
    res = inf
    for j in range(mx):
        res = min(res, dist[i*mx+j])
    print(res)



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

int main() {
  int A, B;
  cin >> A >> B;

  string ans = "Draw";
  if (A != 1 && B != 1) {
    if (A > B)
      ans = "Alice";
    if (A < B)
      ans = "Bob";
  } else {
    if (A == 1 && B != 1)
      ans = "Alice";
    if (A != 1 && B == 1)
      ans = "Bob";
  }

  cout << ans << endl;
}

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

#define INFTY (1 << 30)

void maxHeapify(int);
int Extract();
void IncreseKey(int,int);
void Insert(int);

int n, A[2000001];

int main(){
  int key;
  char str[10];

  while(1){
    scanf("%s",str);

    if(str[0] == 'e' && str[1] == 'n') break;
    else if(str[0] == 'i'){
      scanf("%d",&key);
      Insert(key);
    }
    else printf("%d\n",Extract());
  }

  return 0;
}

void maxHeapify(int x){
  int right, left, largest;
  int tmp;
  left = 2 * x;
  right = 2 * x + 1;

  if(left <= n && A[left] > A [x]) largest = left;
  else largest = x;

  if(right <= n && A[right] > A[largest]) largest = right;

  if(largest != x){
    tmp = A[x];
    A[x] = A[largest];
    A[largest] = tmp;

    maxHeapify(largest);
  }
}

int Extract(){
  int max;
  if(n < 1) return -INFTY;
  max = A[1];
  A[1] = A[n--];
  maxHeapify(1);
  return max;
}

void IncreseKey(int x, int key){
  int tmp;
  if(key < A[x]) return;
  A[x] = key;
  while(x > 1 && A[x / 2] < A[x]){
    tmp = A[x];
    A[x] = A[x / 2];
    A[x / 2] = tmp;
    x = x / 2;
  }
}

void Insert(int x){
  n++;
  A[n] = -INFTY;
  IncreseKey(n, x);
}



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


int main(void){
  int n,c = 1, in, b4 = -1, f = 0;
  cin>>n;

  cin>>b4;
  for(int i = 0 ; i < n -1 ; i ++){
    cin>>in;
    if( b4 < in ){
      if( f >= 0 ) f = 1;
      if( f == -1 ){
        f = 0;
        c ++;
      }
    }
    if( b4 > in ){      
      if( f <= 0 ) f = -1;
      if( f == 1 ){
        f = 0;
        c ++;
      }
    }
    b4 = in;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

bool contain(int mask, int position){
    if((mask & (1 << position)) != 0) return true;
    else return false;
}

int main(void){
	string s; cin >> s;
	int n = s.size() - 1;
	
	ll sum = 0;
	for(int mask = 0; mask < (1 << n); ++mask){
		int l = 0;
		ll tmp = 0;
		// printf("kk\n");
		int j;
        for (j = 0; j < n; ++j){
        	// printf("%d\n", j);
            //jビット目が立っているとき
            if(contain(mask, j)){
            	// printf("ok\n");
            	// printf("mas %d\n", mask);
            	string t = s.substr(l, j - l + 1);
            	// printf("ok\n");
            	ll num = std::stoll(t);
            	// printf("num %lld\n", num);
            	tmp += num;
            	l = j + 1;
            }
        }
        // printf("mas %d\n", mask);
        string t = s.substr(l, j - l + 1);
        ll num = stoll(t);
        // printf("num %lld\n", num);
        tmp += num;
        sum += tmp;
    }
    printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 256
from sys import stdin
 
while True:
    (a, op, b) = stdin.readline().split(' ')
    a = int(a)
    b = int(b)
    if op == "?":
        break;
    elif op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)

Measured memory_bytes: 6724
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using static System.Math;

namespace _20190511
{
    class Program
    {
        public static void Main(string[] args)
        {
            using (var sc = new SetConsole())
            {
                long n = long.Parse(GetString());
                long sum = 0;
                var divisors = new List<long>();

                for (long i = 1; i <= (long)Pow(n, 0.5); i++)
                {
                    if (n % i == 0)
                    {
                        divisors.Add(i);

                        if (i != n / i)
                        {
                            divisors.Add(n / i);
                        }
                    }
                }
                divisors.ForEach(d =>
                {
                    if (d - 1 == 0) { return; }
                    if (n / (d - 1) != n % (d - 1)) { return; }
                    sum += d - 1;
                });

                CWrite(sum);
            }
        }

        static void CWrite<T>(T str) => Console.WriteLine(str);
        static string GetString() => Console.ReadLine();
        static T[] GetArray<T>()
        {
            var t = typeof(T);
            var str = Console.ReadLine();
            if (t == typeof(string))
            {
                return (T[])(object)str.Split();
            }
            if (t == typeof(int))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            throw new NotSupportedException($"{t} is not supported.");
        }
    }



    class SetConsole : IDisposable
    {
        readonly StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
        public SetConsole()
        {
            sw.AutoFlush = false;
            Console.SetOut(sw);
        }
        public void Dispose()
        {
            Console.Out.Flush();
            sw.AutoFlush = true;
            Console.SetOut(sw);
        }
    }

    static class ExtentionsLibrary
    {
        public static T[] ToNumArray<T>(this string str)
        {
            var t = typeof(T);
            if (t == typeof(int))
            {
                return (T[])(object)str.Split().Select(int.Parse).ToArray();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.Split().Select(long.Parse).ToArray();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.Split().Select(double.Parse).ToArray();
            }
            throw new NotSupportedException();
        }
        public static int ToInt(this string str) => int.Parse(str);
    }
}


Measured memory_bytes: 13268
A,B,M = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a)+min(b)
for i in range(M):
    x, y, c = list(map(int,input().split()))
    tmp = a[x-1] + b[y-1] - c
    ans = min(tmp,ans)
print(ans)

Measured memory_bytes: 18612
N = int(input())
xlist = list(map(int,input().split()))
xlist = [0]+xlist+[0]
div = []
n = len(xlist)-1
for i in range(n):
    div.append(abs(xlist[i+1]-xlist[i]))
al = sum(div)
for i in range(n-1):
    print(al-div[i]-div[i+1]+abs(xlist[i+2]-xlist[i]))

Measured memory_bytes: 14048
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli A,B,C,D;
  string a,b,c;
  cin >>A;
  B=(A/15)*200;
  A*=800;
  
  Out(A-B);
}


Measured memory_bytes: 256
n, m = map(int, input().split())
dic = {}
for i in range(n):
	x = list(map(int, input().split()))
	for i in range(x[0]+1):
		if i == 0:
			continue
		if x[i] in dic:
			dic[x[i]] += 1
		else:
			dic[x[i]] = 1
cnt = 0
for i in dic.keys():
	if dic[i] == n:
		cnt += 1
print (cnt)

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define IOS             ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define read            freopen("in.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
#define loop(i,a,b)     for (int i = a; i <= b; i++)
#define rloop(i,a,b)    for (ll i = a; i >= b; i--)
#define ll              long long int
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rall(a)         a.rbegin(),a.rend()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd((a),(b))
#define lcm(a,b)        ((a)*(b))/(gcd(a,b))
#define sq(a)           (a)*(a)
#define sz(a)           a.size()
#define mod             1000000007
#define PI              2*acos(0.0)

int main()
{
    IOS
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll n;
        cin>>n;
        cout<<(n*(n-1))/2;

    }
    return 0;
}


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

int main() {
  
	string s;
   cin >> s;
  
  int ans =0,ant=0;
  
  for(int i=0;i<s.size()-1;i++){
    
    
    if(s[i] != s[i+1]){
      ans++;
    }
  }
  
  cout << ans << endl;
}
  

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

int main() {
	
	int n[3],i;
	
	for(i=0; i<3; i++){ 
		cin >> n[i];
	}
	sort(n,n+3);
	
	cout << n[0] << " " << n[1] << " " << n[2] << endl;
	
	return 0;
}

Measured memory_bytes: 1180
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});
process.stdin.on('end', () => {
  const nums = content
    .trim()
    .split('\n')
    .map(n => parseInt(n, 10))
    .filter(n => n !== 0);
  nums.forEach((n, i) => console.log(`Case ${i + 1}: ${n}`))
});


Measured memory_bytes: 23180
import java.util.*
 
fun main(args: Array<String>){
  
  val(a,b,c,d,e) = readLine()!!.split(" ").map{it.toInt()}
 
  when(a+b+c+d+e){
    14 -> print("1")
    
    13 -> print("2")
    
    12 -> print("3")
    
    11 -> print("4")
    
    10 -> print("5")
    
    else -> print("error")
  }
  
}

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

int main() {
	string s;
	cin>>s;
	vector<char> v;
	for(int i=0;i<s.size();i++){
		if(v.size()){
			if(s[i]=='T'){
				if(v.back()=='S'){
					v.pop_back();
					continue;
				}
			}
		}
		v.push_back(s[i]);
	}
	cout<<v.size()<<endl;
	return 0;
}


Measured memory_bytes: 772
# 2020年6月17日

# 修行という概念がない場合、消化コストを大から小に並べて食べにくさを小から大に並べて順にマッチングさせれば良い。
# そうでない状態から2つを交換したときに最大値が下がる方向にしか行かないため。

# 修行をするなら最大値を引き下げるところに修行をするのが最適なので、
# 無修行状態の結果を優先度付きキューに入れる→K回最大値を取り出してコストを引いて再投入→を繰り返す。
# 本当か? やってるうちに最適な組み合わせが変わらないか? →変わらない。食べにくさを昇順に並べたときに消化コストが降順になるのが最善手なので。
# あとKが大きいのでこれだと間に合わない。

# 決め打ち二分探索か?
# あ、それだわ。

# Python TLE 2秒以上
# PyPy 287ms

n, k = map(int, input().split())
people = list(map(int, input().split()))
foods = list(map(int, input().split()))

# 食べにくさは昇順（小から大）、人間は降順（大から小）
foods.sort()
people.sort(reverse=True)

def is_valid(time):
    # k回以下の修行で実現可能か

    n_train = 0
    for i in range(n):
        if foods[i] * people[i] <= time:
            pass
        else:
            n_train += people[i] - time // foods[i]
    
    return n_train <= k


time_ok = 2 * 10 ** 12
time_ng = -1  # 計算上、is_valid(-1) = Trueになることはあるが、二分探索の方法から言ってこれで正しいはず

while abs(time_ok - time_ng) > 1:
    mid = (time_ok + time_ng) // 2
    if is_valid(mid):
        time_ok = mid
    else:
        time_ng = mid

print(time_ok)


Measured memory_bytes: 103980
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct CumulativeSum{
    vector<int> data;
    CumulativeSum(int sz) : data(sz, 0) {};
    void add(int k, int x){
        data[k] += x;
    }
    void build(){
        for(int i = 1; i < data.size(); i++){
            data[i] += data[i - 1];
        }
    }
    int query(int k){
        if(k < 0) return 0;
        return (data[min(k, (int)data.size() - 1)]);
    }
    int query(int l, int r){
        return query(r - 1) - query(l - 1);
    }
};

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    CumulativeSum cs(n);
    rep(i, 0, n) cs.add(i, s[i] == '.');
    cs.build();
    // all #
    int ans = cs.query(0, n);
    // ....####
    //    i
    rep(i, 0, n){
        int ld = cs.query(0, i + 1);
        int ls = i + 1 - ld;
        int rd = cs.query(i + 1, n);
        ans = min(ans, ls + rd);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2196
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            String word = sc.next();
            if (list.contains(word)) {
                System.out.println("No");
                return;
            } else {
                list.add(word);
            }
        }
        for (int i = 1; i < n; i++) {
            String tmp = list.get(i);
            String bef = list.get(i - 1);
            String tmp_first = tmp.substring(0,1);
            String bef_last = bef.substring(bef.length() - 1, bef.length());
            if (!tmp_first.equals(bef_last)) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}

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

int a, b, C = ~(1<<31), M = (1<<16)-1;
int r() {
  a = 36969 * (a & M) + (a >> 16);
  b = 18000 * (b & M) + (b >> 16);
  return (C & ((a << 16) + b)) % 1000000;
}

class HappySequence{
public:
	map<int,int> seq;
	HappySequence(){ int inf = 1e9; seq[-inf] = -inf; }
	bool insert(int key,int val){
		if( (--seq.upper_bound(key))->second >= val ) return false;
		seq[key] = val;
		auto it = ++seq.find(key);
		while( it != seq.end() && (*it).second <= val ) seq.erase(it++);
		return true;
	}
};

HappySequence seg[1000100];

void ins(int y,int z,int v){
	for(int i = y ; i < 1000100 ; i += i & -i ) seg[i].insert(z,v);
}
int get(int y,int z){
	int v = 0;
	for(int i = y ; i > 0 ; i -= i & -i ){
		v = max(v,(--seg[i].seq.lower_bound(z))->second);
	}
	return v;
}

int main(){
	int n,m,A,B;
	while( cin >> m >> n >> A >> B && n+m ){	
		a = A;
		b = B;
		vector< array<int,3> > ps;
		vector<int> uy;
		for(int i = 0 ; i < m ; i++){	
			int x,y,z;
			cin >> x >> y >> z;
			ps.push_back(array<int,3>{x,y,z});
			uy.push_back(y);
		}
		for(int i = 0 ; i < n ; i++){
			int x = r();
			int y = r();
			int z = r();
			ps.push_back(array<int,3>{x,y,z});
			uy.push_back(y);
		}
		sort(uy.begin(),uy.end());
		uy.erase(unique(uy.begin(),uy.end()),uy.end());
		for(int i = 0 ; i <= uy.size() ; i++) seg[i] = HappySequence();
		sort(ps.begin(),ps.end(),[&](array<int,3> a,array<int,3> b){
			if( a[0] != b[0] ) return a[0] < b[0];
			return make_pair(a[1],a[2]) > make_pair(b[1],b[2]);
		});
		int ans = 0;
		for( auto p : ps ){
			p[1] = lower_bound(uy.begin(),uy.end(),p[1]) - uy.begin() + 1;
			int mx = get(p[1]-1,p[2]) + 1;
			ans = max(ans,mx);
			ins(p[1],p[2],mx);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 159324
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


int main()
{
    int a,b,c,d;//かっている数//最大100
  priority_queue<int> v;
    
    cin >> a >> b >> c;
  
  v.push(a);
  v.push(b);
  v.push(c);
    
  a =v.top();
  v.pop();
  b =v.top();
  v.pop();
  c = v.top();


    cout << (abs(a-b) + abs(b-c) ) << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var length = int.Parse(Console.ReadLine());
            var otoshidama = new double[length];
            var jpyOrBtc = new string[length];

            for (int i = 0; i < length; i++)
            {
                var input = Console.ReadLine().Split(' ');
                otoshidama[i] = double.Parse(input[0]);
                jpyOrBtc[i] = input[1];
            }

            double goukei = 0;

            for (int i = 0; i < length; i++)
            {
                if (jpyOrBtc[i] == "JPY")
                {
                    goukei += otoshidama[i];
                }
                else
                {
                    goukei += 380000 * otoshidama[i];
                }
            }

            Console.WriteLine($"{goukei}");
        }
    }
}


Measured memory_bytes: 11092