akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,l,k,g[55];
double s=0;
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&g[i]);
	sort(g,g+n);
	for(int i=0;i<n;i++)
	if(i) s=(1.0*g[i]+s)/2.0;
	else s=g[i];
	printf("%f",s);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	if(a+b+c >= 22)
		cout << "bust\n";
	else 
		cout << "win\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int count=0;
  for(int i=1;i<=n;i++){
    if(i>=1 && i<=9) count++;
    else if(i>=100 && i<=999) count++;
    else if(i>=10000 && i<=99999) count++;
  }
  cout<<count<<endl;
}

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

int main(){
 long long a,b,c,x,y,sum;
  cin >> a >> b >> c >> x >> y;
  int xymax=max(x,y);
  int xymin=min(x,y);
  long long ans=a*x+b*y;
  int ians;
  for(int i=0;i<=2*xymax;i=i+2){
    sum=0;
    sum+=i*c;//iはABを買う個数
    if(xymin<i/2){
      if(x<=y)sum+=b*(y-i/2);
      if(x>y)sum+=a*(x-i/2);
    }
    else{
    sum+=a*(x-i/2);
    sum+=b*(y-i/2);
    }
    ans=min(ans,sum);

    }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI2(N,M);
    vector<vector<P>> list(N);
    FOR(i,M){
        GI2(p,Y);
        list[p-1].push_back(P(i,Y));
    }
    vector<P> final(M);
    FOR(i,N){
        sort(ALL(list[i]),[](const P& l,const P& r){return l.second<r.second;});
        FOR(j,list[i].size()){
            final[list[i][j].first]=P(i,j);
        }
    }
    FOR(i,M){
        printf("%06d%06d\n",final[i].first+1,final[i].second+1);
    }
    return 0;
}

Measured memory_bytes: 7680
open System

let N = stdin.ReadLine() |> int
let data : (int * int * int) [] = Array.zeroCreate N
for i in 0..N-1 do
    let xyh = stdin.ReadLine().Split() |> Array.map int
    data.[i] <- (xyh.[0],xyh.[1],xyh.[2])

let mutable found = false
for i in 0..100 do
    for j in 0..100 do

        let mutable h = 0
        for k in 0 .. N-1 do
            let (i0, j0, h0) = data.[k]
            if 0 < h0 then
                let mutable di = i - i0
                let mutable dj = j - j0

                if di < 0 then
                    di <- -di
                if dj < 0 then
                    dj <- -dj
                h <- h0 + di + dj

        if 1 <= h then
            let mutable ng = false;
            for k in 0..N-1 do
                let (i0, j0, h0) = data.[k]
                let mutable di = i - i0
                let mutable dj = j - j0
                if di < 0 then
                    di <- -di
                if dj < 0 then
                    dj <- -dj
                if Math.Max(0, h - di - dj) <> h0 then
                    ng <- true

            if ng = false then
                found <- true
                printfn "%d %d %d" i j h


Measured memory_bytes: 14044
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int K = Integer.parseInt(sc.next());
		int T = Integer.parseInt(sc.next());

		int[] cake = new int[T];

		for(int i = 0; i < T; i++){
			cake[i] = Integer.parseInt(sc.next());
		}

		int max = getArrayMax(cake);

		int day = Math.max(0, (max - (K/2 + 1))*2 + (K+1) % 2);

		System.out.println(day);

	}

	static int getArrayMax(int[] array){
		int max = 0;
		for(int i = 0; i < array.length; i++){
			max = Math.max(max, array[i]);
		}
		return max;
	}
}


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

const long long mod=1000000007;

long long pw(long long x,int y){
	long long a=1;
	while(y){
		if(y&1)a=a*x%mod;
		x=x*x%mod;
		y/=2;
	}
	return a;
}
long long modinv(long long x){
	return pw(x,mod-2);
}
int S;
long long c[10001];

long long comb(int n,int r){
	return c[n]*modinv(c[r]*c[n-r]%mod)%mod;
}


int main(){
	cin>>S;
	c[0]=1;
	for(int i=1;i<=10000;i++){
		c[i]=c[i-1]*i%mod;
	}
	long long res=0;
	for(int i=1;S-i*3>=0;i++){
		int t=S-i*3;
		res+=comb(t+i-1,t);
		res%=mod;
	}
	cout<<res<<endl;
}



Measured memory_bytes: 3676
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

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

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

int dp[3100][3100];

