akhauriyash/Code-Regression huggingface dataset:
#include <cstring>
#include <iostream>

const int N = 100 + 3;

int n, m, k, mod;
int h[2][N][N], (*f)[N] = h[0], (*g)[N] = h[1];
int bin[N][N], pow[N][N];

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%d%d%d%d", &n, &m, &k, &mod);
	if (n < m) std::swap(n, m);
	for (int i = 0; i <= std::max(n, k); ++i)
		for (int j = bin[i][0] = 1; j <= i; ++j)
			bin[i][j] = (bin[i - 1][j - 1] + bin[i - 1][j]) % mod;
	for (int i = 0; i <= std::max(n, k); ++i)
		for (int j = pow[i][0] = 1; j <= std::max(n, k); ++j)
			pow[i][j] = 1ll * pow[i][j - 1] * i % mod;
	f[0][0] = 1;
	for (int t = 0; t < k; ++t) {
		auto clear = []() {
			for (int i = 0; i <= n; ++i) memset(f[i], 0, sizeof(int) * (m + 1));
		};
		std::swap(f, g), clear();
		for (int i = 0; i <= n; ++i) for (int j = 0; j <= m; ++j) {
			if (!g[i][j]) continue;
			int x = 1, y = 1ll * pow[t + 1][m - j] * pow[k - t][j] % mod;
			for (int l = 0; i + l <= n; ++l, x = 1ll * x * y % mod)
				f[i + l][j] = (f[i + l][j] + 1ll * bin[n - i][l] * x % mod * g[i][j]) % mod;
		}

		std::swap(f, g), clear();
		for (int i = 0; i <= n; ++i) for (int j = 0; j <= m; ++j) {
			if (!g[i][j]) continue;
			int x = 1, y = 1ll * pow[t + 1][n - i] * pow[k - t][i] % mod;
			for (int l = 0; j + l <= m; ++l, x = 1ll * x * y % mod)
				f[i][j + l] = (f[i][j + l] + 1ll * bin[m - j][l] * x % mod * g[i][j]) % mod;
		}

		std::swap(f, g), clear();
		for (int i = 0; i <= n; ++i) for (int j = 0; j <= m; ++j) {
			if (!g[i][j]) continue;
			int x = 1, y = -1ll * pow[t + 1][m - j] * pow[k - t - 1][j] % mod;
			for (int l = 0; i + l <= n; ++l, x = 1ll * x * y % mod)
				f[i + l][j] = (f[i + l][j] + 1ll * bin[n - i][l] * x % mod * g[i][j]) % mod;
		}

		std::swap(f, g), clear();
		for (int i = 0; i <= n; ++i) for (int j = 0; j <= m; ++j) {
			if (!g[i][j]) continue;
			int x = 1, y = -1ll * pow[t + 1][n - i] * pow[k - t - 1][i] % mod;
			for (int l = 0; j + l <= m; ++l, x = 1ll * x * y % mod)
				f[i][j + l] = (f[i][j + l] + 1ll * bin[m - j][l] * x % mod * g[i][j]) % mod;
		}
	}
	printf("%d", (f[n][m] + mod) % mod);

	return 0;
}


Measured memory_bytes: 3960
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

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

A, B, C, D = map(int, readline().split())

start = max(A, C)
end = min(B, D)
ans = max(0, end - start)
print(ans)

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

int a[101][101],n,ans;

int main()
{
	scanf("%d",&n);
	if (n&1)
	{
		for (int i=1; i<=n; i++)
			for (int j=i+1; j<=n; j++)
				if (j!=i&&j!=n-i) a[i][j]=1,ans++;
		printf("%d\n",ans);
		for (int i=1; i<=n; i++)
			for (int j=i+1; j<=n; j++)
				if (a[i][j]) printf("%d %d\n",i,j);
	} else
	{
		for (int i=1; i<=n; i++)
			for (int j=i+1; j<=n; j++)
				if (j!=i&&j!=n+1-i) a[i][j]=1,ans++;
		printf("%d\n",ans);
		for (int i=1; i<=n; i++)
			for (int j=i+1; j<=n; j++)
				if (a[i][j]) printf("%d %d\n",i,j);
	}
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    long long l = 1;
    for (int i = 0; i < N; i++) {
        long long T;
        cin >> T;
        l = lcm(l, T);
    }
    cout << l << endl;
}

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

