akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;
#define PI              3.1415926536

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define REP(i,n) for(i=0;i<n;i++)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

bool f(int x, int y)
{
	return x > y;
}
void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }

void solve()
{
	double d, t, s;
	cin >> d >> t >> s;

	double time = d / s;

	if (time <= t)
		cout << "Yes";
	else
		cout << "No";

}




int32_t main()
{
	//c_p_c();
	FIO;

	// w(t)
	// {
	solve();
}




Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
const int mod=pow(10,9)+7;
int main() {
	// your code goes here
	int n,W;
	cin>>n>>W;
	vector<int> w(n),v(n);
	for(int i=0;i<n;i++)cin>>w[i]>>v[i];
	int totval=0;
	for(int x:v)totval+=x;
	vector<vector<ll>> dp(n,vector<ll>(totval+1,1LL*pow(10,18) ));
	for(int i=0;i<n;i++)dp[i][0]=0;
	dp[0][v[0]]=w[0];
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<=totval;j++)
		{
			dp[i][j]=min(dp[i][j],dp[i-1][j]);
			if(j-v[i]>=0)dp[i][j]=min(dp[i][j],(1LL*w[i]+dp[i-1][j-v[i]])  );
		}
	}
	ll ans=0;
	for(int i=totval;i>=0;i--)
	{
		if(dp[n-1][i]<=W)
		{
			ans=max(ans,1LL*i);
		}
	}
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 82248
s = str(input())
t = str(input())
ls = len(s)
lt = len(t)
a = 0
for i in range(ls):
    if i >= lt:
        break
    if s[i] != t[i]:
        a += 1
for i in range(1, ls-lt+1):
    b = 0
    for j in range(i, ls):
        if j - i >= lt:
            break
        if s[j] != t[j-i]:
            b += 1
    if b < a:
        a = b
print(a)


Measured memory_bytes: 9068
#!/usr/bin/env ruby
while line = gets
  input = line.chomp!.split(?,).map(&:to_i)

  l = input[0..9]
  va, vb = input[10..11].map(&:to_f)

  s = (va / (va+vb)) * l.inject(:+)
  k = 0
  10.times do |n|
    k += l[n]

    if s <= k
      puts (n+1)
      break
    end
  end
end

Measured memory_bytes: 8604
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,m,k;

signed main(){
	cin>>n>>m>>k;
	int num=4*n*m;
	int num2=(k-n-m)*(k-n-m);
	if(k-n-m<0)cout<<"No"<<endl;
	else if(num<num2)cout<<"Yes"<<endl;
	else if(num>=num2)cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;

long long gcd(long long a, long long b) {
    long long r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i=0; i<n; ++i){
        cin >> a[i];
    }
    int ans = a[0];
    for (int i=1; i<n; ++i){
        ans = gcd(ans, a[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <set>

using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    string before, after;
    set<string> words_list;
    cin >> before;
    words_list.insert(before);
    bool flg = true;
    for(int i=1;i<n;++i) {
        cin >> after;
        if (before[before.length()-1] != after[0] || words_list.find(after) != words_list.end()) {
            flg = false;
            break;
        }
        words_list.insert(before);
        before = after;
    }
    if (flg) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int ar[2005];

int32_t main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>ar[i];
	}
	sort(ar+1,ar+n+1);
	int ans = 0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			auto x = lower_bound(ar+j+1,ar+n+1,ar[i]+ar[j]);
			x--;
			auto y = lower_bound(ar+j+1,ar+n+1,ar[j]-ar[i]);
			y--;
			ans += x-y;
			//cout<<i<<" "<<j<<" "<<x-ar<<" "<<y-ar<<"\n";
			assert(ans>=0);
			//cout<<ans<<endl;
		}
	}
	cout<<ans;
}


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

int main(void){
  long long N;
  cin >> N;
  long long sq = sqrt(N);
  while(sq > 0){
    if(N % sq == 0){
      cout << sq + N / sq - 2;
      break;
    }
    else sq--;
  }
  
 return 0; 
}

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

