akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define RREP(i,a) for(int (i)=(a)-1;(i)>=0;(i)--)
#define FORR(i,a,b) for(int (i)=(a)-1;(i)>=(b);(i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<<C<<endl;
#define VI vector<int>
#define VII vector<VI>
#define VL vector<LL>
#define VLL vector<VL>
#define VD vector<double>
#define VDD vector<VD>
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<LL,LL>
#define VPII vector<PII>
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EP emplace_back
#define FORE(a,b) for(auto &&a:b)

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF=1e9;
const int MOD=INF+7;

int main(void){
    string S; cin >> S;
    int n=0,s=0,e=0,w=0;
    REP(i,S.size()){
        if(S[i]=='N') n=1;
        else if(S[i]=='S') s=1;
        else if(S[i]=='E') e=1;
        else w=1;
    }
    bool f=false;
    if(n&&s&&e&&w){
        f=true;
    }
    if(n&&s&&(!(e||w))){
        f=true;
    }
    if(e&&w&&(!(n||s))){
        f=true;
    }
    if(f){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int mod = 1e9+7,N = 25100;
int n,k,m,a[N];
ll ans;
void upd(int&a,ll b){a=(a+b)%mod;}
ll fp(ll a,ll k){
	ll ans=1;
	for(;k;k>>=1,a=a*a%mod)
		if(k&1) ans=a*ans%mod;
	return ans;
}
int main(){
	read(n);read(k);read(m);
	int flag=0,flag2=m>k;
	for(int i=1;i<=m;i++){
		read(a[i]);
		if(i>=k){
			int h[410]={},now=1;
			for(int j=i-k+1;j<=i;j++)
				if(++h[a[j]]==2) now=0;
			flag|=now;
		}
		if(!flag2)
			for(int j=1;j<i;j++)
				flag2|=a[i]==a[j];
	}
	if(flag&&m>=k){
		ll ans=fp(k,n-m)*(n-m+1)%mod;
		cout<<(ans+mod)%mod<<'\n';
		return 0;
	}
	if(flag2){
		int g1[N][410]={},g2[N][410]={};
		for(int i=1;i<=k;i++){
			int flg=0;
			for(int j=1;j<i;j++)
				if(a[i]==a[j]){flg=1;break;}
			if(flg){g1[0][i-1]=1;break;}
		}
		for(int i=1;i<=k;i++){
			int flg=0;
			for(int j=1;j<i;j++)
				if(a[m-i+1]==a[m-j+1]){flg=1;break;}
			if(flg){g2[0][i-1]=1;break;}
		}
		for(int i=1;i<=n;i++){
			for(int j=k-1;j;j--){
				upd(g1[i][j],g1[i-1][j]+g1[i][j+1]);
				upd(g2[i][j],g2[i-1][j]+g2[i][j+1]);
			}
			for(int j=1;j<k;j++){
				upd(g1[i][j],1ll*g1[i-1][j-1]*(k-j+1));
				upd(g2[i][j],1ll*g2[i-1][j-1]*(k-j+1));
			}
		}
		for(int i=0;i<=n;i++){
			for(int j=1;j<k;j++)
				upd(g1[i][0],g1[i][j]),
				upd(g2[i][0],g2[i][j]);
		}
		for(int i=1;i<=n-m+1;i++){
			ans=(ans+1ll*g1[i-1][0]*g2[n-i-m+1][0])%mod;
		}
	}
	else{
		int g[N][410][2]={};
		g[0][0][0]=1;
		for(int i=1;i<=n;i++){
			for(int j=k-1;j;j--){
				upd(g[i][j][0],g[i-1][j][0]+g[i][j+1][0]);
				upd(g[i][j][1],g[i-1][j][1]+g[i][j+1][1]);
			}
			for(int j=1;j<k;j++){
				upd(g[i][j][0],1ll*g[i-1][j-1][0]*(k-j+1));
				upd(g[i][j][1],1ll*g[i-1][j-1][1]*(k-j+1));
			}
			for(int j=m;j<k;j++)
				upd(g[i][j][1],g[i][j][0]);
		}
		for(int i=1;i<k;i++) ans=(ans+g[n][i][1])%mod;
		ll cef=1;
		for(int i=k-m+1;i<=k;i++) cef=cef*i%mod;
		ans=ans*fp(cef,mod-2)%mod;
	}
	ans=((n-m+1)*fp(k,n-m)-ans)%mod;
	cout<<(ans+mod)%mod<<'\n';
	return 0;
}


Measured memory_bytes: 82688
#include <stdio.h>

int main(void) 
{
	int a[5];
	int i, f;
	for(i=0;i<5;i++){
		scanf("%d", &a[i]);
	}
	for(i=0;i<5;i++){
		if(a[i]==0){
			printf("%d", i+1);
		}
	}
	return 0;
}


Measured memory_bytes: 1656
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
s=input()
from collections import defaultdict
ad1 = defaultdict(int)
ad2 = defaultdict(int)

for i in range(1<<n):
 a=""
 b=""
 for j in range(n):
  if i & (1<<j) ==0:
     a+=s[j]
  else:
     b+=s[j]
 ad1[a+"_"+b[::-1]]+=1
 a=""
 b=""
 for j in range(n):
  if i & (1<<j):
     a+=s[j+n]
  else:
     b+=s[j+n]
 ad2[b[::-1]+"_"+a]+=1
 
cc=0
for i in ad1.keys():
 cc+=ad1[i]*ad2[i]

print(cc)

Measured memory_bytes: 144380
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
int INF = 1<<29;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

long long int i,j;


char maze[51][51];
int h,w;
int d[51][51];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int bfs(){
	queue<P> que;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			d[i][j]=INF;
		}
	}
	que.push(P(0,0));
	d[0][0]=0;
	while(que.size()){
		P p=que.front();
		que.pop();
		if(p.first == h-1 && p.second == w-1)break;

		for(int i=0;i<4;i++){
			int nx=p.first+dx[i];
			int ny=p.second+dy[i];
			if(0<=nx && nx<h && 0<=ny && ny<w && maze[nx][ny]!='#'&&d[nx][ny]==INF){
				que.push(P(nx,ny));
				d[nx][ny]=d[p.first][p.second] +1;
			}
		}
	}
	return d[h-1][w-1];
}

