akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
constexpr ll MOD = 1e9+7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  int N;
  cin >> N;
  int max = 0;
  int min = 1e9 + 7;
  rep(i,N)
  {
    int A;
    cin >> A;
    chmax(max,A);
    chmin(min,A);
  }
  cout << max -min << endl;

  
  
  
}


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

int main() {
  int n;
  cin >> n;
  
  int p;
  int ans = 0;
  int num = 100000000;
  for(int i=0; i<n; i++) {
    cin >> p;
    if(p<=num) ans++;
    num = min(num, p);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  int ans = 1000;
  for (int i = 0; i <= s.size() - 3; i++) {
    int x = (s.at(i) - '0') * 100 + (s.at(i + 1) - '0') * 10 + (s.at(i + 2) - '0');
    ans = min(ans, abs(x - 753));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

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

const int mod = 1e9 + 7;
const int mod2 = 998244353;

void fact_init(int n);
ll exp(ll taban, ll us, ll md);
ll ebob(ll a, ll b);
ll ekok(ll a, ll b);
ll komb(ll a, ll b);

vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}
ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}

ll komb(ll a, ll b){
	if(a < b) return 0;
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}

const int N = 4e5 + 5;
int main(){
	ios::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	int cnt[4] = {};
	while(n--){
		string s; cin>>s;
		if(s == "AC") cnt[0]++;
		if(s == "WA") cnt[1]++;
		if(s == "TLE") cnt[2]++;
		if(s == "RE") cnt[3]++;
	}
	cout<<"AC x "<<cnt[0]<<"\n"<<"WA x "<<cnt[1]<<"\n"<<"TLE x "<<cnt[2]<<"\n"<<"RE x "<<cnt[3];
}

Measured memory_bytes: 3656
# 赤が入ってる可能性が0になる場合（すべての球を取り出した場合）があることに注意
n, m = map(int, input().split())
balls = [1 for _ in range(n)]
reddable = [False for _ in range(n)]
reddable[0] = True
for _ in range(m):
    x, y = map(lambda x: int(x) - 1, input().split())
    if reddable[x] == True:
        reddable[y] = True
        balls[x] -= 1
        balls[y] += 1
    else:
        balls[x] -= 1
        balls[y] += 1
    if balls[x] == 0:
        reddable[x] = False

ans = list(filter(lambda x: x == True, reddable))
print(len(ans))


Measured memory_bytes: 55772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll Q=1000000007;

int main(){
  int X,A,B;
  cin >> X >> A >> B;
  A=abs(X-A);
  B=abs(X-B);
  if(A<B){
    cout << "A" << endl;
    return 0;
  }
  cout << "B" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#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 repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}


int f[26], s[26], cnt[26];;
void solve(){
	string ss;
	cin >> ss;
	rep(i, sz(ss)){
		if(!i) continue;
		if(ss[i] == ss[i - 1]){
			cout << i << ' ' << i + 1;
			return;
		}
		if(!(i - 1)) continue;
		if(ss[i] == ss[i - 2]){
			cout << i - 1 << " " << i + 1 << endl;
			return;
		}
	}
	cout << -1 << " " << -1;
}


 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
    long long int n;
    long long int ans = 2000000000000;

    cin >> n;

    for (long long int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            if (ans > i + n / i - 2) {
                ans = i + n / i - 2;
            }
        }
    }

    cout << ans << endl;
}


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

using namespace std;

const int MAX = 1005;
int V;
vector<int> G[MAX];
int match[MAX];
bool used[MAX];

int GCD(int a, int b){
  if(b == 0) return a;
  return GCD(b,a%b);
}

void add_edge(int u, int v){
  G[u].push_back(v);
  G[v].push_back(u);
}