int main(){
int N, M, buy = 0;  
long long ans = 0;
  cin >> N >> M;

vector<int> A(N), B(N);
  
  for(int i = 0;i < N;i++){
  cin >> A[i] >> B[i];
  }
  
vector<pair<int, int>> AB(N);
  
  for(int i = 0;i < N;i++){
    AB[i] = make_pair(A[i], B[i]);
  }
  
  sort(AB.begin(), AB.end());
  
  for(int i = 0;i < N;i++){    
    buy = min(AB[i].second, M);
    ans += (long long)buy * AB[i].first;
    M -= buy;
  }
  
  cout << ans << endl;
  return 0;
  
}

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int A, B;
    cin >> A >> B;
    int ans = 0;
    if(B != 1){
    ans++;
    B -= A;
    int x = A - 1;
    while(B > 0){
        B -= x;
        ans++;
    }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

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

    sort(a.begin(), a.end());
    cout << abs(a.back() - a.front()) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
    char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
    vector<char*> v({token});
    while(token = strtok(NULL,", ")) v.push_back(token);
    return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
    debug() << " [" << args.back() << ": " << H << "] ";
    args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
ll mod=1e9+7;
const int MX=0x3f3f3f3f;

int main(){
    IOS;
    int n,i;
    cin>>n;
    ll x,y,admax=-1e18,admin=1e18,submax=-1e18,submin=1e18;
    REP(i,0,n-1){
        cin>>x>>y;
        admax=max(admax,x+y);
        admin=min(admin,x+y);
        submax=max(submax,x-y);
        submin=min(submin,x-y);
    }
    cout<<max(admax-admin,submax-submin);
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)

int main(){
  char c;
  cin >> c;
  string v = "aeiou";
  if (v.find(c)!=-1) {
    puts("vowel");
  } else {
    puts("consonant");
  }
  return 0;
}

Measured memory_bytes: 256
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string & S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}

ll f(ll b, ll n) {
	if (b > n) return n;
	return f(b, n / b) + (n % b);
}
ll xa[3];
ll xr[3];
ll xb[3];
bool use1[3];
ll Cb(ll n, vector<ll> vec,int de);
ll Ca(ll n,vector<ll> vec,int de) {

	if (de == 0) {
		ll res = Cb(n, vec,1);

		for (size_t i = 0; i < 3; i++)
		{
			if (use1[i]) continue;
			use1[i] = true;
			vec[i] = n / xa[i];

			ll val = Ca(n - (vec[i] * xa[i]), vec, 0);
			val = max(val, Cb(n - (vec[i] * xa[i]), vec,1));
			res = max(res, val);
			vec[i] = 0;
			use1[i] = false;
		}
		return res;
	}
	else if(de == 1){
		ll res = 0;
		for (int i = 0;i < 3;i++)
		{
			res += vec[i] * xa[i];
		}
		return res;
	}

}
bool use2[3];
ll Cb(ll n,vector<ll> vec,int de) {

	ll res = 0;

	for (size_t i = 0; i < 3; i++)
	{
		if (use2[i]) continue;
		use2[i] = true;
		ll tmp = vec[i];

		vec[i] = n / xb[i];
		ll val = Cb(n - (vec[i] * xb[i]), vec, de);
		val = max(val, Ca(n - (vec[i] * xb[i]), vec, (de == 2 ? 0 : de)));
		ll val2 = tmp * xb[i];
		vec[i] = 0;
		val = max(val, val2 + Cb(n, vec, de));
		res = max(res, val);
		use2[i] = false;
	}
	return res;

}
void solv() {

	int x, a;
	cin >> x >> a;
	if (x < a) {
		cout << 0 << endl;
	}
	else {
		cout << 10 << endl;
	}

}