int main(){
	cin>>h>>w;
	int kuro=0;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			cin>>maze[i][j];
			if(maze[i][j]=='#')kuro+=1;
		}
	}
	int res=bfs();
	if(res==INF){
		cout<<-1<<endl;
	}else{
	cout<<h*w-res-kuro-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <cstdio>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)	
const int INF = 1e9;

set<vector<int>> m1;
string s1, s2;
vector<int> memo(26);
int ans = 0;

void hashh(void){
	/*
	for (int i = 0; i < s1.size(); ++i){
		rep(k, 26)memo[k] = 0;
		for (int j = i; j < s1.size(); ++j){
			memo[s1[j] - 'a']++;
			m1.insert(memo);
		}

		rep(k, 26) memo[k] = 0;
		for (int l = 0; l < s2.size(); ++l){
			rep(k, 26) memo[k] = 0;
			for (int m = l; m < s2.size(); ++m){
				memo[s2[m] - 'a']++;
				if(m1.count(memo)){
					ans = max(ans, m - l + 1);
				}
			}
		}
		m1.erase(m1.begin(), m1.end());
	}
	*/

	for (int i = 1; i <= s1.size(); ++i){//??????
		rep(k, 26)memo[k] = 0;
		for (int j = 0; j < i; ++j){
			memo[s1[j] - 'a']++;
			m1.insert(memo);
		}
		int l = 0;
		for (int r = i; r < s1.size(); ++r){
			// printf("l %d r %d\n", l, r);
			memo[s1[r] - 'a']++;
			memo[s1[l] - 'a']--;
			m1.insert(memo);
			l++;
		}

		rep(k, 26)memo[k] = 0;
		for (int j = 0; j < i; ++j){
			memo[s2[j] - 'a']++;
		}
		if(m1.count(memo)){
			ans = max(ans, i);
		}
		l = 0;
		for (int r = i; r < s2.size(); ++r){
			memo[s2[r] - 'a']++;
			memo[s2[l] - 'a']--;
			if(m1.count(memo)){
				ans = max(ans, i);
			}
			l++;
		}
		m1.erase(m1.begin(), m1.end());
	}
}

int main(void){
	cin >> s1 >> s2;
	if(s1.size() > s2.size()){
		swap(s1, s2);
	}
	hashh();
	printf("%d\n", ans);
	return 0;
}

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

template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }

    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }

    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};

using mint = ModInt<1000000007>;

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

    int n;
    cin >> n;
    vector<int> as(n);
    map<int, int> fac;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        as[i] = a;
        map<int, int> fac2;
        for (int j = 2; j * j <= a; j++) {
            while (a % j == 0) {
                fac2[j]++;
                a /= j;
            }
        }
        if (a > 1) {
            fac2[a]++;
        }
        for (auto &p : fac2) {
            fac[p.first] = max(fac[p.first], p.second);
        }
    }
    // for(auto &p : fac) {
    //     cout << p.first << ' ' << p.second << endl;
    // }
    mint ans = 0;
    mint lcm = 1;
    for (auto& p : fac) {
        lcm *= pow(mint(p.first), p.second);
    }
    for (int i = 0; i < n; i++) ans += lcm / as[i];
    cout << ans << endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main (void) {
  vector<string> cards(3);
  for (int i=0; i<3; i++) cin >> cards[i];

  int turn =0;
  while(true){
    if (cards[turn].empty()){
      cout << (char)('A'+turn);
      break;
    }
    int next =cards[turn][0]-'a';
    cards[turn].erase(0,1);
    turn =next;
  }  
}