bool dfs(int v){
  used[v] = true;
  for(int i = 0; i < (int)G[v].size(); i++){
    int u = G[v][i];
    int w = match[u];

    if(w < 0 || !used[w] && dfs(w)){
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}

int bipartite_matching(){
  int res = 0;
  memset(match, -1, sizeof(match));
  for(int v = 0; v < V; v++){
    if(match[v] < 0){
      memset(used,0,sizeof(used));
      if(dfs(v)) res++;
    }
  }
  return res;
}

void init(){
  for(int i = 0; i < MAX; i++) G[i].clear();
}	
	
void input(int m, int n){
  vector<int> B(m),R(n);
  
  for(int i = 0; i < m; i++) cin >> B[i];
  for(int i = 0; i < n; i++) cin >> R[i];

  
  for(int i = 0; i < (int)B.size(); i++)
    for(int j = 0; j < (int)R.size(); j++)
      if(GCD(B[i],R[j]) > 1) add_edge(i,m+j);
}


int main(){
  int m,n;
  while(cin >> m >> n && n+m){
    init();
    input(m,n);
    V = m+n+2;
    cout << bipartite_matching() << endl;
  }
  return 0;
}

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

typedef long long ll;

const int INF = 1001001001;

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    X--;
    Y--;
    vector<int> ans(N);
    //各頂点からの最短距離を求めていく
    for (int sv=0;sv<N;sv++){
        // ある頂点までの距離（未定の場合はINF）
        vector<int> dist(N, INF);
        // 隣接している頂点を保持するqueue
        queue<int> q;
        //これはラムダ式といわれるもの
        //頂点vの距離をdに設定してキューに押し込む
        auto push = [&](int v, int d){
            if (dist[v] != INF) return;
            dist[v] = d;
            q.push(v);
        };
        //スタートする頂点の最短距離を0にする
        push(sv,0);
        //隣接頂点がなくなるまで、キューを拾って処理する
        while (!q.empty()){
            int v=q.front();q.pop();
            int d = dist[v];
            // 下の頂点が存在していればキューに入れる
            if (v-1 >= 0) push(v-1, d+1);
            // 上の頂点が存在していればキューに入れる
            if (v+1 < N) push(v+1, d+1);
            // 頂点Xの場合、Yを隣接として処理する
            if (v == X) push(Y, d+1);
            // 頂点Yの場合、Xを隣接として処理する
            if (v == Y) push(X, d+1);
        }
        //各頂点について、距離に対応する個数を集計
        for (int i=0;i<N;i++) ans[dist[i]]++;
    }
    // 各辺が２回ずつカウントされているので半分にする
    for (int i=0;i<N;i++) ans[i] /= 2;
    //出力
    for (int i=1;i<=N-1;i++){
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
P = list(map(float,read().split()))

"""
・表が出た枚数 -> 確率でdp遷移
・多項式((1-p)+px)をかけていく
"""

dp = np.zeros(N+1)
dp[0] = 1.0

for p in P:
    prev = dp
    dp = prev * (1-p)
    dp[1:] += prev[:-1] * p

answer = dp[N//2+1:].sum()
print(answer)

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

using namespace std;

int num[105] ;
void select(int n)
{
    int ans = 0;
    for(int i= 0 ; i<n ;i++){
        int mini = i ;
        for(int j =i+1;j<n;j++){
            if(num[mini]>num[j]){
                mini=j;
            }
        }
        if(i!=mini){
            ans++;
        }
        swap(num[i],num[mini]) ;

    }
    printf("%d",num[0]) ;
    for(int i = 1 ; i<n;i++){
        printf(" %d",num[i]) ;
    }
    printf("\n") ;
    printf("%d\n",ans) ;
}
int main()
{
    int n ;
    while(~scanf("%d",&n)){
        for(int i = 0 ;i<n;i++){
            scanf("%d",num+i);
        }
        select(n);
    }
    return 0;
}

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

using namespace std;

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

#define rep(pos, len) for(int pos=0;pos<len;pos++)
#define repp(pos, len) for(int pos=1;pos<=len;pos++)

#define INF 987654321
#define IINF 2987654321987654321
#define MOD 998244353

const int MAXN = 1e5 + 50;
ll x[MAXN];

int main() {
	int n, k; scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i++)
		scanf("%lld", &x[i]);

	vector<ll> a, b;
	b.push_back(0);
	for(int i = 1; i <= n; i++) {
		if(x[i] < 0) a.push_back(-x[i]);
		else b.push_back(x[i]);
	}
	a.push_back(0);
	reverse(a.begin(), a.end());
	ll ans = IINF;
	for(int x = max(0, k-(int)b.size()+1); x <= min((int)a.size()-1, k); x++)
		ans = min(ans, min(2*a[x]+b[k-x], a[x]+2*b[k-x]));
	printf("%lld\n", ans);
}

Measured memory_bytes: 2424
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramB a = new ProgramB();
            a.main();//実行する

        }

    }

    class ProgramA
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();

            //時間に換算して起きてる時間からk時間を除く
            Console.WriteLine(s.Substring(0,3));

        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力
            string[] s1 = Console.ReadLine().Split(' ');
            long a = long.Parse(s1[0]);
            long v = long.Parse(s1[1]);
            string[] s2= Console.ReadLine().Split(' ');
            long b = long.Parse(s2[0]);
            long w = long.Parse(s2[1]);
            long t = long.Parse(Console.ReadLine());
            long temp = t * (v - w);

            if(w == v)
            {
                Console.WriteLine("NO");
                return;
            }

            //?はD、それ以外は普通に出す
            
            if (temp >= Math.Abs(a - b))
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");


        }
    }

    class ProgramC
    {
        public void main()
        {

            int n = int.Parse(Console.ReadLine());
            string[] a = Console.ReadLine().Split(' ');

            //n=0のときは例外処理
            if (n == 0)
            {
                if (a[0] == "1")
                    Console.WriteLine("1");
                else
                    Console.WriteLine("-1");
                return;
            }
            //0のときは0以外はダメ
            if (a[0] != "0")
            {
                Console.WriteLine("-1");
                return;
            }
            long[] num = new long[n + 1];
            long[] leave = new long[n + 1];
            num[0] = 1;
            leave[n] = long.Parse(a[n]);
            //深さiを含む後ろの根の数を数えておく
            for (int i = n - 1; i >= 0; i--)
                leave[i] = leave[i + 1] + long.Parse(a[i]);
            //前から根の数を決める（ただし、最大は後ろに考えるべき根の数に限られる）
            for (int i = 1; i <= n; i++)
            {
                num[i] = Math.Min(2 * (num[i - 1] - long.Parse(a[i - 1])), leave[i]);
                //あり得る数が葉になる数より大きければあり得ない(n-1まで）
                if (i < n && num[i] <= long.Parse(a[i]))
                {
                    Console.WriteLine("-1");
                    return;
                }
                //最後は頭からの条件で満たさないならアウト
                if (i == n && num[i] < long.Parse(a[i]))
                {
                    Console.WriteLine("-1");
                    return;
                }
            }

            //答え出力
            long ans = 0;
            for (int i = 0; i <= n; i++)
                ans += num[i];

            Console.WriteLine(ans);
        }
    }
}