int main() {
//	COMinit();
	solv();

	return 0;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
V = np.array([int(i) for i in input().split(" ")])
C = np.array([int(i) for i in input().split(" ")])

vc = V-C

val = 0

for i in range(N):
    if vc[i]>0:
        val+=vc[i]
print(val)

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

int top,S[1000];

void push(int x){
    S[++top]=x;
}

int pop(){
    top--;
    return S[top+1];
}

int main(){
    int a,b;
    top=0;
    char s[100];
    while(scanf("%s",s)!=EOF){
        if(s[0]=='+'){
            a=pop();
            b=pop();
            push(a+b);
        }else if(s[0]=='-'){
            b=pop();
            a=pop();
            push(a-b);                                           

        }else if(s[0]=='*'){
            a=pop();
            b=pop();
            push(a*b);
        }else
            push(atoi(s));

    }
    printf("%d\n",pop());
    return 0;

    
}



Measured memory_bytes: 2732
#include <stdio.h>
#include <math.h>
#define N 50001

void Eratos(void);
int prime[N];

int main(void){
	int n;
	int p[N];
	int num = 0;
	int ans;

	Eratos();
	for(int i=0; i<N; i++){
		if(prime[i] == 1){
			p[num] = i;
			num++;
		}
	}

	while(1){
		ans = 0;
		scanf("%d", &n);
		if(n == 0) break;

		for(int i=0; i<num && n/2 >= p[i]; i++){
			if(prime[n - p[i]] == 1){
				ans++;
			}
		}

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

	return 0;
}

void Eratos(void){
	for(int i=0; i<N; i++){
		prime[i] = 1;
	}
	prime[0] = prime[1] = 0;

	for(int i=2; i<=sqrt(N); i++){
		for(int j=2; i*j < N; j++){
			prime[i*j] = 0;
		}
	}
}

Measured memory_bytes: 976
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B, x;
  cin >> N >> A >> B;
  x = A * N;
    
  if (x <= B) {
    cout << x << endl;
  }
  else { 
    cout << B << endl;
  }
}  

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

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
const int INF = 1e9;

using namespace std;
priority_queue<int> p;

int main() {
    string str;
    while(cin >> str, str != "end"){
        if(str == "insert"){
            int x;
            cin >> x;
            p.push(x);
        } else if(str == "extract"){
            cout << p.top() << endl;
            p.pop();
        }
    }
    return 0;
}

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

#define ll = long long;
#define ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const long long INF = 2e18;
const long long MOD = 1e9+7;

#define sx(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i < n; i++)
#define ALL(a) begin(a),end(a)

int main(void) {
    int N,M;
    cin >> N >> M;
    vector<int> A(M,0);
    REP(i,N) {
        int K;
        cin >> K;
        REP(j,K) {
            int a;
            cin >> a;
            A[a-1]++;
        }
    }
    int ans = 0;
    REP(i,M) {
        if (A[i] == N) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

vector<vector<int>> adj;
int mod = 1000000007;

int mul(int a, int b)
{
    return (long long) a * b % mod;
}

// returns a pair, where first number denotes number of ways to become a black color node and second denotes number of ways to become
// a white color node.
pair<int, int> dfs(int u, int parent)
{
    int white = 1; // all children white
    int some_black = 0; // some children are black
    for(int i = 0; i < adj[u].size(); i++)
    {
        int v = adj[u][i];
        if(v == parent)
            continue;
        pair<int, int> p = dfs(v, u);
        int orig = white;
        white = ((long long)white*p.second) % mod;
        some_black = (((long long)orig*p.first) % mod + ((long long)some_black * (p.first + p.second) % mod) % mod) % mod;
    }
    return {white, (white + some_black) % mod};
}

int main()
{
    int n;
    cin >> n;
    adj = vector<vector<int>> (n);
    for(int i = 0; i < n - 1; i++)
    {
        int x, y;
        cin >> x >> y;
        adj[x - 1].push_back(y - 1);
        adj[y - 1].push_back(x - 1);
    }
    pair<int, int> p = dfs(0, -1);
    int ans = (p.first + p.second) % mod;
    cout << ans;
    return 0;
}

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

const ll MOD = 1000000007;
ll hoge[10];

void solve() {
    ll M;
    string C;
    cin >> M >> C;
    int N = C.size();
    ll CM = 0;

    ll base = 1;
    REP(i, N) {
        int idx = N - i - 1;
        (hoge[C[idx]-'0'] += base) %= MOD;
        (CM += base * (C[idx] - '0') % MOD) %= MOD;
        base = base * 10 % MOD;
    }

    vector<int> fuga = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    do {
        if (N != 1 && fuga[C[0]-'0'] == 0) continue;
        ll D = CM;
        REP(i, 10) (D += (fuga[i] - i) * hoge[i] % MOD) %= MOD;
        D = (D % MOD + MOD) % MOD;
        if (D == M) {
            REP(j, N) cout << fuga[C[j]-'0'];
            cout << endl;
            return;
        }
    } while (next_permutation(fuga.begin(), fuga.end()));

    cout << -1 << endl;
}

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



Measured memory_bytes: 3320
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
const int N = 1000+5;
using namespace std;
int G[N*2][N*2];
int getNum(int x1,int y1,int x2,int y2){
    return G[x2][y2]-G[x1][y2]-G[x2][y1]+G[x1][y1];
}
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        int x,y;
        char c;
        scanf("%d %d %c",&x,&y,&c);
        if(c=='W')
            x+=k;
        x=x%(k*2);
        y=y%(k*2);
        G[x+1][y+1]++;
    }
    for(int i=1;i<=2*k;i++)
        for(int j=1;j<=2*k;j++)
            G[i][j]+=G[i-1][j]+G[i][j-1]-G[i-1][j-1];
    int res=-INF;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            int temp1=getNum(0,0,i,j);
            int temp2=getNum(0,j+k,i,2*k);
            int temp3=getNum(i+k,0,2*k,j);
            int temp4=getNum(i+k,j+k,2*k,2*k);
            int temp5=getNum(i,j,i+k,j+k);
            int sum=temp1+temp2+temp3+temp4+temp5;
            res=max(res,max(sum,n-sum));
        }
    }
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 16000
def resolve():
    s = input()

    def dfs(i, f):
        if i == 3:
            return f.split(",")
        return dfs(i+1, f + "+" + s[i+1]) + dfs(i+1, f + "-" + s[i+1])
    for i in dfs(0, s[0]):
        if eval(i) == 7:
            print(i + "=7")
            exit()
