akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <unordered_map>

int main()
{
    int N;
    scanf("%d", &N);

    long long ans = 1;
    std::unordered_map<int, int> dict;

    for (int i = 2; i < N + 1; i++) {
        int tmp = i;
        for (int j = 2; j < i + 1; j++) {
            while (true) {
                if (tmp % j == 0) {
                    if (dict.find(j) == dict.end()) {
                        dict[j] = 1;
                    } else {
                        dict.at(j) += 1;
                    }
                    tmp /= j;
                } else {
                    break;
                }
            }
            if (tmp == 1) {
                break;
            }
        }
    }

    for (auto itr = dict.begin(); itr != dict.end(); ++itr) {
        //        std::cout << "key = " << itr->first              // キーを表示
        //                 << ", val = " << itr->second << "\n";  // 値を表示
        ans *= (itr->second + 1);
        if (ans > 1000000007) {
            ans %= 1000000007;
        }
    }
    std::cout << (ans) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <cstring>
#define N 100000
using namespace std;

int main() {
  int a,b,k;
  cin >> a >> b >> k;
  if((b-a) < k*2)
    for(int i = a;i <= b;i++)
      cout << i << endl;
  else{
    for(int i = a;i < a+k;i++)
      cout << i << endl;
    for(int i = b-k+1;i < b+1;i++)
      cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

template<int mod>
struct ModInt {
    int x;

    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }

    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if(e%2 == 0) {p = (p*p) % mod; e /= 2;}
            else {a = (a*p) % mod; e--;}
        }
        return ModInt(a);
    }

    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

const int mod = 1e9 + 7;
using modint = ModInt<mod>;
 
modint f[201010];
 
modint nCr(int n, int r){
    if(n-r < 0) return 0;
    return f[n] / (f[r] * f[n-r]);
}


int main(){
    fastcin();

    f[0] = 1;
    rep1(i, 200010) f[i] = f[i-1]*i;

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    modint ans = 0;
    rep(i, n){
        int j = n-i-1;
        if(j < k-1) break;
        ans -= nCr(j, k-1)*a[i];
    }
    for(int i=n-1; i>=0; i--){
        if(i < k-1) break;
        ans += nCr(i, k-1)*a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") 
//#pragma GCC target("avx2")
#define _CRT_SECURE_NO_WARNINGS // - for VisualStudio: do not disturb about warnings
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <functional>
#include <ctime>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <climits>

using namespace std;
#define open_streams ifstream fin("output.txt");ofstream fout("output.txt")
#define close_streams fin.close();fout.close()
#define speed cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0)
#define pus system("pause");
#define ll long long
#define ull unsigned long long
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define UNIQ(a) a.resize(unique(all(a)) - a.begin())
#define eps 1e-6
//const double PI = M_PI;
const int INF = INT_MAX;
const ll limit = 1LL * 1e18;
const int MOD = 1e9 + 711;
const int MOD2 = 1e9 + 933;
const int MOD3 = 1e9 + 993;
//---------------------------------------------------------------------------
const int mod = 1e9 + 7;
const int maxn = 5e5 + 100;





signed main() {
	speed;
	int n, t;
	cin >> n >> t;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i].first >> a[i].second;
	}
	sort(all(a));
	vector<int> dp(t + 1,-1);
	dp[0] = 0;
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		int time = a[i].first, val = a[i].second;
		for (int j = t - 1; j >= 0; --j) {
			if (dp[j] == -1) {
				continue;
			}
			ans = max(ans, dp[j] + val);
			if (j + time < t) {
				dp[j + time] = max(dp[j + time], dp[j] + val);
			}
		}
	}
	cout << ans;
	cerr << "\n\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	
	for (int i=1; i<10; i++){
		for(int j=1; j<10; j++){

			cout << i << 'x' << j << '=' << i*j;


			cout << "\n";
		}

	

	
	}


return 0;

}

Measured memory_bytes: 2912
I=lambda:list(map(int,input().split()))
n,=I()
s=list(input())
i=0
j=n-1
ans=0
while i<j:
	if s[i]=='R' and s[j]=='W':
		i+=1
		j-=1
	elif s[i]=='R':
		i+=1
	elif s[j]=='W':
		j-=1
	else:
		s[i]='R'
		s[j]='W'
		ans+=1
		i+=1
		j-=1
print(ans)


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

#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif

//{{{
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x; while
(getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}

int a[22][22];
int n;

LL dp[1 << 16];

LL dfs(int st)
{
    if (dp[st] != -1) return dp[st];

    if (__builtin_popcount(st) == 1)
    {
        return dp[st] = 0;
    }

    LL ret = 0;
    for (int i = 0; i < n; i++)
    {
        if ((st & (1 << i)) == 0) continue;
        for (int j = i + 1; j < n; j++)
        {
            if ((st & (1 << j)) == 0) continue;
            ret += a[i][j];
        }
    }

    for (int i = st; i; i = (i - 1) & st)
    {
        if (i == st) continue;
        int st1 = i;
        int st2 = st ^ i;

        LL v = dfs(st1) + dfs(st2);
        if (v > ret) ret = v;
    }
    return dp[st] = ret;
}

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
// freopen("out", "w", stdout);
#endif

    while (cin >> n)
    {
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++) cin >> a[i][j];

        clr(dp, -1);
        dp[0] = 0;
        int lim = (1 << n) - 1;
        LL ans = dfs(lim);
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 4112
#include <stdio.h>

int main(void) {

	int a = 0, b = 0, c = 0, d = 0;

	scanf("%d %d %d %d", &a, &b, &c, &d);

	if ((a + b) < (c + d)) {
		printf("Right\n");
	}
	else if ((a + b) > (c + d)) {
		printf("Left\n");
	}
	else
		printf("Balanced\n");

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

int main(){
	int x;
	cin >> x;
	cout << (x xor 1) << endl;
	return 0;
}
 


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int N,M;
  cin>>N>>M;
  
  vector<pair<long long,int>> data(N);
  for(int i=0;i<N;i++){
    int x,y;
    cin>>x>>y;
    data.at(i) = make_pair(x,y);
  }
  
  sort(data.begin(),data.end());
  
  long long sum=0;
  int t=0;
  for(int i=0;i<N;i++){
    t+=data.at(i).second;
    sum+=data.at(i).second*data.at(i).first;
    if (t>=M){
      sum-=data.at(i).first*(t-M);
      break;
    }
  }
  
  cout<<sum<<endl;
}


Measured memory_bytes: 1792
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nk = readln.split.to!(int[]);
    auto N = nk[0];
    auto K = nk[1];
    auto S = readln.chomp;
    int cnt, p;
    int[] as;
    foreach (c; S) {
        auto pp = c == '0' ? -1 : 1;
        if (p != pp) {
            if (p != 0) as ~= cnt * p;
            cnt = 0;
            p = pp;
        }
        ++cnt;
    }
    as ~= cnt * p;
    auto len = as.length;
    size_t i, j;
    int max_s;
    foreach (_; 0..K) {
        if (j == len) break;
        if (as[j] > 0) {
            max_s += as[j++];
        }
        if (j == len) break;
        max_s += -as[j++];
    }
    if (j <= len-1) max_s += as[j++];

    auto s = max_s;
    while (j < len) {
        if (as[i] > 0) s -= as[i++];
        s += as[i++];
        s -= as[j++];
        if (j < len) s += as[j++];
        max_s = max(max_s, s);
    }
    writeln(max_s);
}

Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
#define int                  long long int
#define ff                   first
#define ss                   second
#define pb                   push_back
#define mp                   make_pair
#define pii                  pair<int,int>
#define vi                   vector<int>
#define mi                   map<int,int>
#define pqb                  priority_queue<int>
#define pqs                  priority_queue<int,vi,greater<int>>
#define setbits(x)           __builtin_popcountll(x)
#define zrobits(x)           __builtin_ctzll(x)
#define mod                  1000000007
#define inf                  1e18
#define precise(x,y)         fixed<<setprecision(y)<<x
#define w(x)                 int x;cin>>x;while(x--)
#define endl                 "\n"
#define no_of_digit(n)       floor(log10(n))+1
#define copyarr(a,b,n)       copy_n(a,n,b)
mt19937                      rng(chrono::steady_clock::now().time_since_epoch().count());

//*******************to check if all number in array are positive*******************
//all_of(arr,arr+n,[](int x){return x>0;})?cout<<"positive":cout<<"some negative";


//*******************to check if any element in array is negative*******************
//any_of(arr,arr+n,[](int x){return x<0;})?cout<<"Any negative":cout<<"All positive";


