akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val buttons = listOfInt()
    val start = Math.max(buttons[0], buttons[2])
    val last = Math.min(buttons[1], buttons[3])

    println(Math.max(0, last - start))
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37988
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;

template <class T> using Vec = vector<T>;

/* 定数 */
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;

#define ALL(v) v.begin(), v.end()

#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    u32 N, X;
    cin >> N >> X;
    Vec<u32> m(N);
    u32 sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> m[i];
        sum += m[i];
    }
    sort(ALL(m));
    u32 r = X - sum;
    u32 c = N;
    c += r / m[0];
    cout << c << endl;
}


Measured memory_bytes: 256
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var x = nexts(5);
  return 15-x.reduce((a,b)=>a+b);
}

Measured memory_bytes: 29628
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		Map<Integer, Integer> numCount =new HashMap<>();

		for (int i = 0; i < n; i++) {
			int x = Integer.parseInt(sc.next());
			int count = numCount.containsKey(x) ? numCount.get(x) : 0;
			numCount.put(x, count + 1);
		}
		long ans = numCount.entrySet().stream().filter(s -> s.getValue() % 2 != 0).count();
		System.out.println(ans);
	}
}


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

int main()
{
    string s;
    int a,b,i;
    
    cin>>a>>b;
    cin>>s;
    
    for(i=0;i<s.size();i++)
    {
    	if(i!=a){
    	   if(!isdigit(s[i]))
    	   {
    	   	cout<<"No";
    	   	return 0;
    	   }
        }
    	else
    	   {
    	   	if(s[i]!='-')
    	   	{
    	   	    cout<<"No";
    	   	    return 0;
    	   	}
    	   }
    }
    
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
# 12,432 -> 012,432
def align_digits(a, b):
    la, lb = len(a), len(b)
    if la < lb:
        a = a.zfill(lb)
    elif lb < la:
        b = b.zfill(la)
    return a, b


def add(a, b):
    a, b = align_digits(a, b)
    zipped = list(zip(a[::-1], b[::-1]))
    carry = 0
    result = []
    for i, z in enumerate(zipped):
        a, b = z
        s = int(a) + int(b) + carry
        carry = int(s / 10)
        if i == len(zipped) - 1:
            result.append(str(s))
        else:
            result.append(str(s % 10))
    ans = ''.join(result[::-1])
    if len(ans) > 80:
        return 'overflow'
    return ans


if __name__ == '__main__':
    n_input = int(input())
    inputs = []
    for i in range(n_input):
        inputs.append((input(), input()))
    for a, b in inputs:
        print(add(a, b))


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1000000007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

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

const int MAX = 100010;
ll dp[MAX];

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    for (int i = 0; i < n - 2; i++)
    {
        dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 1] + abs(h[i + 2] - h[i + 1]));
    }
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 4404
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll tMOD=(ll)1e9+7;
const ll MOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll n;
int main(){
	cin>>n;
	if(n%2==0){
		cout<<n/2-1<<endl;
	}else{
		cout<<n/2<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define INT_DMAX 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define reps(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define rrep(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define rreps(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
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;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;

struct node {
    std::vector<int> nextnode;
};

int seeker(std::vector<node>& nodelist, std::vector<int>& check, pii remove, int now, int& all)
{
    if (check[now] == 1) {
        return 0;
    } else {
        check[now] = 1;
        all++;
        for (int i = 0; i < nodelist[now].nextnode.size(); i++) {
            if ((now == remove.first && nodelist[now].nextnode[i] == remove.second) || (now == remove.second && nodelist[now].nextnode[i] == remove.first)) {
                continue;
            }
            seeker(nodelist, check, remove, nodelist[now].nextnode[i], all);
        }
    }
    return 0;
}

signed main()
{
    int n, m;
    cin >> n >> m;
    std::vector<node> nodelist(n);
    std::vector<pii> pathlist(m);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        nodelist[a].nextnode.pb(b);
        nodelist[b].nextnode.pb(a);
        pii temp = {a, b};
        pathlist[i] = temp;
    }

    int out = 0;
    for (int i = 0; i < m; i++) {
        pii remove = pathlist[i];
        int all = 0;
        std::vector<int> check(n, 0);
        seeker(nodelist, check, remove, 0, all);
        if (all != n) {
            out++;
        }
    }

    cout << out << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	for(;;){
	int n,k;
	cin >> n >> k;
	if(n==0&&k==0)return 0;
	string ss[10];
	vector<string> ans;
	for(int i=0;i<n;i++)cin >> ss[i];
	int a=0,b=1,c=2,d=3;

	
	if(k==2){
		for(;;){
			string x="";
			x+=ss[a]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[a];
			ans.push_back(x);
			b++;
			if(b==n){
				if(a==n-2)goto next;
				a++;
				b=a+1;
			}
		}
	}
	else if(k==3){
		for(;;){
			string x="";
			x+=ss[a]+ss[b]+ss[c];
			ans.push_back(x);
			x="";
			x+=ss[a]+ss[c]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[a]+ss[c];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[c]+ss[a];
			ans.push_back(x);
			x="";
			x+=ss[c]+ss[a]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[c]+ss[b]+ss[a];
			ans.push_back(x);
			x="";
			c++;
			if(c==n){
				if(b==n-2){
					if(a==n-3){
						goto next;
					}
					a++;
					b=a+1;
					c=a+2;
					goto f;
				}
				b++;
				c=b+1;
			}
			f:;
		}
	}
	else {
		for(;;){
			string x="";
			x+=ss[a]+ss[b]+ss[c]+ss[d];
			ans.push_back(x);
			x="";
			x+=ss[a]+ss[b]+ss[d]+ss[c];
			ans.push_back(x);
			x="";
			x+=ss[a]+ss[c]+ss[b]+ss[d];
			ans.push_back(x);
			x="";
			x+=ss[a]+ss[c]+ss[d]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[a]+ss[d]+ss[b]+ss[c];
			ans.push_back(x);
			x="";
			x+=ss[a]+ss[d]+ss[c]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[a]+ss[c]+ss[d];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[a]+ss[d]+ss[c];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[c]+ss[d]+ss[a];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[c]+ss[a]+ss[d];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[d]+ss[a]+ss[c];
			ans.push_back(x);
			x="";
			x+=ss[b]+ss[d]+ss[c]+ss[a];
			ans.push_back(x);
			x="";
			
			x+=ss[c]+ss[a]+ss[b]+ss[d];
			ans.push_back(x);
			x="";
			x+=ss[c]+ss[a]+ss[d]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[c]+ss[b]+ss[a]+ss[d];
			ans.push_back(x);
			x="";
			x+=ss[c]+ss[b]+ss[d]+ss[a];
			ans.push_back(x);
			x="";
			x+=ss[c]+ss[d]+ss[a]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[c]+ss[d]+ss[b]+ss[a];
			ans.push_back(x);
			x="";
			x+=ss[d]+ss[a]+ss[b]+ss[c];
			ans.push_back(x);
			x="";
			x+=ss[d]+ss[a]+ss[c]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[d]+ss[b]+ss[a]+ss[c];
			ans.push_back(x);
			x="";
			x+=ss[d]+ss[b]+ss[c]+ss[a];
			ans.push_back(x);
			x="";
			x+=ss[d]+ss[c]+ss[a]+ss[b];
			ans.push_back(x);
			x="";
			x+=ss[d]+ss[c]+ss[b]+ss[a];
			ans.push_back(x);
			x="";
			d++;
			if(d==n&&c==n-2&&b==n-3&&a==n-4)goto next;
			else if(d==n&&c==n-2&&b==n-3){
				a++;
				b=a+1;
				c=a+2;
				d=a+3;
			}
			else if(d==n&&c==n-2){
				b++;
				c=b+1;
				d=c+1;
			}
			else if(d==n){
				c++;
				d=c+1;
			}
			else ;
		}
	}
next:;
	sort(ans.begin(),ans.end());
	/*for(int i=0;i<ans.size();i++){
		cout << ans[i] << "\n";
	}*/
	int ret=0;
	for(int i=0;i<ans.size();i++){
		ret++;
		if(i==ans.size()-1)goto xx;
		while(ans[i]==ans[i+1]){
			i++;
			if(i==ans.size()-1)goto xx;
		}
	}
	xx:;
	printf("%d\n",ret);
	}
	return 0;
}

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

int main(){
	
	int x, a, b;
	cin >> x >> a >> b;
	if ( x > a && x > b && x - a > x - b ){
		cout << " B " << endl;
	} else if ( x > a && x > b && x - a < x - b ){
		cout << " A " << endl;
	} else if ( x > a && x < b && x - a > b - x ){
		cout << " B " << endl;
	} else if ( x > a && x < b && x - a < b - x ){
		cout << " A " << endl;
	} else if ( x < a && x > b && a - x > x - b ){
		cout << " B " << endl;
	} else if ( x < a && x > b && a - x < x - b ){
		cout << " A " << endl;
	} else if ( x < a && x < b && a - x > b - x ){
		cout << " B " << endl;
	} else if ( x < a && x < b && a - x < b - x ){
		cout << " A " << 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);

        int n = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();

        int min = a + b - n;
        int max = a > b ? b : a;

        if(min < 0) {
            min = 0;
        }

        System.out.println(String.format("%d %d", max, min));
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using std::min;
using std::max;
char s[105];
int a[205][205],ans,h,w,sx,sy;
short dp[105][105][105][105];
short sh[105][105],sl[105][105];
#define ch(x,l,r) sh[x][r]-sh[x][l-1]
#define cl(x,l,r) sl[x][r]-sl[x][l-1]
#define m(x,y) x=x>y?x:y
int main(){
	scanf("%d%d",&h,&w);
	for (int i=1;i<=h;i++) {
		scanf("%s",s+1);
		for (int j=1;j<=w;j++){
			if (s[j]=='o') a[i][j]=1;
			if (s[j]=='E') sx=i,sy=j;
		}
	}
	for (int i=1;i<=h;i++)
		for (int j=1;j<=w;j++) 
			sh[i][j]=a[i][j]+sh[i][j-1],sl[j][i]=a[i][j]+sl[j][i-1];
	for (int i=0;i<=h+1;i++)
		for (int j=0;j<=w+1;j++)
			for (int i2=0;i2<=h+1;i2++)
				for (int j2=0;j2<=w+1;j2++)
					dp[i][j][i2][j2]=-1;
	dp[sx][sy][sx][sy]=0;
	for (int i=sx;i>=1;i--)
		for (int j=sy;j>=1;j--)
			for (int i2=sx;i2<=h;i2++)
				for (int j2=sy;j2<=w;j2++){
					if (i==sx && i2==sx && j==sy && j2==sy) continue;
					if (dp[i+1][j][i2][j2]>=0 && i>i2-sx && i!=sx) 
						m(dp[i][j][i2][j2],dp[i+1][j][i2][j2]+ch(i,max(j,j2-sy+1),min(j2,w-(sy-j))));
					if (dp[i][j][i2-1][j2]>=0 && i2<=h-(sx-i) && i2!=sx) 
						m(dp[i][j][i2][j2],dp[i][j][i2-1][j2]+ch(i2,max(j,j2-sy+1),min(j2,w-(sy-j))));
					if (dp[i][j+1][i2][j2]>=0 && j>j2-sy && j!=sy) 
						m(dp[i][j][i2][j2],dp[i][j+1][i2][j2]+cl(j,max(i,i2-sx+1),min(i2,h-(sx-i))));
					if (dp[i][j][i2][j2-1]>=0 && j2<=w-(sy-j) && j2!=sy) 
						m(dp[i][j][i2][j2],dp[i][j][i2][j2-1]+cl(j2,max(i,i2-sx+1),min(i2,h-(sx-i))));
					m(ans,dp[i][j][i2][j2]);
				}
	printf("%d\n",ans);	
}

Measured memory_bytes: 233728
#include <stdbool.h>
#include <stdio.h>

// ref. http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B

bool binary_search(int xs[], int len, int target) {
    int l = 0, h = len-1, mid;

    while (h >= l) {
        mid = (l + h) / 2;
        if (xs[mid] < target) {
            l = mid + 1;
        } else if (xs[mid] > target) {
            h = mid - 1;
        } else {
            return true;
        }
    }

    return false;
}

#define MAX_N 100000
#define MAX_Q 50000

int main(void) {
    int n;
    int xs[MAX_N];
    int q;
    int count = 0;

    scanf("%d\n", &n);

    for (int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        xs[i] = x;
    }

    scanf("%d\n", &q);
    
    for (int i = 0; i < q; i++) {
        int y;
        scanf("%d", &y);

        if (binary_search(xs, n, y)) {
            // printf("%d\n", y);
            count++;
        }
    }
    
    printf("%d\n", count);

    return 0;
}




Measured memory_bytes: 2112
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	string s, t;

	cin >> s >> t;

	vector<ll> v1(26, 0);
	vector<ll> v2(26, 0);

	REP(i, s.size()) {
		v1[s[i] - 'a']++;
	}

	REP(i, t.size()) {
		v2[t[i] - 'a']++;
	}

	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());

	REP(i, 26) {
		if (v1[i] != v2[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
}

Measured memory_bytes: 776
#include<stdio.h>
int main(){
    int n,k,x,y;
    scanf("%d %d %d %d",&n,&k,&x,&y);
    if(n<=k){
        printf("%d\n",n*x);
    }
    else{
        printf("%d\n",k*x+(n-k)*y);
    }
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;cin>>n;
	cout << (int)((n+1)/2) << endl;
	
	return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cout << (a-1)*(b-1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define _USE_MATH_DEFINES
#include<math.h>

using namespace std;

struct Point{
    double x;
    double y;
};

int n;

void koch(Point p1, Point p2, int n){
    if(n == 0){
        return;
    }
    else{
        Point s;
        s.x = p1.x * 2 / 3 + p2.x * 1 / 3;
        s.y = p1.y * 2 / 3 + p2.y * 1 / 3;

        Point t;
        t.x = p1.x * 1 / 3 + p2.x * 2 / 3;
        t.y = p1.y * 1 / 3 + p2.y * 2 / 3;

        Point u;
        double rd = M_PI / 3;
        Point tmp;
        tmp.x = t.x - s.x;
        tmp.y = t.y - s.y;
        u.x = tmp.x * cos(rd) - tmp.y * sin(rd) + s.x;
        u.y = tmp.x * sin(rd) + tmp.y * cos(rd) + s.y;

        koch(p1, s, n-1);
        printf("%lf %lf\n", s.x, s.y);
        koch(s, u, n-1);
        printf("%lf %lf\n", u.x, u.y);
        koch(u, t, n-1);
        printf("%lf %lf\n", t.x, t.y);
        koch(t, p2, n-1);
    }
}

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

    Point p1;
    p1.x = 0;
    p1.y = 0;
    
    Point p2;
    p2.x = 100;
    p2.y = 0;

    printf("%lf %lf\n", p1.x, p1.y);
    koch(p1, p2, n);
    printf("%lf %lf\n", p2.x, p2.y);
}


Measured memory_bytes: 2756
#include<bits/stdc++.h>
using namespace std;
int dp[100100],deg[100100],N;
vector<int> dag,G[100100];
void get_dag()
{
	for(int i=0;i<N;i++)
		if(deg[i]==0)
			dag.push_back(i);
	int pos=0;
	while(dag.size()!=N)
	{
		for(;pos<dag.size();pos++)
			for(int i=0;i<G[dag[pos]].size();i++)
			{
				deg[G[dag[pos]][i]]--;
				if(!deg[G[dag[pos]][i]])
					dag.push_back(G[dag[pos]][i]);
			}
	}
	return ;
}
int main()
{
	int M;
	cin>>N>>M;
	while(M--)
	{
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		G[a].push_back(b);
		deg[b]++;
	}
	get_dag();
	for(int i=0;i<N;i++)
		for(int j=0;j<G[dag[i]].size();j++)
			dp[G[dag[i]][j]]=max(dp[G[dag[i]][j]],dp[dag[i]]+1);
	int ans=0;
	for(int i=0;i<N;i++)
		ans=max(ans,dp[i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 7032
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

const int MAXT = 1e5+10;

int main() {
    int n, c; cin >> n >> c;
    vector<vector<int>> vec(c, vector<int>(MAXT, 0));
    rep(i, n) {
        int s, t, c; cin >> s >> t >> c; c--;
        if (vec[c][s]==-1) vec[c][s]++; // 同じチャネルで連続放送
        else {
            s--;
            vec[c][s]++;
        }
        if (vec[c][t-1]) vec[c][t-1]--; // 同じチャネルで連続放送
        else vec[c][t]--;
    }
    // rep(i, c) debug(vec[i]);
    int ans = 0;
    FOR(i, 1, MAXT) {
        int cnt = 0;
        rep(j, c) {
            vec[j][i] += vec[j][i-1];
            cnt += min(1, vec[j][i]);
        }
        chmax(ans, cnt);
    }
    // rep(i, c) debug(vec[i]);
    cout << ans << endl;
}

Measured memory_bytes: 12416
#include<stdio.h>
#include<cstring>
using namespace std;
char st[106];
int main() {
  scanf("%s",st+1);
  int n=strlen(st+1);
  for (int i=1;i<=n;++i)
  if (st[i]=='C') {
    for (int j=i+1;j<=n;++j)
    if (st[j]=='F') {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
//#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int MOD = 1e9 + 7, INF = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;

int gcd(int a, int b){
	return (b == 0 ? a : gcd(b, a % b));
}

signed main(){
	int n, ma, mb;
	cin >> n >> ma >> mb;
	int a[n], b[n], c[n];
	rep(i, n)cin >> a[i] >> b[i] >> c[i];

	int dp[n + 1][401][401];
	rep(i, n + 1)rep(j, 401)rep(k, 401)
		dp[i][j][k] = INF;
	dp[0][0][0] = 0;

	rep(i, n){
		rep(j, 401)rep(k, 401){
			if(dp[i][j][k] == INF)continue;
			dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
			dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
		}
	}

	int ans = INF;
	range(i, 1, 401)range(j, 1, 401)
		if(i * mb == j * ma)ans = min(ans, dp[n][i][j]);

	if(ans == INF)
		cout << -1 << endl;
	else
		cout << ans << endl;
}


Measured memory_bytes: 25984
#include<bits/stdc++.h>
using namespace std;
int a[1010];
int main()
{
    int N;
    cin >> N;
    for(int i=0; i<N; ++i) cin>>a[i];
    cout << *max_element(a,a+N)-*min_element(a,a+N) << endl;
}

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

using namespace std;

constexpr int N = 3e5 + 10;
constexpr int MOD = 998244353;

long long n, ll[N], rr[N], now, ans, sss;
multiset <pair <int, int>> r, l;

bool in (int x, int lll, int rrr) {
    if (x >= lll && x <= rrr)
        return true;
    return false;
}

void compute (int x, int lll, int rrr) {
    r.erase (r.find ({rrr, lll}));
    l.erase (l.find ({lll, rrr}));
    if (in (x, lll, rrr))
        return;
    ans += min (abs (x - lll), abs (x - rrr));
    if (abs (x - lll) < abs (x - rrr))
        now = lll;
    else
        now = rrr;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> ll[i] >> rr[i];
        r.insert ({rr[i], ll[i]});
        l.insert ({ll[i], rr[i]});
    }
    now = 1e9;
    while ((int)r.size()) {
        pair <int, int> mr = *r.begin(),
                            ml = *(--l.end());
        if (in (now, mr.second, mr.first)) {
            compute (now, ml.first, ml.second);
        }
        else if (in (now, ml.first, mr.second)) {
            compute (now, mr.second, mr.first);
        }
        else {
            int d1 = abs (now - mr.first);
            int d2 = abs (now - ml.first);
            if (d1 > d2)
                compute (now, mr.second, mr.first);
            else
                compute (now, ml.first, ml.second);
        }
    }
    ans += abs (now);
    ans -= 1e9;
    sss = ans;
    ans = 0;
    now = -1e9;
    for (int i = 0; i < n; i++) {
        r.insert ({rr[i], ll[i]});
        l.insert ({ll[i], rr[i]});
    }
    while ((int)r.size()) {
        pair <int, int> mr = *r.begin(),
                            ml = *(--l.end());
        if (in (now, mr.second, mr.first)) {
            compute (now, ml.first, ml.second);
        }
        else if (in (now, ml.first, mr.second)) {
            compute (now, mr.second, mr.first);
        }
        else {
            int d1 = abs (now - mr.first);
            int d2 = abs (now - ml.first);
            if (d1 > d2)
                compute (now, mr.second, mr.first);
            else
                compute (now, ml.first, ml.second);
        }
    }
    ans += abs (now);
    ans -= 1e9;
    sss = max (sss, ans);
    cout << sss << '\n';
    return 0;
}


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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000 //10^12

int main() {
    ll x;
    cin >> x;

    FOR(a, -150, 150) {
        FOR(b, -150, 150) {
            if (pow(a, 5) - pow(b, 5) == x) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(in) in.begin(),in.end()
#define fi first
#define se second
using namespace std;

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

using ll = long long;
using pp = pair<pair<ll,ll>,ll>;

bool comp(pp a, pp b){ return a.fi.fi + a.fi.se < b.fi.fi + b.fi.se; }

int main(){
    int n; cin >> n;
    vector<pp> data(n); rep(i,n) cin >> data[i].fi.fi >> data[i].fi.se >> data[i].se;
    sort(all(data), comp);
    vector<vector<ll>> dp(n+1,vector<ll>(20001,0ll));
    rep(i,n) rep(j,20001){
        chmax(dp[i+1][j], dp[i][j]);
        if(j >= 1) chmax(dp[i+1][j], dp[i+1][j-1]);
        if(j >= data[i].fi.fi && j - data[i].fi.fi <= data[i].fi.se)
        chmax(dp[i+1][j], dp[i][j-data[i].fi.fi] + data[i].se);
    }
    ll ans = 0;
    rep(i,20001) chmax(ans, dp[n][i]);
    cout << ans << endl;
    return 0;
}

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

class Main{
    public void run(){
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            // br.lines()
            //     .forEach(System.out::println);
            for(int i = 1;i <= 9; i++){
                for(int j = 1; j <= 9; j++){
                    System.out.println(i+"x"+j+"="+i*j);
                }
            }
        }catch(Exception e){

        }
    }
    public static void main(String[] args){
        new Main().run();
    }
}

Measured memory_bytes: 24108
#include<iostream>
using namespace std;
int main() {
	int h, w;
	while (1) {
		cin >> h >> w;
		if (h == 0 & w == 0)
			break;
		for (int i = 0; i < h; i++) {
			for (int k = 0; k < w; k++) {
				cout << '#';
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep0(i, n) for (int i = 0; i <= (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX
int main(){
    ll n;
    cin>>n;
    ll a[n+1];
    ll b[n];
    rep0(i,n) cin>>a[i];
    ll ans=0;
    rep(i,n){ 
        cin>>b[i];
    }
    rep(i,n){
        if (a[i]-b[i]<=0) {
            ans+=a[i];
            b[i]-=a[i];
            if(a[i+1]-b[i]<=0){
                ans+=a[i+1];
                a[i+1]=0;  
            }
            else {
                a[i+1]-=b[i];
                ans+=b[i];
                }
        }
        else{
            ans+=b[i];
        }
    
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	int n, l,i;
	cin >> n >> l;
	vector<string>s(n);
	for (i = 0; i < n; i++) {
		cin >> s[i];
	}
		sort(s.begin(), s.end());
		for (i = 0; i < n; i++) {
			cout << s[i];
		}
		cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
int keta(int a) {
	return to_string(a).size();
}
signed main() {
	int a,b,c,d;
	cin>>a>>b;
	cin>>c>>d;
	if(a==c)cout<<0<<endl;
	else cout<<1<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 505

#define mod 998244353

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

ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}

ll bexp(ll a, ll b)
{
	ll res = 1;
	while(b)
	{
		if(b & 1)
		{
			res = res * a % mod;
		}
		a = a * a % mod;
		b >>= 1;
	}
	return res % mod;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	map<ll, ll> mi;
	ll a[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		mi[a[i]]++;
	}
	// cout << mi.size() << "\n";
	int f = 0;
	if(mi.find(0) != mi.end() && mi[0] == n)
	{
		cout << "Yes\n";
		return 0;
	}

	if(n % 3 != 0)
	{
		cout << "No\n";
		return 0;
	}
	vector<ll> al;
	if(mi.size() == 2)
	{
		ll k1 = mi.begin()->ff, l1 = mi.begin()->ss,
		k2 = mi.rbegin()->ff, l2 = mi.rbegin()->ss;
		
		int k = n / 3;
		for(auto e : mi)
		{
			if(e.ss == k)
				al.pb(e.ff);
			else
				al.pb(e.ff), al.pb(e.ff);
		}
		// for(auto e : mi)
		// {
		// 	for (int i = 0; i < e.ss/(n/3); ++i)
		// 	{
		// 		al.pb(e.ff);
		// 	}
		// }
		if(al.size() == 3 && (al[0] ^ al[1] ^ al[2]) == 0)
		{
			f = 1;
		}
	}
	else if(mi.size() == 3)
	{
		ll b[3] = {}, i = 0;
		for(auto e : mi)
		{
			b[i++] = e.ff; 
		}

		if(((b[0] ^ b[1]) == b[2]) && (mi[b[0]] == mi[b[1]]) && (mi[b[0]] == mi[b[2]]))
			f = 1;
	}

	if(f)
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}

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

int main() {
    long long n,m;
    cin >> n >> m;
    if(n>m) swap(n,m);
    long long ans;
    if(n==1&&m==1) ans=1;
    else if(n==1&&m!=1) ans=m-2;
    else ans=(n-2)*(m-2);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int>ok(100001);
  int l=1;
  while(l*(l-1)/2<ok.size()){ok[l*(l-1)/2]=l;l++;}
  int n;
  cin>>n;
  if(!ok[n])cout<<"No"<<endl;
  else
  {
    l=ok[n];
    cout<<"Yes"<<"\n";
    cout<<l<<"\n";
    unordered_map<ll,int> ma;
    int cnt=1;
    rep(i,l)
    {
      cout<<l-1<<" ";
      rep(j,l)
      {
        if(i==j)continue;
        if(ma.count((j<<20)+i)){cout<<ma[(j<<20)+i]<<" ";continue;}
        cout<<(ma[(i<<20)+j]=cnt++)<<" ";
      }
      cout<<"\n";
    }
  }

  return 0;

}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
long long power_mod(long long x, long long y, long long m){
    long long res = 1 ;
    if(y>0){
        res = power_mod(x,y/2,m) ;
        if(y%2==0){
            res = (res*res)%m ;
        }
        else{
            res = (((res*res)%m)*x)%m ;
        }
    }
    return res ;
}
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    ll n = SZ(s);
    reverse(ALL(s));
    vvll dp(n,vll(13,0));

    if(s[0]!='?'){
        dp[0][s[0]-'0'] = 1;
    }
    else{
        REP(i,10){
            dp[0][i] = 1;
        }
    }

    for(ll i=1;i<n;i++){
        char c = s[i];
        ll hog = power_mod(10,i,13);
        if(c!='?'){
            REP(j,13){
                dp[i][(j+hog*(c-'0'))%13] += dp[i-1][j];
                dp[i][(j+hog*(c-'0'))%13] %= MOD;
            }
        }
        else{
            REP(j,13){
                REP(k,10){
                    dp[i][(j+hog*k)%13] += dp[i-1][j];
                    dp[i][(j+hog*k)%13] %= MOD;
                }
            }
        }
    }


    cout << dp[n-1][5] <<endl;

    
    return 0;
}



Measured memory_bytes: 16588
#include <stdio.h>
#include <math.h>

long gcd(long a, long b)
{
	return (a % b ? gcd(b, a % b) : b);
}
long lcm(long a, long b)
{
	return (b / gcd(fmax(a, b), fmin(a, b)) * a);
}

int main(void)
{
	int x, y, z;
	int xc, yc, zc;
	int a1, m1, a2, m2, a3, m3;
	int xy, yz;

	while (scanf("%d %d %d %d %d %d", &a1, &m1, &a2, &m2, &a3, &m3), a1){
		x = a1 % m1;
		xc = 1;
		while (x != 1){
			x = (a1 * x) % m1;
			xc++;
		}
		
		y = a2 % m2;
		yc = 1;
		while (y != 1){
			y = (a2 * y) % m2;
			yc++;
		}

		z = a3 % m3;
		zc = 1;
		while (z != 1){
			z = (a3 * z) % m3;
			zc++;
		}

		printf("%ld\n", lcm(lcm(xc, yc), zc));
	} 

	return (0);
}

Measured memory_bytes: 604
import java.util.*;


public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
		    String text = sc.next();
		    if ("-".equals(text)) {
		        break;
		    }
		    //行数
		    int n = sc.nextInt();
		    for (int i = 0; i < n; i++) {
		        int x = sc.nextInt();
		        String s1 = text.substring(0, x);
		        String s2 = text.substring(x);
		        text = s2 + s1;
		    }
            System.out.println(text);
		}
		
        
		
		
    }
}



Measured memory_bytes: 26392
#include <iostream>

using namespace std;

typedef long long ll;

string s;
int n;
ll c;

int main() {
	cin >> s;
	n = s.size();
	int a = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'A') {
			a++;
		} else if (i != n-1 && s[i] == 'B' && s[i+1] == 'C') {
			c += a;
			i++;
		} else {
			a = 0;
		}
	}
	cout << c << "\n";
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;cin>>n;
  int a;
  for(int i=0;i<n;i++){
    cin>>a;
    if(!(a%2)){
      if(a%3>0&a%5>0){
        cout<<"DENIED"<<endl;
        return 0;
      }
    }
  }
  cout<<"APPROVED"<<endl;
}

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

int main() {
    int N, M, i, j;
    cin >> N >> M;
    vector<int> a(M);
    vector<int> b(M);
    vector<int> count(N);

    for (i = 0; i < (M); i++) {
        cin >> a.at(i) >> b.at(i);
    }

    for (i = 0; i < M; i++) {
        for (j = 0; j < N; j++) {
            if (a.at(i) == j + 1) {
                count.at(j)++;
            }
            if (b.at(i) == j + 1) {
                count.at(j)++;
            }
        }
    }

    for (i = 0; i < N; i++) {
        cout << count.at(i) << endl;
    }
}


Measured memory_bytes: 256
r,g,b,n = map(int,input().split())

res=0
tmp=n
tmp1=0
re=n//r+1
ge=n//g+1

for i in range(re):
	tmp = tmp - i*r
	tmp1 = tmp
	for j in range(ge):
		tmp1 = tmp - j*g
		if tmp1 >= 0 and tmp1%b==0:
			res = res + 1
			#print(i, j, int(tmp1/t2[2]))
		tmp1 = tmp
	tmp=n

print(res)

Measured memory_bytes: 40940
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Long> list = new ArrayList<>();
    //final List<Long> list2 = new ArrayList<>();

    String n = sc.next();
    char[] work = new char[n.length()];
    int num = 0;

    for(int i = 0; i < n.length(); i++){
            work[i] = n.charAt(i);

            //切り出した文字列を一文字ずつ出力
            //System.out.println(work[i]);
            }

    for(int i = 0; i < n.length(); i++){
        num += Character.getNumericValue(work[i]);
    }
    //System.out.println(num);

    if(num % 9 == 0){
        System.out.println("Yes");
    }else{
        System.out.println("No");
    }





}
}

Measured memory_bytes: 40856
S=int(input());
s=[];
x=[];
X=[];
so=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];
ans=1;
for h in range(S):
    Y=h+1;
    for i in so:
        j=0;
        while Y%i==0:
            Y=Y/i;
            s=s+[i];
            j+=1;
for i in so:
    x=x+[s.count(i)];
X=[X+1 for X in x];
for i in X:
    ans=ans*i;
print(ans%1000000007);

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    vector<long long> a(n),b(n),c(n);
    for(int i=0;i<n;++i) cin >> a[i];
    for(int i=0;i<n;++i) cin >> b[i];
    for(int i=0;i<n;++i) cin >> c[i];
    long long ans = 0;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    int A,C;
    for(int i=0;i<n;++i){
        auto itr_c = upper_bound(c.begin(),c.end(),b[i]);
        C = c.end() - itr_c;
        auto itr_a = lower_bound(a.begin(),a.end(),b[i]);
        A = itr_a - a.begin();
        ans += (long long)A*C;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long
#define nl "\n"
#define pi acos(-1)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pcase printf("Case %d:\n",ca)
int ca=1;
using namespace std;
int main(){
  
      string a;
      cin>>a;
      int sum = 0;
      int v[a.size()+5]={0};
      int j = 0;
      for(int i = 0;i<a.size();i++){
        if(a[i]=='R'){
            sum++;}
            v[j] = sum;
        if(a[i]=='S'){
            sum = 0;
            j++;
        }
}
++j;
    sort(v,v+j);
    cout<<v[j-1]<<nl;


  
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  char k;
  cin>>a;
  cin>>k;
  cin>>b;
  if(k=='+'){
    cout<<a+b<<'\n';
  }
  if(k=='-'){
    cout<<a-b<<'\n';
  }
  return(0);
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[])
{
    int h, w;
    cin >> h >> w;
    char grid[h][w];
    REP(i,h) REP(j,w)
    {
        cin >> grid[i][j];
    }
    int w_max = 0;
    int h_max = 0;

    int w_grid[h][w];
    int h_grid[h][w];
    REP(i,h) REP(j,w)
    {
        w_grid[i][j] = 0;
        h_grid[i][j] = 0;
    }

    REP(i,h)
    {   
        int tmp = 0;
        int _tmp = 0;
        int start = 0;
        int end = 0;
        REP(j,w)
        {
            if (grid[i][j] == '.') _tmp++;
            else
            {   
                end = j;
                FOR(k,start,end-1)
                    w_grid[i][k] = _tmp;
                start = j + 1;
                _tmp = 0;
            }   
        }
        end = w-1;
        FOR(k,start,end)
            w_grid[i][k] = _tmp;

        tmp = _tmp;
        _tmp = 0;
    }

    REP(j, w)
    {
        int tmp = 0;
        int _tmp = 0;
        int start = 0;
        int end = 0;
        REP(i, h)
        {
            if (grid[i][j] == '.')
                _tmp++;
            else
            {
                
                end = i;
                FOR(k, start, end-1)
                    h_grid[k][j] = _tmp;
                start = i + 1;
                _tmp = 0;
            }
        }
        end = h-1;

        FOR(k, start, end)
            h_grid[k][j] = _tmp;

        tmp = _tmp;
        _tmp = 0;

    }

    // cout << "h_grid" << endl;
    // REP(i, h)
    // {
    //     REP(j, w)
    //     {
    //         cout << h_grid[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    int ans = 0;

    REP(i,h) REP(j,w)
    {
        if (ans < h_grid[i][j] + w_grid[i][j])
            ans = h_grid[i][j] + w_grid[i][j];
    }
    cout << ans - 1 << endl;
    return 0;
}


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

int main(){
  int n;cin>>n;
  vector<bool> state(n,false);
  vector<bool> visited(n,false);
  state[0] = true;
  vector<int> a(n);
  for(int i=0;i<n;++i){
    cin>>a[i]; --a[i];
  }

  int ans = 0, i=0;
  while (++ans){
    if (!state[i] || visited[i]) {
      cout<<-1<<endl;
      return 0;
    }
    state[i] = false;
    visited[i] = true;
    state[a[i]] = true;
    i = a[i];
    if(i==1) {
      cout<<ans<<endl;
      return 0;
    }
  }

}

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

int main() {
  int n;
  cin >> n;
  int x = n;
  int y = 0;
  
  for(int i=0;i<n;i++){
    y += x%10;
    x /= 10;
  }
  if(n%y==0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k; cin >> n >> k;
	set<string> r;
	for(int i = 0; i < n; i++){
		string s; cin >> s;
		r.insert(s);
	}
	map<char, int> cnt;
	for(auto e : r) cnt[e[0]]++;
	int op = r.size() / k;
	while(op > 0){
		int sum = 0;
		for(auto e : cnt) sum += min(op, e.second);
		sum = sum / k;
		if(sum < op) op--;
		else break;
	}
	cout << op << endl;
	return 0;
}


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

using namespace std;

int n;
string s;

unordered_map<string, int> cnt;

void solve() {
	cin >> n;
	cnt["TLE"] = 0; cnt["RE"] = 0; cnt["WA"] = 0; cnt["AC"] = 0;
	while (n--) {
		cin >> s;
		cnt[s]++;
	}
	for (auto i: cnt) {
		cout << i.first << " x " << i.second << endl;
	}
}

int main() {
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);    
    //freopen("input.txt", "r", stdin);
	solve();
    return 0;
}

Measured memory_bytes: 3648
#!pytyhon
# -*- coding: utf-8 -*-


def main():
    N, x = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    ANS = 0
    for a_i in a:
        if a_i <= x:
            ANS += 1
            x -= a_i
        else:
            print(ANS)
            return
    if x != 0:
        ANS -= 1
    print(ANS)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060