resolve()

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

int main() {
    long long N, A, B, ans, rem;
    cin >> N >> A >> B;
    
    ans = N / (A+B) * A;
    rem = N%(A+B);
    ans += min(A, rem);
    
    cout << ans << endl;
}


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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> hoge(n, vector<int>(m));
    vector<int> fuga(m);
    for (int i = 0; i < n; i++){
        for (int e = 0; e < m; e++){
            cin >> hoge[i][e];
        }
    }
    for (int i = 0; i < m; i++){
        cin >> fuga[i];
    }

    int ans;
    for (int i = 0; i < n; i++){
        ans = 0;
        for (int e = 0; e < m; e++){
            ans += hoge[i][e]*fuga[e];
        }
        say(ans);
    }
}


Measured memory_bytes: 3212
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
     int A, B;
     cin >> A >> B;
     cout << max(0,A-2*B) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if (a < b) {
		printf("a < b\n");
	} else if (a > b) {
		printf("a > b\n");
	} else {
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<iterator>
#include<set>
#include<queue>

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

using namespace std;


int main(){
	string s;
	int K;
	cin >> s >> K;
	string ans;
	rep(i,s.size()){
		int diff = 'z' - s[i] + 1;
		if(i == s.size() - 1){
			int itr = K % 26;
			if(itr < diff){
				ans.push_back(s[i] + itr);
			}
			else{
				ans.push_back('a' + itr - diff);
			}
		}
		else if(s[i] == 'a'){
			ans.push_back('a');
		}
		else if(diff <= K){
			ans.push_back('a');
			K -= diff;
		}
		else{
			ans.push_back(s[i]);
		}

	}
	cout << ans << endl;
}

Measured memory_bytes: 768
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int ret = INF;
  for (int i = 0; i + 3 <= n; ++i) {
    int cur = 0;
    for (int j = 0; j < 3; ++j) cur = cur * 10 + s[i + j] - '0';
    ret = min(ret, abs(cur - 753));
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>




int main()
{
  int a[5],deray,min,i;

  scanf("%d",&a[0]);
  min=0;deray=a[0]%10?a[0]%10:10;
  for(i=1;i<5;i++)
    {
      scanf("%d",&a[i]);
      if(a[i]%10!=0 && a[i]%10<deray)
	{
	  deray=a[i]%10;
	  min=i;
	}
    }
  int sum=0;
  for(i=0;i<5;i++)
    {
      if(i==min)
	sum+=a[i];
      else
	sum+=(a[i]+9)/10*10;
    }
  

  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 128
while True:
	h,w = map(int,raw_input().split())

	if h == 0 and w == 0:
		break

	for i in range(h):
		if i == 0 or i == h-1:
			print'#'*w
		else:
			print'#'+'.'*(w-2)+'#'
	print

Measured memory_bytes: 6364
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>




using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;



void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    vector<pii> cnt0(100001), cnt1(100001);
    for (int i = 0; i < cnt0.size(); ++i) {
        cnt0[i] = cnt1[i] = {0, i};
    }
    for (int i = 0; i < n; ++i) {
        if (i & 1) {
            cnt1[a[i]].first++;
        }
        else {
            cnt0[a[i]].first++;
        }
    }
    sort(cnt0.rbegin(), cnt0.rend());
    sort(cnt1.rbegin(), cnt1.rend());
    int res = n;
    if (cnt0[0].second != cnt1[0].second) {
        cout << n - cnt0[0].first - cnt1[0].first << endl;
        return;
    }
    else {
        cout << min(res - cnt0[0].first - cnt1[1].first, res - cnt1[0].first - cnt0[1].first) << endl;
    }


}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
        solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 2176
N, M = map(int, input().split())
sc = [tuple(map(int, input().split())) for i in range(M)]

for i in range(10**N):
  n = str(i)
  if len(n) != N: continue
  if all([n[s-1] == str(c) for s, c in sc]):
    print(n)
    break
else:
  print(-1)

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

main() {
    int x,y,n,m; cin >> x >> y >> n >> m;
    int s=n-x,t=m-y;
    cout << n-t <<" "<< m+s <<" "<< n-t-s <<" "<< m+s-t << endl;



    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int read();
int n;
char s[1000006];
int a[1000006];
void calc() {
    for (int i = 1; i < n; ++i) a[i] = abs(a[i] - a[i + 1]);
    --n;
}
int main() {
    n = read(), scanf("%s", s + 1);
    for (int i = 1; i <= n; ++i) a[i] = s[i] - '0';
    if (n == 2) return calc(), printf("%d\n", a[1]), 0;
    calc(), calc();
    int res = 0;
    for (int i = 1; i <= n; ++i) res ^= ((n - 1 | i - 1) == n - 1) * (a[i] & 1);
    if (res == 1) return puts("1"), 0;
    for (int i = 1; i <= n; ++i)
        if (a[i] == 1) return puts("0"), 0;
    res = 0;
    for (int i = 1; i <= n; ++i)
        res ^= ((n - 1 | i - 1) == n - 1) * (a[i] >> 1 & 1);
    printf("%d\n", res << 1);
    return 0;
}

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') f = (c == '-') ? -1 : f, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    int ss = s.size(), tt = t.size();
    if (ss != tt - 1) {
        cout << "No";
        return 0;
    }
    bool ok = true;
    for (int i = 0; i < ss; i++) {
        if (s[i] != t[i]) {
            ok = false;
            break;
        }
    }
    cout << (ok ? "Yes" : "No");
}


Measured memory_bytes: 3652
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
p1 = 0
p2 = 0
for i in range(1,n+1):
    if i % 2 == 0:
        p2 += a[i-1]
    else:
        p1 += a[i-1]

print(p1-p2)

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

typedef long long ll;

const ll mod = 1000000007;

int N, A[1<<18], C[3];
ll sum = 1;

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

    for (int i = 1; i <= N; i++) {
        ll cnt = 0, id = -1;
        if (A[i] == C[0]) { cnt++; id = 0; }
        if (A[i] == C[1]) { cnt++; id = 1; }
        if (A[i] == C[2]) { cnt++; id = 2; }
        if (id == -1) {
            cout << "0" << endl;
            return 0;
        }

        sum *= cnt; C[id]++;
        sum %= mod;
    }
    cout << sum << endl;
}


Measured memory_bytes: 640
//#define NDEBUG
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
static constexpr double PI = 3.1415926535897932;

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
using intl32 = std::int_least32_t;
using intl64 = std::int_least64_t;
using uintl32 = std::uint_least32_t;
using uintl64 = std::uint_least64_t;

	template <typename T>
	auto scan(T &d) ->
		typename std::enable_if<std::is_same<T, std::string>::value>::type {
		d = std::string();
		int c = 0;
		while (c < 'a' || 'z' < c)
			c = fgetc(stdin);
		while ('a' <= c && c <= 'z') {
			d.push_back(c);
			c = fgetc(stdin);
		}
	}
	template <typename T>
	auto scan(T &d) ->
		typename std::enable_if<std::is_same<T, double>::value>::type {
		scanf("%lf", &d);
	}
	template <typename T>
	auto scan(T &d) ->
		typename std::enable_if<std::is_signed<T>::value ==
		std::is_same<T, std::string>::value>::type {
		d = 0;
		int c = 0;
		while (c < '0' || '9' < c)
			c = fgetc(stdin);
		while ('0' <= c && c <= '9') {
			d = d * 10 + c - '0';
			c = fgetc(stdin);
		}
	}
	template <typename T>
	auto scan(T &d) ->
		typename std::enable_if<std::is_signed<T>::value !=
		std::is_same<T, double>::value>::type {
		d = 0;
		int c = 0;
		bool f = 0;
		while (c < '0' || '9' < c) {
			if (c == '-')
				f = 1;
			c = fgetc(stdin);
		}
		while ('0' <= c && c <= '9') {
			d = d * 10 + c - '0';
			c = fgetc(stdin);
		}
		if (f)
			d = -d;
	}

int main(void)
{
	uint32 n, k;
	scan(n);scan(k);
	++n;
	uint64 ans = 0;
	for (uint32 i = k + 1;i < n;++i) {
		ans += (i - k)*(n / i);
		if (n%i >= k) {
			ans += n%i - k;
		}
	}
	if (k == 0) ans -= n - 1;
	printf("%lu\n", ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = Long.parseLong(sc.next());
        StringBuilder sb = new StringBuilder();
        while (n > 0) {
            n--;
            long mod = n % 26;
            sb.append((char) ('a' + mod));
            n /= 26;
        }
        System.out.println(sb.reverse().toString());
    }
}

Measured memory_bytes: 35644
#![allow(unused_macros)]

macro_rules! line {
    () => {{
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf
    }};
}
macro_rules! line_as_vec {
    ( $t:ty ) => {
        line!()
            .trim()
            .split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect::<Vec<$t>>()
    };
}
macro_rules! input {
    { $( $i:ident : $t:ty ),* } => {
        let ( $( $i ),* ) = match &line!().split_whitespace().collect::<Vec<_>>()[..] {
            &[ $( $i ),* ] => ( $( $i.parse::<$t>().unwrap() ),* ),
            _ => panic!(),
        };
    };
}

fn main() {
    input!(n: u32, m: usize, x: u64);

    let v = (0..n).map(|_| line_as_vec!(u64)).collect::<Vec<_>>();
    let mut ans = std::u64::MAX;

    for pattern in 0..1 << n {
        let mut ud = vec![0u64; m + 1];
        let mut cost = 0;

        for i in 0..n as usize {
            if (pattern >> i) & 1 == 1 {
                cost += v[i][0];
                for j in 1..(m + 1) {
                    ud[j] += v[i][j];
                }
            }
        }

        if !ud[1..].into_iter().any(|c| c < &x) {
            ans = std::cmp::min(ans, cost);
        }
    }

    println!("{:?}", if ans == std::u64::MAX { -1 } else { ans as i64 })
}


Measured memory_bytes: 2124
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)

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