Measured memory_bytes: 27560
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

const int maxn=1e2+10;
int n,a[maxn<<1],ans;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=2*n;++i)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	for(int i=1;i<=n;++i)
		ans+=a[2*i-1];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
s = list(map(int,input().split()))
t = max(s[0]+s[1],s[0]-s[1],s[0]*s[1])
print(t)
'''
print('A+B={0},A-B={1},A*B={2},A/B={3}の中で最大の数{4}はです'.format(s[0]+s[1],s[0]-s[1],s[0]*s[1],s[0]/s[1],t))
'''


Measured memory_bytes: 2940
#include <stdio.h>
#define INF 1001001001
typedef long long ll;
int min(int x, int y) {
	return x > y ? y : x;
}
int max(int x, int y) {
	return x < y ? y : x;
}
int main() {
	int h, w, dp[10][10];
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			dp[i][j] = INF;
		}
	}
	scanf("%d%d", &h, &w);
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			scanf("%d", &dp[i][j]);
		}
	}
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}
	int num[10] = {0};
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int a;
			scanf("%d", &a);
			if (a != -1)
				num[a]++;
		}
	}
	ll ans = 0;
	for (int i = 0; i < 10; i++) {
		ans += (ll)dp[i][1] * num[i];
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main() {
  int h, n;
  cin >> h >> n;
  int sum = 0;

  vector<int> v(n);

  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
    sum += v.at(i);
  }

  if (sum >= h) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int n, a, b;
int v[150150][20];

void init() {
  memset(v, -1, sizeof(v));
}

void solve(int l, int r) {
  if (r - l == 2) return;
  int m = (l + r) / 2;
  rep(i, n) {
    if (v[m][i] != -1) continue;
    if (v[l][i] != v[r - 1][i]) {
      FOR(j, l, m) v[j][i] = v[l][i];
      FOR(j, m, r) v[j][i] = v[r - 1][i];
      break;
    }
  }
  rep(i, n) {
    if (v[m - 1][i] == -1) {
      rep(j, n) {
        if (v[m - 1][j] != -1) continue;
        if (j == i) v[m - 1][j] = v[l][j] ^ 1;
        else v[m - 1][j] = v[l][j];
        v[m][j] = v[m - 1][j];
      }
      break;
    }
  }
  solve(l, m);
  solve(m, r);
}

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

  cin >> n >> a >> b;
  int cnt = 0;
  rep(i, n) cnt += (a >> i & 1) + (b >> i & 1);
  if (~cnt & 1) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  init();
  rep(i, n) v[0][i] = (a >> i & 1);
  rep(i, n) v[(1 << n) - 1][i] = (b >> i & 1);
  solve(0, (1 << n));
  rep(i, (1 << n)) {
    int ans = 0;
    rep(j, n) if (v[i][j]) ans += (1 << j);
    cout << ans << ' ';
  }
  cout << '\n';





  




  
  return 0;
}

Measured memory_bytes: 15420
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
const int N=100005; 
int n,f[N],ans[N];
int pp,lnk[N],nxt[N*2],to[N*2];
void ae(int k1,int k2){to[++pp]=k2,nxt[pp]=lnk[k1],lnk[k1]=pp;}
void dfs(int k1,int k2){
	int s=0;
	for(int i=lnk[k1];i;i=nxt[i])if(to[i]!=k2){
		dfs(to[i],k1);
		s|=f[k1]&f[to[i]];
		f[k1]|=f[to[i]];
	}
	s=__lg(s*2);
	s+=__builtin_ctz(~(f[k1]>>s));
	f[k1]=(f[k1]>>s|1)<<s,ans[k1]=s;
}
int main(){
	scanf("%d",&n);
	rep(i,2,n){
		int k1,k2;
		scanf("%d%d",&k1,&k2);
		ae(k1,k2),ae(k2,k1);
	}
	dfs(1,0);
	printf("%d\n",*max_element(ans+1,ans+1+n));
	return 0;
}

Measured memory_bytes: 6400
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    long a, b, n;
    cin >> a >> b >> n;
    long sum = 0;
    long sum_max = 0;
    long x = n;
    for (long i=0; i<2; i++){
        sum = floor(double(a) * double(x) / double(b)) - a * floor(double(x) / double(b));
        if (sum > sum_max){
            sum_max = sum;
        }
        x -= 1;
    }
    x = b;
    if (b < n){
        for (long i=0; i<2; i++){
            sum = floor(double(a) * double(x) / double(b)) - a * floor(double(x) / double(b));
            if (sum > sum_max){
                sum_max = sum;
            }
            x -= 1;
        }
    }
    cout << sum_max << endl;
}