int main() {
	string s, t; cin >> s >> t;

	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < t.size(); j++) {
			if (s[i] == t[j]) chmax(dp[i + 1][j + 1], dp[i][j] + 1);
			chmax(dp[i + 1][j + 1], dp[i + 1][j]);
			chmax(dp[i + 1][j + 1], dp[i][j + 1]);
		}
	}

	string res = "";
	int i = (int)s.size(), j = (int)t.size();
	while (i > 0 && j > 0) {
		if (dp[i][j] == dp[i - 1][j]) i--;
		else if (dp[i][j] == dp[i][j - 1]) j--;
		else {
			res = s[i - 1] + res;
			i--; j--;
		}
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 37120
#include <iostream>

using namespace std;


int parent(int i)
{
    return i / 2;
}

int left(int i)
{
    return i * 2;
}

int right(int i)
{
    return i * 2 + 1;
}


int main()
{
    int H, A[250 + 1];
    cin >> H;

    for (int i = 1; i <= H; i++)
        cin >> A[i];

    for (int i = 1; i <= H; i++) {
        int t;
        cout << "node " << i;
        cout << ": key = " << A[i] << ", ";

        if ((t = parent(i)) > 0)
            cout << "parent key = " << A[t] << ", ";
        if ((t = left(i)) <= H)
            cout << "left key = " << A[t] << ", ";
        if ((t = right(i)) <= H)
            cout << "right key = " << A[t] << ", ";
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3108
import std.stdio;
import std.string;
import std.conv;
import std.bigint;
import std.typecons;
import std.algorithm;
import std.array;
 
void main() {
    auto tmp = readln.split.to!(int[]);
    auto W = tmp[1], H = tmp[0];
    int[][] cost;
    foreach (i; 0..10) {
        tmp = readln.split.to!(int[]);
        cost ~= tmp;
    }
    foreach (k; 0..10) {
        foreach (i; 0..10) {
            foreach (j; 0..10) {
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }
    ulong res = 0;
    foreach (i; 0..H) {
        tmp = readln.split.to!(int[]);
        foreach (j; 0..W) {
            auto a = tmp[j];
            if (a == -1) continue;
            res += cost[a][1];
        }
    }
    writeln(res);
}


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

using namespace std;

int n;
string s;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s;
	for (int i=0; i<s.length(); i++) {
		s[i] = s[i] + n;
		if (s[i] > 'Z') s[i] = s[i] - 26;
	}
	cout << s << endl;
}

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

signed main(){

    // omajinai
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    // omajinai

    string s;
    cin >> s;
    
    int n = s.size();
    vector<int> t(n);
    for(int i = 0;i < n;i ++){
        t.at(i) = s.at(i)- '0';
    }

    if(n == 1){
        cout << t.at(0) << endl;
        return 0;
    }

    int a = 1;
    for(int i = 0;i < n-1;i ++){
        a *= 2;
    }

    int ans = 0;

    for(int i = 0;i < n;i ++){
        ans += t.at(i) * a;
    }
    int b = 9;
    a /= 2;
    for(int i = n-2;i >= 0;i --){
        for(int j = i;j >= 0;j --){
            ans += t.at(j) * a * b;
        }
        a /= 2;
        b *= 10;
    }

    cout << ans << endl;



}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	int n,m;
	cin >> n>>m;
	priority_queue<ll> Q;
	rep(i,n) {
		ll a;
		cin >> a;
		Q.push(a);
	}

	rep(i,m) {
		ll k = Q.top(); Q.pop();
		Q.push(k/2);
	}

	ll ans = 0;
	while(!Q.empty()) {
		ll k = Q.top(); Q.pop();
		ans += k;
	}

	cout << ans << endl;
}




Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int solve (int x){
    int k=0;
    while(x%2 != 1){
        k++;
        x /= 2;
    }
    return k;
}


int main(){
    int n;
    int cnt=0;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n){
        cnt += solve(a[i]);
    }
    cout << cnt << endl;
    
}

Measured memory_bytes: 256
# coding: utf-8

def main():
    a, b = map(int, input().split())
    quo = (b - 1) // (a - 1)
    rem = (b - 1) % (a - 1)
    if rem == 0:
        print(quo)
    else:
        print(quo+1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
const long long mod = 1e9 + 7;

const int AMAX = 100000;
ll cnt[AMAX + 1] = {};

int main()
{
    int n;
    ll k;
    cin >> n >> k;
    rep(i, n)
    {
        int a, b;
        cin >> a >> b;
        cnt[a] += b;
    }
    for (int ans = 1; ans <= AMAX; ans++)
    {
        if (k <= cnt[ans])
        {
            cout << ans << endl;
            return 0;
        }
        k -= cnt[ans];
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);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,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.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 (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;

struct Trie{
	Trie* p[26];
	int x;
	Trie():x(-1){
		memset(p, 0, sizeof(p));
	}
} root;

void add(Trie *p, const string &s, int i, int x){
	REP(i, s.size()){
		if(!p->p[s[i] - 'a']) p->p[s[i] - 'a'] = new Trie();
		p = p->p[s[i] - 'a'];
	}
	p->x = x;
}

int ans[100005][30][30];

vi dfs(Trie *p){
	if(!p) return vi();
	vector<vi> v(26);
	REP(i, 26)if(p->p[i]){
		v[i] = dfs(p->p[i]);
	}
	REP(i, 26)REP(j, 26)if(i != j){
		for(int t : v[i]) ans[t][i][j] += v[j].size();
	}
	vi res;
	for(auto &it : v){
		if(res.size() < it.size()) swap(res, it);
		for(const int x : it) res.pb(x);
	}
	if(p->x != -1){
		ans[p->x][0][0] += res.size();
		res.pb(p->x);
	}
	return res;
}

int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	cin >> n;
	string s;
	REP(i, n){
		cin >> s;
		add(&root, s, 0, i);
	}
	dfs(&root);
	cin >> m;
	REP(i, m){
		int k;
		cin >> k >> s; k--;
		int x = n-ans[k][0][0];
		REP(i, 26)REP(j, i)
			x -= ans[k][s[j]-'a'][s[i]-'a'];
		printf("%d\n", x);
	}
	return 0;
}


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

bool is_good(string s) {
    for (int i = 0; i < s.size(); i++) {
        if (s[0] == s[1]) {
            if (s[0] == s[2]) return true;
            else return false;
        } else {
            if (s[1] == s[2] && s[1] == s[3]) return true;
            else return false;
        }
    }
    return false;
}

int main() {
    string s;
    cin >> s;
    if (is_good(s)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

#define ll long long
#define gcd(a,b) __gcd(a,b)s
const int N=2e5+10;
const int inf=1e9;
const int mod=1e9+7;

int  main(int argc, char const *argv[])
{
	/*#ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);

	ll k, n;
	cin >> k >> n;

	ll a[n+2];
	a[0]=0;
	a[n+1]=k;

	for(int i=1; i<=n; i++)
        cin >> a[i];

    sort(a, a+n+2);

    ll l[n+2]={0};
    ll r[n+2]={0};

    ll ans=1e18;

    for(int i=1; i<=n; i++)
        l[i]=a[i]-a[i-1]+l[i-1];
    for(int i=n; i>=1; i--)
        r[i]=a[i+1]-a[i]+r[i+1];

    /*for(int i=0; i<=n+1; i++)
        cout << l[i] << ' ';
    cout << endl;

    for(int i=0; i<=n+1; i++)
        cout << r[i] << ' ';
    cout << endl;*/

    for(int i=1; i<=n; i++)
    {
        if(i==1)
        {
            ll val=r[i]-(k-a[n]);
            ll val2=l[i]+r[i+1];
            ans=min(min(val, val2), ans);
        }
        else if(i==n)
        {
            ll val=l[i]-a[1];
            ll val2=l[i-1]+r[i];
            ans=min(min(val, val2), ans);
        }
        else
        {
            ll val=r[i+1]+l[i];
            ll val2=r[i]+l[i-1];
            ans=min(min(val, val2), ans);
        }
    }

    cout << ans << endl;

	return 0;
}


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

using namespace std;


string cube[6] = {
    "..rr....",
    "..rr....",
    "ggyybbww",
    "ggyybbww",
    "..oo....",
    "..oo...."
};

void route90(int x, int y){
    char a = cube[x][y];
    cube[x][y] = cube[x+1][y];
    cube[x+1][y] = cube[x+1][y+1];
    cube[x+1][y+1] = cube[x][y+1];
    cube[x][y+1] = a;
}

int main(){

    string s;
    cin >> s;
    char a, b;
    for(int i=0; i< s.size(); i++){
        if(s[i] == 'R'){
            a = cube[0][3]; b = cube[1][3];
            cube[0][3] = cube[2][3]; cube[1][3] = cube[3][3];
            cube[2][3] = cube[4][3]; cube[3][3] = cube[5][3];
            cube[4][3] = cube[3][6]; cube[5][3] = cube[2][6];
            cube[3][6] = a; cube[2][6] = b;
            route90(2, 4);
        }
        else if(s[i] == 'L'){
            a = cube[4][2]; b = cube[5][2];
            cube[4][2] = cube[2][2]; cube[5][2] = cube[3][2];
            cube[2][2] = cube[0][2]; cube[3][2] = cube[1][2];
            cube[0][2] = cube[3][7]; cube[1][2] = cube[2][7];
            cube[3][7] = a; cube[2][7] = b;
            route90(2, 0);
        }
        else if(s[i] == 'U'){
            a = cube[2][0]; b = cube[2][1];
            cube[2][0] = cube[2][2]; cube[2][1] = cube[2][3];
            cube[2][2] = cube[2][4]; cube[2][3] = cube[2][5];
            cube[2][4] = cube[2][6]; cube[2][5] = cube[2][7];
            cube[2][6] = a; cube[2][7] = b;
            route90(0, 2);
        }
        else if(s[i] == 'D'){
            a = cube[3][3]; b = cube[3][2];
            cube[3][3] = cube[3][1]; cube[3][2] = cube[3][0];
            cube[3][1] = cube[3][7]; cube[3][0] = cube[3][6];
            cube[3][7] = cube[3][5]; cube[3][6] = cube[3][4];
            cube[3][5] = a; cube[3][4] = b;
            route90(4, 2);
        }
        else if(s[i] == 'F'){
            a = cube[3][4]; b = cube[2][4];
            cube[3][4] = cube[1][3]; cube[2][4] = cube[1][2];
            cube[1][3] = cube[2][1]; cube[1][2] = cube[3][1];
            cube[2][1] = cube[4][2]; cube[3][1] = cube[4][3];
            cube[4][2] = a; cube[4][3] = b;
            route90(2, 2);

        }
        else if(s[i] == 'B'){
            a = cube[3][5]; b = cube[2][5];
            cube[3][5] = cube[5][2]; cube[2][5] = cube[5][3];
            cube[5][2] = cube[2][0]; cube[5][3] = cube[3][0];
            cube[2][0] = cube[0][3]; cube[3][0] = cube[0][2];
            cube[0][3] = a; cube[0][2] = b;
            route90(2, 6);
        }
    }
    for(int i=0; i < 6; i++){
        cout << cube[i] << endl;
    }
}

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

#define loop(i,a,b) for(ll i=a; i<b; i++)
#define rloop(i,a,b) for(ll i=a; i>b; i--)
#define all(var) var.begin(), var.end()
#define eloop(var) for(auto elem : var)
#define debug(x) cerr<<#x<<" ----> "<<x<<endl;
#define TC ll tt; cin>>tt; while(tt--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ size()
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define MOD 1000000007
#define MAX 100005
typedef long long ll;
typedef long double ld;
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpl vector< pll >

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // TC
    {
        ll x,y;
        cin>>x>>y;
        ll a=(4*x-y)/2;
        ll b= (y-2*x)/2;
        if(a<0 || b<0) {
            cout<<"No\n";
            return 0;
        }
        if(a+b==x) {
            cout<<"Yes\n";
        }
        else cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main()
{
    
    int a,b;
    cin >> a >> b;
    if (0<a && a<=12){
        
        if (31>=b && b>=1){
        
            
        }if (b>a or a==b){
        cout << a << endl;
        } else{
        cout << a-1 << endl;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n;
		double S[] = new double[1000];
		while ((n = sc.nextInt()) != 0)
		{
			double mean = 0;
			for (int i = 0; i < n; i++)
			{
				S[i] = sc.nextDouble();
				mean += S[i];
			}
			mean /= n;
			double bun = 0;
			for (int i = 0; i < n; i++)
			{
				bun += (S[i]-mean) * (S[i]-mean);
			}
			System.out.println(Math.sqrt(bun/n));
		}
		sc.close();
	}
}


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

#define M_PI       3.14159265358979323846   // pi

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

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ll mod = 1000000007;

int main(void)
{
	int m1, d1, m2, d2;
	cin >> m1 >> d1;
	cin >> m2 >> d2;
	if (d2 == 1) {
		cout << 1 << endl;
		return 0;
	}
	cout << 0 << endl;
	return 0;
}


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

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2")

using namespace std;

#define int long long
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

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

const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;

int dp[maxn][2], p[maxn][2];

int get_sum(int i, int l) {
    if (i < 0) return 0;
    return p[i][l];
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int n, k;
    cin >> n >> k;
    int l = 0, r = 1;

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (i == 0) {
            for (int j = 0; j <= x; j++) {
                dp[j][r] = 1;
            }
            for (int j = 0; j <= k; j++) {
                p[j][r] = get_sum(j - 1, r)  + dp[j][r];
            }
            swap(l, r);
            continue;
        }
        for (int j = 0; j <= k; j++) {
            dp[j][r] = get_sum(j, l) - get_sum(j - x - 1, l);
            dp[j][r] = (dp[j][r] + mod) % mod;
            p[j][r] = get_sum(j - 1, r)  + dp[j][r];
            p[j][r] %= mod;
        }
        swap(l, r);
    }
    cout << dp[k][l] << "\n";



    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<string> svec;

#define IN_LL(in) ll in; cin >> in;
#define IN_STR(in) string in; cin >> in;
#define IN_VEC(in, size) vec in; in.reserve(size); for(ll i = 0; i < (size); ++i) cin >> in[i];
#define IN_SVEC(in, size) svec in; in.reserve(size); for(ll i = 0; i < (size); ++i) cin >> in[i];

#define OUT(out) cout << (out);
#define OUT_VEC(out) for(ll i = 0; i < (out).size(); ++i) cout << (out)[i];

int main(void){
	int r;
	cin >> r;
	cout << r * 3.141592 * 2 << endl;
	return 0;
}


Measured memory_bytes: 3788
<?php
$input_line = trim(fgets(STDIN));
  $s = trim(fgets(STDIN));
  $s = str_replace(array("\r\n","\r","\n"), '', $s);
  $s = explode(" ", $s);

  rsort($s);
  $a = [];
  $b = [];
for ($i = 0; $i < $input_line; $i++) {
  if($i % 2 == 0) {
      $a[] = $s[$i];
  } else {
      $b[] = $s[$i];
  }
}

$a = array_sum($a);
$b = array_sum($b);

$answer = $a - $b;

echo $answer;


Measured memory_bytes: 16220
#include<stdio.h>
int ans,wx,wy,rem;
int tab[10][10];
inline void solve(int nx,int ny,int rem){
    int nowx,nowy,*p,*pat=&tab[nx][ny];

    nowx=nx;nowy=ny;
    p=pat;
LA:
   nowx++;
   if(nowx>=wx) goto LB;
   p+=10;
   if(*p==2&&rem==0)ans++;
   else if(*p==1){
       *p=-1;
       solve(nowx,nowy,rem-1);
       *p=1;
       goto LB;
   }
   goto LA;
LB:         

    nowx=nx,nowy=ny;
    p=pat;
MA:
   nowx--;
   if(0>nowx) goto MB;
   p-=10;
   if(*p==2&&rem==0)ans++;
   else if(*p==1){
       *p=-1;
       solve(nowx,nowy,rem-1);
       *p=1;
       goto MB;
   }
   goto MA;
MB:         

    nowx=nx,nowy=ny;
    p=pat;
NA:
   nowy++;
   if(nowy>=wy) goto NB;
   p++;
   if(*p==2&&rem==0)ans++;
   else if(*p==1){
       *p=-1;
       solve(nowx,nowy,rem-1);
       *p=1;
       goto NB;
   }
   goto NA;
NB:        

    nowx=nx,nowy=ny;
    p=pat;
OA:
   nowy--;
   if(0>nowy) return;
   p--;
   if(*p==2&&rem==0)ans++;
   else if(*p==1){
       *p=-1;
       solve(nowx,nowy,rem-1);
       *p=1;
       return;
   }
   goto OA;
}
int main(){
    for(;;){
        int m,n;
        scanf("%d%d",&m,&n);
        if(m==0&&n==0)break;
        int stx,sty,homec=0;
        int i,j;
        for(i=0;i<n;i++)for(j=0;j<m;j++){
            scanf("%d",&tab[i][j]);
            if(tab[i][j]==1)homec++;
            else if(tab[i][j]==2){stx=i;sty=j;}
        }
        wx=n;wy=m;
        ans=0;
        solve(stx,sty,homec);
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 412
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
H = list(map(int, input().split()))

H += [H[-1]] * 2

INF = 10 ** 10
dp = [INF] * (N+1)
dp[0] = 0

for i in range(N):
    if i + 1 <= N:
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(H[i + 1] - H[i]))
    if i + 2 <= N:
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(H[i + 2] - H[i]))


print(dp[-1])


Measured memory_bytes: 13924
/* 161-E.cpp
 *     Created on : Apr 4, 2020
 *     Time		  : 7:00:53 PM
 *     Author     : null_ptr
 */

#include<bits/stdc++.h>

using namespace std;

#define F_Input freopen("input.in","r",stdin)
#define push emplace_back
#define sz(x) (int)x.size()
#define all(x) begin(x),end(x)

template<typename T>
void Swap(T &a,T &b){
a^=b;b^=a;a^=b;}

template<class type>
void show(type name)
{for(auto& nm:name)cerr<<nm<<' ';cerr<<'\n';}

using lint=long long;
using ivec=vector<int>;
using ipair=pair<int,int>;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n,c,k;
	string str;
	cin>>n>>k>>c;
	cin>>str;
	
	vector<pair<bool,bool>>seq(n);
	int cnt1=0,cnt2=0;
	for(int i=0;i<n;++i)
	{
		if(str[i]=='o')seq[i].first=true,i+=c,cnt1++;
	}
	for(int i=n-1;i>=0;--i)
	{
		if(str[i]=='o')seq[i].second=true,i-=c,cnt2++;
	}
	if(cnt1==k && cnt2==k)
		for(int i=0;i<n;++i)
			if(seq[i].first && seq[i].second)cout<<i+1<<'\n';
}





Measured memory_bytes: 2196
def get_weights():
    raw_input()
    return map(int, raw_input().split())

#weights: list
def minimam_cost_sort(weights):
    mw = min(weights)
    s_w = sorted(weights)
    lol = []
    for i in range(len(weights)):
        if weights[i] != 0:
            j = weights[i]
            idx = s_w.index(j)
            weights[i] = 0
            l = [j]
            while weights[idx] != 0:
                l.append(weights[idx])
                j = weights[idx]
                weights[idx] = 0
                idx = s_w.index(j)
            l.sort()
            lol.append(l)

    lol.sort()
    s = 0
    for l in lol:
        s += get_wol(l, mw)

    print s

def get_wol(l, mw):
    sub = (l[0] - mw) * (len(l) - 1) - (l[0] + mw) * 2
    s = sum(l) + (l[0] * (len(l) - 2))
    if sub > 0:
        return s - sub
    return s

minimam_cost_sort(get_weights())

Measured memory_bytes: 6560
#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

typedef long double ld;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 1e9 + 7;
const int oo = 2e9;
const ld PI = acos((ld) -1);
int Getbit(ll x, int k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 6e3 + 5;


ll n, m, query;

int a[N];
int ans = 0;
bool cmp(string s, string t, int n){
    for(int i = 0; i < n; i++){
        if(s[i] < t[i]) return false;
        if(s[i] > t[i]) return true;
    }
    return true;
}
void Solve(){
    int n;
    cin >> n >> m;
    vector<string> v;
    for(int i = 1; i <= n; i++){
        string s;
        cin >> s;
        v.pb(s);
    }
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(cmp(v[i], v[j], m)) swap(v[i], v[j]);
        }
    }
    sort(all(v));
    for(string s: v) cout << s;
}

int main(){
//    Speed;
    int query = 1;
//    cin >> query;
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout)
    while(query--){
        Solve();
    }
}






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

int main(){
    int a, n;
    char buf[30];

    fgets(buf, sizeof(buf), stdin);

    a = atol(buf);
    n = a+a*a+a*a*a;
    

    printf("%d\n", n);
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    int x,a;cin>>x>>a;
    if (x<a)
    {
        /* code */
        cout<<"0"<<endl;
    }
    else
    {
        cout<<"10"<<endl;
    }
    
    
 
    }

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.typecons;

struct UnionFind
{

    struct Node
    {
        size_t parent;
        int rank;

        this(size_t n) {
            parent = n;
            rank = 1;
        }
    }

    Node[] nodes;

    this(size_t n) {
        nodes.length = n;
        foreach (i; 0..n) {
            nodes[i] = Node(i);
        }
    }

    void unite(size_t a, size_t b) {
        a = root(a);
        b = root(b);
        if (a == b) return;

        if (nodes[a].rank < nodes[b].rank) {
            nodes[a].parent = b;
        } else {
            nodes[b].parent = a;
            if (nodes[a].rank == nodes[b].rank) nodes[b].rank += 1;
        }
    }

    bool is_same_root(size_t a, size_t b) {
        return root(a) == root(b);
    }

    size_t root(size_t i) {
        if (nodes[i].parent == i) return nodes[i].parent;
        return nodes[i].parent = root(nodes[i].parent);
    }
}

void main()
{
    auto nkl = readln.split.to!(int[]);
    auto N = nkl[0];
    auto K = nkl[1];
    auto L = nkl[2];

    auto roads = UnionFind(N);
    auto rails = UnionFind(N);

    foreach (_; 0..K) {
        auto pq = readln.split.to!(int[]);
        roads.unite(pq[0]-1, pq[1]-1);
    }
    foreach (_; 0..L) {
        auto rs = readln.split.to!(int[]);
        rails.unite(rs[0]-1, rs[1]-1);
    }

    int[string] cnt;
    string[] ks;
    ks.length = N;
    foreach (i; 0..N) {
        auto rd = roads.root(i);
        auto rl = rails.root(i);
        auto key = rd.to!string ~ "*" ~ rl.to!string;
        ks[i] = key;
        if (key !in cnt) cnt[key] = 0;
        ++cnt[key];
    }

    foreach (ref k; ks) {
        k = cnt[k].to!string;
    }
    writeln(ks.join(" "));
}

Measured memory_bytes: 37116
from collections import defaultdict

N=int(input())
S=input()
S1=S[:N]
S2=S[N:][::-1]

bit=1<<N

firstList=[]
secondList=defaultdict(int)
for i in range(bit):
  blue=""
  red=""
  blue2=""
  red2=""
  for j in range(N):
    if (i>>j)%2:
      blue+=S1[j]
      blue2+=S2[j]
    else:
      red+=S1[j]
      red2+=S2[j]
  firstList.append(blue + "-" + red)
  secondList[blue2 + "-" + red2]+=1

ans=0
for s in firstList:
  ans+=secondList[s]
print(ans)

Measured memory_bytes: 80628
n,m=map(int,input().split())
ka=[list(map(int,input().split())) for i in range(n)]
count=0
for i in range(n):
  del ka[i][0]
a=[flatten for inner in ka for flatten in inner]
for i in range(m):
  if a.count(i+1)==n:
    count+=1
print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
#include <stack>
#include <climits>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;
int m[100005];
ll mod = 1e9+7;
#define int long long
signed main(){
    int n;
    cin >> n;
    int temp;
    rep(i,n){
        cin >> temp;
        m[temp]++;
    }
    bool ok = true;
    if(n%2==0){
        rep(i,n/2){
            ok = ok&&(m[i*2+1]==2);
            //cout << i*2 + 1 << endl;
        }
    }else{
        ok = ok && (m[0]==1);
        rep(i,n/2){
            ok = ok && (m[(i+1)*2]==2);
            //cout << (i+1)*2 << endl;
        }
    }
    if(ok){
        ll ans = 1;
        rep(i,n/2){
            ans*=2;
            ans=ans%mod;
        }
        cout << ans%mod << endl;
    }else puts("0");
}

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

using namespace std;

using ll = long long;

#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 input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

ll c(ll l) {
  return l * (l - 1) / 2;
}

int main() {
  string input(s);
  ll ans = c(s.size());
  ll n = s.size();
  map<char, ll> cnt;
  REP(i, n) {
    cnt[s[i]]++;
  }

  for(auto v: cnt) {
    ans -= c(v.second);
  }
  cout << ans + 1 << endl;
}


Measured memory_bytes: 3660
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const ll mod = 1000000007;
const int inf = 0x3f3f3f3f;
const ll inff = 0x7ffffffffff;
ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
//head
ll x, k, d;
int main() {
	x = read(), k = read(), d = read();
	x = abs(x);
	if(x / d > k) {
		printf("%lld", x - k * d);
	} else {
		ll tmp = x / d;
		ll d1 = x - tmp * d;
		ll d2 = abs(d1 - d);
		if(tmp % 2 == k % 2) printf("%lld", d1);
		else printf("%lld", d2);
	}
	return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=300+10;
int dp[M][M][M];
string x;
void fdp(int i,int j,int k)
{
	if(i==j)
	{
		dp[i][j][k]=1;
		return;
	}
	if(x[i]==x[j])
	{
		dp[i][j][k]=dp[i+1][j-1][k]+2;
	}
	else 
	{
		dp[i][j][k]=max(dp[i+1][j][k],dp[i][j-1][k]);
		if(k!=0)
			dp[i][j][k]=max(dp[i][j][k],dp[i+1][j-1][k-1]+2);
	}
}
main()
{
	cin>>x;	
	int k;
	cin>>k;
	int n=x.size();
	reverse(x.begin(),x.end());
	x+='0';
	reverse(x.begin(),x.end());
	for(int t=0;t<=n-1;t++)
	{
		for(int j=1+t;j<=n;j++)
		{
			for(int l=0;l<=k;l++)
			{
				fdp(j-t,j,l);
			}
		}
	}
	cout<<dp[1][n][k];
}

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

int n, p[9], a, b;

int F(int a) {
	int rt = 1;
	for(int i = 2; i <= a; ++i) {
		rt *= i;
	}
	return rt;
}

int f(int i) {
	if(i == n + 1) return 0;
	for(int j = i + 1; j <= n; ++j) if(p[j] > p[i]) --p[j];
	return F(n - i) * (p[i] - 1) + f(i + 1);
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> p[i];
	}
	a = f(1);
	for(int i = 1; i <= n; ++i) {
		cin >> p[i];
	}
	b = f(1);
	cout << abs(a - b) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(0),cin.tie(0);
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define gg exit(0);

const int M=998244353;

int k,n;
int f[333][333][333];
string s;
vector<int> val;

void add(int &a,int b){
    a=(a+b)%M;
}

main(){
    #define task "TASK"
    if(fopen(task".inp","r")){
        freopen(task".inp","r",stdin);
        //freopen(task".out","w",stdout);
    }
    cin>>s>>k; n=s.size(), s=" "+s, k=min(k,(int)s.size());
    int i=1;
    while(i<=n){
        int j=i;
        while(s[j]=='1') j++;
        val.pb(j-i);
        i=j+1;
    }
    if(s[n]=='0') val.pb(0);
    n=val.size();
    f[n][0][0]=1;
    fordec(i,n,1) forinc(j,0,k) forinc(t,0,j) if(f[i][j][t]){
        for(int p=1;p+j<=k && p<=val[i-1];p++){
            //if(i==n) cerr<<p<<" ";
            add(f[i-1][j+p][t+p],f[i][j][t]);
        }
        for(int p=1;p<=t;++p){

            add(f[i-1][j][t-p],f[i][j][t]);
        }
        add(f[i-1][j][t],f[i][j][t]);
    }
    int tot=0;
    forinc(j,0,k)
        add(tot,f[0][j][0]);
    cout<<tot;
}


Measured memory_bytes: 33948
#include<bits/stdc++.h>
using namespace std;
#define        fast        ios_base::sync_with_stdio(false);cin.tie(NULL)
#define        ll          long long int
#define        End         return 0
#define        st          string
#define        sz(x)       (int)x.size()
#define        nl          '\n'
int main()
{
    fast;
    int k;
    st s="ACL",t="";
    cin>>k;
    while(k--)
        t=t+s;
    cout<<t;
    End;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (){
    char card[201];
    char cardcpy1[201],cardcpy2[201];
    int m,h,i,j,substr,wordcount,lenght;
    while(1){
        scanf("%s",card);
        if(card[0] =='-')break;
        scanf("%d",&m);
        for(i = 0,lenght = strlen(card);i < m;i++){
            scanf("%d",&h);//hは対象文字数
            substr = h;//substrには対象文字以外の先頭の
            wordcount = lenght - h;

            /*cardcpy1に対象文字を代入する*/
            strncpy(cardcpy1,card,h);
            cardcpy1[h]='\0';
            //printf("cardcpy1:%s\n",cardcpy1);//ﾃﾞﾊﾞｯｸﾞ
            /*cardcpy2に対象文字以外を代入する*/
            strncpy(cardcpy2,&card[h],wordcount);
            cardcpy2[wordcount]='\0';
            //printf("cardcpy2:%s\n",cardcpy2);//ﾃﾞﾊﾞｯｸﾞ

            /*cardcpy2にシャッフルの結果を代入*/
            strcat(cardcpy2,cardcpy1);
            memset(card,0,sizeof(card));
            card[200]='\0';
            strcpy(card,cardcpy2);
            //printf("現在のシャッフル:%s\n",card);//ﾃﾞﾊﾞｯｸﾞ

        }
    printf("%s\n",card);
    }
return 0;
}



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

#define int long long

vector<int> res;

int a[15], s(0);

void push() {
	int r = 0;
	for (int i = 1; i <= 10; i++) {
		r = r * 10 + a[i];
	}
	res.push_back(r);
}

void brute(int i) {
	int l, r;
	if (s == 0) l = 0, r = 9;
	else l = max(a[i - 1] - 1, 0LL), r = min(a[i - 1] + 1, 9LL);
	for (int j = l; j <= r; j++) {
		a[i] = j;
		s += j;
		if (i == 10) push();
		else brute(i + 1);
		s -= j;
	}
}

signed main() {
#ifdef _DEBUG
	freopen("in", "r", stdin);
#endif
	brute(1);
	sort(res.begin(), res.end());
	int n; cin >> n;
	cout << res[n] << '\n';
}


Measured memory_bytes: 2420
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int a, b;
    cin >> a >> b;
    int il = abs(a - b) + 1;
    if (0 >= a && 0 <= b)
        cout << "Zero";
    else
    {
        if (a >= 1 || il % 2 == 0)
            cout << "Positive";
        else
            cout << "Negative";
    }
    return 0;
}


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

const int MAX_N = 100010;
const int INF = 0x3f3f3f3f;

int n, m, s, t, ans;
vector<int> G[MAX_N * 3];
int dp[MAX_N * 3];

void dijkstra(){
    fill(dp, dp + MAX_N * 3, INF);
    
    dp[s * 3] = 0;
    
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
    pq.push({0, s * 3});

    while(!pq.empty()){
        pair<int, int> p = pq.top(); pq.pop();

        if (p.first > dp[p.second])
            continue;

        for (auto i: G[p.second]){
            if (dp[i] > dp[p.second] + 1){
                dp[i] = dp[p.second] + 1;
                pq.push({dp[i], i});
            }
        }
    }

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n >> m;
    for (int i = 0; i < m; i++){
        int u, v;
        cin >> u >> v;
        u--; v--;
        G[3 * u].push_back(3 * v + 1);
        G[3 * u + 1].push_back(3 * v + 2);
        G[3 * u + 2].push_back(3 * v);
    }

    cin >> s >> t;
    s--; t--;

    dijkstra();
    
    cout << ((dp[t * 3] != INF) ? dp[t * 3] / 3 : -1) << '\n';

    return 0;
}


Measured memory_bytes: 17792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main(){
  ll h,n;
  cin >> h>>n;
  
  vector<pair<ll,ll>> p(n);
  vector<ll> q(n);
  rep(i,n){
    ll a,b;
    cin>>a>>b;
    q[i]=a;
    auto x=mp(a,b);
    p[i]=x;
  }

  sort(all(p));
  sort(all(q));

  vector<ll> r(50000,INF);
  r[0]=0;
  repo(i,h+q[n-1]+1){
    rep(j,n){
      if(i-p[j].fi>=0 && r[i-p[j].fi]!=INF) {
        r[i]=min(r[i],r[i-p[j].fi]+p[j].se);
      }
    }
  }

  ll ans=INF;
  for(ll i=h;i<=h+q[n-1];i++){
    ans=min(ans,r[i]);
  }


  cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

class Point{
  double x, y;
  Point(double x, double y){
    this.x = x;
    this.y = y;
  }
  void printPoint(){
    System.out.println(this.x + " " + this.y);
  }
}

class Main{
  static final double sin60 = Math.sin(Math.toRadians(60));
  static final double cos60 = Math.cos(Math.toRadians(60));

  static void koch(Point p1, Point p2, int n){
    if(n == 0)
      return;
    else{
      //find point of s, t, u
      Point s = new Point((2*p1.x+p2.x)/3, (2*p1.y+p2.y)/3);
      Point t = new Point((p1.x+2*p2.x)/3, (p1.y+2*p2.y)/3);
      Point u = new Point((t.x-s.x)*cos60-(t.y-s.y)*sin60+s.x,
                          (t.x-s.x)*sin60+(t.y-s.y)*cos60+s.y);
      koch(p1, s, n - 1);
      s.printPoint();
      koch(s, u, n - 1);
      u.printPoint();
      koch(u, t, n - 1);
      t.printPoint();
      koch(t, p2, n - 1);
    }
  }

  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    Point p1 = new Point(0, 0);
    Point p2 = new Point(100, 0);

    p1.printPoint();
    koch(p1, p2, n);
    p2.printPoint();
  }
}

Measured memory_bytes: 32280
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

bool evenstring(const string& s) {
    const int len = s.length();
    if (len % 2 != 0) {
        return false;
    }
    for (int i = 0; i < len / 2; i++) {
        if (s[i] != s[i + len / 2]) {
            return false;
        }
    }
    return true;
}

int main(void) {
    string s;
    cin >> s;

    const int len = s.length();
    for (int i = len - 1; i >= 0; i--) {
        s.resize(i);
        if (evenstring(s)) {
            cout << s.length() << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import math
a, b = map(int, input().split())
n = 1
while True:
  if math.floor(n * 0.08) == a and math.floor(n * 0.1) == b:
    print(n)
    exit()
  elif n == 1000:
    print(-1)
    exit()
  else:
    n = n + 1

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
#define MOD (2019)
typedef long long ll;
int main(){
  ll l,r,min_num=2019,end,num;
  cin >> l>>r;
  if(l==0){
    cout << "0\n";
    return 0;
  }
  end=min((ll)2019,r-l+1);
  for(int i=0;i<end;i++){
    for(int j=i+1;j<end;j++){
      num=(i+l)*(j+l);
      num%=MOD;
      min_num=min(min_num,num);
    }
  }
  cout << min_num<<endl;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll X, K, D;

int main(){
  cin >> X >> K >> D;
  ll cnt = abs(X) / D;

  if (K < cnt){
    if (X < 0){
      cout << abs(X + D * K) << endl;
    }else{
      cout << abs(X - D * K) << endl;
    }
    return 0;
  }

  ll now;
  if (X > 0) now = X - cnt * D;
  else now = X + cnt * D;

  ll ans = 1e18;
  if ((K - cnt) % 2 == 0){
    ans = min(ans, abs(now));
  }else{
    ans = min(abs(now + D), abs(now - D));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632