int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //*****************Enter the code here*******************//
    int n,m;
    cin>>n>>m;
    int x=m/2;
    int final=0;
    if(n<=x){
        final+=n;
        m-=n*2;
        if(m!=0){
            final+=m/4;
        }
    }
    else if(n>x){
        final+=x;
    }
    cout<<final;

    return 0;
}


Measured memory_bytes: 256
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define __gcd gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
 
void solve(){
    int a,b;
    cin>>a>>b;
    if(a>9 or b>9) cout<<-1;
    else cout<<a*b;
}
 
int main(){
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    // fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
import sys
from operator import itemgetter

def solve():
    n, m = map(int, sys.stdin.readline().split())
    edges = [None] * m

    for i in range(m):
        s, t, w = map(int, sys.stdin.readline().split())
        edges[i] = (s, t, w)

    edges.sort(key=itemgetter(2), reverse=True)

    uf = UnionFind(n)

    ans = 0

    for i in range(n - 1):
        while edges:
            s, t, w = edges.pop()

            if not uf.same(s, t):
                uf.unite(s, t)
                break

        ans += w

    print(ans)

class UnionFind:
    def __init__(self, n):
        self.p = list(range(n))
        self.rank = [0] * n

    def find_root(self, x):
        if x != self.p[x]:
            self.p[x] = self.find_root(self.p[x])

        return self.p[x]

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

    def unite(self, x, y):
        u = self.find_root(x)
        v = self.find_root(y)

        if u == v: return

        if self.rank[u] < self.rank[v]:
            self.p[u] = v
        else:
            self.p[v] = u

            if self.rank[u] == self.rank[v]:
                self.rank[u] += 1

if __name__ == '__main__':
    solve()

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

int s_i(char x){
  if(x=='1')
    return 1 ;
  else if(x=='2')
    return 2 ;
  else if(x=='3')
    return 3 ;
  else if(x=='4')
    return 4 ;
  else if(x=='5')
    return 5 ;
  else if(x=='6')
    return 6 ;
  else if(x=='7')
    return 7 ;
  else if(x=='8')
    return 8 ;
  else if(x=='9')
    return 9 ;
  else if(x=='0')
    return 0 ;
}

long int keisan(bitset<9> pl,string s){
  long int a = 0 ;
  long int b = 0 ;
   a += s_i(s.at(0)) ;
  for(int i=0;i<n-1;i++){
    if(pl[i]){
      b += a ;
      a = 0 ;
    }else{
      a *= 10 ;
    }
    a += s_i(s.at(i+1)) ;
  }
  return a+b ;
}

int main(){
  string s ; cin >> s ;
  n = s.size() ;
  long int sum = 0 ;
  for(int i=0;i<(1<<n-1);i++){
    bitset<9> pl(i) ;
    sum += keisan(pl,s) ;
  }
  cout << sum << endl ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int i,k,a,b;
 cin >> k >> a >> b;
 for(i=a;i<=b;i++)
 {
  if(i%k==0)
  {
   cout << "OK";
   return 0;
  }
 }
 cout << "NG";
 return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ps puts("")
#define fi first
#define nd second
#define mset(x) memset((x), 0, sizeof (x))
#define mk make_pair
#define sqr(x) ((x)*(x))
#define pii pair<int,int>
#define lch (o<<1)
#define rch (o<<1|1)
using namespace std;
typedef long long ll;
ll read() {ll x = 0;char f = 1, ch = getchar();while(ch < '0' || ch > '9') {if(ch == '-')f = -1;
ch = getchar();}while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0';ch = getchar();}return x * f;}
void write(ll x) {if(x < 0) x = -x, putchar('-');if(x > 9) write(x / 10);putchar(x % 10 + '0');}
inline void writeln(ll x) {write(x);puts("");}
const int N = 600000;

set<string>v;
string last, s;

int main() {
	int n =read();
	for(int i = 1; i <= n; ++i) {
		cin>>s;
		if(i > 1 && s[0] != last[last.length() - 1] || v.count(s)) {
			puts("No");return 0;
		} 
		last = s;
		v.insert(s);
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
xyzk_, *nums_ = [input() for _ in range(4)]

*le, k = [int(w) for w in xyzk_.split()]
abc = [sorted((int(n) for n in w.split()), reverse=True) for w in nums_]

p = [0, 0, 0]
pool = [0, sum(abc[i][p[0]] for i in range(3))]
for _ in range(k):
    max_pool = max(pool)
    max_t = 0
    for i in range(3):
        if p[i] + 1 == le[i]:
            continue
        t = abc[i][p[i] + 1] + abc[(i + 1) % 3][0] + abc[(i + 2) % 3][0]
        if t > max_t:
            max_t = t
            max_3 = i
    if max_pool < max_t:
        p[max_3] = min(p[max_3] + 1, le[max_3] - 1)
        j, k = (max_3 + 1) % 3, (max_3 + 2) % 3
        for n1 in abc[j][:p[j] + 1]:
            for n2 in abc[k][:p[k] + 1]:
                pool.append(n1 + n2 + abc[max_3][p[max_3]])
    print(pool.pop(pool.index(max(pool))))


Measured memory_bytes: 4724
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pb push_back
#define endl "\n"
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main(){
  fast;
  {
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vector<int> pqa(a),pqb(b),pqc(c);
    vector<int> pq;
    for(int i=0;i<a;i++)
        cin>>pqa[i];
    for(int i=0;i<b;i++)
        cin>>pqb[i];
    for(int i=0;i<c;i++)
        cin>>pqc[i];
    sort(pqa.begin(),pqa.end(),greater<int>());
    sort(pqb.begin(),pqb.end(),greater<int>());
    sort(pqc.begin(),pqc.end(),greater<int>());
    for(int i=0;i<x;i++)
    {
        pq.push_back(pqa[i]);
    }
    for(int i=0;i<y;i++)
    {
        pq.push_back(pqb[i]);
    }
    for(int i=0;i<c;i++)
    {
        pq.push_back(pqc[i]);
    }
    sort(pq.rbegin(),pq.rend());
    int ans=0;
    a=x+y;
    while(a--)
    {
        ans+=pq[a];
    }

    cout<<ans<<endl;
  }

  return 0;
}


Measured memory_bytes: 8816
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a = int(input())
b = int(input())
print(2*b-a)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}
struct UnionFind {
    VI d;
    UnionFind(int n = 0): d(n,-1) {}
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x,int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};
int deg[100005];
VI to[100005];

struct mint {
  LL x; // typedef long long ll;
  mint(LL x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(LL t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(MOD-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
    if(n == 0) return 1;
    mint x = f(n/2);
    x *= x;
    if(n%2 == 1) x *= 2;
    return x;
}

mint choose(int n,int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main() {
    char c;
    cin >> c;
    c += 1;
    cout << c << endl;
}


Measured memory_bytes: 2560
//Leonidas
#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container'.',hpp>
//#include <ext/pb_ds/tree_policy'.',hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1000000007;
//const int mod=1009;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int F[2000005];
int Pow(int a,int b)
{
    int wynik=1;
    while(b)
    {
        if(b&1)
            wynik=((ll)wynik*a)%mod;
        a=((ll)a*a)%mod;
        b/=2;
    }
    return wynik;
    return wynik;
}
int symbol(int n,int k)
{
    return (((ll)F[n]*Pow(F[k],mod-2)%mod)*Pow(F[n-k],mod-2))%mod;
}
int32_t main()
{
    speed
    int k;
    cin>>k;
    string s;
    cin>>s;
    int n=s.size();
    swap(n,k);
    F[0]=1;
    for(int i=1;i<=2000000;i++)
        F[i]=((ll)i*F[i-1])%mod;
    ll wynik=0;
    for(int i=k;i<=n+k;i++)
    {
        wynik+=(ll)symbol(n+k,i)*Pow(25,n-(i-k));
        wynik%=mod;
    }
    cout<<wynik;
    return 0;
}


Measured memory_bytes: 12120
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=Integer.parseInt(in.next()),H[]=new int[n+1];
		for(int i=1;i<=n;i++)H[i]=Integer.parseInt(in.next());
		
		PrintWriter out=new PrintWriter(System.out);
		for(int i=1;i<=n;i++) {
			out.printf("node %d: key = %d, ", i, H[i]);
			if(i/2>0)out.printf("parent key = %d, ", H[i/2]);
			if(i*2<=n)out.printf("left key = %d, ", H[i*2]);
			if(i*2+1<=n)out.printf("right key = %d, ", H[i*2+1]);
			out.println();
		}
		out.flush();
	}

}



Measured memory_bytes: 30480
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int x = int.Parse(Console.ReadLine());
        int ans = 1;
        int tmp;
        for (int i = 2; i * i <= x; i++)
        {
            tmp = 1;
            while (tmp * i <= x)
            {
                tmp *= i;
            }
            ans = Math.Max(ans, tmp);
        }
        Console.WriteLine(ans);
    }
}

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

int main(){
  int N,M,X,Y;
  cin>>N>>M>>X>>Y;
  int x,y;
  for(int i=0;i<N;i++){
    cin>>x;
    X=max(x,X);
  }
  for(int i=0;i<M;i++){
    cin>>y;
    Y=min(y,Y);
  }
  if(X<Y)cout<<"No War"<<endl;
  else cout<<"War"<<endl;
}


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

int main() {

    int x;
    cin >> x;

    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 3588
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd


N=int(input())
AB=[list(map(int,input().split())) for i in range(N-1)]

data=[[] for i in range(N+1)]
for a,b in AB:
    data[a].append(b)
    data[b].append(a)

lst=[0 for i in range(N+1)]
stack=deque([[1,0]])
visited=set([1])

while stack:
    a,m=stack.popleft()
    for p in data[a]:
        if not p in visited:
            visited.add(p)
            stack.append([p,m+1])
            lst[p]=m+1


oddslst=[i for i in range(len(lst)) if i and not lst[i]%2]
evenlst=[i for i in range(len(lst)) if i and lst[i]%2]
lst=[0 for i in range(N+1)]
if N//3<len(oddslst) and N//3<len(evenlst):
    for i in range(1,N+1):
        if i%3==1:
            lst[oddslst.pop()]=i
        if i%3==2:
            lst[evenlst.pop()]=i
    oddslst+=evenlst
    for i in range(1,N+1):
        if i%3==0:
            lst[oddslst.pop()]=i
else:
    if len(evenlst)<len(oddslst):
        oddslst,evenlst=evenlst,oddslst
    for i in range(1,N+1):
        if i%3==0:
            if oddslst:
                lst[oddslst.pop()]=i
            else:
                lst[evenlst.pop()]=i
        else:
            lst[evenlst.pop()]=i

print(" ".join([str(i) for i in lst if i]))


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<VB> VVB;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REPR(i,n) RFOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = INT_MAX;
const LL LINF = LLONG_MAX;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

VI dx = {1,0,-1,0};
VI dy = {0,1,0,-1};

LL Gcd(LL a, LL b) {
  return __gcd(a,b);
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}

bool IsPrime(LL N){
  if(N <= 1) return false;
  for(int i = 2; i*i <= N; ++i){
    if(N%i == 0) return false;
  }
  return true;
}

bool ComPaiSec(PII a, PII b){
  if(a.SE != b.SE){
    return a.SE < b.SE;
  }else{
    return a.FI < b.FI;
  }
}


int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  VVI c(3,VI(3));
  REP(i,3){
    REP(j,3){
      cin >> c.at(i).at(j);
    }
  }
  
  VI s(3),t(3);
  
  REP(i,3){
    s.at(i) = c.at(1).at(i)-c.at(0).at(i);
    t.at(i) = c.at(2).at(i)-c.at(0).at(i);
  }
  
  REP(i,2){
    if(s.at(i) != s.at(i+1) || t.at(i) != t.at(i+1)){
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  
  return 0;
}

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

int		main(void)
{
	int a, b, c;

	cin >> a >> b >> c;
	if (a == 7 && b == 5 && c == 5 ||
		a == 5 && b == 7 && c == 5 ||
		a == 5 && b == 5 && c == 7)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define N 100
#define BIG 10000000

int n,arr[N][N];

int main(){
  int num,i,j,node,me,omomi,d[N],p[N],col[N],u,v,min;
  scanf("%d",&n);
  if(n<1 || n>N) exit(2);
  
  for(i=0;i<n;i++){
    d[i]=BIG;
    p[i]=-1;
    col[i]=0;
    for(j=0;j<n;j++){
      arr[i][j] = BIG;
    }		     
  }
  
  for(i=0;i<n;i++){
    scanf("%d %d",&me,&num);
    for(j=0;j<num;j++){
      scanf("%d %d",&node,&omomi);
      arr[me][node]=omomi;
    }
  }

  d[0]=0;
  col[0]=1;
  while(1){
    min=BIG;
    u=-1;
    for(i=0;i<n;i++){
      if(min>d[i] && col[i]!=2){
	u=i;
	min=d[i];
      }
    }
    if(u==-1)break;
    col[u]=2;
    for(v=0;v<n;v++){
      if(col[v]!=2 && arr[u][v] != BIG){
	if(d[v] > arr[u][v]+d[u]){
	  d[v]=arr[u][v]+d[u];
	  p[v]=u;
	  col[v]=1;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(d[i] == BIG) printf("%d %d\n",i,-1);
    else printf("%d %d\n",i,d[i]);
  }
  return 0;
}



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

int main(){
  string a, b;
  cin >> a >> b;
  
  if(a[0] == b[2] && a[2] == b[0] && a[1] == b[1]){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str;
        str = scan.nextLine();
        //String[] num = str.split(" ",0);
        double a, b;
        double pi = 3.141592653589793;
        a = Double.valueOf(str);
        //b = Integer.valueOf(num[1]);
        System.out.println(String.format("%.6f", (double)a*a*pi) + " " + String.format("%.6f", (double)a*2*pi));
        scan.close();
    }
}


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

int main() {
	int counter = 0;
	string s;
	string t;
	cin >> s >> t;
	int n = s.size();
	for(int i = 0 ; i < n ; ++i)
	{
		if(s[i] != t[i])
			counter++;
	}
	cout<<counter<<endl;
	return 0;
}

Measured memory_bytes: 3872
s=input()
flag=0
x=[]
if(len(s)>26):
    print("no")
else:
    for i in range(len(s)):
        for j in range(i):
            if(s[i]==s[j]):
                flag=1
    if(flag==1):
        print("no")
    else:
        print("yes")

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	vector<ll> dp(4, 0), np(4);
	int n;
	cin>>n;

	rep(i, n){
		np = dp;
		int p[3];
		cin >>p[0] >>p[1] >>p[2];
		rep(j,3) rep(k,3) if(j !=k && dp[j]>=0){
			np[k] = max(np[k], dp[j] + p[k]);
		}
		swap(np, dp);
	}
	cout << *max_element(all(dp))<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#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 INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N,W; cin >> N >> W;
  ll dp[N][W+1];
  vector<ll> w(N);
  vector<ll> v(N);
  REP(i,N){
      cin >> w[i] >> v[i];
  }

  REP(i,N){
    REP(j,W+1){
      dp[i][j] = -LINF;
    }
  }
  dp[0][0] = 0;
  dp[0][w[0]] = v[0];

  REP(i,N-1){
    REP(j,W){
      if(dp[i][j] >=0){
        dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
        if(j+w[i+1] <= W){
          dp[i+1][j+w[i+1]] = max(dp[i+1][j+w[i+1]], dp[i][j] + v[i+1]);
        }
      }
    }
  }

  ll ans = 0;
  REP(j,W+1){
    ans = max(dp[N-1][j], ans);
  }
  cout << ans << endl;



}

Measured memory_bytes: 78336
#https://atcoder.jp/contests/abc160/tasks/abc160_c
# -*- coding: utf-8 -*-
K,N = map(int,input().split())
A = input().split()
A = [int(i) for i in A]
saityou = K-A[-1]+A[0]
for i in range(1,len(A)):
  if saityou < A[i]-A[i-1]:
    saityou  = A[i]-A[i-1]
print(K-saityou)

Measured memory_bytes: 77640
import java.util.*;

public class  Main{
	public static void main(String args[]){
	    Scanner sc = new Scanner(System.in);
	    String s = sc.next();
      	
      	if(s.charAt(2) == s.charAt(3)){
          if(s.charAt(4) == s.charAt(5)) System.out.println("Yes");
          else System.out.println("No");
        }
      	else System.out.println("No");
	}
}


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

#define int long long int
#define main signed main()
#define bye return 0

#define rep(i, n) for (int i = 0; i < (n); i++)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define sum(v) accumulate(all(v), 0)
#define cinv(v, n) rep(i, n) cin >> v[i]
#define prec(n) fixed << setprecision(n)
#define odd(n) ((n) % 2)
#define even(n) (!((n) % 2))

#define INF 1e9
#define MOD (1e9 + 7)

#define pb push_back
#define mt make_tuple
#define fi first
#define se second
#define str string
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<str>

using namespace std;

main {
  string s;
  cin >> s;
  stack<char> t;
  rep(i, s.size()) {
    if (t.empty() || t.top() == 'T') {
      t.push(s[i]);
    } else if (s[i] == 'T') {
      t.pop();
    } else {
      t.push(s[i]);
    }
  }
  cout << t.size() << endl;
  bye;
}


Measured memory_bytes: 644
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	int res = 0;
	if(s[0] == s[1] && s[1] == s[2]) res++;
	if(s[1] == s[2] && s[2] == s[3]) res++;
	if (res == 0) cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int h1 = sc.nextInt();
		int w1 = sc.nextInt();
		System.out.println((w - w1)*(h - h1));
	}
}

Measured memory_bytes: 22868
/**
 * Created by hiroqn on 13/10/10.
 */

var fs = require('fs'),
    length = fs.fstatSync(process.stdin.fd).size,
    buffer = new Buffer(length),
    bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
    input = buffer.toString('utf8', 0, bytesRead).split('\n');
main();
function main() {
  var temp, n, m, i, list, res;
  while (true) {
    temp = input.shift().split(' ');
    n = +temp[0];
    m = +temp[1];
    if (n === 0 && m === 0) {
      break;
    }
    list = [];
    for (i = 0; i < n; i++) {
      temp = input.shift().split(' ');
      list[i] = [+temp[0], +temp[1]]
    }
    list.sort(function (a, b) {
      return b[1] - a[1];
    });
    res = 0;
    for (i = 0; i < n; i++) {
      if (m > list[i][0]) {
        m -= list[i][0]
      } else {

        res += (list[i][0] - m) * list[i][1];
        m = 0;
      }
    }
    console.log(res);
  }
}

Measured memory_bytes: 22812
#include <iostream>

using namespace std;

int main() {
	int N, sum=0;
	cin >> N;
	int V[N], C[N];
	for(int i=0; i<N; i++)
		cin >> V[i];
	for(int i=0; i<N; i++){
		cin >> C[i];
		if(V[i]>C[i])
			sum += V[i]-C[i];
	}
	cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 long long int a,b,c,k;
 cin >> a >> b >> c >> k;
 if(k<=a)
 cout << k;
 else if(k<=(a+b))
 cout << a;
 else
 cout << a-k+a+b;
 return 0;
}

Measured memory_bytes: 3636
if __name__ == '__main__':
	s = str(input())
	n = int(input())
	for i in range(n):
		data = input().split()
		if data[0] == "print":
			print(s[int(data[1]):int(data[2])+1])
		elif data[0] == "reverse":
			tmp = s[int(data[1]):int(data[2])+1]
			tmp = [s for s in tmp]
			tmp.reverse()
			rev = "".join(tmp)
			s = s[:int(data[1])]+rev+s[int(data[2])+1:]
		elif data[0] == "replace":
			s = s[:int(data[1])]+data[3]+s[int(data[2])+1:]


Measured memory_bytes: 5620
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int H,W,sharp=0;
    cin >> H >> W;
    vector<string> A(H);
    for(int i=0;i<H;i++){
        cin >> A[i];
    }
 
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(A[i][j]=='#'){
                    sharp++;
            }
        }
    }
 
    if(sharp == H+W-1){
        cout << "Possible" << endl;
    }else{
        cout << "Impossible" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n,m;
  R n;
  m=n;
  int sum=0;
  while(n) {
    sum+=n%10;
    n/=10;
  }
  if(m%sum==0) pr("Yes");
  else pr("No");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();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 d = sc.nextInt();
        int g = sc.nextInt();
        int[] p = new int[d];
        int[] c = new int[d];
        int cnt = 0;
        for (int i = 0; i < d; i++) {
            p[i] = sc.nextInt();
            c[i] = sc.nextInt();
            cnt += p[i];
        }
        int point = 0;
        int dp[] = new int[cnt + 1];
        for (int i = 0; i < d; i++) {
            for (int j = point; j >= 0; j--) {
                for (int k = 0; k < p[i]; k++) {
                    int tmp = dp[j] + (i + 1) * 100 * (k + 1);
                    if (k + 1 == p[i]) {
                        tmp += c[i];
                    }
                    if (tmp > dp[j + k + 1]) {
                        dp[j + k + 1] = tmp;
                    }
                }
            }
            point += p[i];
        }
        for (int i = 0; i < cnt + 1; i++) {
            if (g <= dp[i]) {
                System.out.println(i);
                return;
            }
        }
    }
}

Measured memory_bytes: 21844
n,m,l = map(int,input().split())
a = []
b = []
for _ in range(n):
    a.append(list(map(int,input().split())))
for _ in range(m):
    b.append(list(map(int,input().split())))
c = [[0 for _ in range(l)] for _ in range(n)]

for i in range(n):
    for j in range(m):
        for k in range(l):
            c[i][k] += a[i][j]*b[j][k]

for i in c:
    print(" ".join(list(map(str,i))))

Measured memory_bytes: 8916
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input1 = Console.ReadLine().Split(' ');

        var a = long.Parse(input1[0]);
        var b = long.Parse(input1[1]);
        var c = long.Parse(input1[2]);
        var k = long.Parse(input1[3]);

        long ans = 0;

        if(k <= a)
        {
            ans = k;
        }
        else if(k <= a + b)
        {
            ans = a;
        }
        else
        {
            var n = k - a - b;
            ans = a - n;
        }


        Console.WriteLine(ans);
        Console.ReadLine();

    }


}


Measured memory_bytes: 17872
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define hell 1000000007
using namespace std;
void solve()
{
  ll n,m,i,j,k,c=0,y=0,ans=0,a,b;
  string s;
  cin>>n;
  vector < ll > v(n);
  rep(i,0,n)
  {
      cin>>v[i];
  }
  ll money=1000;
  for(i=0;i<n;i++)
  {
      if(i+1<n)
      {
          if(v[i]<v[i+1])
          {
              ll buy=money/v[i];
              ll get=buy*v[i+1]+money%v[i];
              money=get;
          }
      }

  }
  cout<<money;

}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin>>t;
    while(t--)
    solve();
}


Measured memory_bytes: 3656
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll n;
vector<vector<ll>> dp;
vector<vector<ll>> p;
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    dp.assign(n + 1, vector<ll>(3, 0));
    p.assign(n, vector<ll>(3, 0));
    F0R(i, n) F0R(j, 3) cin >> p[i][j];
    FOR(i, 1, n + 1)
    {
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + p[i - 1][0];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + p[i - 1][1];
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + p[i - 1][2];
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    int count = 0;
    for (int i = 0; i <= 25; i++){
        for (int j = 0; j <= 15; j++){
            if (4 * i + 7 * j == N){
                count++;
            }
        }
    }
    if (count >= 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 100000
using namespace std;
ll v[LIM];
int main() {
  ll n, k, x, y;
  cin >> n >> k >> x >> y;
  cout << min(n, k) * x + max(0, (int)(n-k)) * y << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let ab: Vec<(i64, i64)> = (0..n).map(|_| (read(), read())).collect();

    println!(
        "{}",
        ab.iter()
            .rev()
            .fold(0i64, |a, &(a_i, b_i)| a + (b_i - (a + a_i) % b_i) % b_i)
    );
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 6396
///******* In the name of Allah *******///

#include <bits/stdc++.h>
using namespace std;

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

void Ok()
{
    long long int a[10013],b[10013],c,d,e,f,g,h,t,s,i,j,k,l1,l2,m,n,r,sum = 0,ans_1,ans_2,ans_3,cnt = 0,Max,Min,flag,div,temp;
    double aa,bb,cc,dd,ee,tot;
    //char aaa[3013],bbb[1013],ccc[1013],num;
    string aaa,bbb,ccc;
    cin>>aaa>>bbb;
    cin>>c>>d;
    cin>>ccc;
    if(ccc==aaa)
    {
        c--;
        cout<<c<<" "<<d<<endl;
    }
    else if(ccc==bbb)
    {
        d--;
        cout<<c<<" "<<d<<endl;
    }


}

int main()
{
    Ok();

    return 0;
}


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

using namespace std;

int main(){

  int d, n;

  cin >> d >> n;

  if (n != 100){
    cout << n * pow(100, d) << endl;;
  }else{
    cout << int(101 * pow(100, d)) << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    ll l, r; cin >> l >> r;
    if (r - l >= 2019) cout << 0 << endl;
    else
    {
        ll ans = 2018;
        for (ll i = l; i < r; i++)
            for (ll j = i + 1; j <= r; j++)
                ans = min(ans, i * j % 2019);
        cout << ans << endl;
    }
}

Measured memory_bytes: 256