int main()
{
    int N, M;
    cin>>N>>M;
    vector<pair<int, int> > constraints;
    for(int i=0; i<M; i++){
        int ci, si;
        cin>>ci>>si;
        constraints.push_back(make_pair(ci, si));
    }
    int answer = -1;
    int num = 0;
    if(N>1){
        num = (int)pow(10, N-1);
    }
    for(; num<pow(10, N); num++){
        // char curnum[20], fstr[20];
        // sprintf(fstr, "%%0%dd", N);
        // sprintf(curnum, fstr, num);
        // // printf("%s\n",curnum);
        string curnum = to_string(num);
        int ci, si;
        bool valid = true;
        for(int j=0; j<constraints.size(); j++){
            si = constraints[j].first;
            ci = constraints[j].second;
            if(curnum[si-1] != (char)('0'+ci)){
                valid = false;
                break;
            }
        }
        if(valid){
            answer = num;
            break;
        }
    }
    cout<<answer<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;


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

    int cnt=0;

    while(n>0){
        cnt++;
        n/=k;
    }
    cout<<cnt;



	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

vector<int> l;
int ia,ib,ic;

int solve(int a,int b,int c,int index,int cost) {
  if(index == l.size())
    if(ia == a || ib == b || ic == c) return 112345678;
    else return abs(a) + abs(b) + abs(c) + cost;
  vector<int> ans(4);
  ans[0] = solve(a-l[index], b, c, index + 1, cost + 10);
  ans[1] = solve(a, b-l[index], c, index + 1, cost + 10);
  ans[2] = solve(a, b, c-l[index], index + 1, cost + 10);
  ans[3] = solve(a, b, c, index + 1, cost);
  sort(ans.begin(), ans.end());
  return ans[0];
}

int main(void)
{
  int n;
  cin >> n >> ia >> ib >> ic;
  REP(i, n) {
    int x;
    cin >> x;
    l.push_back(x);
  }
  cout << solve(ia,ib,ic,0,-30) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  for(int i = 10 * B; i <= 10 * B + 9; i++) {
    if ((i * 8) / 100 == A) {
      cout << i << endl;
      break;
    }
    if (i == 10 * B + 9) {
      cout << -1 << endl;
    }
  }
}

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

using namespace std;
int main() {
	int N, L;
	cin >> N >> L;
	vector<int> taste(N);
	for (int i = 0; i < N; ++i) {
		taste[i] = L + i;
	}
	if (L <= 0 && L + N - 1 >= 0) {
		cout << accumulate(taste.begin(), taste.end(), 0) << endl;
	} else if (L > 0) {
		cout << accumulate(taste.begin(), taste.end(), 0) - taste[0] << endl;
	} else {
		cout << accumulate(taste.begin(), taste.end(), 0) - taste[N - 1]
		     << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL ans=0;
int a,b,c,d,e,f,g;
int x,y,z;
int main(){
	scanf("%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g);
	ans=b;
	x=a,y=d,z=e;
	int t=(x&1)+(y&1)+(z&1);
	if (y&1)
		swap(x,y);
	if (z&1)
		swap(z,y);
	if (t>=2){
		if (z>0)
			ans+=3,x--,y--,z--;
	}
	ans+=x/2*2;
	ans+=y/2*2;
	ans+=z/2*2;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    bool alph[30];
    for (int i = 0; i < 26; ++i) {
		alph[i] = false;
	}
    for(int i = 0; S[i] != '\0'; i++){
        alph[S[i]-'a'] = true;
    }
    for(int i = 0; i < 26; i++){
        if(!alph[i]) {
            char c = i+'a';
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

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

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ii, null_type,less<ii>, rb_tree_tag,tree_order_statistics_node_update>
#define graph vector<vi>
#define Mod 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T int t;cin>>t;rep(i,t)



void solve() {

    ll t;
    cin >> t;
    if (t >= 30)
        cout << "Yes\n";
    else
        cout << "No\n";
    
 }

int main()
{
    fastio;
    // T
    solve();
    //code
    return 0;
}


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

int main(){
    int X;
    cin >> X;
    if(X == 2) goto lab;
    while(1){
        for(int i = 2;i < X;i++){
            if(X%i == 0) break;
            if(i == X-1) goto lab;
        }
        X++;
    }
    lab : cout << X << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

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


int main()
{
	int n, x, temp, dist, ans;
	ans = dist =  0;
	cin >> n >> x;
	rep(i, n) {
		ans++;
		cin >> temp;
		dist += temp;
		if (dist > x) {
			cout << ans << endl;
			return 0;
		}
	}

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

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

TList = input().split()

M = int(input())

List=[list(map(int,input().split())) for i in range(M)]


for i in List:
    sum = 0
    for j in range(N):
        if int(i[0]) == int(j+1):
            sum = sum + int(i[1])
        else :
            sum = sum + int(TList[j])
    print(sum)

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

template<class V> class MaxFlow_Ford {
public:
	struct edge { int to,reve;V cap;};
	static const int MV = 10000;
	vector<edge> E[MV];
	int vis[MV];
	void add_edge(int x,int y,V cap,bool undir=false) {
		E[x].push_back((edge){y,(int)E[y].size(),cap});
		E[y].push_back((edge){x,(int)E[x].size()-1,undir?cap:0});
	}
	V dfs(int from,int to,V cf) {
		V tf;
		if(from==to) return cf;
		vis[from]=1;
		FORR(e,E[from]) if(vis[e.to]==0 && e.cap>0 && (tf = dfs(e.to,to,min(cf,e.cap)))>0) {
			e.cap -= tf;
			E[e.to][e.reve].cap += tf;
			return tf;
		}
		return 0;
	}
	V maxflow(int from, int to) {
		V fl=0,tf;
		while(1) {
			ZERO(vis);
			if((tf = dfs(from,to,numeric_limits<V>::max()))==0) return fl;
			fl+=tf;
		}
	}
};

MaxFlow_Ford<ll> mf;

int N;
int A[101];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	ll tot=0;
	for(i=1;i<=N;i++) {
		cin>>A[i];
		if(A[i]>=0) {
			tot+=A[i];
			mf.add_edge(0,i,A[i]);
			mf.add_edge(i,N+1,0);
		}
		else {
			mf.add_edge(0,i,0);
			mf.add_edge(i,N+1,-A[i]);
		}
		
		for(x=i*2;x<=N;x+=i) mf.add_edge(x,i,1LL<<40);
	}
	cout<<tot-mf.maxflow(0,N+1)<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 512
n, m = map(int, input().split())
a = list()
favorite = {i+1: 0 for i in range(m)}
for i in range(n):
    x = list(map(int, input().split()))
    a.append(x)

for i in a:
    for j in i[1:]:
        favorite[j] += 1

ans = 0

for i in favorite.values():
    if i == n:
        ans += 1

print(ans)


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

struct Node {
	int s, e, m;
	//covers s,e;
	ll sum;
	ll lazy;
	ll mini;
	Node *l, *r;
	
	Node(int a, int b) {
		s = a;
		e = b;
		sum = 0;
		lazy = 0;
		mini = 0;
		if (s != e) {
			m = (s+e)/2;
			l = new Node(s,m);
			r = new Node(m+1,e);
		}
		else {
			l = NULL;
			r = NULL;
		}
	}

	void push() {
		if (s != e) {
			l->lazy += lazy;
			l->sum += (l->e - l->s + 1) * lazy;
			l->mini += lazy;

			r->lazy += lazy;
			r->sum += (r->e - r->s + 1) * lazy;
			r->mini += lazy;
		}
		lazy = 0;
	}

	void add(int st, int en, ll x) {
		//lazy: already accounted for in your own node, not the childs nodes
		if (st <= s && e <= en) {
			lazy += x;
			sum += (e - s + 1) * x;
			mini += x;
			return;
		}
		push();
		if (st <= m) {
			l->add(st,en,x);
		}
		if (en > m) {
			r->add(st,en,x);
		}
		sum = l->sum + r->sum;
		mini = min(l->mini,r->mini);
	}

	ll getmini(int st, int en) {
		push();
		//if completely included
		if (st <= s && e <= en) {
			return mini;
		}
		ll ret = 1000000000000000000;
		if (st <= m) {
			ret = min(ret,l->getmini(st,en));
		}
		if (en > m) {
			ret = min(ret,r->getmini(st,en));
		}
		return ret;
	}	

	ll getsum(int st, int en) {
		push();
		//if completely included
		if (st <= s && e <= en) {
			return sum;
		}
		ll ret = 0;
		if (st <= m) {
			ret += l->getsum(st,en);
		}
		if (en > m) {
			ret += r->getsum(st,en);
		}
		return ret;
	}
};

const int maxn = 2e5+5;
int N;
ll D, A;
pair<ll,ll> a[maxn];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N >> D >> A;
    for (int i = 0; i < N; i++) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a,a+N);
    int pt = 0, r = 0;
    Node *root = new Node(0,N);
    for (int i = 0; i < N; i++) {
        root->add(i,i,a[i].second);
    }
    ll ans = 0;
    while (pt < N) {
        if (root->getsum(pt,pt) <= 0) {
            pt++;
            continue;
        }
        else {
            while (r < N && a[r].first <= a[pt].first+2*D) {
                r++;
            }
            ll need = (root->getsum(pt,pt)+A-1)/A;
            root->add(pt,r-1,-1LL*need*A);
            ans += need;
            pt++;
        }
    }
    cout << ans << endl;
}



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

#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

template <typename T>
T gcd(T x, T y)
{
    T xy = x * y;
    if (x < y)
        swap(x, y);
    T r;
    r = x % y;
    while (r != 0)
    {
        x = y;
        y = r;
        r = x % y;
    }
    return y;
};
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);

    rep(i, n)
    {
        cin >> a[i];
    }
    int g;

    g = a[0];
    rep(i, n - 1)
    {
        g = gcd(g, a[i + 1]);
    }
    cout << g << endl;
}

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

set<string> res;
int n;

void func(int i, char m, string& s)
{
    if (i>=n) return;
    for(char c='a'; c<=m+1; ++c) {
        char t=s[i];
        s[i]=c;
        res.insert(s);
        func(i+1, max(m, c), s);
        s[i]=t;
    }
}

int main()
{
    cin>>n;
    string s(n, 'a');
    res.insert(s);
    func(1, 'a', s);
    for(auto& e: res) cout<<e<<'\n';
}


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

using namespace std;

int a[5005][5005];
string s, t, ans;

int main() {
    getline(cin, s);
    getline(cin, t);
    ans = "";
    for (int i = 1; i <= s.size(); i++){
        for (int j = 1; j <= t.size(); j++){
            if (s[i - 1] == t[j - 1]){
                a[i][j] = a[i - 1][j - 1] + 1;
            } else {
                a[i][j] = max(a[i - 1][j], a[i][j - 1]);
            }
        }
    }
    int i = s.size();
    int j = t.size();
    while (i != 0 && j != 0){
        if (s[i - 1] == t[j - 1]){
            ans = s[i - 1] + ans;
            i--;
            j--;
        } else
        if (a[i][j] == a[i - 1][j]){
            i--;
        } else j--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 59264
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N; 
    cin >> N;

    VI A(N);
    rep(i, N){
        cin >> A.at(i);
        A[i] -= (i+1);
    }
    sort(ALL(A));
    debug(A);

    ll x = A[N/2];
    ll sum = 0;
    for(ll a : A){
      sum += abs(a-x);
    }
    p(sum);
    
    return 0;
}

Measured memory_bytes: 1792
N = int(input())
AC, WA, TLE, RE = 0, 0, 0, 0

for i in range(N):
  type = input()
  if type == "AC":
    AC += 1
    continue
  if type == "WA":
    WA += 1
    continue
  if type == "TLE":
    TLE += 1
    continue
  if type == "RE":
    RE += 1
    continue
print("AC x {}".format(AC))
print("WA x {}".format(WA))
print("TLE x {}".format(TLE))
print("RE x {}".format(RE))

Measured memory_bytes: 9076
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

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

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, i, j, k, ans, cnt = 0;
string s;

int main(){
    //cin >> ;
    //cout << ans << endl;
    bool flag = false;
    cin >> s;
    REP(i, 3){
        if(s.at(i) == '7'){
            flag = true;
        }
    }

    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3664
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int N = in.nextInt();
            int[] A = new int[N];
            int[][] x = new int[N][];
            int[][] y = new int[N][];
            for (int i = 0; i < N; ++i) {
                A[i] = in.nextInt();
                x[i] = new int[A[i]];
                y[i] = new int[A[i]];
                for (int j = 0; j < A[i]; ++j) {
                    x[i][j] = in.nextInt();
                    y[i][j] = in.nextInt();
                    --x[i][j];
                }
            }
            int ans = 0;
            out:
            for (int s = 1; s < (1 << N); ++s) {
                for (int i = 0; i < N; ++i) {
                    if ((s >> i) % 2 == 0)
                        continue;
                    for (int j = 0; j < A[i]; ++j) {
                        if ((s >> x[i][j]) % 2 != y[i][j])
                            continue out;
                    }
                }
                ans = Math.max(ans, Integer.bitCount(s));
            }
            out.println(ans);

        }

    }
}



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

int main()
{
    ll n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> dist(n, -1);
    rep(i, n) cin >> a[i];
    rep(i, n) a[i]--;
    dist[0] = 0;
    ll before = 0;
    ll from = 0;
    ll loop = 0;
    while (1)
    {
        ++loop;
        ll to = a[from];
        if (dist[to] != -1)
        {
            before = dist[to];
            loop -= dist[to];
            from = to;
            break;
        }
        dist[to] = dist[from] + 1;
        from = to;
    }

    ll ans = 0;
    if (k >= before)
    {
        k = (k - before) % loop;
        ans = from;
    }
    while (k--)
        ans = a[ans];

    cout << ans + 1 << endl;
}

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

bool pair_compare(const pair<int, int>& firstpair, const pair<int, int>& secondpair)
{
	return firstpair.second < secondpair.second;
}

int main(void)
{
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> bridge(m);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		bridge[i] = make_pair(a, b);
	}

	sort(bridge.begin(), bridge.end(), pair_compare);

	int ans = 1;
	int first_i = 0;
	int max_a = bridge[0].first;
	int min_b = bridge[0].second;;
	for (int i = 1; i < m; i++) {
		if (bridge[i].first >= min_b) {
			ans++;
			max_a = bridge[i].first;
			min_b = bridge[i].second;
			continue;
		}

		if (bridge[i].first > max_a)
			max_a = bridge[i].first;
	}
	cout << ans << endl;

	return 0;
}


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

int main () {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int res = 0;
  while (true) {
    bool exist_odd = false;
    
    for (int i = 0; i < N; i++) {
      if (vec.at(i) % 2 != 0) {
        exist_odd = true;
      }
    }
    
    if (exist_odd) {
      break;
    }
    
    for (int i = 0; i < N; i++) {
      vec.at(i) /= 2;
    }
    res++;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* Author :  lethuc_upcoder.hcmup.edu.vn
* Creation Date : 29-09-19 10:34:29 GMT+07
_._._._._._._._._._._._._._._._._._._._._.*/

#include  <bits/stdc++.h>
#define ll long long
#define db(x) cerr << #x << " = " << (x) << " ";
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mp make_pair

using namespace std;

bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){ 
    return (a.second < b.second);
} 

bool cmpdec(int a,int b){
        return a>b;
}

ll n;

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

  cin >> n;
  ll x;
  ll res[n];
  for (int i = 0 ; i < n ; i++){
    cin >> x;
    res[x] = i+1;
  }
  for (int i = 1 ; i <= n ; i++){
    cout << res[i] << " ";
  }

  cerr << "\nTime elapsed: " << 1000*clock() / CLOCKS_PER_SEC << "ms\n";
    
}


Measured memory_bytes: 1664
N,K = map(int,input().split())
d = []
A = []
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))            
dp = [0]*(N+1)
for i in range(K):
    for j in range(d[i]):
        dp[A[i][j]] = 1
print(N-sum(dp))

Measured memory_bytes: 67532
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast","no-stack-protector","unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for(int i=L;i<R;++i)
#define FE(i,L,R) for(int i=L;i<=R;++i)
#define getI(a) scanf("%lf", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define debug(x) cout<<(#x)<<"="<<x<<"\n";
#define qq cout<<"QQ\n";
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define f first
#define s second
#define ll long long
#define INF 2000000000
int main(){
	double l;
	while(~getI(l)){
		l/=3;
		printf("%.8lf\n",l*l*l);
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;
int main(){
	int h, w;
	cin >> h >> w;
	int ap[26] = { };
	REP(i, h*w){
		char c;
		cin >> c;
		ap[c-'a']++;
	}
	bool f = true;
	if(h%2==0 && w%2==0){
		REP(i, 26){
			if(ap[i] % 4 != 0) f = false;
		}
		if(f) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else if(h%2 == 0 || w%2 == 0){
		int q = 0, e = 0, o = 0;
		REP(i, 26){
			if(ap[i] % 4 == 0) q++;
			else if(ap[i] % 2 == 0) e++;
			else o++;
		}
		if(o > 0) cout << "No" << endl;
		else{
			if(h%2 == 0 && e <= h/2) cout << "Yes" << endl;
			else if(w%2 == 0 && e <= w/2) cout << "Yes" << endl;
			else cout << "No" << endl;
		}
	}
	else{
		int q = 0, e = 0, o = 0;
		REP(i, 26){
			if(ap[i] % 4 == 0) q++;
			else if(ap[i] % 2 == 0) e++;
			else{
				if(ap[i] % 4 == 1) q++;
				else e++;
				o++;
			}
		}
		if(o > 1) cout << "No" << endl;
		else if(e <= (h+w-2)/2) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 384
n,t = map(int,input().split())
l = []
for i in range(n):
    a,b = map(int,input().split())
    l.append([a,b])
l.sort(key=lambda x:x[0])
dp = [[0 for i in range(t)] for i in range(n+1)]
al = []
for i in range(n):
    a,b = l[i]
    for j in range(t):
        if dp[i][j] == 0:
            if j == 0:
                if j + a < t:
                    dp[i+1][j+a] = max(dp[i][j+a],b)
                else:
                    al.append(b)
        else:
            if j + a < t:
                dp[i+1][j+a] = max(dp[i][j+a],dp[i][j]+b)
            else:
                al.append(dp[i][j]+b)
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
if len(al) > 0:
    print(max(max(dp[n]),max(al)))
else:
    print(max(dp[n]))

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

int main(){
int n,m;
cin>>n>>m;
int a[100][100],b[100];

     for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
               cin>>a[i][j];
          }
     }
     for(int i=0;i<m;i++){
          cin>>b[i];
     }
     for(int i=0;i<n;i++){
          int ans=0;
          for(int j=0;j<m;j++){
               ans+=a[i][j]*b[j];
          }
          cout<<ans<<endl;
     }
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)

#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define pii pair<int, int>
#define vi vector<int>

using namespace std;
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& p)
{
    return o << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& vc)
{
    o << "sz = " << vc.size() << endl
      << "[";
    for (const T& v : vc)
        o << v << ",";
    o << "]";
    return o;
}
using ll = long long;
constexpr ll MOD = 1000000007;

constexpr int MAX = 100000;

int node[MAX];

int main()
{
    int N, M;
    cin >> N >> M;
    rep(i, M)
    {
        int a, b;
        cin >> a >> b;
        node[a]++;
        node[b]++;
    }
    rep(i, N)
    {
        if (node[i] % 2 == 1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


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

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

#define fi first
#define se second

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

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

int N, M, ans;
vector <int> Prime;

int Judge(){
  for (int i = 1; i * i <= M; i++){
    if (M % i == 0){
      Prime.push_back(i);
      Prime.push_back(M / i);
    }
  }
  return 0;
}


int main(){
  cin >> N >> M;
  Judge();

  for (int i = 0; i < Prime.size(); i++){
    int P = Prime[i];
    if (M / P >= N){
      ans = max(P, ans);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3648
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"unicode"
)

func main() {
	sc := NewScanner()
	S := sc.Next()
	if unicode.IsUpper(rune(S[0])) {
		fmt.Println("A")
	} else {
		fmt.Println("a")
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1768
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

int p[100001],r[100001],c[100001];
void init(){rep(i,100001)p[i]=i,r[i]=0,c[i]=1;}
int find(int x){return (p[x]==x)?x:(p[x]=find(p[x]));}
void unite(int x,int y) {
  x=find(x),y=find(y);
  if(x==y)return;
  int cx=c[x],cy=c[y];
  if(r[x]<r[y])p[x]=y;
  else{p[y]=x;if(r[x]==r[y])r[x]++;}
  c[find(x)]=cx+cy;
}
bool same(int x,int y){return find(x)==find(y);}

void Main() {
  init();
  ll n,m;
  cin >> n >> m;
  ll d[2];
  mem(d);
  rep(i,m) {
    ll x,y;
    cin >> x >> y;
    x--,y--;
    unite(x,y);
    if(x<=1) d[x]++;
    if(y<=1) d[y]++;
  }
  ll cnt=0;
  REP(i,2,n) {
    if(find(i)!=find(0)&&find(i)!=find(1)) cnt++;
  }
  ll x=c[find(0)],y=c[find(1)];
  ll d1=(x+cnt)*(x+cnt-1)/2;
  ll d2=(y+cnt)*(y+cnt-1)/2;
  ll d3=x*(x-1)/2;
  ll d4=y*(y-1)/2;
  pr(max(d1+d4-m,d2+d3-m));
}

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


Measured memory_bytes: 1408
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int d = sc.nextInt();
		int [][] in = new int [n][d];
        for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
                             in[i][j] = sc.nextInt();
                            }
                            }
        int b = 0;
        int c = 0;
        for(int i=0;i<n-1;i++){
          for(int j=i+1;j<n;j++){c=0;
          for(int k=0;k<d;k++){c+=(in[i][k]-in[j][k])*(in[i][k]-in[j][k]);}
                                for(int l=0;l<=Math.sqrt(c);l++){if(l*l==c){b++;}
                                                                }                                       
                                }                            
        }      
		System.out.println(b);
	}
}


Measured memory_bytes: 22996
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
set<char> st;

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

  cin >> s;
  rep(i, Size(s)) st.insert(s[i]);
  if (Size(st) == 2)
    Cout("Yes");
  else
    Cout("No");
  return 0;
}

Measured memory_bytes: 256
#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 li long int
#define ld long double
#define lld long long double

#define pb push_back
#define mk make_pair
#define F first
#define S second

#define all(v) (v).begin(),(v).end()
#define fill(a) memset(a, 0, sizeof(a))

const int MX = 1e6;
const int MI = -1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;

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

const int mod=1e9+7;
inline int add(int x,int y)
{
  x+=y;
  if (x>=mod)
    return x-mod;
  return x;
}
inline int sub(int x,int y)
{
  x-=y;
  if (x<0)
    return x+mod;
  return x;
}
inline int mul(int x,int y)
{
  return (x*1ll*y)%mod;
}
inline int power(int x,int y)
{
  int ans=1;
  while(y)
    {
      if (y&1) ans=mul(ans,x);
      x=mul(x,x);
      y>>=1;
    }
  return ans;
}
inline int inv(int x)
{
  return power(x,mod-2);
}
inline int gcd(int x, int y)
{
  return(y!=0)?gcd(y, x%y):x;
}
inline ll nPr(int n, int r)
{
  ll i,result=1;
  rep(i,r)
    {
      result*=(ll)(n-i);
    }
  return result;
}
inline ll nCr(int n,int r)
{
  ll i,result=1;
  rep(i,min(r,n-r))
    {
      result*=(ll)(n-i);
      result/=(ll)(i+1);
    }
  return result;
}
bool prime(int n)
{
  for (int i=2; i<n/2; i++)
    {
      if(n%i==0)
	return false;
    }
  return true;
}

/*------------CODE->BEGINS------------*/



int main()
{
  IOS;
  string s;
  cin >> s;
  int l=s.length();
  if (s[l-1]!='s')
    {
      cout << s << "s" << endl;
    }
  else if (s[l-1]=='s')
    {
      cout << s << "es" << endl;
    }
  return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

bool isAc[MAX_N];
int prob[MAX_N];

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

    int N, M;
    cin >> N >> M;

    int ac = 0, wa = 0;

    REP(i, M) {
        int P;
        string S;
        cin >> P >> S;
        if(S == "AC") {
            if(!isAc[P]) {
                ac++;
                wa += prob[P];
                isAc[P] = true;
            }
        }
        else {
            if(isAc[P]) {
            }
            else {
                prob[P]++;
            }
        }
    }
    printf("%lld %lld\n", ac, wa);

    return 0;
}


Measured memory_bytes: 1152
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	Scanner sc = new Scanner(System.in);
	public void run(){
		while(true){
			int r0 = sc.nextInt();
			int w0 = sc.nextInt();
			int c = sc.nextInt();
			int r = sc.nextInt();
			if(r0 == 0 && w0 == 0 && c == 0 && r == 0)break;
			calc(r0, w0, c, r);
		}
	}
	public void calc(int r0, int w0, int c, int r){
		int ans = 0;
		while(true){
			int x = (r0 + r * ans)/ w0;
			if (x >= c) break;
			ans=ans+1;
		}
		
		System.out.println(ans);
	}
	
	public static void main(String[] args){
		new Main().run();
	}
	
}

Measured memory_bytes: 26412
/* #                          */

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <deque>
#include <map>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
//#pragma warning(disable:4996)

using namespace std;


/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
#define		it(x)  x.begin() 
#define		all(x)  x.begin(), x.end()
#define		pb(x)   push_back(x)
constexpr int           inf = 0x3f3f3f3f;
constexpr long long 	INF = 9123456789123456789;
constexpr long long     MOD = 1000000007LL;
/*************************************************/
int rvs(0); //reverse check;
string s;
string back, front;
int Q;
void add(int& op2, char& e) {
    if (rvs) {
        if (op2 == 1) back.push_back(e);
        else front.push_back(e);
    }
    else {
        if (op2 == 1) front.push_back(e);
        else back.push_back(e);
    }
}
void sol() {
    int op; cin >> op;
    if (op == 1) {
        rvs ^= 1;
    }
    else {
        int op2;    cin >> op2;
        char e;     cin >> e;
        add(op2, e);
    }
}



int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie(nullptr);

    cin >> s;
    cin >> Q;
    while (Q--)
        sol();

    if (rvs) {
        reverse(all(back));
        reverse(all(s));
        cout << back << s << front << endl;
    }
    else {
        reverse(all(front));
        cout << front << s << back << endl;
    }

    return 0;
}

Measured memory_bytes: 1040
data = input().split(" ");

def reverse_polish_notation(data):
    operands = [];
    for n in data:
        if n not in "*+-":
            operands.append(int(n));
        else:
            operand_second = operands.pop();
            operand_first = operands.pop();
            operands.append(calculate(n, operand_first, operand_second));
    return operands[0];

def calculate(operator, a, b):
    if operator == "*":
        return a * b;
    elif operator == "-":
        return a - b;
    elif operator == "+":
        return a + b;

print(reverse_polish_notation(data));


Measured memory_bytes: 5600
#include<iostream>
#include<vector>
#include<string>
#include<math.h> 
#include<algorithm> 
#include<stdio.h> 
#include<sstream>
#include<fstream>  
using namespace std; 
typedef long long ll; 
typedef long double ld; 


char nl = '\n'; 
char bl = ' ';
const int MOD = 1e9 + 7; 

int main(){

ios_base::sync_with_stdio(false);
cin.tie(NULL); 



int k;
cin >> k;
for(int i = 0; i<k; i++){
    cout << "ACL"; 
}

}



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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  long long N;
  cin >> N;
  vector<long long> H(N);
  for (int i = 0; i < N; i++)
    cin >> H[i];
  long long ans = 0, cnt = 0;
  for (int i = 0; i < N - 1; i++)
  {
    if (H[i] >= H[i + 1])
      cnt++;
    else
      cnt = 0;
    ans = max(cnt, ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1152
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	std::string s;
	std::cin >> s;
	s.replace(5, 1, " ");
	s.replace(13, 1, " ");
	std::cout << s << std::endl;
}

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

int main(){
	int n,i;
	cin>>n;
	char a[n+1];
	
	for(i=1;i<=n;i++){
		cin>>a[i];
	}
	
	for(i=1;i<=n;i++){
		if(a[i]=='Y'){
			cout<<"Four"<<endl;
			return 0;
		}
	}
	cout<<"Three"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
long dp[62][3]={1},n,b,i,j,x,y;main(){for(std::cin>>n;i<61;i++)for(b=(n>>i)&1,j=0;j<3;j++)for(x=0;x<2;x++)for(y=x;y<2;y++)(dp[i+1][(x+y+j+1-b)/2]+=dp[i][j])%=(long)1e9+7;std::cout<<dp[61][0]<<"\n";}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main(){
  int h,w,m;cin>>h>>w>>m;
  int a[h]={0} , b[w]={0};
  set<int> m1[h];
  for (int i=0;i<m;++i){
    int h1,w1;cin>>h1>>w1;
    a[h1-1]++;
    b[w1-1]++;
    m1[h1-1].insert(w1-1);
  }
  int a1 = *max_element(a,a+h) , a2 =*max_element(b,b+w);
  vector<int> b1,b2;
  for (int i=0;i<h;++i){
   if (a[i] == a1) b1.push_back(i);
  }
  for (int i=0;i<w;++i){
   if (b[i] == a2) b2.push_back(i);
  }
  for (auto v1 : b1)for (auto v2: b2) {if (m1[v1].find(v2) == m1[v1].end()){cout<<a1+a2;return 0;}}
  cout<<a1+a2-1;
}

Measured memory_bytes: 37896
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

fn solve() {
    input!{
        s: Chars,
        K: usize,
    }

    let mut length = if s.len() < 5 { s.len() } else { 5 };
    let mut bset_all: BTreeSet<String> = BTreeSet::new();

    while length > 0 {
        // dbg!(&bset_all);
        let mut tmp_bset: BTreeSet<String> = BTreeSet::new();
        for i in 0..(s.len()-length+1) {
            let tmp_string = s[i..i+length].iter().map(|c| *c).collect::<String>();
            if !bset_all.contains(&tmp_string) {
                tmp_bset.insert(tmp_string);
            }
        }

        bset_all.append(&mut tmp_bset);
        length -= 1;
    }

    for (i, str) in bset_all.iter().enumerate() {
        if i == K-1 { println!("{}", str) }
    }
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


Measured memory_bytes: 3016