Measured memory_bytes: 3632
//hi
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long int LL;
pair<char,int> p[4005];
int dp[2002][2002];
int cw[2002][2002];
int cb[2002][2002];
unordered_set<int> stw, stb;
#define inf 100000000
int main(void){
    int n;
    scanf("%d",&n);
    int i,j;
    for(i=0;i<2*n;i++) {
		char s[2];
		scanf("%s",s);
		p[i].F=s[0];
		scanf("%d",&p[i].S);
	}
	for(i=0;i<2*n;i++){
		if(p[i].F=='W'){
			int cnt=0;
			for(j=1;j<p[i].S;j++) if(stw.find(j)!=stw.end()) cnt++;
			for(j=0;j<=n;j++){
				if(stb.find(j)!=stb.end()) cnt++;
				cw[p[i].S][j]=i-cnt;
			}
			stw.insert(p[i].S);
		}else{
			int cnt=0;
			for(j=1;j<p[i].S;j++) if(stb.find(j)!=stb.end()) cnt++;
			for(j=0;j<=n;j++){
				if(stw.find(j)!=stw.end()) cnt++;
				cb[p[i].S][j]=i-cnt;
			}
			stb.insert(p[i].S);
		}
	}
	for(i=0;i<=n;i++)
		for(j=0;j<=n;j++)
			dp[i][j]=inf;
	dp[0][0]=0;
	for(i=0;i<=n;i++)
		for(j=0;j<=n;j++){
			if(i) dp[i][j]=min(dp[i][j], dp[i-1][j]+cw[i][j]);
			if(j) dp[i][j]=min(dp[i][j], dp[i][j-1]+cb[j][i]);
		}
	printf("%d\n",dp[n][n]);
    return 0;
}


Measured memory_bytes: 47488
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
typedef long long ll;
using namespace std;

int main(void){
    int H, A;
    cin >> H >> A;
    if(H <= A) cout << 1 << endl;
    else if(H % A == 0) cout << H / A << endl;
    else cout << H / A + 1 << endl;
}


Measured memory_bytes: 256
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


mod=1000000007
def combinations_count_mod(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x,y: x*y%mod, range(n, n - r, -1), 1)
    denom = pow( reduce(lambda x,y: x*y%mod, range(1, r + 1), 1) , mod-2, mod)
    return numer * denom % mod


def solve():
    pass

