akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
#include <bitset>
#include <random>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;



//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int i = 1; i < N; i++) cout << ", " << v[i]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()


int ProblemA()
{
	string S;
	cin >> S;

	cout << (((S[0] == S[1] && S[1] == S[2]) || (S[1] == S[2] && S[2] == S[3])) ? "Yes" : "No") << endl;

	return 0;
}

int main()
{
	//clock_t start, end;
	//start = clock();

	ProblemA();
	
	//end = clock();
	//printf("%d msec.\n", end - start);

	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val S = readLine()!!
    val T1 = S.take(S.length / 2)
    val T2 = S.takeLast(S.length - T1.length)
    println(if (T1 == T2) "Yes" else "No")
}

Measured memory_bytes: 31812
fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val list = readLine()!!.split(" ").toMutableList()
    val s = list[0].split("")
    val t = list[1].split("")
    var str = ""
    for(i in 0 .. n) {
        str += s[i] + t[i]
    }
    println(str)
}

Measured memory_bytes: 37932
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,m;
  string s,t;
  cin >> n >> m >> s >> t;
  long long l=n*m/__gcd(n,m);
  for(long long i=0;i<m;i++){
    long long j=i*(l/m);
    if(j%(l/n)==0 and s[j/(l/n)]!=t[i]){
      cout << -1 << endl;
      return 0;
    }

  }
  cout << l << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <stdlib.h>