Measured memory_bytes: 256
import collections
import math
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
n = int(input())
c = collections.Counter(prime_factorize(n))
d = list(c.values())
number = 0
for i in range(len(d)):
    number += math.floor((-1 + math.sqrt(1 + 8*d[i]))/2)
print(number)

Measured memory_bytes: 9468
import java.util.Scanner;

public class Main {

public static void main(String[] args) {

// ?¨??????\???????????????????????????????????????

Scanner sc = new Scanner(System.in);

// ????????????????????????????????´??°?????¨????????????????????????

int x = sc.nextInt();

int answer = x*x*x /* ??????????????????3????????????! */;

System.out.println(answer); 

}

}

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

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

typedef long long ll;
// ll mod_pow(ll x, ll n, ll mod){//x^n % mod
//     if (n == 0)
//         return 1;
//     ll res = mod_pow(x * x % mod, n / 2, mod);
//     if (n & 1)
//         res = res * x % mod;
//     return res;
// }
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    string S; cin >> S;
    S[K-1] = tolower(S[K-1]);
    cout << S << endl; 
    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int N = scanner.nextInt();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        out.println(Math.min(N*A,B));
        
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        
        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
}


Measured memory_bytes: 21076
X,K,D=(int(x) for x in input().split())
x=abs(X)
a=x//D
 
b=x-a*D
B=abs(x-(a+1)*D)
 
if b>B:
  a=a+1
 
if a>=K:
  print(abs(x-K*D))
 
else:
  c=K-a
  if c%2 == 0:
    print(abs(x-a*D))
  else:
    d=abs(x-(a-1)*D)
    e=abs(x-(a+1)*D)
    print(min(d,e))

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }

typedef pair<int,int> pi;
#define mp make_pair

int H,W; 
string board[30];
bool visit[30][30];
queue< pi > q,r;

int bfs(){
  int count = 0;
  while(1){
    while(!q.empty()){
      int i = q.front().first;
      int j = q.front().second;
      q.pop();
      for(pi temp: {  mp(i-1,j), mp(i+1,j), mp(i,j-1), mp(i,j+1) } ){
        int a = temp.first;
        int b = temp.second;
        if(! (a>=0 && a<H) ){ continue; }
        if(! (b>=0 && b<W) ){ continue; }
        if( board[a][b]=='#' ) { continue; }
        if( visit[a][b] ){ continue; }
        visit[a][b] = true;
        r.push(temp);
      }
    }
    if(r.empty()){ break; }
    ++count;
    while(!r.empty()){
      q.push( r.front() );
      r.pop();
    }
  }
  return count;
}

