akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#include<stdio.h>
#include<queue>
#include<stack>
#include<set>
#define int long long
#define MAX 1000000000000000000LL
int inf=100000000000007;
using namespace std;
typedef pair<int,int> P;
string alph="abcdefghijklmnopqrstuvwxyz";
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


signed main(){
    int n;cin>>n;
    deque<int> s;
    int a;
    for(int i=0; i<n; i++){
        cin>>a;
        if(i%2==0)s.push_front(a);
        else s.push_back(a);
    }
    if(n%2==0)reverse(s.begin(),s.end());
    for(int i=0; i<n; i++){
        cout<<s[i];
        if(i!=n-1)cout<<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3840
n, t = map(int, input().split())
ct = [input() for i in range(n)]
m = 1001
for i in ct:
    cost, time = i.split()
    cost = int(cost)
    time = int(time)
    if time <= t:
        if cost < m:
            m = cost
if m > 1000:
    print('TLE')
else:
    print(m)

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

int main()
{
    string S;

    cin >> S;
    int i;
    for(i = 0; i < 26; i++) {
        int j;
        for(j = 0; j < S.size(); j++) {
            if(S[j] == i + 'a') break;
        }

        if(j == S.size()) {
            cout << (char)(i + 'a') << endl;
            break;
        }
    }

    if(i == 26) cout << "None" << endl;
    return (0);

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FALSE 0
#define TRUE 1

int main(){
    int N;
    vector<int>     vA(100010, 0);
    // map<int64_t, int>   mP;
    int res;

    int AiMax = 0;
    cin >> N;
    for (int i=0; i<N; i++){
        int Ai;
        cin >> Ai;
        vA.at(Ai)++;
        AiMax = max(AiMax, Ai);
    }

    res = 0;
    for (int i=0; i<=AiMax; i++){
        int count3 = vA.at(i)
                     + vA.at(i+1)
                     + vA.at(i+2);
        res = max(res, count3);
    }

    cout << res << endl;
    return 0;
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    string s;
    cin >> s;
    int l = s.length();
    for (int i = 0; i < l; i++) {
        if (s[i] == 'F' && s[i+1] == 'E' && s[i+2] == 'S' && s[i+3] == 'T' && s[i+4] == 'I'&& s[i+5] == 'V'&& s[i+6] == 'A'&& s[i+7] == 'L' && (i+7 == l-1) ) {
            cout << s.substr(0, i) << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
open Hashtbl
let h = create 1000000
let s = read_int ()
let f n = if n mod 2 = 0 then n / 2 else 3 * n + 1
let x, i = ref s, ref 1
let _ = while not @@ mem h !x do add h !x 1; x := f !x; incr i done; Printf.printf "%d\n" !i

Measured memory_bytes: 10624
from fractions import gcd
a,b,k = map(int,input().split())
x = gcd(a,b)
now = 1
if now == k:
    print(x)
    exit()
for i in range(x-1,-1,-1):
    if x%i == 0:now += 1
    if now == k:
        print(i)
        exit()

Measured memory_bytes: 5432
/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int n,m;
	cin>>n>>m;
	vi p(m);
	vector<string> s(m);
	loop(i,m)
	{
		cin>>p[i]>>s[i];
		p[i]--;
		}
	vi wa(n);
	vector<bool> flag(n);
	    loop(i,m) {
        if (flag[p[i]] == true) continue;
        if (s[i] == "AC") {
            flag[p[i]] = true;
        }
        else wa[p[i]]++;
    }
    int cntac = 0;
    int cntwa = 0;
    loop(i,n) {
        if (flag[i] == false) { //acできてないなら
            continue;
        }
        cntac++;
        cntwa += wa[i];
    }
    cout << cntac << " " << cntwa << endl;
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 7136
def main():
    data = []
    n = input().split()
    a = int(n[0])
    b = int(n[1])
    c = int(n[2])
    div = 0

    one_div=(a == b) and c % a == 0 or c % b == 0

    if one_div:
        div = 1

    for i in range(a, b):
        div_ans = c % i
        if div_ans == 0:
            div += 1

    print(div)

if __name__ == '__main__':
    main()

Measured memory_bytes: 5600
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 100010
#define MOD 1000000007
typedef long long ll;
using namespace std;
int a[MAXN],pre[MAXN];
int d[MAXN],n,cnt[MAXN];
ll ans=1;
ll f[MAXN];
bool vis[MAXN];
int main(){
	SF("%d",&n);
	for(int i=1;i<=n;i++){
		SF("%d",&a[i]);
		d[a[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(d[i]>2){
			PF("0");
			return 0;
		}
		if(d[i]<2||vis[i]==1)
			continue;
		int p=a[i];
		vis[i]=1;
		pre[p]=i;
		while(p!=i){
			if(vis[p]==1){
				PF("0");
				return 0;	
			}
			vis[p]=1;
			pre[a[p]]=p;
			p=a[p];	
		}
	}
	for(int i=1;i<=n;i++)
		if(d[i]==0){
			int p=i,l1=0,l2=1;
			while(vis[p]==0){
				vis[p]=1;
				p=a[p];
				l1++;
			}
			p=pre[p];
			while(d[p]!=2){
				p=pre[p];
				l2++;
			}
			if(l1<l2)
				ans=ans*2ll%MOD;
			else if(l1>l2){
				PF("0");
				return 0;
			}
		}
	for(int i=1;i<=n;i++)
		if(vis[i]==0){
			int len=0;
			int p=i;
			while(vis[p]==0){
				len++;
				vis[p]=1;
				p=a[p];
			}
			cnt[len]++;
		}
	for(int i=1;i<=n;i++){
		f[0]=1;
		ll mul=i%2+1;
		if(i==1)
			mul=1;
		f[1]=mul;
		for(int j=2;j<=cnt[i];j++)
			f[j]=(1ll*f[j-2]*(j-1)%MOD*i%MOD+f[j-1]*mul%MOD)%MOD;
		ans=ans*f[cnt[i]]%MOD;
	}
	PF("%lld",ans);
}

Measured memory_bytes: 1792
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_list_of_int():
    return [int(i) for i in input().split()]


def get_list_of_float():
    return [float(f) for f in input().split()]


def get_list_of_char():
    return list(input().strip())


def get_data(n, order=None, **kwargs):
    if not order:
        order = range(len(kwargs))
    it = iter(order)
    var, fn = zip(*sorted(sorted(kwargs.items()), key=lambda _: next(it)))

    rows = []
    for _ in range(n):
        rows.append(input().split())
    columns = zip(*rows)
    exec("global "+", ".join(var)+"\n"+"\n".join(
        v+"=list(map(fn[{}], data[{}]))".format(i, i)
        for i, v in enumerate(var)),
        globals(),
        {"fn": list(fn), "data": list(columns)}
    )
    return


# inputs
A, B = 0, 0


def set_inputs():
    global A, B
    A, B = get_list_of_int()
    return


def f(n):
    if n == 0:
        return 0
    div, mod = divmod(n, 4)
    if mod == 0:
        div -= 1
        mod = 4
    ret = n
    for i in range(mod):
        ret ^= (n-1-i)
    return ret


def main():
    setrecursionlimit(100000)
    set_inputs()
    print(f(A-1) ^ f(B))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
issii
2
---+/
/+---test
qq
81
---+/
/+---test
cooooooooonteeeeeeeeeest
999993333
---+/

void main(string[] args) {
  auto  S = readln.chomp.to!string;
  const K = readln.chomp.to!long;

  long ans;
  auto l = S.countUntil!(x => x != S[0]);
  auto r = S.retro.countUntil!(x => x != S[$-1]);

  if (l < 0 || r < 0) {
    (S.length*K/2).writeln;
    return;
  }

  ans += l/2;
  ans += r/2;

  if (S[0] == S[$-1]) {
    ans += (l+r)/2 * (K-1);
  } else {
    ans += (l/2 + r/2) * (K-1);
  }
  r = S.length - r;

  long n = 1;
  foreach (i; l..r+1) {
    if (S[i-1] == S[i]) {
      ++n;
    } else {
      ans += n/2 * K;
      n = 1;
    }
  }
  ans.writeln;
}


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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////


int main(){fastio
    ll n,h,w;cin>>n>>h>>w;
    ll c=0;
    rep(z,0,n-1){
        ll a,b;cin>>a>>b;
        if(a>=h&&b>=w)c++;
    }
    cout<<c;
    
    return 0;
}


Measured memory_bytes: 256
fn read_split<T : std::str::FromStr>() -> Vec<T> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

fn main() {
    let inputs : Vec<i32> = read_split();
    let train = inputs[0] * inputs[1];
    if train < inputs[2] {
        println!("{}", train);
    } else {
        println!("{}", inputs[2]);
    }
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pci pair<char, int>
#define pic pair<int, char>
#define plvl pair<long long, vector<long long> >
#define pcvc pair<char, vector<char> >


using namespace std;

const int mod = 1e9 + 7;

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

template <typename T>
void show1(vector<T> dp) {
	for(auto d : dp) {
		cout << d << " ";
	}
	cout << endl;
}

template <typename T>
void show2(vector<vector<T> > dp) {
	for(auto d : dp) {
		for(auto dd : d) {
			cout << dd << " ";
		}
		cout << endl;
	}
}

void executeCode() {
	ll n;
	cin >> n;
	vector<ll> A(n);
	map<ll, ll> mp;
	ll s = 0;
	for(int i = 0 ; i < n ; i++) {
		cin >> A[i];
		s += A[i];
		mp[A[i]]++;
	}
	ll q;
	cin >> q;
	while(q--) {
		ll b, c;
		cin >> b >> c;
		if(mp.find(b) != mp.end()) {
			s -= (mp[b] * b);
			mp[c] += mp[b];
			s += (mp[b] * c);
			mp.erase(b);
		}
		cout << s << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int tt = 1;
	// cin >> tt;
	while(tt--) {
		executeCode();	
	}
	return 0;
}

Measured memory_bytes: 7844
fn main() {
    let params: Vec<i32> = read_vec_i32();
    println!("{}", solve(params));
}

fn solve(mut param: Vec<i32>) -> String {
    param.sort();
    return if param == [5, 5, 7] {
        String::from("YES")
    } else {
        String::from("NO")
    };
}

fn read_vec_i32<T: std::str::FromStr>() -> Vec<T> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>

using namespace std;

int main(){

    int N;cin>>N;
    int cnt[13]={0};
    REP(i,N){
        int d;cin>>d;
        cnt[d]++;
    }
    int res=0;
    if(cnt[0]>0 || *max_element(cnt,cnt+13)>2){
        res = 0;
    }else{
        vector<int> time;
        time.push_back(0);
        REP(i,13){
            if(cnt[i]==2){
                time.push_back(i);
                time.push_back(24-i);
            }
        }

        vector<int> one;
        REP(i,13)if(cnt[i]==1)one.push_back(i);

        REP(i,1<<(one.size())){
            vector<int> culc(time);
            REP(j,one.size()){
                if((i>>j)&1)culc.push_back(one[j]);
                else culc.push_back(24-one[j]);
            }
            sort(ALL(culc));
            int min_t=INT_MAX;
            REP(j,culc.size()-1)min_t=min(min_t,culc[j+1]-culc[j]);
            min_t = min(min_t, culc[0]+24 - culc[culc.size()-1]);
            res = max(res, min_t);

        }

    }

    cout<<res<<endl;



    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def input():
    return sys.stdin.readline()


def resolve():
    n, k = map(int, input().split())
    d_list = []
    a_list = []
    for i in range(k):
        d_list.append(int(input()))
        a_list.append(list(map(int, input().split())))

    remain_list = [i for i in range(1, n+1)]

    for a in a_list:
        for sunuke_no in a:
            try:
                remain_list.remove(sunuke_no)
            except:
                pass

    print(len(remain_list))



if __name__ == "__main__":
    resolve()



Measured memory_bytes: 67980
#pragma comment(linker, "/STACK:1073741824")

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<fstream>
#include<iterator>
#include<functional>
#include<bitset>
#include<memory>
#include<sstream>
#include<new>
#include<cassert>
#include<iomanip>

using namespace std::placeholders;

typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef long long ll;
typedef long double ld;
typedef std::vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<bool, bool> pbb;
typedef std::pair<ld, ld> pdd;

const int inf = (int)1e9;
const ll linf = (ll) 1e18;
const ld eps = 1e-5;
const int mod = (int) 1e9 + 7;

#define it(v) v.begin(), v.end()
#define pb push_back
#define eb emplace_back
#define mp std::make_pair
#define fst first
#define scn second
#define sgn(x) (x > 0 ? 1 : (x == 0 ? 0 : -1))

int main()
{
	std::ios_base::sync_with_stdio(false);
	int n;
	std::cin >> n;
	vi c(n), s(n), f(n);
	for (int i = 0; i < n - 1; i++)
	{
		std::cin >> c[i] >> s[i] >> f[i];
	}
	for (int i = 0; i < n - 1; i++)
	{
		int time = s[i] + c[i];
		for (int j = i + 1; j < n - 1; j++)
		{
			time = std::max(time, s[j]);
			if (time % f[j] == 0)
				time += c[j];
			else
				time = ((time / f[j] + 1) * f[j]) + c[j];
		}
		std::cout << time << "\n";
	}
	std::cout << "0";
}



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

#define int long long

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e16;
const int MOD = 1e9+7;

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


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n; cin >> n;
    int taro = 0, hanako = 0;
    REP(i, n)
    {
        string s, t; cin >> s >> t;
        if(s > t) taro += 3;
        else if(s < t) hanako += 3;
        else taro++, hanako++;
    }
    cout << taro << " " << hanako << endl;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
int n , ans , now;
string s;
int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	cin >> s;
	int len = s.size();
	for(int i = 0; i < len; i ++)
	{
		if(s[i] == 'I') now ++;
		else now --;
		ans = max(now , ans);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <string>
#include <iostream>
using namespace std;
int n,a,c;string s;
int main() {
	scanf("%d",&n);
	for(;n--;)scanf("%d", &a),s+=(char)(a+48);
	while(~s.find(to_string(c++)));
	printf("%d\n",--c);
	return 0;
}

Measured memory_bytes: 3336
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    int N, X, l, d=0, count=0;
    cin>>N>>X;
    if(d<=X) count++;
    rep(i, N){
        cin>>l;
        d+=l;
        if(d<=X) count++;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 256
l = input().split()
N = int(l[0])
W = int(l[1])
products = [] # [[value, weigth]]
for i in range(N):
    l = input().split()
    products.append([int(l[0]),int(l[1])])

DP = [0 for _ in range(W+1)]
p_flag = [[False for _ in range(N)] for _ in range(W+1)]
for i in range(N):
    new_DP = [DP[j] if j < products[i][1] else 0 for j in range(W+1)]
    for j in range(products[i][1], W + 1):
        product_in = DP[j - products[i][1]] + products[i][0]
        if product_in >= DP[j]:
            new_DP[j] = product_in
        else:
            new_DP[j] = DP[j]
    DP = [v for v in new_DP]
print(DP[W])

Measured memory_bytes: 17840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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; }

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cout << a[i] << " "; cout << "\n"; }
template<class T> void verr(const vector<T>& v){ for(auto& a : v) cout << a << " "; cout << "\n"; }
ll dbgt = 1; void err() { cout << "passed " << dbgt++ << "\n"; }
template<class H, class... T> void err(H&& h,T&&... t){ cout<< h << (sizeof...(t)?" ":"\n"); if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll K,T;
    cin >> K >> T;
    vl A(T);
    rep(i, T) cin >> A[i];
    ll M = *max_element(all(A));
    ll rest = K - M;
    if(M<=(K+1)/2){
        cout << 0 << endl;
    }else{
        cout << (M - rest - 1) << endl;
    }
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define N 10000
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.14159265
#define cot cout.tie(0)
using namespace std;
/**
        * @author :: Sawlani
        *
        */

string k;
ll d;
ll n;
ll dp[N + 1][2][101];
const ll M = 1e9 + 7;

ll rec(ll i, ll tight, ll sum)
{
    if (i == n && sum == 0)
        return 1;
    else if (i == n)
        return 0;

    if (dp[i][tight][sum] != -1)
        return dp[i][tight][sum];
    int no = (int)k[i] - 48;

    //debug(no);
    ll ans = 0;

    if (i == 0)
    {
        f(j, 0, no - 1)
            ans = (ans + rec(i + 1, tight, (sum + j) % d)) % M;

        ans = (ans + rec(i + 1, tight + 1, (sum + no) % d)) % M;
    }
    else
    {
        if (tight)
        {
            f(j, 0, no - 1)
            {
                ans = (ans + rec(i + 1, tight - 1, (sum + j) % d)) % M;
            }
            ans = (ans + rec(i + 1, tight, (sum + no) % d)) % M;
        }
        else
        {
            f(j, 0, 9)
            {
                ans = (ans + rec(i + 1, tight, (sum + j) % d)) % M;
            }
        }
    }
    return dp[i][tight][sum] = ans;
}
int main()
{
     cin >> k >> d;

    memset(dp, -1, sizeof(dp));

    n = k.length();
    cout << (rec(0, 0, 0) % M - 1 % M + M) % M;
}

Measured memory_bytes: 16896
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
char s[maxn];
int trans[maxn][26], f[maxn], path[maxn];
int main()
{
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	for(int j = 0; j < 26; ++j) trans[n][j] = n + 1;
	for(int i = n - 1; ~i; --i)
	{
		for(int j = 0; j < 26; ++j)
			trans[i][j] = trans[i + 1][j];
		trans[i][s[i + 1] - 'a'] = i + 1;
	}
	for(int i = n; ~i; --i)
	{
		f[i] = n + 1;
		for(int j = 0; j < 26; ++j)
			if(f[trans[i][j]] + 1 < f[i])
			{
				f[i] = f[trans[i][j]] + 1;
				path[i] = j;
			}
	}
	int cur = 0;
	while(cur != n + 1)
	{
		putchar(path[cur] + 'a');
		cur = trans[cur][path[cur]];
	}
	return 0;
}

Measured memory_bytes: 25804
import queue
import copy

h, w = map(int, input().split())
l = [input() for _ in range(h)]

def dist(m, x1, y1):
    q = queue.Queue()
    q.put((x1, y1, 0))
    checked=[[False for _ in range(w)] for __ in range(h)]
    checked[y1][x1] = True
    while not q.empty():
        x, y, count = q.get()
        if x > 0 and m[y][x-1] == "." and checked[y][x-1] == False:
            checked[y][x-1] = True
            q.put((x-1, y, count+1))
        if y > 0 and m[y-1][x] == "." and checked[y-1][x] == False:
            checked[y-1][x] = True
            q.put((x, y-1, count+1))
        if x < w-1 and m[y][x+1] == "." and checked[y][x+1] == False:
            checked[y][x+1] = True
            q.put((x+1, y, count+1))
        if y < h-1 and m[y+1][x] == "." and checked[y+1][x] == False:
            checked[y+1][x] = True
            q.put((x, y+1, count+1))
    return count

ans = 0
for i in range(h):
    for j in range(w):
        if l[i][j] == ".":
            ans = max(ans, dist(l, j, i))
print(ans)

Measured memory_bytes: 99688
from sys import stdin,stdout
I = lambda : map(int,stdin.readline().split())

alphabet = [chr(x) for x in range(ord('a'), ord('z')+1)]
alnum = lambda x: ord(x) - ord('a')


def next(i, n):
	return (i+1) % n
def prev(i, n):
	return (i-1+n) % n

def next_arr(ch, a):
	n = len(a)
	i = a.find(ch)
	if i == -1:
		return [-1] * n
	ret = [-1] * n
	while ret[prev(i,n)] == -1:
		if a[i] == ch:
			ret[prev(i,n)] = i
		else:
			ret[prev(i,n)] = ret[i]
		i = prev(i,n)
	return ret

a = raw_input()
b = raw_input()
n = len(a)

next_ = [next_arr(alphabet[i], a) for i in range(26)]
ptr = -1
ans = 0
for ch in b:
	old_ptr = ptr
	ptr = next_[alnum(ch)][ptr]
	if ptr == -1:
		print -1
		exit()
	if ptr <= old_ptr:
		ans += n
print ans+ptr+1





Measured memory_bytes: 26116
#include <stdio.h>
 
/* プロセスに適した構造体 */
typedef struct {
    char name[11];
    int time;
} Queue;
 
 
int main()
{
    //入力
    int n, q;
    scanf("%d%d", &n, &q);
 
    int size = 2 * n;
    Queue Queue[size];
    int pre = 0, rear = 0, cnt = 0;
    for( rear = 0; rear < n; ++rear )
        scanf("%s %d", Queue[rear].name, &Queue[rear].time);
 
 
    //処理と出力
    while( pre != rear ){
        if( Queue[pre].time <= q ){
            cnt += Queue[pre].time;
            printf("%s %d\n", Queue[pre].name, cnt);
        } else {
            cnt += q;
            Queue[pre].time -= q;
            Queue[rear] = Queue[pre];
            rear = (rear + 1) % size;
        }
 
        //次の指す先
        pre = (pre + 1) % size;
    }
 
 
    return 0;
}


Measured memory_bytes: 3256
n = int(input())
if n==1:
    print(''.join(sorted(input())))
else:
    dic = {}
    s = input()
    for i in s:
        dic[i] = s.count(i)
    for i in range(n-1):
        s = input()
        for j in dic.keys():
            dic[j] = min(dic[j], s.count(j))
    s = ''
    for i in dic.keys():
        s += i*dic[i]
    print(''.join(sorted(s)))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define SUM(v) accumulate(v.begin(),v.end(),lli(0))
#define rev(n,d) for(int i=n;i>=d;i--)
#define FOR0(n) for(int i=0;i<n;i++)
#define FOR(a,n) for(int i=a;i<n;i++)
#define FORQ(a,n) for(int i=a;i<=n;i++)
#define inf 1000000009
#define inff 0x3f3f3f3f
#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define mem(ar,x) memset(ar,x,sizeof ar)
#define present(container, element) (container.find(element) != container.end())
#define max3(a,b,c) return (lli(a)>lli(b)?(lli(a)>lli(c)?a:c):(lli(b)>lli(c)?b:c))
#define max4(a,b,c,d) return (max3(a,b,c)>lli(d)?(max3(a,b,c)):d)
#define min3(a,b,c) return (lli(a)<lli(b)?(lli(a)<lli(c)?a:c):(lli(b)<lli(c)?b:c))
#define min4(a,b,c,d) return (max3(a,b,c)<lli(d)?(max3(a,b,c)):d)
typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<int,pii>ppii;
typedef vector<int>vi;
typedef vector<vi>vvi;
typedef vector<pii>vpii;
const int N=100005;
int dr8[]={0,0,1,-1,1,1,-1,-1};
int dc8[]={1,-1,0,0,-1,1,-1,1};
int dr4[]={0,1,-1,0};
int dc4[]={1,0,0,-1};
int main(){
	fast
	int x,n;
	cin>>x>>n;
	int a[105];
	mem(a,0);
	FOR0(n){
		int k;
		cin>>k;
		a[k]=1;
	}
	if(n==0){
		cout<<x;return 0;
	}
	int mn=abs(0-x),nm=0;
	FORQ(1,101){
		if(!a[i]){
			if(abs(i-x)<mn){
				mn=abs(i-x);
				nm=i;
//				cout<<mn<<endl;
			}
		}
	}
	cout<<nm;
}



Measured memory_bytes: 3648
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

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

    int h, w;
    cin >> h >> w;

    vector< vector<int> > a(h, vector<int>(w));
    rep(i, h){
        rep(j, w){
            cin >> a[i][j];
        }
    }

    vector< pair< P, P > > ans;
    rep(i, h){
        rep(j, w){
            if(a[i][j] & 1){
                if(j < w - 1){
                    ans.push_back({{i, j}, {i, j + 1}});
                    ++a[i][j + 1];
                }else if(i < h - 1){
                    ans.push_back({{i, j}, {i + 1, j}});
                    ++a[i + 1][j];
                }
            }
        }
    }

    cout << ans.size() << endl;
    for(auto x : ans){
        cout << x.first.first + 1 << " " << x.first.second + 1 << " " << x.second.first + 1 << " " << x.second.second + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 5236
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int a,p;
  cin >> a >> p;

  p = p + a * 3;

  cout << p /2;

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}

Measured memory_bytes: 256
// In The Name Of God
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ll long long
#define for2(a,b,c) for(int (a) = (b); (a) < (c); (a)++)
#define setp cout << fixed << setprecision(15)
#define endl "\n"
#define minit(a,b) a = min(a,b)
#define maxit(a,b) a = max(a,b)
#define PII pair<int,int>
#define Vec vector<int>
#define error(x) cerr << #x << " = " << (x) << endl;
#define all(x) (x).begin() , (x).end()


int32_t main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    int cnt = 0;
    while(a[1] < a[2]){
        a[0] ++;
        a[1] ++;
        cnt++;
    }
    while(a[0] < a[1]){
        a[0] += 2;
        cnt++;
    }
    if(a[0] != a[1]) cnt++;
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV
        
    return CONV()



sys.setrecursionlimit(200005)


def main():
    K = iRaw()
    A,B = isRaw()
    div = A//K
    if A%K !=0:
        div+=1
    ans = "OK" if (div*K) <= B else "NG"
    return ans

if __name__ == "__main__":
    print(main())


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


int main()
{
	int n, i, j;
	int b[1000] = { 0 };
	int f[1000] = { 0 };
	int r[1000] = { 0 };
	int v[1000] = { 0 };
	int A[3][10] = { 0 };
	int B[3][10] = { 0 };
	int C[3][10] = { 0 };
	int D[3][10] = { 0 };

	cin >> n;

	for (i = 0; i < n; i++)
	{
		cin >> b[i] >> f[i] >> r[i] >> v[i];

		if (b[i] == 1)
		{
			for (j = 0; j < 3; j++)
			{
				if (f[i] == j+1)
				{
					for (int k = 0; k < 10; k++)
					{
						if (r[i] == k+1)
						{
							A[j][k] += v[i];
						}
					}
				}
			}
		}
		if (b[i] == 2)
		{
			for (j = 0; j < 3; j++)
			{
				if (f[i] == j + 1)
				{
					for (int k = 0; k < 10; k++)
					{
						if (r[i] == k+1)
						{
							B[j][k] += v[i];
						}
					}
				}
			}
		}
		if (b[i] == 3)
		{
			for (j = 0; j < 3; j++)
			{
				if (f[i] == j + 1)
				{
					for (int k = 0; k < 10; k++)
					{
						if (r[i] == k+1)
						{
							C[j][k] += v[i];
						}
					}
				}
			}
		}
		if (b[i] == 4)
		{
			for (j = 0; j < 3; j++)
			{
				if (f[i] == j + 1)
				{
					for (int k = 0; k < 10; k++)
					{
						if (r[i] == k+1)
						{
							D[j][k] += v[i];
						}
					}
				}
			}
		}
	}

	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			cout << " " << A[i][j];
		}
		cout << endl;
	}
	for (i = 0; i < 20; i++)
	{
		cout << "#";
	}
	cout << endl;

	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			cout << " " << B[i][j];
		}
		cout << endl;
	}
	for (i = 0; i < 20; i++)
	{
		cout << "#";
	}
	cout << endl;

	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			cout << " " << C[i][j];
		}
		cout << endl;
	}
	for (i = 0; i < 20; i++)
	{
		cout << "#";
	}
	cout << endl;

	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			cout << " " << D[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1180
// #include "lcs.h"
#include <algorithm>
#include <iostream>
#include <vector>

#include <iterator>

std::string lcs(const std::string& lhs, const std::string& rhs)
{
    std::vector<std::vector<int>> dp(lhs.size() + 1,
                                     std::vector<int>(rhs.size() + 1));
    std::vector<std::vector<std::pair<size_t, size_t>>> path(
        lhs.size() + 1,
        std::vector<std::pair<size_t, size_t>>(rhs.size() + 1, {0, 0}));

    for (size_t left = 1; left <= lhs.size(); ++left) {
        for (size_t right = 1; right <= rhs.size(); ++right) {
            if (lhs[left - 1] == rhs[right - 1]) {
                dp[left][right] = 1 + dp[left - 1][right - 1];
                path[left][right] = {left - 1, right - 1};
                continue;
            }
            if (dp[left][right - 1] > dp[left - 1][right]) {
                dp[left][right] = dp[left][right - 1];
                path[left][right] = {left, right - 1};
            }
            else {
                dp[left][right] = dp[left - 1][right];
                path[left][right] = {left - 1, right};
            }
        }
    }

    size_t left{lhs.size()};
    size_t right{rhs.size()};

    std::string result;

    // for (const auto& row : dp) {
    //     std::copy(row.cbegin(),
    //               row.cend(),
    //               std::ostream_iterator<
    //                   std::iterator_traits<decltype(row.cbegin())>::value_type>(
    //                   std::cout, ", "));
    //     std::cout << '\n';
    // }
    //
    // for (const auto& row : path) {
    //     for (const auto& element : row) {
    //         std::cout << "(" << element.first << ", " << element.second
    //                   << "), ";
    //     }
    //     std::cout << '\n';
    // }
    // for (const auto& row : path) {
    //     for (const auto& element : row) {
    //         std::cout << "(" << lhs[element.first - 1] << ", "
    //                   << rhs[element.second - 1] << "), ";
    //     }
    //     std::cout << '\n';
    // }

    while (left > 0 && right > 0) {
        if (lhs[left - 1] == rhs[right - 1]) {
            result.push_back(lhs[left - 1]);
            --left;
            --right;
            continue;
        }
        dp[left][right - 1] > dp[left - 1][right] ? --right : --left;
    }

    // while (left > 0 && right > 0) {
    //     if (lhs[left - 1] == rhs[right - 1])
    //         result.push_back(lhs[left - 1]);
    //     // if (left == 1 && right == 1)
    //     //     break;
    //     left = path[left][right].first;
    //     right = path[left][right].second;
    // }

    std::reverse(result.begin(), result.end());
    return result;

    // return trace_string(lhs, rhs, dp);
}

int main(int argc, char* argv[])
{
    std::string lhs, rhs;
    std::cin >> lhs >> rhs;
    std::cout << lcs(lhs, rhs) << std::endl;
    return 0;
}


Measured memory_bytes: 176384
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))
X, Y = LI()
print(X * Y)


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

using namespace std;

#define X first
#define Y second
#define eps  1e-5
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;

const int maxn = 1e5+7;
const int INF  = 1<<30;
const int mod  = 1e9+7;

struct node
{
    int a,b;
    bool operator < (const node &x)const{
        return b>x.b || (b==x.b&&a<x.a);
    }
}s[maxn];
int par[maxn];
bool v[maxn];
int find(int x){
    return par[x] < 0 ? x:par[x] = find(par[x]);
}

int n,m;
void solve(){
    cin>>n>>m;
    mem(par,-1);
    for(int i=1;i<=n;i++){
        cin>>s[i].a>>s[i].b;
    }
    sort(s+1,s+1+n);
    long long res = 0;
    for(int i=1;i<=n;i++){
        if(s[i].a <= m){
            int x = find(m-s[i].a+1);
            if(!v[x]){
                if(x!=1) par[x] = x-1;
                v[x] = true;
                res += s[i].b;
            }
        }
    }
    cout<<res<<endl;
    return;
}

int main()
{
#ifndef ONLINE_JUDGE
   // freopen("in.txt","r",stdin);
#endif
//    freopen("out.txt","w",stdout);
//    ios::sync_with_stdio(false);
    int t = 1;
    //scanf("%d",&t);
    while(t--){
    //    printf("Case %d: ",cas++);
        solve();
    }
#ifndef ONLINE_JUDGE
   // printf("%.10f\n",1.0*clock()/CLOCKS_PER_SEC);
#endif
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    int X;
    cin >> X;
    X -= 400;
    int temp = X / 200;
    int ans = 8 - temp;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back

vector<pii> score;
int pena[100][100];

void mysort(int ac[100]){
    for(int i=0;i<score.size()-1;i++){
        for(int j=i+1;j<score.size();j++){
//            if(score[i].first<score[j].first || ( score[i].first==score[j].first && score[i].second<score[j].second )){
            if(ac[score[i].second]<ac[score[j].second])swap(score[i],score[j]);
            else if(ac[score[i].second]==ac[score[j].second] && score[i].first>score[j].first)swap(score[i],score[j]);
            else if(ac[score[i].second]==ac[score[j].second] && score[i].first==score[j].first && score[i].second>score[j].second)swap(score[i],score[j]);
        }
    }
}


int main(){
    int t,p,r;
    while(cin>>t>>p>>r){
        int ac[100]={};
        if(t==0 && p==0 && r==0)break;
        score.clear();
        rep(i,t)score.pb(pii(0,i));
        rep(i,100)rep(j,100)pena[i][j]=0;
        
        
        rep(i,r){
            int team,prob,time;
            string mess;
            cin>>team>>prob>>time>>mess;
            team--;
            
            if(mess=="WRONG"){
                pena[team][prob]++;
            }else{
                score[team].first+=time+pena[team][prob]*1200;
                ac[team]++;
            }
        }
        
        mysort(ac);
        
        rep(i,score.size()){
            cout<<score[i].second+1<<" "<<ac[score[i].second]<<" "<<score[i].first<<endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 1260
#include <stdio.h>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef std::vector<ll> lls;
#define MIN(a, b) ( ((a)<(b)) ? (a) : (b) )
#define MAX(a, b) ( ((a)>(b)) ? (a) : (b) )

void cinv(lls& llVec, ll n) {
	ll val;
	llVec.reserve((size_t)(n));
	for (ll i = 0; i < n; i++) {
		cin >> val;
		llVec.push_back(val);
	}
}


int main()
{
	std::string S;

	cin >> S;
	std::string ret;
	if (S == "Sunny") ret = "Cloudy";
	else if (S == "Cloudy") ret = "Rainy";
	else ret = "Sunny";


	cout << ret << '\n';

	return 0;
}



Measured memory_bytes: 256
N = int(input())
M = 26
n = 0
m = 1
s = [0, 0]
while s[1] < N:
  m *= M
  s[0] = s[1]
  s[1] += m
  n += 1
N = N - s[0] - 1
ans = ""
for i in range(n):
  ans = chr(ord("a") + (N % M)) + ans
  N //= M
print(ans)

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int n;
	cin >> n;
	ll ans = 0;
	fx(n) {
		if ((x+1)%3!=0&&(x+1)%5!=0) {
			ans += x + 1;
		}
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 3636
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s1 = new String(sc.nextLine());
        String s2 = new String(s1+s1);
        String s3 = new String(sc.nextLine());
        
        if(s2.indexOf(s3) != -1){
        	System.out.println("Yes");
        }
        else{
        	System.out.println("No");
        }
        sc.close();
    }
 
}


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

int main(){
  int N,X,L,sum=0,ans=1;
  cin>>N>>X;
  
  for(int i=0;i<N;i++){
    cin>>L;
    sum+=L;
    if(sum<=X){ans++;}
    else{break;}
  }
  cout<<ans;
}
  
  

Measured memory_bytes: 256
#!/usr/bin/env python3


numbers = input().split(" ")
n = int(numbers[0])
x = int(numbers[1])
t = int(numbers[2])

r = 0
if n % x == 0:
    r = int(n / x) * t
else:
    r = int(n / x + 1) * t
print(r)


Measured memory_bytes: 9104
#include <stdio.h>

int main(void)
{
	int a;
	for(a=1;a<10;a++){
		printf("%dx1=%d\n""%dx2=%d\n""%dx3=%d\n""%dx4=%d\n""%dx5=%d\n""%dx6=%d\n""%dx7=%d\n""%dx8=%d\n""%dx9=%d\n",a,a*1,a,a*2,a,a*3,a,a*4,a,a*5,a,a*6,a,a*7,a,a*8,a,a*9);
	}
	return 0;
}

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

int main() {
	int n, q;
	string s;
	cin >> n >> q >> s;
	vector<int> l(q), r(q);
	rep(i, q) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		l[i] = a;
		r[i] = b;
	}
	vector<int> ac(n);
	rep(i, n) {
		if(i==0) continue;
		if(s[i-1]=='A' && s[i]=='C') ac[i]++;
		ac[i] += ac[i-1];
	}
	rep(i, q) {
		int now = ac[r[i]];
		if(l[i] > 0) {
			now -= ac[l[i]-1];
			if(s[l[i]-1]=='A' && s[l[i]]=='C') now--;
		}
		cout << now << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
using namespace std;
int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if (0<=x-r && x+r<=W &&y-r>=0 && y+r<=H){
        cout << "Yes" << endl;
    } else{
        cout <<"No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3104