#define rep(i,l,r) for((i)=(l);(i)<(r);(i)++)
#define erep(i,l,r) for((i)=(l);(i)<=(r);(i)++)
#define drep(i,l,r) for((i)=(l);(i)>=(r);(i)--)
#define MOD 1000000007
#define ll long long
using namespace std;
int cmp(const void *a,const void *b){
return *(double *)a-*(double *)b;
}
int main(){
    int n;
    cin>>n;
    int i;
    double a[n],ans;
    rep(i,0,n)cin>>a[i];
    qsort(a,n,sizeof(double),cmp);
    ans=(a[0]+a[1])/2;
    rep(i,2,n) ans=(ans+a[i])/2;
    printf("%.6lf\n",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int a, b, c, d, e, f;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> a >> b >> c >> d >> e >> f;
	pair<double, pair<int, int> > ma;
	ma.first = 0;
	ma.second.first = 100*a;
	ma.second.second = 0;

	for (int i = 0; i <= 30; i++) {
		for (int j = 0; j <= 30; j++) {
			if (100*a*i + 100*b*j > f) continue;
			for (int x = 0; x <= 100000; x++) {
				int dy = min(e*(a*i+b*j)-c*x, f-100*a*i-100*b*j-c*x);
				if (dy < 0) continue;
				int y = dy/d;
				int w = 100*a*i+100*b*j, v = c*x+d*y;
				if (ma.first < v/(double)(w+v)) {
					ma.first = v/(double)(w+v);
					ma.second.first = w+v;
					ma.second.second = v;
				}
			}
		}
	}
	cout << ma.second.first << " " << ma.second.second << endl;
	return 0;
}

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


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 100010;
const int mod = 1e9+7;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n,m;

int has[1<<16],nm[1<<16],Es[maxn];

int f[1<<16];

void Work(){
	for(int sta=0;sta<1<<n;sta++)nm[sta]=nm[sta>>1]+(sta&1);
	f[0]=1;
	for(int sta=0;sta<1<<n;sta++)if((sta&3)==3||(sta&3)==0){
		for(int s=sta;s;s=(s-1)&sta){
			int ans=1;
			REP(i,1,n)if(((sta^s)>>i-1)&1)ans=1LL*ans*(Es[nm[has[i]&s]]-1)%mod;
			int tmp=0;
			REP(i,1,n)if((s>>i-1)&1)tmp+=nm[has[i]&(sta^s)];
//			if(ans&&f[sta^s])cout<<sta<<' '<<s<<' '<<1LL*f[sta^s]*ans%mod*fexp(2,tmp)<<' '<<tmp<<endl;
			f[sta]=(f[sta]+1LL*f[sta^s]*ans%mod*Es[tmp])%mod;
		}
//		cout<<sta<<' '<<f[sta]<<endl;
	}
	iout((fexp(2,m)-f[(1<<n)-1]+mod)%mod);
}

void Init(){
	read(n,m);
	REP(i,1,m){
		int u,v;
		read(u,v);
		has[u]|=1<<v-1;
	}
	Es[0]=1;REP(i,1,n*n)Es[i]=(Es[i-1]<<1)%mod;
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
   
   ll n,w;
   cin>>n>>w;
   vector<ll>V(n),W(n);
   for(int i=0;i<n;i++)
   {
       cin>>W[i]>>V[i];
   }
   vector<ll>dp(w+1,0);
   for(int i=0;i<n;i++)
   {
       for(int j=w;j>=W[i];j--)
       {
           dp[j]=max(dp[j],dp[j-W[i]]+V[i]);
       }
   }
   cout<<dp[w];
	return 0;
}

Measured memory_bytes: 4048
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();
        int h = nextInt(), a = nextInt();
        System.out.println((int)Math.ceil((double)h / a));
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

Measured memory_bytes: 23120
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

struct Sushi {
    int64_t x, v;
    Sushi(int64_t a, int64_t b) {
        x = a;
        v = b;
    }
};

int main(void) {
    int n;
    int64_t c;
    cin >> n >> c;
    std::vector<Sushi> s;
    s.push_back(Sushi(0, 0));
    for (int i = 0; i < n; i++) {
        int64_t m1, m2;
        cin >> m1 >> m2;
        s.push_back(Sushi(m1, m2));
    }

    int64_t cum_clock[100010] = {}, cum_anti[100010] = {};
    // cout << "cum_clock" << endl;
    for (int i = 1; i <= n; i++) {
        cum_clock[i] = cum_clock[i - 1] + s[i].v - (s[i].x - s[i - 1].x);
        // cout << cum_clock[i] << endl;
    }
    cum_anti[n] = s[n].v - (c - s[n].x);
    // cout << "cum_anti" << endl << cum_anti[n] << endl;
    for (int i = n - 1; i >= 0; i--) {
        cum_anti[i] = cum_anti[i + 1] + s[i].v - (s[i + 1].x - s[i].x);
        // cout << cum_anti[i] << endl;
    }

    int64_t antimax[100010] = {};
    antimax[n]              = std::max((int64_t)0, cum_anti[n]);
    // cout << "antimax" << endl << antimax[n] << endl;
    for (int i = n - 1; i >= 0; i--) {
        antimax[i] = std::max(antimax[i + 1], cum_anti[i]);
        // cout << antimax[i] << endl;
    }
    int64_t clockmax[100010] = {};
    // cout << "clockmax" << endl;
    for (int i = 1; i <= n; i++) {
        clockmax[i] = std::max(clockmax[i - 1], cum_clock[i]);
        // cout << clockmax[i] << endl;
    }
    // clock->anticlock
    int64_t res = clockmax[n];
    for (int turn = 1; turn <= n - 1; turn++) {
        int64_t temp = cum_clock[turn] - s[turn].x + antimax[turn + 1];
        if (temp > res)
            res = temp;
    }

    // anticlock->clock
    res = std::max(res, antimax[1]);

    for (int turn = n; turn >= 2; turn--) {
        int64_t temp = cum_anti[turn] - (c - s[turn].x) + clockmax[turn - 1];
        if (temp > res)
            res = temp;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 5104
#include<iostream>
#include<queue>
using namespace std;
int main(void){
  queue<char> ch_a, ch_b, ch_c;
  string st_a;
  cin >> st_a;
  for (int i = 0; i < st_a.size();i++){
    ch_a.push(st_a[i]);
  }

  string st_b;
  cin >> st_b;
  for (int i = 0; i < st_b.size();i++){
    ch_b.push(st_b[i]);
  }

  string st_c;
  cin >> st_c;
  for (int i = 0; i < st_c.size();i++){
    ch_c.push(st_c[i]);
  }
  char ans=ch_a.front();
  ch_a.pop();
  while (true)
  {
     if((ch_a.empty()&&ans=='a')||(ch_b.empty()&&ans=='b')||(ch_c.empty()&&ans=='c')){
      break;
    }
    if(ans=='a'){
      ans = ch_a.front();
      ch_a.pop();
      
    }
    else if (ans == 'b')
    {
      ans = ch_b.front();
      ch_b.pop();
      
    }
    else
    {
      ans = ch_c.front();
      ch_c.pop();
       
    }
    
  }
  ans = ans - 0x20;
  cout << ans << endl;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 52;

ll dp[MAXN][MAXN][MAXN * MAXN];

int v[MAXN];

void solve(){
	int n, a;
	cin >> n >> a;
	REPN(i, 1, n){
		cin >> v[i];
	}
	dp[0][0][0] = 1;
	ll ans = 0ll;
	REP(i, 0, n){
		REPN(j, 0, i){
			REPN(k, 0, MAXN * i){
				dp[i + 1][j][k] += dp[i][j][k];
				dp[i + 1][j + 1][k + v[i + 1]] += dp[i][j][k];
			}
		}
	}
	REPN(i, 1, n){
		ans += dp[n][i][a * i];
	}
	cout << ans << endl;
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

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

typedef long long ll;

struct UF{
	int par[100010];
	int r[100010];
	void init(){
		for(int i = 0 ; i < 100010 ; i ++){
			par[i] = i;
			r[i] = 0;
		}
	}
	int find(int x){
		if(par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	bool same(int x,int y){
		return find(x) == find(y);
	}
	void unit(int x,int y){
		if(same(x,y))return;
		x = find(x);
		y = find(y);
		if(r[x] < r[y]){
			par[x] = y;
		}
		else {
			par[y] = x;
			if(r[x] == r[y])r[x] ++;
		}
	}
}uf;

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	uf.init();
	for(int i = 0 ; i < m ; i ++){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		uf.unit(x,y);
	}
	int cnt = 0;
	for(int i = 1 ; i <= n ; i ++){
		if(uf.find(i) == i)cnt ++;
	}
	cout << cnt << endl;
}

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

using namespace std;

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

	int k;
	string s;

	cin >> k >> s;

	if (s.length() > k) {
		for (int i = 0; i < k; i++)
			cout << s[i];
		cout << "...\n";
	} else {
		cout << s << "\n";
	}

	return 0;
}

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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;

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




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



void printv(vint &v){
  for(auto e:v) cout<<e<<" ";
  cout<<endl;
}


// 繰り返し二乗法
ll power(ll a, ll b){
  if(a==1)return a;
  // if(a==0)re
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

const int MAX=2100000;
 
ll fact[MAX], fact_inv[MAX];
 
void init_fact(ll n){
  fact[0]=1;
  // 階乗の計算
  rep(i, n) fact[i+1]=fact[i]*(i+1)%MOD;
  fact_inv[n]=power(fact[n], MOD-2);
  // 逆元の計算
  for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}
 
ll comb(ll n, ll r){
  return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
 
ll perm(ll n, ll r){
  return (fact[n]*fact_inv[n-r])%MOD;
}






int main() {
  cout<<fixed<<setprecision(10);

  ll n; cin>>n;

  if(n%2) cout<<2*n<<endl;
  else cout<<n<<endl;


}






Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
char s[1000005];int n;
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	printf("%c%d%c",s[1],n-2,s[n]);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    int cnt = 0;
    for (int i=0; i<N; i++){
        if (S[i] == '.'){
            cnt++;
        }
    }

    int res = cnt;

    for (int i=0; i<N; i++) {
        if (S[i] == '#') {
            cnt++;
        } else{
            cnt--;
        }
        res = min(res,cnt);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
n,W=map(int,input().split())
wv=[]
m=1
for i in range(n):
    p=[int(j) for j in input().split()]
    wv.append(p)
    m+=p[1]

dp=[10**100 for i in range(m)]
dp[0]=0

for i in range(n):
    w,v=wv[i][0],wv[i][1]
    for j in range(m):
        if dp[-1-j]!=10**100:
            dp[-1-j+v]=min(dp[-1-j+v],dp[-1-j]+w)

ans=0
for i in range(m):
    if dp[i]<=W:
        ans=i
print(ans)

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

int main() {
    int N;
    while (cin >> N, N) {
        vector<int> d(10);
        for (int i = 0; i < N; i++) {
            int x = 0;
            cin >> x;
            d[x]++;
        }

        for (auto i : d) {
            if (i == 0) cout << "-" << endl;
            else {
                for (int j = 0; j < i; j++) {
                    cout << "*";
                }
                cout << endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3008
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll n,W;
ll w[101],val[101];
ll dp[101][100001]={0};
ll func(ll i,ll wt)
{
//	cout<<W<<' '<<n<<endl;
	if(wt>W)
	return -9999999999;
	if(i==n)
	return 0;
//	cout<<dp[i][wt]<<endl;
	if(dp[i][wt]!=-1)
	return dp[i][wt];
	ll ret=max(func(i+1,wt),func(i+1,wt+w[i])+val[i]);
//	cout<<ret<<endl;
	return dp[i][wt]=ret;
}
int main()
{
	cin>>n>>W;
	for(ll i=0;i<n;i++)
	cin>>w[i]>>val[i];
	for(ll i=0;i<101;i++)
	{
		for(ll j=0;j<100001;j++)
		{
			dp[i][j]=-1;
		}
	}
	cout<<func(0,0);
}

Measured memory_bytes: 79104
#include <stdio.h>


int main(void)
 {

	int a, b;
	char op;

	while(1){
	scanf("%d %c %d",&a,&op,&b);
	if( op =='?')
		break;
	else if( op == '+')
		printf("%d\n",a+b);
	else if( op == '-')
		printf("%d\n",a-b);
	else if( op == '*')
		printf("%d\n",a*b);
	else if( op == '/')
		printf("%d\n",a/b);
	
	}

	return 0;

}

Measured memory_bytes: 600
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	LL x = 1000;
	LL n; cin >> n;
	vector<LL> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	LL now = a[0];
	for (int i = 0; i < n; i++) {
		if (a[i] < now) {
			now = a[i];
		}
		else if (a[i] > now) {
			LL r = x % now;
			LL q = x / now;

			x = a[i]*q + r;
			now = a[i];
		}
	}

	cout << x << endl;

}

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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  int n, l;
  cin >> n >> l;
  
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  
  sort(s.begin(), s.end());
  
  string ans = "";
  rep(i, n) {
    ans += s[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3660
A, B = map(int, input().split())

d = {}
for n in range(1250, 0, -1):
    a = int(n * 0.08)
    b = int(n * 0.10)
    if 1 <= a and 1 <= b:
        d[(a, b)] = n

print(d.get((A, B), -1))

Measured memory_bytes: 38768
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-9;
const double INF = 1e9;



long memo[10001];
int main(){
	int a;
	CLR(memo);
	memo[1]=2;
	FOR(n,1,10000)memo[n+1]=memo[n]+n+1;
	
	while(cin>>a)cout<<memo[a]<<endl;
	return 0;
}
/*

*/

Measured memory_bytes: 1244
package main

import (
  "fmt"
)

func maxInt(a ...int) int {m := a[0]; for _, x := range a {if x > m {m = x}}; return m}
func minInt(a ...int) int {m := a[0]; for _, x := range a {if x < m {m = x}}; return m}

func main() {
  var n, r int
  fmt.Scan(&n, &r)
  r += 100 * maxInt(0, 10 - n)
  fmt.Println(r)
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
struct RollingHash{
	const ll mask30=(1ll<<30)-1;
	const ll mask31=(1ll<<31)-1;
	const ll mod=(1ll<<61)-1;

	ll mul(ll a, ll b){
		ll au=(a>>31), ad=(a&mask31), bu=(b>>31), bd=(b&mask31);
		ll mid=au*bd+ad*bu;
		ll midu=(mid>>30), midd=(mid&mask30);
		ll ret=((au*bu)<<1)+midu+(midd<<31)+ad*bd;
		ret=(ret>>61)+(ret&mod);
		if(ret>=mod) ret-=mod;
		return ret;
	}

	vector<ll> hash, power;

	RollingHash(const string &s, ll base=1000000007){
		int sz=s.size();
		hash.resize(sz+1);
		power.resize(sz+1);
		power[0]=1;
		for(int i=0; i<sz; i++){
			power[i+1]=mul(power[i], base);
			hash[i+1]=mul(hash[i], base);
			hash[i+1]+=s[i];
			if(hash[i+1]>=mod) hash[i+1]-=mod;
		}
	}

	ll get(int l, int r){ // [l, r)
		ll ret=hash[r]+mod-mul(hash[l], power[r-l]);
		if(ret>=mod) ret-=mod;
		return ret;
	}

	ll concat(ll h1, ll h2, int len2){ //h1+h2
		ll ret=mul(h1, power[len2])+h2;
		if(ret>=mod) ret-=mod;
		return ret;
	}
};
int main()
{
	int n; cin>>n;
	string s; cin>>s;
	RollingHash rh(s);
	int ans=0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			while(i+ans<j && j+ans<n){
				if(rh.get(i, i+ans+1)!=rh.get(j, j+ans+1)) break;
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main{
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		String first = scan.nextLine();
		String fRep = first + first;
		String second = scan.nextLine();
		boolean flg = false;

		for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		}
		System.out.println((flg)? "Yes" : "No");
	}
}

Measured memory_bytes: 26268
#include <stdio.h>
#include <string.h>

int main(void) {
    int k, len;
    char str[101];

    scanf("%d", &k);
    scanf("%s", str);
    len = strlen(str);

    if(k < len) {
        for(int i = k; i <= len -1; i++) {
            str[i] = 0;
        }
        printf("%s...\n", str);
    }
    else {
        printf("%s\n", str);
    }
}

Measured memory_bytes: 2112
#include<stdio.h>
int main(void){
    char map[110][110]={{0}};
    int x,y,i,j,k,sun;
    scanf("%d %d",&y,&x);
    for(i=0;i<y;i++){
        for(j=0;j<x;j++){
            scanf(" %c",&map[j][i]);
        }
    }
    for(i=0;i<y;i++){
        for(j=0;j<x;j++){
            sun=0;
            for(k=j;k>=0;k--){
                if(map[k][i]=='c'){
                    break;
                }else if(k==0){
                    sun=1;
                }
            }
            if(sun==1){
                printf("-1");
            }else{
                printf("%d",j-k);
            }
            if(j==x-1){
                printf("\n");
            }else{
                printf(" ");
            }
        }
    }
 
    return 0;
}

Measured memory_bytes: 2724
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=2e5+10;
char s1[maxn],s2[maxn];
int a[300],b[300];
int aa[50],bb[50];
int main() {
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    scanf("%s%s",s1,s2);
    int n1=strlen(s1),n2=strlen(s2);
    for (int i=0;i<n1;i++) a[s1[i]]++;
    for (int i=0;i<n2;i++) b[s2[i]]++;
    int cnta=0;
    for (int i=0;i<290;i++)
        if (a[i]>0)
            aa[cnta++]=a[i];

    int cntb=0;
    for (int i=0;i<290;i++)
        if (b[i]>0)
            bb[cntb++]=b[i];

    if (cnta!=cntb){
        puts("No");
        return 0;
    }
    sort(aa,aa+cnta);
    sort(bb,bb+cntb);
    bool f=true;
    for (int i=0;i<cnta;i++){
        if (aa[i]!=bb[i]) {
            f=false;
            break;
        }
    }

    printf("%s\n", f?"Yes":"No");
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int i,j;
  int flag=0;
  for(i=0;i<26;i++){
    for(j=0;j<15;j++){
      if(4*i+7*j==N){
        flag=1;
        break;
      }
    }
    if(4*i+7*j==N){
      break;
    }
  }
  if(flag==1){
    printf("Yes" );
  }else{
    printf("No" );
  }
}



Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>
#include<functional>
#include<unordered_set>
#include<unordered_map>
#include<atcoder/all>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const long long ll_min = -9223372036854775807;
const int int_max = 2147483647;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> ret;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i] ++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

template<typename T>
T modinv(T a, T m) {
	T b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int op(int a, int b) {
	return max(a, b);
}

int e() {
	return 0;
}

int main() {
	int n, k;
	cin >> n >> k;

	atcoder::segtree<int, op, e> segtree(300010);

	int ans = 0;
	rep(i, 0, n) {
		int a;
		cin >> a;
		int l = max(a - k, 0);
		int r = min(a + k, 300000) + 1;
		int tmp = segtree.prod(l, r) + 1;
		ans = max(ans, tmp);
		segtree.set(a, tmp);
	}

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


Measured memory_bytes: 8540
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn main() {
    let n: u32 = read_line().parse().unwrap();
    let s = read_line();
    
    println!("{}", if n >= 3200 { s } else { "red".to_owned() })
}

Measured memory_bytes: 4352
#AのリストにCのリストを加えて大きい順に並べ替えてNまでの和を求める
N,M = map(int,input().split())

#Aの入力
A_list = list(map(int,input().split()))

C_list = []

#Cのリストに追加する
for i in range(M):
    bi,ci = map(int,input().split())
    C_list.append([bi,ci])

#C_listをCの値でソート
C_list=sorted(C_list, reverse=True, key=lambda x:x[1])

count = 0
for bi,ci in C_list:
    count += bi
    if count > N:
        #countがNより大きくなったらNより小さい分だけ使う
        bi = N - count + bi
        A_list.extend([ci]*bi)
        break
    A_list.extend([ci]*bi)

#A_Listを大きい順に並べ替える
A_list=sorted(A_list,reverse=True)

#N番目までの総和を求める
print(sum(A_list[0:N]))


Measured memory_bytes: 28284
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
 
void solve(){
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0,ctr=0;
    for(int i=n-1;i>0;i--){
        if(a[i]<=a[i-1]){
            ctr++;
        }
        else
            ctr=0;
        ans=max(ctr,ans);
    }
    cout<<ans<<endl;
}
 
int main(){
    solve();
    return 0;
}

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

using namespace std;

int main() {
    // Input
    int A, B, C;
    cin >> A >> B >> C;

    // Process
    int cnt = 0;
    if (A == B) cnt++;
    if (A == C) cnt++;
    if (B == C) cnt++;

    // Output
    cout << (cnt == 1 ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
import sys

n, m = map(int, input().split())
links = [set() for _ in range(n)]
counts = [0] * n
for line in sys.stdin:
    s, t = map(int, line.split())
    s -= 1
    t -= 1
    links[s].add(t)
    counts[s] += 1

# Expected number of edges passing from i to N
expected = [0.] * n

# i から伸びる辺を1本消すことで削減できる"iからNまでの辺数の期待値"の最大量
reducible = [0.] * n

for i in range(n - 2, -1, -1):
    nxt_exp = [expected[j] for j in links[i]]
    sum_exp = sum(nxt_exp)
    cnt = counts[i]

    expected[i] = sum_exp / cnt + 1

    if cnt > 1:
        reduced_exp = (sum_exp - max(nxt_exp)) / (cnt - 1) + 1
        reducible[i] = expected[i] - reduced_exp
    else:
        reducible[i] = 0.

# Probability of visiting i when starting from 1
probability = [0.] * n
probability[0] = 1.

for i in range(n - 1):
    jp = probability[i] / counts[i]
    for j in links[i]:
        probability[j] += jp

print(expected[0] - max(p * r for p, r in zip(probability, reducible)))


Measured memory_bytes: 19172
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;

int main(){
    long k;
    int t;
    cin >> k >> t;

    int a[100];
    for(int i=0;i<t;i++)
        cin >> a[i];

    sort(a,a+t);

    for(int i=t-1;i>0;i--){
        a[i-1]=a[i]-a[i-1];
        sort(a,a+i);
    }
    if(a[0]>1)
        cout << a[0]-1<<endl;
    else
        cout << 0<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
ll dp[2019][2019], pos[2019][2], bpos[4019][2019], wpos[4019][2019];
int main(){
	ll n;
	cin>>n;
	vector<ll> num,col;
	for(int i=0;i<2*n;i++){
		string ts;
		ll tn;
		cin>>ts>>tn;
		num.pb(tn);
		if(ts=="B"){
			col.pb(0);
			pos[tn][0] = i;
		}
		else{
			col.pb(1);
			pos[tn][1] = i;
		}
	}
	for(int i=1;i<=n;i++){
		ll f = 0;
		for(int j=0;j<2*n;j++){
			if(num[j] == i && col[j]==0){
				f = 1;
			}
			bpos[j][i] = bpos[j][i-1] + f;
		}
	}
	for(int i=1;i<=n;i++){
		ll f = 0;
		for(int j=0;j<2*n;j++){
			if(num[j] == i && col[j]==1){
				f = 1;
			}
			wpos[j][i] = wpos[j][i-1] + f;
		}
	}
	for(int i=1;i<=n;i++){
		ll cp = pos[i][0];
		ll gb = bpos[cp][i-1];
		ll gw = wpos[cp][0];
		dp[0][i] = dp[0][i-1] + (cp - gb - gw);
	}
	for(int i=1;i<=n;i++){
		ll cp = pos[i][1];
		dp[i][0] = dp[i-1][0] + cp - bpos[cp][0] - wpos[cp][i-1];
		for(int j=1;j<=n;j++){
			ll t1,t2;
			t1 = dp[i-1][j];
			cp = pos[i][1];
			t1 += cp - bpos[cp][j] - wpos[cp][i-1];
			t2 = dp[i][j-1];
			cp = pos[j][0];
			t2 += cp - bpos[cp][j-1] - wpos[cp][i];
			dp[i][j] = min(t1,t2);
		}
	}
	/* for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			cout<<"dp"<<i<<j<<" "<<dp[i][j]<<endl;
		}
	}
	cout<<wpos[5][3]<<" "<<bpos[5][3]<<endl; */
	cout<<dp[n][n]<<endl;
	return 0;
}

Measured memory_bytes: 158720
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    divisors=sorted(divisors)
    return divisors

n, k = map(int, input().split())
alist = list(map(int, input().split()))
nagaa = len(alist)
wa = sum(alist)
yakusu=make_divisors(wa)
ng=len(yakusu)

for i in range(ng):
    nowyaku=yakusu[ng-i-1]
    amalist=[]
    for al in alist:
        amalist.append(al%nowyaku)
    amalist=sorted(amalist)
    amawa=sum(amalist)
    hidari=amawa
    migi=0
    j=0
    while hidari!=migi:
        #try:
        nowama=amalist[nagaa-j-1]
        hidari-=nowama
        migi+=(nowyaku-nowama)
        j+=1
    #print(hidari, nowyaku)
    if hidari<=k:
        print(nowyaku)
        exit()
    #print(hidari, nowyaku)

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

using namespace std;

int main(void) {

	long double a, b, c;
	cin >> a >> b >> c;
	
	if (2 * sqrtl(a*b) < c - a - b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

const ulong[] cnt = [0,2,5,5,4,5,6,3,7,6];

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto A = readln.split.map!(to!int).filter!(a => cnt[a] <= N).array;

    auto dp = new string[](N+1);
    dp[] = "0";
    dp[0] = "";

    foreach (i; 0..N) {
        if (dp[i] == "0") continue;
        foreach (j; A) {
            if (i + cnt[j] > N) continue;
            if (dp[i].length + cnt[j] < dp[i+cnt[j]].length) continue;
            string next = dp[i] ~ j.to!string;
            if (next.length == dp[i+cnt[j]].length && next < dp[i+cnt[j]]) continue;
            dp[i+cnt[j]] = next;
        }
    }

    dp[N].writeln;
}


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

using vtsii=vector<tuple<string,int,int>>;
        
int main(){
  int i,j;
  int N;cin>>N;
  vtsii rest(N);
  for(i=0;i<N;i++){
    cin>>get<0>(rest[i])>>get<1>(rest[i]);
    get<1>(rest[i])*=-1;
    get<2>(rest[i])=i+1;
    //cout<<get<0>(rest[i])<<" "<<get<1>(rest[i]);
  }
  sort(rest.begin(),rest.end());
  for(i=0;i<N;i++){
    //cout<<get<0>(rest[i])<<" "<<get<1>(rest[i])<<" ";
    cout<<get<2>(rest[i])<<endl;
  }
  
  
  
  
}


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

struct Flow{
    struct edge{
        int to, cap, rev;
    };
    vector<edge> G[MAX_V];//??£??\?????????
    bool used[MAX_V];

    void add_edge(int from, int to, int cap){
        G[from].push_back((edge){to, cap, G[to].size()});//from -> to
        G[to].push_back((edge){from, 0, G[from].size() - 1});//to -> from
    }

    //?¢???????????????¢???
    int dfs(int v, int t, int f){
        if(v == t) return f;
        used[v] = true;
        for (int i = 0; i < G[v].size(); ++i){
            edge &e = G[v][i];
            if(!used[e.to] && e.cap > 0){
                int d = dfs(e.to, t, min(f, e.cap));
                if(d > 0){
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    //s??????t???????????§???
    int max_flow(int s, int t){
        int flow = 0;
        while(1){
            memset(used, 0, sizeof(used));
            int f = dfs(s, t, INF);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

int main(void){
	int V, E; cin >> V >> E;
	Flow mf;
	rep(i, E){
		int u, v, c; cin >> u >> v >> c;
		mf.add_edge(u, v, c);
	}
	printf("%d\n", mf.max_flow(0, V - 1));
	return 0;
}

Measured memory_bytes: 1248
from fractions import gcd

a, b, c, d = map(int, input().split())

lcm = c * d // gcd(c, d)
a -= 1

under_b = b - (b//c + b//d - b//lcm)
under_a = a - (a//c + a//d - a//lcm)

answer = under_b - under_a
print(answer)


Measured memory_bytes: 5048
#include <iostream>
#include <array>
#include <map>
using namespace std;

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

    array<array<bool, 13>, 4> have_card {false};
    const char suite[4] = {'S', 'H', 'C', 'D'};
    map<char, int> s2i = {{'S', 0}, {'H', 1}, {'C', 2}, {'D', 3}};

    for (int i=0; i!=n; ++i){
        char s;
        int number;
        cin >> s >> number;
        have_card[s2i[s]][number - 1] = true;
    }

    for (int s=0; s!=4; ++s){
        for (int num=0; num!=13; ++num){
            if (!have_card[s][num]){
                cout << suite[s] << ' ' << num + 1 << endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1196
R, C, K = map(int, input().split())
score = [[0]*C for i in range(R)]

for i in range(K):
  r, c, v = map(int, input().split())
  score[r-1][c-1]+=v
  
ans0 = [[0]*C for i in range(R)]
ans1 = [[0]*C for i in range(R)]
ans2 = [[0]*C for i in range(R)]
ans3 = [[0]*C for i in range(R)]

ans1[0][0]=score[0][0]
ans2[0][0]=score[0][0]
ans3[0][0]=score[0][0]

for i in range(R):
  for j in range(C):
    if i>0:
      ans0[i][j]=max(ans0[i][j],ans3[i-1][j])
      ans1[i][j]=max(ans1[i][j],ans3[i-1][j]+score[i][j])
      ans2[i][j]=max(ans2[i][j],ans3[i-1][j]+score[i][j])
      ans3[i][j]=max(ans3[i][j],ans3[i-1][j]+score[i][j])
    if j>0:
      ans0[i][j]=max(ans0[i][j],ans0[i][j-1])
      ans1[i][j]=max(ans1[i][j],ans0[i][j-1]+score[i][j],ans1[i][j-1])
      ans2[i][j]=max(ans2[i][j],ans1[i][j-1]+score[i][j],ans2[i][j-1])
      ans3[i][j]=max(ans3[i][j],ans2[i][j-1]+score[i][j],ans3[i][j-1])

print(ans3[R-1][C-1])

Measured memory_bytes: 429104
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

int prime[MAXSIZE];

int32_t main(){
	fastio();
	bool ok = true;
	set<int>s;
	int cnt = 0;
	for(int i = 2; i < MAXSIZE; i++){
		if(prime[i] == 0){
			prime[i] = i;
			cnt++;
			for(int j = i * i; j < MAXSIZE; j+=i){
				prime[j] = i;
			}
		}
	}
	int n;
	cin >> n;
	int a[n];
	int g = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		g = __gcd(g,a[i]);
		
	}
	if(g != 1){
		cout << "not coprime";
		return 0;
	}
	
	for(int i = 0; i < n; i++){
		while(a[i] > 1){
			int k = prime[a[i]];
			while(a[i] % k == 0) a[i] /= k;
			if(s.count(k)){
				cout << "setwise coprime";
				return 0;
			}
			s.insert(k);
		}
	}
	cout << "pairwise coprime";
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const ll MAX = 10000;
static const ll INFTY = 1e12;
static const ll MOD = 1e9+7;

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

// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
using P = pair<ll, ll>;
// 入力
// 入力
ll h, w;
ll startX, startY, endX, endY;
vector<vector<char>> s;
vector<vector<ll>> cnts; // 魔法使った回数


int main() {

  ll N;
  cin >> N;
  vector<ll> A(N);
  ll sum = 0;
  REP(i, N){
    cin >> A[i];
    sum += A[i];
    sum %= MOD;
  }
  ll ans = 0;
  REP(i, N-1){
    sum -= A[i];
    if (sum < 0) sum += MOD;
    ll tmp = (sum * A[i]) % MOD;
    ans += tmp;
    ans %= MOD;
    // cout << ans << endl;
  }
  cout << ans << endl;

   
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9 + 7;
 
int dx[]={-1, 0, 1, 0};
int dy[]={0, -1, 0, 1};



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

 
map<pii,int>mp;
int n;
cin>>n;
int ans=0;        
for(int i=1;i<=n;i++)
{
  int k1=i%10;
  int k2=i; int j=i; 
  while(j>=10)
  {
    j/=10;
  }
  k2=j;  
  mp[{k2,k1}]++;
}

 map<pii,int>z=mp;

 for(auto i : mp)
 {
    int x=i.first.first;
    int y=i.first.second;
    ans+=z[{x,y}]*z[{y,x}];

 }
 cout<<ans<<"\n";

   
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
    }
    
    Scanner sc;
    int N;
    int[] a;
    int answer = 0;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        N = sc.nextInt();
        a = new int[N];
        
        for (int i=0; i<N; ++i){
            a[i] = sc.nextInt();
        }
    }
    
    //解答処理
    int solve() {
        for (int i=0; i<N; ++i){    //fが最大→ m%a[i]が最大
            a[i] -= 1;
            answer += a[i];
        }
       
        return answer;
    }
    
    //出力
    void show(int answer) {
        System.out.println(answer);
    }
}

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

typedef vector<int> vec;
typedef vector<vec> mat;

mat multi(const mat& A, const mat& B, const int& mod)
{
  mat C(A.size(), vec(B[0].size()));
  for(int i = 0; i < A.size(); i++) {
    for(int j = 0; j < B.size(); j++) {
      for(int k = 0; k < B[0].size(); k++) {
	(C[i][k] += A[i][j] * B[j][k]) %= mod;
      }
    }
  }
  return C;
}

mat power(mat A, int n, int mod)
{
  mat B(A.size(), vec(A.size()));
  for(int i = 0; i < A.size(); i++) B[i][i] = 1;
  while(n > 0) {
    if(n & 1) B = multi(B, A, mod);
    A = multi(A, A, mod);
    n >>= 1;
  }
  return B;
}

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

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, M, L;
  for(int T = 1; cin >> N >> M >> L, N || M || L; T++) {
    int num = 0;
    vector<pint> pos;
    map<pint, int> id;
    int s = 0, t = N-1;
    rep(i, N+N-1) {
      if(i < N) t++;
      else s++;
      reps(j, s, t) {
	pos.push_back(make_pair(i, j));
	id[make_pair(i, j)] = num++;
      }
    }
    mat X(num, vec(1));
    rep(i, num) cin >> X[i][0];
    mat A(num, vec(num));
    rep(i, num) {
      int y, x;
      tie(y, x) = pos[i];
      rep(j, 6) {
	int ny = y + dy[j], nx = x + dx[j];
	if(id.count(make_pair(ny, nx))) {
	  A[i][id[make_pair(ny, nx)]] = 1;
	}
      }
      A[i][i] = 1;
    }
    mat Y = power(A, L, M);
    mat Z = multi(Y, X, M);
    int ans = 0;
    rep(i, Z.size()) ans += Z[i][0];
    cout << "Case " << T << ": " << ans << endl;
  }

  return 0;
}

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

int main() {
  string s;
  cin >> s;
  int c =0;
  
  if (s[0] == 'o') c++;
  if (s[1] == 'o') c++;
  if (s[2] == 'o') c++;
 
  cout << 700 + 100*c << endl;
 
  
}


Measured memory_bytes: 256