int main() {
  int N;
  int count = 0;
  int i = 1;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  vector<int> store(0);

  while(i != 2) {
    store.push_back(i);
    i = vec[i - 1];
    if (find(store.begin(), store.end(), i) != store.end()) {
      count = -1;
      break;
    }
    count++;
  }

  cout << count << endl;
}

Measured memory_bytes: 4236
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}
int main()
{
	int n;
	cin>>n;
	int x;
	cin>>x;
	int y[n+1];
	for(int i=0;i<n;i++)
	   cin>>y[i];
	y[n]=x;
	sort(y,y+n+1);
	int ans=y[1]-y[0];
	for(int i=1;i<n;i++)
	   ans=gcd(ans,y[i+1]-y[i]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
/******************
 *AUTHOR: speckrel*
 ******************/

//******************************************************************************
#include "bits/stdc++.h"
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define fpowll fpow<long long>
#define fpowi fpow<int>
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define all(v) (v).begin(), (v).end()


//Fast exponentiation
template <typename T>
T fpow(T base, T expo){
    if(expo==0){return 1;}
    else if(expo==1){return base;}
    else{
        if(expo%2==0){return fpow(base,expo/2)*fpow(base,expo/2);}
        else{return base*fpow(base,expo-1);}
    }
}

//******************************************************************************
//Auxiliary Functions go here

//******************************************************************************
void solve(){
    static int coun=0;
    //cout<<"This is a test code "<<coun<<"\n";
    //coun++;
  char str[4];
  for(int i=0;i<3;i++){cin>>str[i];}
  if(str[0]=='R'){
    if(str[1]=='S'){cout<<1;}
    else{
      if(str[2]=='S'){cout<<2;}
      else{cout<<3;}
    }
  }
  else{
    if((str[1]=='S')&&(str[2]=='S')){cout<<0;}
    else if((str[1]=='R')&&(str[2]=='R')){cout<<2;}
    else{cout<<1;}
  }
}

// main function
int main(){
    IOS
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ll t=1;
    //cin>>t;

    while(t--){
        solve();
    }

    return 0;
}
//******************************************************************************


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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> C;
    for (int i = 0; i < h; i++) {
        string c;
        cin >> c;
        C.push_back(c);
    }

    for (int i = 0; i < h; i++) {
        cout << C[i] << endl;
        cout << C[i] << endl;
    }

    return 0;
}


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

#define int long long int

int32_t main()
{
    int n;
    cin>>n;
    map<int,int> m;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        m[x]++;
    }
 
    for(auto i:m)
    {
        if(i.first!=i.second)
        ans+=i.second<i.first?i.second:i.second-i.first;
    }
    cout<<ans<<endl;
}

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