def main():
    n,x,t = map(int,input().strip().split())
    ans=-(-n//x)*t
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 78336
#include<stdio.h>
int main(void)
{
  int a,b,c;
  scanf("%d%d",&a,&b);
  
  if(a<=9&&b<=9)
  {
    c=a*b;
    printf("%d",c);
  }
  else
  {
    printf("-1");
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    ll n;
    cin>>n;
    ll x[100]={};
    rep(i,n){
        cin>>x[i];
    }
    ll min_sum=1000000;
    rep(i,100){
        ll sum=0;
        rep(j,n){
            sum+=pow(x[j]-i-1,2);
        }
        min_sum=min(min_sum,sum);
    }
    cout<<min_sum<<endl;
}



Measured memory_bytes: 256
X,Y,Z,K = map(int,input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
xy=[]
for a in A:
    for b in B:
        xy.append(a+b)
xy=sorted(xy,reverse=True)
xy=xy[:K]
xyz=[]
for c in C:
    for x in xy:
        xyz.append(x+c)
xyz=sorted(xyz,reverse=True)
for i in range(K):
    print(xyz[i])


Measured memory_bytes: 185756
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int e[400000][2];
int d[200001];
int search(int x, int l, int r){
	while(l<=r){
		int m=(l+r)/2;
		if(e[m][0]>=x) r=m-1; else l=m+1;
	}
	return l;
}

int main(void){
	int n, i;
	scanf("%d", &n);
	for(i=0; i<n-1; i++){
		int A, B;
		scanf("%d%d", &A, &B);
		e[i*2][0]=A; e[i*2][1]=B;
		e[i*2+1][0]=B; e[i*2+1][1]=A;
	}
	qsort(e, (n-1)*2, sizeof(int)*2, comp);

	int s[200000], S=0;
	d[1]=0;
	s[S++]=1;
	while(S>0){
		int p=s[--S];
		i=search(p, 0, (n-1)*2-1);
		for(; e[i][0]==p; i++){
			if(e[i][1]!=1 && d[e[i][1]]==0){
				d[e[i][1]] = d[p] + 1;
				s[S++]=e[i][1];
			}
		}
	}

	int b=0, c=0;
	for(i=1; i<=n; i++){
		if(d[i]%2==0){
			b++;
		}else{
			c++;
		}
	}
	if(b>n/3+(n+2)/3){
		int a=0;
		b=(n+2)/3; c=(n+1)/3;
		for(i=1; i<=n; i++){
			if(d[i]%2==0){
				if(b>0){
					b--;
					printf("%d ", b*3+1);
				}else if(c>0){
					c--;
					printf("%d ", c*3+2);
				}else{
					a++;
					printf("%d ", a*3);
				}
			}else{
				a++;
				printf("%d ", a*3);
			}
		}
	}else if(c>n/3+(n+1)/3){
		int a=0;
		b=(n+2)/3; c=(n+1)/3;
		for(i=1; i<=n; i++){
			if(d[i]%2==0){
				a++;
				printf("%d ", a*3);
			}else{
				if(b>0){
					b--;
					printf("%d ", b*3+1);
				}else if(c>0){
					c--;
					printf("%d ", c*3+2);
				}else{
					a++;
					printf("%d ", a*3);
				}
			}
		}
	}else{
		int a=0;
		b=(n+2)/3; c=(n+1)/3;
		for(i=1; i<=n; i++){
			if(d[i]%2==0){
				if(b>0){
					b--;
					printf("%d ", b*3+1);
				}else{
					a++;
					printf("%d ", a*3);
				}
			}else{
				if(c>0){
					c--;
					printf("%d ", c*3+2);
				}else{
					a++;
					printf("%d ", a*3);
				}
			}
		}
	}
	putchar(10);
}


Measured memory_bytes: 6396
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int N; cin >> N;

    int S = 0, NN = N;
    while (NN > 0) {
        S += NN%10;
        NN /= 10;
    }

    cout << (N%S == 0 ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "tmp.cpp"

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

  int n, C;
  cin >> n >> C;
  vector<vi> imos(C, vi((int)1e5 + 1, 0));
  REP(i, n) {
    int s, t, c;
    cin >> s >> t >> c;
    s--;
    t--;
    c--;
    imos[c][s]++;
    imos[c][t + 1]--;
  }

  int ans = 0;
  FOR(i, 1, (int)1e5 + 1) {
    int cur = 0;
    REP(j, C) {
      imos[j][i] += imos[j][i - 1];
      if (imos[j][i] > 0)
        cur++;
    }
    chmax(ans, cur);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 12416
object Main {
  def main(args:Array[String]) = {
    var sc = new java.util.Scanner(System.in)
    var n = sc.nextInt
    var v = Array.fill(n)(sc.nextInt())
    var c = Array.fill(n)(sc.nextInt())
    var sum = 0
    for(i <- 0 until n){
        if(v(i) - c(i) > 0){
            sum += v(i) - c(i)
        }
    }
    println(sum)
  }
}

Measured memory_bytes: 25548
#include "iostream"
#include <string>
using namespace std;
 
int main(){

  int N;
  string S;
  string T;
  
  cin >> N;
  cin >> S >> T;
 
 for(int i=0 ; i<N ;i++){
   
   cout << S[i] << T[i];
   
 }
  
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int x,y,n,Max[N],Max2[N],l[N],z[N];
vector<int>G[N];
char s[N];
long long ans;
inline void upd(int x,int y){
	if (y>Max[x])Max2[x]=Max[x],Max[x]=y;
	else if (y>Max2[x])Max2[x]=y;
}
inline void dfs1(int x,int y){
	l[x]=N;
	if (s[x]=='1')l[x]=0,z[x]=1;
	for (int i:G[x])
		if (i!=y){
			dfs1(i,x);
			int d=Max[i]+1;
			upd(x,d);
			if (z[i]){
				l[x]=min(l[x],d);
				z[x]+=z[i];
			}
		}
}
inline void dfs2(int x,int y){
	if (y){
		int d=Max[x]+1==Max[y]?Max2[y]+1:Max[y]+1;
		upd(x,d);
		if (z[1]>z[x])l[x]=min(l[x],d);
	}
	for (int i:G[x])
		if (i!=y)dfs2(i,x);
	int L=l[x],R=min(Max2[x]+1,Max[x]-1);
	if (L<=R)ans+=R-L+1;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		G[x].push_back(y);
		G[y].push_back(x);
	}
	scanf("%s",s+1);
	dfs1(1,0);
	dfs2(1,0);
	printf("%lld\n",ans+1);
	return 0;
}


Measured memory_bytes: 19328
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        double tmp = (n - 1.0) / (k - 1.0);
        int ans = (int) Math.ceil(tmp);
        System.out.println(ans);
    }
}

Measured memory_bytes: 59404
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

signed main() {
  int N, D, A;
  cin >> N >> D >> A;
  
  vector<pair<int, int>> M(N);
  vector<int> X(N);
  for( int i = 0; i < N; i++ ){
    int H;
    cin >> X.at(i) >> H;
    M.at(i) = make_pair(X.at(i), H);
  }
  sort(M.begin(), M.end());
  sort(X.begin(), X.end());
  
  int ans = 0;
  vector<int> imos(N);
  for( int i = 0; i < N; i++ ){
    
    if( i > 0 ) imos.at(i) += imos.at(i-1);
    int HP = M.at(i).second;
    
    if( HP-imos.at(i) <= 0 ) continue;
    int now = (HP-imos.at(i)+A-1)/A;
    ans += now;
    imos.at(i) += now*A;
    
    auto Iter = upper_bound(X.begin(), X.end(), X.at(i)+2*D);
    int k = Iter - X.begin();
    if( k < N ) imos.at(k) -= now*A;
    
  }
  cout << ans << endl;
    
}


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

using namespace std;

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

int H, W; 
char A[8][8];

bool is_ok(vector<string> curr){
	bool res = true;
	rep (i, H) rep (j, W) res &= (curr[i][j] == A[i][j]);
	return res;
}

void disp_curr(vector<string> curr){
	cerr << endl;
	rep (i, H){
		rep (j, W){
			cerr << curr[i][j];
		} // end rep
		cerr << endl;
	} // end rep
}

bool dfs(int row, int col, vector<string> curr){
	curr[row][col] = '#';

	if (row == H - 1 && col == W - 1){
//		disp_curr(curr);
		return is_ok(curr);
	} // end if

	bool res = false;
	for (int i = 0; i < 2; ++i){
		if (i == 0){
			if (row + 1 < H && A[row + 1][col] == '#'){
				res |= dfs(row + 1, col, curr);
			} // end if
		}else{ // if (i == 1)		 
			if (col + 1 < W && A[row][col + 1] == '#'){
				res |= dfs(row, col + 1, curr);
			} // end if
		} // end if
	} // end for

	return res;
}

int main()
{
	rep (i, 8) rep (j, 8) A[i][j] = '.';	

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	cin >> H >> W;
	rep (i, H) rep (j, W) cin >> A[i][j];

	vector<string> curr(H, string(W, '.'));
	bool res = dfs(0, 0, curr);

	cout << (res ? "Possible": "Impossible") << endl;			

	return 0;
}

Measured memory_bytes: 256
# Initializing variables
monsterCount, specialAttacks = map(int, input().split())
monsters = sorted(list(map(int, input().split())), reverse=True)
# NOTE: The sorted() function is in an ascending order in default. Now it's reversed.

# Calculating and judging the minimal number of attacks fennec needs to win.
if len(monsters) <= specialAttacks:
    print(0)
else:
    EntireMonsters = sum(monsters)
    destroyed = sum(monsters[:specialAttacks])
    print(EntireMonsters - destroyed)

# Check out my Youtube channel! https://www.youtube.com/channel/UCMOKVyAbTZOpKikTrX5dy_A


Measured memory_bytes: 26764
N = int(input())
A = []
M = 0
p = 0
for i in range(N):
	t = int(input())
	A.append(t)
	if M < t:
		M = t
		p = i

A[p] = 0
sec = max(A)

for i in range(N):
	if i == p:
		print(sec)
	else:
		print(M)


Measured memory_bytes: 12568
// 偶数か奇数か
import 'dart:io';

void main() {
  List ab = stdin
      .readLineSync()
      .split(" ")
      .map((x) => int.parse(x))
      .toList(); // 一行に複数入力
  int c = ab[0] * ab[1];
  if (c % 2 == 0) {
    print("Even");
  } else {
    print("Odd");
  }
}


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

int main() {

    int A,B,C,D;
    cin >> A >> B >> C >> D;

    int recA = A * B;
    int recB = C * D;

    if(recA >= recB){
        cout << recA << endl;
    }else{
        cout << recB << endl;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define int long long

using namespace std;
const int inf = 1e18;
const double EPS = 0.00000001;
const int mod = 1000000007;
signed main(){
    int n,a,m;
    cin >> n >> m>> a;
    vector<int> v(n),v1(m);
    for(int i =0;i<n;i++) cin >> v[i];
    for(int i =0;i<m;i++) cin >> v1[i];
    int cnt = 0;
    int pred[m+1];
    pred[0] = 0;
    int res = 0;
    for(int i = 1;i<=m;i++) pred[i] = pred[i-1]+v1[i-1];
    for(int i =0;i<=n;i++){
        int l,r;
        l = -1,r = m+1;
        while(l+1 < r){
            int mid = (l+r)/2;
            if((pred[mid]+cnt) <= a){
                res = max(res,mid+i);
                l = mid;
            }
            else r = mid;
        }
        if(i == n) break;
        cnt += v[i];
    }
    cout << res;
}


Measured memory_bytes: 7944
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DFiveFiveEverywhere solver = new DFiveFiveEverywhere();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFiveFiveEverywhere {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            ArrayList<Integer> prime = Prime.eratosthenesSieve(55555);
            int n = in.nextInt();
            prime.removeIf(i -> i % 5 != 1);
            for (int i = 0; i < n; i++) {
                out.print(prime.get(i));
                out.print(" ");
            }
            out.println();
        }

    }

    static class Prime {
        public static ArrayList<Integer> eratosthenesSieve(int n) {
            // n 以下の素数を列挙する, O(N*log(log N))
            ArrayList<Integer> prime = new ArrayList<>();
            ArrayList<Integer> nums = new ArrayList<>();
            for (int i = 2; i <= n; i++) {
                nums.add(i);
            }
            while (nums.get(0) <= Math.sqrt(n)) {
                int nxtPrime = nums.get(0);
                prime.add(nxtPrime);
                nums.removeIf(x -> (x % nxtPrime == 0));
            }
            prime.addAll(nums);
            return prime;
        }

    }
}



Measured memory_bytes: 30292
n, m = map(int, input().split())
d = []
c = 0
last = 0

for i in range(n):
    d.append(tuple(map(int, input().split())))
d.sort()

while m > 0:
    a, b = d[last]
    c += min(a * b, m * a)
    m -= b
    last+=1

print(c)

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define mp(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INF_=1LL<<60;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

ll s;

ll Count(ll x){
	ll cnt=x/3*4+x/5*4,n=1;
	if(cnt>s) return cnt;
	
	rep(i,0,18){
		ll a;
		if(n*10>x){
			a=x;
			cnt+=(x-n+1-(a/3-(n-1)/3)-(a/5-(n-1)/5)+(a/15-(n-1)/15))*(i+1);
			break;
		}
		a=n*10-1;
		cnt+=(i+1)*(a-n+1-(a/3-(n-1)/3)-(a/5-(n-1)/5)+(a/15-(n-1)/15));
		if(cnt>s) return cnt;
		n*=10;
	}

	return cnt;
}


void Solve(){
	cin >> s;

	ll lb=0,ub=INF_;
	while(ub-lb>1){
		dump(lb);
		dump(ub);
		ll m=(lb+ub)/2;
		if(Count(m)<s) lb=m;
		else ub=m;
	}

	string ans;
	rep(i,1,21){
		if((lb+i)%3==0&&(lb+i)%5==0) ans+="FizzBuzz";
		else if((lb+i)%3==0) ans+="Fizz";
		else if((lb+i)%5==0) ans+="Buzz";
		else{
			stringstream ss;
			ss << (lb+i);
			string tmp;
			ss >> tmp;
			ans+=tmp;
		}
	}
	
	cout << ans.substr(s-Count(lb)-1,20) << endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	Solve();
	return 0;
}

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

int main() {
  int N, A1, A2, A3, A4, T;
  cin >> N;
  
  A4 = N*0.001;
  A3 = N*0.01 - A4*10;
  A2 = N*0.1 - A4*100 - A3*10;
  A1 = N - A4*1000 - A3*100 - A2*10;
   
  if (A4 == A3 && A3 == A2) {
	cout << "Yes" << endl;  
  }
  else if (A3 == A2 && A2 == A1) {
	cout << "Yes" << endl;  
  }
  else {
	cout << "No" << endl;  
  }
 
 
  }


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 100000 + 100;

int n, m;
long long k;
int init_x[MAXN];
int per[MAXN];
bool vis[MAXN];

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> init_x[i];
	cin >> m >> k;
	for(int i = 1; i <= n - 1; i++)
		per[i] = i;
	for(int i = 1; i <= m; i++)
	{
		int x;
		cin >> x;
		swap(per[x - 1], per[x]);
	}
	for(int i = 1; i <= n - 1; i++)
		if(!vis[i])
		{
			vector<int> arr;
			int cur = i;
			do
			{
				vis[cur] = true;
				arr.push_back(cur);
				cur = per[cur];
			}
			while(cur != i);
			for(int i = 0; i < arr.size(); i++)
				per[arr[i]] = arr[(i + k) % arr.size()];
		}
	long long cur = init_x[1];
	cout << cur << endl;
	for(int i = 1; i <= n - 1; i++)
	{
		cur += init_x[per[i] + 1] - init_x[per[i]];
		cout << cur << endl;
	}

	return 0;
}


Measured memory_bytes: 2288
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <climits>

using namespace std;

int main(){
    int d, n; cin >> d >> n;
    int ans=1;
    for(int i=0; i<d; ++i) ans*=100;
    if(n==100) n=101;
    ans*=n;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<ctime>

using namespace std;

template <typename T>

inline T read()
{
	T x=0,f=1;char c=getchar();
	while(!isdigit(c))
	{if(c=='-') f=-f;c=getchar();}
	while(isdigit(c))
	{x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint

const int inf=1e9+1e7;
const int Mod=1e9+7;

lint ans=0;
lint n,k;

int main(void)
{

	//freopen("testdata.in","r",stdin);
	//freopen("testdata.out","w",stdout);

	scanf("%lld%lld",&n,&k);

	for(lint i=k;i<=n+1;i++)
	{
		ans+=(n+n-i+1)*i/2-(i-1)*i/2+1;
		ans%=Mod;
		// printf("%lld\n",ans);
	}

	printf("%lld\n",ans);

	return 0;

}


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

int n;
double sum;

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++){
		double x;
		string s;
		cin >> x >> s;
		if(s=="JPY") sum+=x;
			else sum += x*380000;
	}
	cout << setprecision(4) << fixed << sum << endl;
	return 0;
}

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

using namespace std;

int main() {
    string s;
    cin >> s;
    string ans = "Yes";
    for(int i = 0; i < s.length(); ++i) {
        if (i % 2) {
            if (!(s.at(i) == 'L' || s.at(i) == 'U' || s.at(i) == 'D')) {
                ans = "No";
                // cout << i << ":";
            }
        } else {
            if (!(s.at(i) == 'R' || s.at(i) == 'U' || s.at(i) == 'D')) {
                ans = "No";
                // cout << i << ":";
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
  n = int(input())
  S = input()
  ans = 0
  dp = [[0]*n for _ in range(n)]
  for j in range(n-1, 0, -1):
    for i in range(j-1, -1, -1):
      if j == n-1:
        dp[i][j] = int(S[i] == S[j])
      else:
        if S[i] == S[j]:
          dp[i][j] = dp[i+1][j+1] + 1
      ans = max(ans, min(dp[i][j], j-i))
  print(ans)
if __name__ == "__main__":
  main()

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

const ll MOD = 1000000007;

int a[1002], b[1002];
int s[1000002], t[1000002];
bool f[1000002], g[1000002];

int main()
{
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        s[a[i]]++;
        f[a[i]] = true;
    }
    for(int j = 0; j < m; j++){
        cin >> b[j];
        t[b[j]]++;
        g[b[j]] = true;
    }
    for(int i = n * m; i > 0; i--){
        s[i - 1] += s[i];
        t[i - 1] += t[i];
    }
    ll ans = 1;
    for(int i = n * m; i > 0; i--){
        if(f[i] && g[i]){
            if(s[i] - s[i + 1] > 1 || t[i] - t[i + 1] > 1) ans = 0;
        }
        else if(f[i]) ans = ans * t[i] % MOD;
        else if(g[i]) ans = ans * s[i] % MOD;
        else ans = ans * (s[i] * t[i] - (n * m - i)) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 11408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { 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 int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main(){
	int h, w;
	cin >> h >> w;
	char grid[h][w];
	int ans = 0;
	rep(i,h)rep(j,w) cin >> grid[i][j];
	int l[h][w], r[h][w], u[h][w], d[h][w];
	rep(i,h)rep(j,w){
		if(grid[i][j]=='#') l[i][j]=0;
		else{
			if(j==0) l[i][j] = 1;
			else l[i][j] = l[i][j-1]+1;
		}
	}
	rep(i,h){
		for(int j = w-1; j >= 0; j--) {
			if(grid[i][j]=='#') r[i][j] = 0;
			else{
				if(j==w-1) r[i][j] = 1;
				else r[i][j] = r[i][j+1]+1;
			}
		}
	}
	rep(i,w){
		rep(j,h){
			if(grid[j][i]=='#') u[j][i] = 0;
			else {
				if(j==0) u[j][i] = 1;
				else u[j][i] = u[j-1][i]+1;
			}
		}
	}
	rep(i,w){
		for(int j = h-1; j >= 0; j--) {
			if(grid[j][i]=='#') d[j][i] = 0;
			else{
				if(j==h-1) d[j][i] = 1;
				else d[j][i] = d[j+1][i]+1;
			}
		}
	}

	rep(i,h)rep(j,w){
      	if(grid[i][j]=='#') continue;
		chmax(ans, l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
	}

	cout << ans << endl;
}

Measured memory_bytes: 66688
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
P p[ohara];
    
//------ Believe yourself as a genius!!!!!! ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    rep(i,n){
        cin>>a;
        p[i]=m_p(a,i);
    }
    sort(p,p+n);
    rep(i,n){
        cout<<p[i].se+1;
        if(i==n-1)cout<<"\n";
        else cout<<" ";
    }
    return 0;
}

Measured memory_bytes: 2432
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

int main() {
	int n;
	cin >> n;
	long long int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0 || i % 5 == 0) continue;
		ans += i;
	}
	cout << ans << endl;
}

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

int main(){
  int n;
  int a;
  int z;

  cin >> n;
  cin >> a;
  z = n % 500;
  if (z <= a){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return(0);
}


Measured memory_bytes: 256
A,B,C,X,Y = map(int,input().split())
ans = 0
if C*2 < A+B:
  ans += min(X,Y)*C*2
  if X == Y:
    pass
  elif X > Y:
    if A > C*2:
      ans += C*2*(X-Y)
    else:
      ans += A*(X-Y)
  else:
    if B > C*2:
      ans += C*2*(Y-X)
    else:
      ans += B*(Y-X)
else:
  ans = A*X + B*Y
print(ans)
      

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fe first
#define se second
#define pii pair<int,int>
#define PI  3.14159265358979323846
const int N=1e5+10;
const ll INF=1e18+10;

ll wei,n,sub,val,w;
int maxi;



void solve()
{
	cin>>n>>wei;
  vector<ll> w(n),val(n);
  int sum=0;
    for(int i=0;i<n;i++)
    	 { cin>>w[i]>>val[i];
         sum+=val[i];
       }

       //dp[i] = The minimum total weight of items with total value exactly i
       vector<ll> dp(sum+1,INF);
       dp[0]=0;
	for(int i=0;i<n;i++)
     { for(int j=sum-val[i];j>=0;j--)
         { dp[j+val[i]]=min(dp[j+val[i]],dp[j]+w[i]);
         }
     }
   
     for(int i=0;i<=sum;i++)
       { if(dp[i]<=wei)
          maxi=max(maxi,i);
       }
       cout<<maxi;
  }     



int main()
{  cool;
   int t=1;
   while(t--)   
     solve(); 

  return 0; 
}






Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	ll a;
	double b;
	cin >> a >> b;
	ll tt = b * 100 + 0.5;
	cout << a * tt / 100 << endl;	
}





Measured memory_bytes: 3736