int main(){
  cin>>H>>W;
  CINA(board,H);
  int ans = 0;
  REP(i,H){
    REP(j,W){
      if(board[i][j]=='#'){
        continue;
      }else{
        FILL2(visit,H,W,false);
        visit[i][j] = true;
        q.push( make_pair(i,j) );
        chmax(ans,bfs());
      }
    }
  }
  cout << ans <<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

int main() {

    ll N;
    cin >> N;

    string s = "";

    ll n = N;

    if(n == 0){
        cout << 0 << endl;
        return 0;
    }

    while (n){
        if(n % -2 == 0){
            s = "0" + s;
            n = n / -2;
        } else if(n % -2 == 1){
            s = "1" + s;
            n = n / -2;
        }else if(n % -2 == -1){
            s = "1" + s;
            n = n / -2 + 1;

        }
    }


    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #pragma GCC optimization ("O3,unroll-loops")
// #pragma GCC target ("avx,avx2,fma")
using namespace std;

#define _ << ": " <<
#define watch1(var1) (cerr << (#var1) _ var1 << '\n')
#define watch2(var1, var2) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << '\n';
#define watch3(var1, var2, var3) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << ", " << (#var3) _ var3 << '\n';
#define wloop(size, arr) cerr << (#arr) << ": "; for (int i = 0; i < size; i++) cerr << arr[i] << " \n"[i+1 == size];

template<typename... Args>
void read(Args&... args) { ((cin >> args), ...); }

template<typename... Args>
void show(Args... args) { ((cout << args << " "), ...); }

#define ints(a...) int a; read(a)
#define longs(a...) int64_t a; read(a)

void solve() {
    ints(n, k);
    vector<int> v(n);
    for (auto &it : v) cin >> it;
    sort(v.begin(), v.end());
    cout << accumulate(v.begin(), v.begin() + k, 0LL);
}

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

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
const int lim = 1000006;
//適当に被らなそうな値
const int ok = 100;

int a[lim];
int b[lim];
int ans = 0;

int main(){
	int n;
	cin >> n;
	
	int x; cin >> x;
	for(int i=0; i<x; i++){
		int id; cin >> id;
		a[id] = 1;
	}
	
	int y; cin >> y;
	for(int i=0; i<y; i++){
		int id; cin >> id;
		b[id] = 1;
	}
	
	int z; cin >> z;
	for(int i=0; i<z; i++){
		int id; cin >> id;
		if(!a[id] || b[id]) ans++;
	}

	cout << ans << endl;
	
	
	return 0;
}


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

void solve(){
    
}
int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(NULL);
    char c;
    cin >> c;
    if(c >= 97)
    cout << "a";
    else 
    cout <<"A";
    return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    if (a + b >= 10)
        cout << "error"<< "\n";
    else
        cout << a + b << "\n";
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
 int main() {
	 
	 long long n, a, b;
	 cin >> n >> a >> b;
	 long long f = n / (a + b);
	 long long m = min(a, n % (a+b));
	 cout << f * a + m << endl;
	 
 }


Measured memory_bytes: 256
#pragma GCC optimize(3,"Ofast","inline")
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include<string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
using namespace std;
char s[150];
int main()
{
      int k;
	  cin>>k;
      scanf("%s",s);
      int len=strlen(s);
      if(len<=k)  printf("%s",s);
      else 
      {
      	for(int i=0;i<=k-1;i++)
      	{
      		cout<<s[i];
		  }
		cout<<"..." ; 
	  }
 } 

Measured memory_bytes: 3864
def answer():
    input_s = input()

    sign_list = [input_s[0]]
    n_list = [1]

    for sign in input_s[1:]:
        previous_sign = sign_list[-1]

        if sign == previous_sign:
            n_list[-1] += 1
        else:
            sign_list.append(sign)
            n_list.append(1)

    for i, sign in enumerate(sign_list[:-1]):
        if sign == '<':
            this_n = n_list[i]
            next_n = n_list[i+1]
            if this_n < next_n:
                n_list[i] -= 1
            else:
                n_list[i+1] -= 1

    total = 0
    for n in n_list:
        total += n*(n+1)//2

    print(total)


if __name__ == '__main__':
    answer()


Measured memory_bytes: 9928
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N,K=pin()
    P=sorted(lispin())[:K]
    print(sum(P))

#%%submit!
resolve()

Measured memory_bytes: 62472
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	ll h;
	cin >> h;
	pair<ll,ll>  pll;
	pll = {1,h};
	ll ans = 0;
	while(pll.second > 0){
		ans += pll.first;
		pll.first*=2;
		pll.second/=2;
	}
	cout << ans << endl;
}


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


int main(){

  int x = 0;
  int ans = 0;

  for (int i=0; i!=5; ++i){
    cin >> x;
    if (x != (i+1)){
      ans = i+1;
      break;
    }
  }

  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    if(n == 1) printf("Hello World\n");
    if(n == 2) {
        int a, b;
        scanf("%d", &a);
        scanf("%d", &b);
        printf("%d\n", a + b);
    }
    return 0;
}

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

int main() {
	string a;
	cin >> a;
	if (a=="ooo") {
		cout << 1000 << endl;
	}
	else if (a=="oox") {
		cout<<900<<endl;
}
	else if (a == "oxo") {
		cout << 900 << endl;
	}
	else if (a == "xoo") {
		cout << 900 << endl;
	}
	else if (a == "oxx") {
		cout << 800 << endl;
	}
	else if (a == "xox") {
		cout << 800 << endl;
	}
	else if (a == "xxo") {
		cout << 800 << endl;
	}
	else if (a == "xxx") {
		cout << 700 << endl;
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll l,r,d;cin>>l>>r>>d;
  cout<<r/d-(l-1)/d<<endl;
  return 0;
}


Measured memory_bytes: 3564
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

# for i in range(N):
# while 1:
#     S = str(N)
#     wa = 0
#     for i in range(len(S)):
#         wa += int(S[i])
    

S = str(N)
su = 0
# nine = "9" * (len(S)-1)
# a = "8" + nine
# b = "9" + nine
wa = 0
wa = 9 * (len(S) - 1) 
# if 
# print(wa)
# c = 9 - int(S[0])
# if S.count("9") == len(S):
#     print(9 * len(S))
if S[1:] == (len(S)-1) * "9":
    ans = 9 * (len(S)-1) + int(S[0])
    print(ans)
# elif len(S) == 1:
#     print(N)
else:
    ans = wa + int(S[0]) - 1
    # print(int(a))
    # print(wa)
    print(ans)

Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int H,W;
  cin >> H >> W;
  vector<string> picture(H + 2);
  for(int i;i < H+2;i++){
    if(i == 0 || i == H + 1){
      for(int j = 0;j < W;j++){ //ここでj = 0と初期化しないと前のループのjを引き継ぐ
      picture.at(i) += "#";
      }
    }else cin >> picture.at(i);
  }
  for(int i;i <H + 2;i++){
    cout << "#" << picture.at(i) << "#" << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import heapq
INF = float("inf")


# 無向グラフを仮定する。
class Graph(object):
    def __init__(self, N):
        self.N = N
        self.V = list(range(N))
        self.E = [[] for _ in range(N)]

    def add_edge(self, edge):
        """辺を加える。edgeは(始点, 終点、重み)からなるリスト
        重みがなければ、重み1とする。
        """
        if len(edge) == 2:
            edge.append(1)
        elif len(edge) != 3:
            print("error in add_edge")
            pass

        s, t, w = edge
        self.E[s].append([t, w])
        self.E[t].append([s, w])  # 無向グラフを仮定。逆向きにも辺を張る

        pass


def shortestPath(g: Graph, s: int):
    """ グラフgにおいて、始点sから各頂点への最短路を求める
    引数
    g: グラフ, s: 始点
    返り値
    dist: 始点からの距離が格納されたリスト
    prev: 始点から最短経路で移動する場合、各頂点に至る前の頂点のリスト
    """
    dist = [INF]*g.N
    dist[s] = 0

    prev = [None]*g.N
    Q = []
    heapq.heappush(Q, (dist[s], s))

    while len(Q) > 0:
        _, u = heapq.heappop(Q)
        for v, w in g.E[u]:
            if dist[v] > dist[u] + w:
                dist[v] = dist[u] + w
                prev[v] = u
                heapq.heappush(Q, (dist[v], v))
    return dist, prev


def solve(N: int, u: "List[int]", v: "List[int]", w: "List[int]"):

    g = Graph(N)
    for _u, _v, _w in zip(u, v, w):
        g.add_edge([_u-1, _v-1, _w])  # インデックスのとり方が違うので調整。

    dist, prev = shortestPath(g, 0)

    for d in dist:
        if d % 2 == 0:
            print(0)
        else:
            print(1)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    u = [int()] * (N-1)  # type: "List[int]"
    v = [int()] * (N-1)  # type: "List[int]"
    w = [int()] * (N-1)  # type: "List[int]"
    for i in range(N-1):
        u[i] = int(next(tokens))
        v[i] = int(next(tokens))
        w[i] = int(next(tokens))
    solve(N, u, v, w)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62552
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

  map<pair<string,string>,int> mp;
  for(int i=0;i<(1<<n);i++){
    int now=i;
    string ft,bt;
    for(int j=0;j<n;j++){
      if((1<<j)&now){
        ft.push_back(s[n+j]);
      }else{
        bt.push_back(s[n+j]);
      }
    }
    reverse(ft.begin(),ft.end());
    reverse(bt.begin(),bt.end());
    mp[make_pair(ft,bt)]++;
  }

  ll ans=0;
  for(int i=0;i<(1<<n);i++){
    int now=i;
    string ft,bt;
    for(int j=0;j<n;j++){
      if((1<<j)&now){
        ft.push_back(s[j]);
      }else{
        bt.push_back(s[j]);
      }
    }
    ans=ans+mp[make_pair(ft,bt)];
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 87040
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::BTreeMap;

fn main() {
    input!(n: usize, mut ab: [(usize, usize); n]);

    // 区間スケジューリング
    // 区間の終端でソートして貪欲
    ab.sort_by(|x, y| x.1.cmp(&y.1));
    let mut ok = true;
    let mut left = 0;
    for &(a, b) in ab.iter() {
        left += a;
        if left > b {
            ok = false;
        }
    }

    println!("{}", if ok { "Yes" } else { "No" });
}


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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (auto&& e : a) cin >> e;
    string s;
    cin >> s;
    vector<long long> v;
    auto add = [&](long long x) -> bool {
      for (auto e : v) {
        x = min(x, x ^ e);
      }
      if (x) {
        v.push_back(x);
        return true;
      }
      return false;
    };
    int res = 0;
    for (int i = n; i--; ) {
      if (s[i] == '0') {
        add(a[i]);
      } else {
        if (add(a[i])) {
          res = 1;
          break;
        }
      }
    }
    cout << res << '\n';
  }
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const int mnx = 3e5 + 9;
const int mod = 1e9 + 7;

ll n;
ll a[mnx];

int main(){

cin>>n;

n += n;;

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

sort(a + 1, a + n + 1);

ll sum = 0;

for(int i=1; i<=n; i+=2){
    sum += min(a[i], a[i + 1]);
}

cout<<sum<<'\n';

return 0;

}


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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for(int i = m; i < (n); ++i)

const int INF = 1001001001;

int n, t[20][20];
int memo[1<<16];

int min_time(int i, int s)
{
    int ans = t[i][0];
    rep(j, n) if(s & 1<<j) {
        ans = min(ans, t[i][j+1]);
    }
    return ans;
}

int dp(int s)
{
    int &res = memo[s];
    if(res >= 0) return res;
    if(s == (1<<n)-1) return 0;
    res = INF;
    rep(i, n) if(!(s & 1<<i)) {
        res = min(res, dp(s | 1<<i) + min_time(i, s));
    }
    return res;
}

int main()
{
    int tt;
    while(cin >> n && n)
    {
        fill_n(memo, 1<<16, -1);
        rep(i, n) rep(j, n+1) {
            cin >> tt, t[i][j] = tt;
        }
        cout << dp(0) << endl;
    }
}

Measured memory_bytes: 1124
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    static int MOD = 1000000007;


    public static void main(String[] args) {

        //int ans=Integer.MAX_VALUE;
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        int k=sc.nextInt();
        long[] h = new long[n];
        for(int i=0;i<n;i++)h[i]=sc.nextLong();
        Arrays.sort(h);
        for(int i=0;i<k&&i<n;i++){
            h[n-i-1]=0;
        }
        long ans=0;
        for(int i=0;i<n;i++)ans+=h[i];

        System.out.println(ans);


    }


}


Measured memory_bytes: 89472
def output(moves):
    print(len(moves))
    for a,b,c,d in moves:
        print(a+1,b+1,c+1,d+1)


def move(x, y, dx, dy, a, moves):
    if a[x][y]%2 != 0:
        a[x+dx][y+dy] += 1
        moves.append((x, y, x+dx, y+dy))


def main():
    H, W = list(map(int, input().split(' ')))
    a = []
    for i in range(H):
        a.append(list(map(int, input().split(' '))))
    x = 0
    y = 0
    dy = 1
    moves = []
    while True:
        if (x+1 == H and y+1 == W and dy == 1) or (x+1 == H and y == 0 and dy == -1):
            break
        elif y+1 == W and dy == 1:
            move(x, y, 1, 0, a, moves)
            x += 1
            dy = -1
        elif y == 0 and dy == -1:
            move(x, y, 1, 0, a, moves)
            x += 1
            dy = 1
        else:
            move(x, y, 0, dy, a, moves)
            y += dy

    output(moves)


if __name__ == '__main__':
    main()


Measured memory_bytes: 24776
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>

using namespace std;
void swap(int &a, int &b);

int main()
{
	string sstr;
	char *cstr;
	getline(cin, sstr);
	cstr = new char[sstr.size() + 1];

	for (int i = 0; i < static_cast<int>(sstr.size()); ++i)
	{
		if (islower(sstr[i]))
		{

			cstr[i] = toupper(sstr[i]);
		}
		else
		{
			cstr[i] = tolower(sstr[i]);
			
		}
	}
	cstr[sstr.size()] = '\0';
	cout << cstr << endl;

	return 0;
}




Measured memory_bytes: 3172
#include <cstdio>
#include <algorithm>
using namespace std;

int memo[101][10001];
int w[101], v[101];
int dp(int i, int j)
{
    if (i == 0)
        return 0;
    if (memo[i][j] >= 0)
        return memo[i][j];
    if (j - w[i - 1] < 0)
        return memo[i][j] = dp(i - 1, j);

    return memo[i][j] = max(dp(i - 1, j), dp(i - 1, j - w[i - 1]) + v[i - 1]);
}

int main()
{
    for (int i = 0; i < 101; i++)
    {
        for (int j = 0; j < 10001; j++)
        {
            memo[i][j] = -1;
        }
    }
    int N, W;
    scanf("%d %d", &N, &W);
    for (int k = 0; k < N; k++)
    {
        scanf("%d %d", &v[k], &w[k]);
    }
    printf("%d\n", dp(N, W));
}


Measured memory_bytes: 6672
//26
#include<iostream>

using namespace std;

int dfs(int n,int s,int u,int b){
  if(n==0){
    return s==0;
  }else{
    int r=0;
    for(int i=b+1;i<=9;i++){
      if((u&1<<i)==0){
	r+=dfs(n-1,s-i,u|1<<i,i);
      }
    }
    return r;
  }
}

int main(){
  for(int n,s;cin>>n>>s,n|s;){
    cout<<dfs(n,s,0,-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
using System;

class program
{
    static void Main(string[] args)
    {
        string[] inputs = Console.ReadLine().Split();
        int A = int.Parse(inputs[0]);
        int B = int.Parse(inputs[1]);
        int C = int.Parse(inputs[2]);

        if (C >= A && C <= B) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<pair<int, int>> task;
    for(int i = 0; i < N; i++){
        int A,B;
        cin >> A >> B;
        task.emplace_back(B,A);
    }
    sort(task.begin(),task.end());
    int sum = 0;
    bool tf = true;
    
    for(auto i: task){
        sum += i.second;
        
        if(sum > i.first){
            tf = false;
            break;
        }
    }
    cout << (tf ? "Yes": "No") << endl;
    
    return 0;
}


Measured memory_bytes: 2420
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1000000000000
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
  int a[3][3];
  REP(i, 3){
    REP(j, 3){
      cin >> a[i][j];
    }
  }
  int d = a[1][0] - a[0][0];
  int e = a[2][0] - a[1][0];
  if((a[1][1] - a[0][1] == d) && (a[1][2] - a[0][2] == d) && (a[2][1] - a[1][1] == e) && (a[2][2] - a[1][2] == e)) cout << "Yes" << endl;
  else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
def readinput():
    n = int(input())
    a = list(map(int,input().split()))
    q = int(input())
    m = list(map(int,input().split()))
    return n,a,q,m

def canmake(a,i):
    if(len(a)==1):
        if(a==i):
            return True
        else:
            return False

    for j in range(len(a)):
        ii = i-a[j]
        can=canmake(a[:j-1]+a[j+1:],ii) 
        if(can==True):
            return True
    return False   


def main(n,a,q,m):
    for i in m:
        ans=canmake(a,i)
        if(ans==True):
            print('yes')
        else:
            print('no')
    return

def solve(a,i,m):
    if(m==0):
        return True
    if(i>=len(a)):
        return False
    return solve(a,i+1,m) or solve(a,i+1,m-a[i])

def main2(n,a,q,m):
    for mm in m:
        ans=solve(a,0,mm)
        if(ans==True):
            print('yes')
        else:
            print('no')


def main3():
    global n
    global a
    n=int(input())
    a=list(map(int,input().split()))
    q=int(input())
    ms=list(map(int,input().split()))
    for m in ms:
        ans=solve2(0,m)
        if(ans==True):
            print('yes')
        else:
            print('no')

def solve2(i,m):
    global n
    global a
    if(m==0):
        return True
    if(i>=n):
        return False
    return solve2(i+1,m) or solve2(i+1,m-a[i])

def main4():
    n = int(input())
    a = list(map(int,input().split()))
    q = int(input())
    m = list(map(int,input().split()))

    S = [0]*(2**n)
    #print(S)
    for i in range(2**n):
        b=1
        for j in range(n):
            #print(i,j,bin(b),i&b)
            if ( i&b == b):
                S[i] += a[j]
            b*=2
    #print(S)

    for mm in m:
        if (mm in S):
            print('yes')
        else:
            print('no')



if __name__=='__main__':
    #n,a,q,m = readinput()
    main4()


Measured memory_bytes: 42988
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int w,h;
int masu[111][111];
int visit[111][111];

void saiki(int y,int x){
	if(y<0 || x<0 || y>=h || x>=w)return;
	
	if(masu[y][x]==1)return;
	
	if(visit[y][x]==1)return;
	visit[y][x]=1;
	
	if(y%2==1){
		int dx[6]={ 0, 1,-1, 1, 0, 1};
		int dy[6]={-1,-1, 0, 0, 1, 1};
		rep(i,6){
			saiki(y+dy[i], x+dx[i]);
		}
	}else{
		int dx[6]={-1, 0,-1, 1,-1, 0};
		int dy[6]={-1,-1, 0, 0, 1, 1};
		rep(i,6){
			saiki(y+dy[i], x+dx[i]);
		}
	}
}

int main(){
	cin>>w>>h;
	
	reps(i,1,h+1){
		reps(j,1,w+1){
			cin>>masu[i][j];
		}
	}
	
	h+=3; w+=3;
	
	saiki(0,0);
	
	int anss = 0;
	rep(i,h){
		rep(j,w){
			if(visit[i][j]==0){
				continue;
			}
			int ans = 0;
			if(i%2==1){
				int dx[6]={ 0, 1,-1, 1, 0, 1};
				int dy[6]={-1,-1, 0, 0, 1, 1};
				rep(k,6){
					int y = i+dy[k];
					int x = j+dx[k];
					if(y<0 || x<0 || y>=h || x>=w)continue;
					if(masu[y][x]==1) ans++;
				}
				anss += ans;
			}else{
				int dx[6]={-1, 0,-1, 1,-1, 0};
				int dy[6]={-1,-1, 0, 0, 1, 1};
				rep(k,6){
					int y = i+dy[k];
					int x = j+dx[k];
					if(y<0 || x<0 || y>=h || x>=w)continue;
					if(masu[y][x]==1) ans++;
				}
				anss += ans;
			}
		}
	}
	
	printf("%d\n",anss);
}

Measured memory_bytes: 1900
#include<bits/stdc++.h>
#define ll long long
#define rll register long long
using namespace std;
ll m,n;
int main()
{
    scanf("%lld%lld",&m,&n);
    for(rll i=0;i<=m;i++)
	for(rll j=0;j<=m;j++)
	for(rll k=0;k<=m,i+j+k<=m;k++)
	{
	    if(i+j+k==m and i*1000+j*5000+k*10000==n)
	    {
	        printf("%d %d %d\n",k,j,i);
	        return 0;
	    }
	}
    printf("-1 -1 -1\n");
    return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        int n = sc.nextInt();
        double x = 1.0 * n / 3;

        out.printf("%10.10f", x * x * x);

        out.flush();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

Measured memory_bytes: 19924
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second

using namespace std;
int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
   
   int x,y;
   
   cin>>x>>y;
   
   string ans = "No";
   
   for(int a=0;a<=x;a++)
   {
       int b = x - a;
       
       if((4*a + 2*b)==y)
       {
           ans="Yes";
           break;
       }
   }
   
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
typedef long long ll;
using namespace std;
char a[100010][20];
map<string,int>ma;
map<string,int>ma1;
int main()
{
	int n;
	scanf("%d",&n);
	ll sum=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%s",a[i]);
		sort(a[i],a[i]+10);
		ma[a[i]]++;
	}
    for(int i=1;i<=n;i++)
    {
    	if(!ma1[a[i]])
    	{
    		ma1[a[i]]++;
    		ll w=ma[a[i]];
    		sum+=w*(w-1)/2;
		}
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 24064
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

s, = read_line(str)

# print(s)

c = 0
count_start_0 = 0
for i in range(len(s)):
    if int(s[i]) == c:
        count_start_0 += 1
    c = 0 if c == 1 else 1

count_start_1 = len(s) - count_start_0

print(min([count_start_0, count_start_1]))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> vec(3);
  cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
  sort(vec.begin(), vec.end());

  if((vec.at(0) == 5 && vec.at(1) == 5) && vec.at(2) == 7){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n, k;
    int ans = 1;

    cin >> n >> k;
    for(int i=0; i<n; i++) {
        if (ans < k) {
            ans *= 2;
        } else {
            ans += k;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int a[5],s = 0,mx = 10;
	for(int i = 0;i < 5;i++){
		scanf("%d",&a[i]);
		int t = a[i] % 10;
		if(t == 0)
			s += a[i];
		else{
		//	s += (a[i] / 10 + 1) * 10;
			s += a[i] + (10 - t);
			if(t < mx)
				mx = t;
		}
	}
	if(mx < 10)
		s = s - (10 - mx);
	printf("%d\n",s);
	return 0;	
} 

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

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

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    string o,e,pw="";
    cin>>o>>e;

    rep(i,50){
        if(i<o.length())pw += o[i];
        if(i<e.length())pw += e[i];
    }
    cout<<pw<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


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

int A[100001];
int MOD = 998244353;

ll powMod(ll x, ll k) {
  if (k == 0) return 1;
  if (k % 2 == 0)
    return powMod(x * x % MOD, k / 2);
  else
    return x * powMod(x, k - 1) % MOD;
}

int main() {
  int N;
  cin >> N;
  vector<int> D(N);
  for (int i = 0; i < N; i++) {
    cin >> D[i];
    A[D[i]]++;
  }

  if (D[0] != 0 || A[0] != 1) {
    cout << 0 << endl;
    return 0;
  }

  ll ret = 1;
  for (int i = 2; i < N; i++) {
    ret = ret * powMod(A[i - 1], A[i]) % MOD;
  }
  cout << ret << endl;
}

Measured memory_bytes: 1024
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{
    public void Proc()
    {
        int inputCount = int.Parse(Reader.ReadLine());

        decimal[] inpt = Reader.ReadLine().Split(' ').Select(a => decimal.Parse(a)).ToArray();

        decimal T = inpt[0];
        decimal A = inpt[1];

        inpt = Reader.ReadLine().Split(' ').Select(a => T - (decimal.Parse(a) * 0.006m)).Select(a => Math.Abs(a - A)).ToArray();

        decimal target = inpt.Min();

        int ans = inpt.ToList().FindIndex(a => a == target) + 1;

        Console.WriteLine(ans);
    
    
    }


    private int[] ScanInt() {
        return Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }

    private long[] ScanLong() {
        return Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
    }

    private string[] ScanStr() {
        return Reader.ReadLine().Split(' ').ToArray();
    }

    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"




3
21 -11
81234 94124 52141


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


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

int main(){
  int N;
  cin>>N;
  int k = 0;//合計
  int j = 0;//桁数
  int a = 0;
  for(int n = 1;n <= N;n++){
    a = n;
    while (a != 0){
      a /= 10;
      j++;
   }
   if(j % 2 == 1){
     k++;
   }
   j = 0;
  }
  cout<<k<<endl;
}

Measured memory_bytes: 3148