struct UnionFind{
    vector<int> data;
    //要素の根を管理
    //xが根ならdata[x]<0で、-data[x]がその集合のサイズ
    UnionFind(int n){ data.assign(n, -1); }
    void init_(int n){ data.assign(n, -1); }
    bool unite(int x, int y){
        x = root(x), y = root(y);
        if(x != y){
            if(data[y] < data[x])swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    int root(int x){ return data[x]<0 ? x : data[x]=root(data[x]); }
    int size(int x){ return -data[root(x)]; }
    bool same(int x, int y){ return root(x) == root(y); }
};

int main(){
    
    int N, M;
    scanf("%d %d", &N, &M);
    vector<int> a(M),b(M);
    rep(i,M){
        scanf("%d %d",&a[i], &b[i]);
        a[i]--,b[i]--;
    }

    int cnt=0;
    UnionFind uf(N);
    
    rep(i,M){
        rep(j,N)uf.data[j]=-1;
        rep(j,M)if(i != j)uf.unite(a[j], b[j]);
        if(!uf.same(a[i], b[i]))cnt++;
    }
    
    cout << cnt << endl;

}

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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	int n;
	ll a;
	ll sum=0;
	cin >> n;
	map<ll,int> m;
	FOR(i,n){
		cin >> a;
		if(m.find(a)!=m.end() && m[a] >0) m[a]=0;
		else if(m.find(a)!=m.end() && m[a]==0) m[a]=1;
		else m.insert(MP(a,1)); 
	}
	for(auto it=m.begin();it!=m.end();it++){
		//cout << it->first <<" " << it->second <<"\n";
		sum+=it->second;
	}
	cout << sum;

	return 0;
}

Measured memory_bytes: 6528
function main(input) {
    const AA = input.split(" ");
    const BB = parseInt(AA[0], 10);
    const BA = parseInt(AA[1], 10);
    if(BB * BA % 2 === 0){
        console.log("Even");
    }else{
        console.log("Odd");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
template<typename T> T gcd(T a,T b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const ll mod = 10000018033;
const double pi = acos(-1);
const double eps = 1e-10;
int n;
int s[300][300];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) FOR(j, 0, n){
    char c;
    cin >> c;
    s[i][j] = c-'a';
  }
  int ans = 0;
  FOR(i, 0, n){
    FOR(j, 0, n)FOR(k, 0, j) if(s[(j+i)%n][k] != s[(k+i)%n][j]) goto l_break;
    ans += n;
    l_break:
    ;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define vi vector<int>
#define rep(i, xtz, n) for(int i=xtz; i<n; i++)

using namespace std;

int main(){
    //freopen("i.in", "r", stdin);
    int n; cin>>n;
    vector<vector<int>> dp(3, vector<int>(n, 0));
    vector<int> a(n), b(n), c(n);
    rep(i, 0, n) cin>>a[i]>>b[i]>>c[i];
    dp[0][0] = a[0];
    //cout<<a[0]<<" "<<b[0]<<" "<<c[0]<<"\n";
    dp[1][0] = b[0];
    dp[2][0] = c[0];
    rep(i, 1, n){
        dp[0][i] = max(dp[1][i-1]+a[i], dp[2][i-1]+a[i]);
        dp[1][i] = max(dp[0][i-1]+b[i], dp[2][i-1]+b[i]);
        dp[2][i] = max(dp[1][i-1]+c[i], dp[0][i-1]+c[i]);
    }
    //cout<<dp[0][n-1]<<" "<<dp[1][n-1]<<" "<<dp[2][n-1]<<"\n";
    if(dp[0][n-1]>dp[1][n-1]) cout<<max(dp[0][n-1], dp[2][n-1]);
    else cout<<max(dp[1][n-1], dp[2][n-1]);
}

Measured memory_bytes: 2556
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<ll> p(a), q(b), r(c);
    for (int i = 0; i < a; i++) {
        cin >> p[i];
    }
    for (int i = 0; i < b; i++) {
        cin >> q[i];
    }
    for (int i = 0; i < c; i++) {
        cin >> r[i];
    }
    sort(all(p));
    sort(all(q));
    reverse(all(p));
    reverse(all(q));
    vector<ll> v;
    for (int i = 0; i < y; i++) {
        v.eb(q[i]);
    }
    for (int i = 0; i < c; i++) {
        v.eb(r[i]);
    }
    sort(all(v));
    reverse(all(v));
    ll res = -INF;
    ll s = 0;
    for (int i = 0; i < y; i++) {
        s += v[i];
    }
    for (int i = 0; i < x; i++) {
        s += p[i];
    }
    for (int i = x - 1; i >= 0; i--) {
        chmax(res, s);
        s -= p[i];
        if (y + (x - 1 - i) >= v.size()) {
            break;
        }
        s += v[y + (x - 1 - i)];
    }
    if (x + y <= v.size()) {
        chmax(res, s);
    }
    cout << res << endl;
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define INF 1020304050

int main()
{
  int n;cin>>n;
  vector<int> a(n);
  int i;
  rep(i,n)cin>>a[i];
  vector<int> lans(n,INF);
  rep(i,n)
  {
    int ind=lower_bound(all(lans),a[i])-lans.begin();
    lans[ind]=a[i];
  }
  int ans=0;
  rep(i,n)
  {
    if(lans[i]!=INF)ans++;
    else break;
  }
  cout<<ans<<endl;
}



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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

#define All(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1e9;

int main(){
   int n;
   cin >> n;
   while(ceil(sqrt(n)) != floor(sqrt(n))){
      n--;
   }
   cout << n << endl;
   return 0;
}

Measured memory_bytes: 256
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end

def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(ym){Array.new(l,d)}}end

def yn(f) return (f)? "Yes": "No" end

def ynb(f) return (f)? "YES": "NO" end

def ap(a) a.each{|u| p u} end

def bit(n) n.to_s(2).split("").map(&:to_i) end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

n = inp[0]
bb = cc = 1
f = 1
n.times do
  b,c = inp
  hi = [(bb+b-1)/b,(cc+c-1)/c,1].max
  bb,cc = b*hi,c*hi
end
p (bb+cc).to_i

Measured memory_bytes: 1788
#include <algorithm>
#include <iostream>
#include <set>

using namespace std;
using LLONG = long long;

int main()
{
    int A, B;
    int K;
    cin >> A >> B >> K;
    set<int> values;
    for (int i = A; i <= min(B, A + K - 1); ++i)
    {
        values.insert(i);
    }
    for (int i = B; i >= max(A, B - K + 1); --i)
    {
        values.insert(i);
    }
    for (const int value : values)
        cout << value << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())

c0 = 0
c1 = 0
c2 = 0
c3 = 0

for i in range(n):
  s = input()
  if s == "AC":
    c0 += 1
  elif s == "WA":
    c1 += 1
  elif s == "TLE":
    c2 += 1
  elif s == "RE":
    c3 += 1
print("AC x {}".format(c0))
print("WA x {}".format(c1))
print("TLE x {}".format(c2))
print("RE x {}".format(c3))

Measured memory_bytes: 9204
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int,Int>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

Int LCM(Int a, Int b){
    return a*b/GCD(a,b);
}


int main() {
    int K,X;

    cin >> K >>X;

    if(K*500>=X){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256