akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 998244353LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
};
ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
typedef vector<vector<Edge>> Graph;


signed main(void) {
	int r, g, b, n;
	cin >> r >> g >> b >> n;
	int ans = 0;

	for (int i = 0; n + 1 > i; i++) {
		for (int j = 0; n + 1 > j; j++) {
			if (n - i * r - j * g >= 0) {
				if (((n - i * r - j * g) % b) == 0) {
					ans++;
				}
			}
		}
	}


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


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#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 all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
typedef priority_queue <ll> pq;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
const ll INF = (ll)1e18;
const ll MAXN = 1000006;

ll po(ll x, ll n, ll m){ 
  ll ans=1;
     while(n>0){
       if(n&1) ans=(ans*x)%m;
       x=(x*x)%m;
       n/=2;
     }
     return ans;
}

pair<int,int> fun(string &s){
  
  
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
 
  int T=1;
  //cin >> T;
  while(T--){
    ll n;
    string s;
    cin>>n>>s;

    int x=0;
    pair<int, int> p;
    rep(i,s.length()) if(s[i]=='1') x++;
    ll z=0, y=0;
    rep(i,s.length()){
      z = z*2 + (int)(s[i]-'0');
      y = y*2 + (int)(s[i]-'0');
      if(x>1) z%=(x-1);
      y%=(x+1);
    }
    if(x>1) p = mp(z,y);
    else if(x==1) p = mp(-1,0);
    else p = mp(-1,-1);

    int ans;
    rep(i,n){
      if(s[i]=='0'){
        if(p.ss==-1){
          cout<<1<<el;
        }
        else{
          z = (p.ss + po(2ll, (ll)n-i-1, (ll)x+1))%(x+1);
          ans=1;
          while(z>0){
            y = __builtin_popcount(z);
            z%=y;
            ans++;
          }
          cout<<ans<<el;
        }
      }
      else{
        if(p.ff==-1) cout<<0<<el;
        else{
          z = (p.ff - po(2ll, (ll)(n-i-1), (ll)(x-1)) + x-1)%(x-1);
          ans=1;
          while(z>0){
            y = __builtin_popcount(z);
            z%=y;
            ans++;
          }
          cout<<ans<<el;

        }
      }
    }
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
  return 0;
}

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

int dir[8][2] = {{0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}};

int main(void){
    int h, w;
    string str;
    vector <string> s;
    int i, j, k;
    int cnt;
    
    cin >> h >> w;
    for(i = 0; i < h; i++){
        cin >> str;
        s.push_back(str);
    }
    
    for(i = 0; i < h; i++){
        for(j = 0; j < w; j++){
            if(s[i][j] == '#'){
                cout << "#";
            }
            else{
                cnt = 0;
                for(k = 0; k < 8; k++){
                    if(i + dir[k][0] >= 0 && i + dir[k][0] < h && j + dir[k][1] >= 0 && j + dir[k][1] < w){
                        if(s[i + dir[k][0]][j + dir[k][1]] == '#')      cnt++;
                    }
                }
                cout << cnt;
            }
        }
        cout << endl;
    }
    
    
    return 0;
}

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

int main(void) {
	int k = 0;
	char l[200];
	char s[200];
	int i;

	fgets(l, sizeof(l), stdin);
	k = atoi(l);
	//printf("%d", k);

	fgets(s, sizeof(s), stdin);
	//printf("%d", strlen(s));

	if(strlen(s)-1 <= k) {
		printf("%s", s);
	} else {
		for(i=0; i<k; i++)
			printf("%c", s[i]);
			printf("...");
	}

	return 0;
}

Measured memory_bytes: 1668
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
set <string> a;
char la;
int n;
string w;
bool b=true;

int main(){
	cin>>n>>w;
	a.insert(w);
	la=w[w.size()-1];
	for(int i=1;i<n;i++){
		cin>>w;
		if(a.count(w)!=0){
			b=false;
			break;
		}
		if(w[0]!=la){
			b=false;
			break;
		}
		a.insert(w);
		la=w[w.size()-1];
	}
	if(b){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N,X=map(int,input().split())
L=list(map(int,input().split()))
S=[0]
sum_L=0
for i in range(N):
  sum_L+=L[i]
  S.append(sum_L)
counter=0
for i in range(N+1):
  if S[i]<=X:
    counter+=1
print(counter)
     

Measured memory_bytes: 9168
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
#include  <cstdio>
#include  <sstream>
#include  <bitset>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using VPi = vector<Pi>;
using VPl = vector<Pl>;
using VPli = vector<Pli>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };



int main()
{
    int d, t, s;
    cin >> d >> t >> s;
    if (d <= t * s) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3668
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint ax[58],ay[58],bx[58],by[58];
lint dist(int a,int b){
	return abs(ax[a]-bx[b])+abs(ay[a]-by[b]);
}
int main()
{
	int n,m;
	cin>>n>>m;
	rep(i,n) cin>>ax[i]>>ay[i];
	rep(i,m) cin>>bx[i]>>by[i];
	rep(i,n){
		int ret=-1;
		rep(j,m){
			if(ret<0 || dist(i,j)<dist(i,ret)) ret=j;
		}
		cout<<ret+1<<endl;
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <random>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))
#define N 200005

int n;
vector<vi> g;

ll mod = 1000000007;
ll dp[N];
int cnt[N];
ll fct[N];

ll binpow(ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1) {
			res = (res * a) % mod;
		}

		a = (a * a) % mod;
		n /= 2;
	}

	return res;
}

ll ob(ll a) {
	if (a == 1) {
		return 1;
	}
	return binpow(a, mod - 2);
}

void dfs(int v, int p = -1) {
	cnt[v] = 1;
	dp[v] = 1;
	ll op = 1;
	int sons = 0;

	REP(i, sz(g[v])) {
		int u = g[v][i];
		if (u != p) {
			dfs(u, v);
			cnt[v] += cnt[u];
			dp[v] = (dp[v] * dp[u]) % mod;
			op = (op * fct[cnt[u]]) % mod;
		}
	}

	dp[v] = (dp[v] * fct[cnt[v] - 1]) % mod;
	dp[v] = (dp[v] * ob(op)) % mod;
}

ll ans[N];

void Swap(int v, int u) {
	int cntu1 = cnt[v] - cnt[u];
	int cntv1 = cnt[v];
	ll dpu1 = (dp[v] * fct[cnt[u]]) % mod;
	dpu1 = (dpu1 * fct[cntu1 - 1]) % mod;
	dpu1 = (dpu1 * ob((dp[u] * fct[cnt[v] - 1]) % mod)) % mod;

	ll dpv1 = (dp[u] * dpu1) % mod;
	dpv1 = (dpv1 * fct[cntv1 - 1]) % mod;
	dpv1 = (dpv1 * ob((fct[cnt[u] - 1] * fct[cntu1]) % mod)) % mod;

	dp[v] = dpu1;
	dp[u] = dpv1;
	cnt[v] = cntu1;
	cnt[u] = cntv1;
}

void dfs2(int v, int p = -1) {
	ans[v] = dp[v];

	REP(i, sz(g[v])) {
		int u = g[v][i];
		if (u != p) {
			Swap(v, u);
			dfs2(u, v);
			Swap(u, v);
		}
	}
}

int main(void) {
	fct[0] = 1;
	FOR(i, 1, N) {
		fct[i] = (fct[i - 1] * i) % mod;
	}
	scanf("%d", &n);
	g.resize(n);
	REP(i, n - 1) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
	}

	dfs(0);

	dfs2(0);

	REP(i, n) {
		printf("%lld\n", ans[i]);
	}


	//scanf("%d", &n);

}

Measured memory_bytes: 19444
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 25, M = 1e6 + 25, oo = 1e9+7, mxmsk = 1 << 16;
const long long OO = 1e18+25;
    
#define par pair<pair<int,int>, int>
#define f first
#define s second

int c,d;
long long a,b,l;


int main() {
	scanf("%lld%lld%d%d",&a,&b,&c,&d);
    l = 1ll*c*d/__gcd(c,d);
    printf("%lld",(b-a+1)-((b/c-(a-1)/c)+(b/d-(a-1)/d)-(b/l-(a-1)/l)));
	return 0;
}

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

int main(){
    int X;
    std::cin >> X;
    
    int ans;
    if(X < 600){
        ans = 8;
    }else if(X < 800){
        ans = 7;
    }else if(X < 1000){
        ans = 6;
    }else if(X < 1200){
        ans = 5;
    }else if(X < 1400){
        ans = 4;
    }else if(X < 1600){
        ans = 3;
    }else if(X < 1800){
        ans = 2;
    }else if(X < 2000){
        ans = 1;
    }
    
    std::cout << ans << std::endl;
    
    
    return 0;
    
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <functional>
using namespace std;
#define rep(i, a, b) for (int(i) = a; (i) < (int)(b); (i)++)

int main()
{
    string S;
    cin >> S;
    if (S[0] == S[1] && S[0] == S[2]){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

using namespace std;

int main()
{
    map<int,int>m;
    long long int n;
    cin>>n;
    long long int a[n];
    long long int sum=0;
    //long long int neww=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
        sum=sum+a[i];
    }
    sort(a,a+n);
    int q;
    cin>>q;
    long long int b[q],c[q];
    for(int i=0;i<q;i++)
    {
        cin>>b[i]>>c[i];
    }
    for(int i=0;i<q;i++)
    {
        if(m[b[i]]!=0)
        {
            m[c[i]]=m[c[i]]+m[b[i]];
            sum=sum-m[b[i]]*b[i];
            sum=sum+m[b[i]]*c[i];
            m[b[i]]=0;
        }
        cout<<sum<<endl;
    }

}


Measured memory_bytes: 10156
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const int N = 1e5+10;
char a[101][101];
int main() {
	int n,m;
	cin>>n>>m;
	for(int x=1;x<=n;x++){
		for(int i=1;i<=m;i++){
			cin>>a[x][i];
		}
	}
	for(int x=1;x<=n;x++){
		for(int i=1;i<=m;i++){
			int b=0;
			if(a[x][i]=='#'){
				cout<<'#';
				continue;
			}
			if(a[x-1][i-1]=='#'){
				b++;
			}
			if(a[x-1][i]=='#'){
				b++;
			}
			if(a[x-1][i+1]=='#'){
				b++;
			}
			if(a[x][i-1]=='#'){
				b++;
			}
			if(a[x][i+1]=='#'){
				b++;
			}
			if(a[x+1][i-1]=='#'){
				b++;
			}
			if(a[x+1][i]=='#'){
				b++;
			}
			if(a[x+1][i+1]=='#'){
				b++;
			}
			cout << b;
		}
		cout << endl;
	}
}

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

int main()
{
  int n,ans=0;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<n-2;i++)
  {
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
      ans++;
  }
  cout<<ans<<"\n";
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int a[4], k;
ll res;
int main(){
  std::cin >> a[0] >> a[1] >> a[2] >> k;
  sort(a,a+3);
  res = a[2]*(1<<k) + a[0] + a[1];
  std::cout << res << '\n';
}


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

int main() {
#ifdef LOCAL_DEFINE
	//freopen("in.txt", "rt", stdin);
	//freopen("out.txt", "w", stdout);
	long long _begin_time = clock();
#endif
	
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] -= i;
	}
	sort(a.begin(), a.end());
	int b = (n & 1 ? a[n / 2] : (a[n / 2 - 1] + a[n / 2]) / 2);
	long long ans = 0;
	for(int i = 0; i < n; i++) {
		ans += abs(a[i] - b);
	}
	cout << ans << '\n';

#ifdef LOCAL_DEFINE
	long long _end_time = clock();
	cerr << "time = " << _end_time - _begin_time << " ms\n";
#endif
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        System.out.println(Math.min(b, d) - Math.max(a, c) > 0 ? Math.min(b, d) - Math.max(a, c) : 0);
    }
}

Measured memory_bytes: 23760
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <fstream>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <assert.h>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 998244353LL 
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
 
 
#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
 
//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)
 
struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
 
};
typedef vector<vector<Edge>> Graph;
typedef unsigned long long ull;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
ll mod_pow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = (res * x) % MODU;
		x = (x*x)%MODU;
		n >>= 1;
	}
	return res;
}
ll divmod(ll a, ll b) { // a/b(mod m)
								  // a/b (mod m)
								  // a*b^-1
								  // b^-1 * b = 1
								  // b^(m-1) = 1 
								  // b^(m-2) * b = 1
								  // b^-1 = b^(m-2)

								  // a/b = a * b^(m-2)

	return (a * mod_pow(b, MODU - 2)) % MODU;
}


ll fmemo[10000] = {};
ll factorial(ll n) {//階乗

	if (n > 0) {
    assert(n < 10000);
if(fmemo[n] != 0) return fmemo[n];
		return fmemo[n] = (n * factorial(n - 1))%MODU;
	}
	else {
		return 1;
	}
}

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

  if(s[0] == '7' || s[1] == '7' || s[2] == '7' )
  cout << "Yes" << endl;
  else
  cout << "No" << endl;
  return 0;
} 

Measured memory_bytes: 3068
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
string f(string s,string t){
  int j;
  int a,slen,tlen;
  string u(128,'0');
  slen=s.length();
  tlen=t.length();
  a=0;
  for(j=0;j<(slen>tlen?slen:tlen);j++){
    if((j<slen?s[slen-j-1]:'0')+(j<tlen?t[tlen-j-1]:'0')+a-'0'-'0'>9){
      u[127-j]=(j<slen?s[slen-j-1]:'0')+(j<tlen?t[tlen-j-1]:'0')+a-'0'-10;
      a=1;
    }else{
      u[127-j]=(j<slen?s[slen-j-1]:'0')+(j<tlen?t[tlen-j-1]:'0')+a-'0';
      a=0;
    }  
  }
  u[127-j]=a+'0';
  for(j=0;j<127&&u[j]=='0';j++);
  return u.substr(j);
}
int main(){
  int i,j,k;
  int len;
  string s[3],t[3],u;
  for(;;){
    u="";
    cin>>u;
    if(u.empty())
      break;
    int pl,eq;
    pl=u.find("+");
    eq=u.find("=");
    s[0]=u.substr(0,pl);
    s[1]=u.substr(pl+1,eq-pl-1);
    s[2]=u.substr(eq+1);
    for(i=0;i<3;i++){
      if(s[i].length()>1&&s[i][0]=='X')
	break;
    }
    if(i==3)
      i=0;
    else
      i=1;
    for(;i<10;i++){
      for(j=0;j<3;j++){
	t[j]=s[j];
	len=t[j].length();
	for(k=0;k<len;k++){
	  if(t[j][k]=='X')
	    t[j][k]='0'+i;
	}
      }
      if(f(t[0],t[1])==t[2])
	break;
    }
    if(i==10)
      cout<<"NA"<<endl;
    else
      cout<<i<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {
    int N;
    cin >> N;
    vector<P> tree[N];
    int color[N - 1];
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        a--; b--;
        color[i] = -1;
        tree[a].push_back(make_pair(b, i));
        tree[b].push_back(make_pair(a, i));
    }
    int K = 0;
    for (int i = 0; i < N; i++) {
        if (tree[i].size() > K) {
            K = tree[i].size();
        }
    };

    bool flag[K];

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < K; j++) flag[j] = false;
        for (int j = 0; j < tree[i].size(); j++) {
            if (color[tree[i][j].second] >= 0) flag[color[tree[i][j].second]] = true;
        }
        int l = 0;
        for (int j = 0; j < tree[i].size(); j++) {
            if (color[tree[i][j].second] >= 0) continue;
            while (flag[l]) l++;
            color[tree[i][j].second] = l;
            l++;
        }
    }
    cout << K << endl;
    for (int i = 0; i < N - 1; i++) {
        cout << color[i] + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
int dx[] = {0, 1};
int dy[] = {1, 0};
int dp[1003][1003];
int H, W;
char ar[1003][1003];

int isVal(int h, int w) {
	return h>=0 && w>=0 && h<H && w<W && ar[h][w]=='.';
}

long long rec(int h, int w) {
	if(h == H-1 && w == W-1)
		return 1;
	if(dp[h][w]!=-1)
		return dp[h][w];
	long long ans = 0;
	for(int i=0;i<2;++i) {
		if(isVal(h + dx[i], w + dy[i])) {
			ans = (ans + rec(h+dx[i], w+dy[i])) % 1000000007;
		}
	}
	dp[h][w] = ans;
	return ans;
}

int main() {
	scanf("%d %d", &H, &W);
	for(int i=0;i<H;++i) {
		scanf("%s", &ar[i]);
	}
	memset(dp, -1, sizeof(dp));
	printf("%lld\n", rec(0, 0));
	return 0;
}

Measured memory_bytes: 5248
int main(int argc, const char * argv[]) {
    // insert code here...

    int x;
    int count = 1;
    
    while(1)
    {
        scanf("%d",&x);
        if(x == 0)break;
        else printf("Case %d: %d\n",count,x);
        count ++;
        
    }
    
    return 0;
}


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

int main() {
  int64_t n,m,k;
  cin>>n>>m>>k;
  int64_t a[n];
  for(int i=0; i<n; i++) cin>>a[i];
  int64_t b[m];
  for(int i=0; i<m; i++) cin>>b[i];

  int64_t sum = 0;
  int posi1 = 0;
  while(posi1<n) {
    if(sum+a[posi1]<=k) {
      sum += a[posi1];
      posi1++;
    }
    else break;
  }
  int posi2 = 0;
  while(posi2<m) {
    if(sum+b[posi2]<=k) {
      sum += b[posi2];
      posi2++;
    }
    else break;
  }

  int ans = posi1 + posi2;

  while(posi1>=0 && posi2<m) {
    posi1--;
    sum -= a[posi1];
    while(posi2<m) {
      if(sum+b[posi2]<=k) {
        sum += b[posi2];
        posi2++;
        if(posi2==m) break;
      }
      else break;
    }

    if(ans<posi1+posi2) ans=posi1+posi2;
  }
  if(ans<posi1+posi2) ans=posi1+posi2;

  cout<<ans<<endl;


  return 0;
}

Measured memory_bytes: 6756
import java.util.*;
public class Main{

    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int z,x=0,c;
        boolean m=false;
        z=input.nextInt();
        String s=String.valueOf(z);
        for(int i=0;i<s.length();i++)
        {
            for(int r=i;r<4;r++)
            {
                if(s.charAt(i)==s.charAt(r))
                {
                    x++;
                    if(x==3)
                        break;
                }
                else x--;
            }
            if (x>2)
            {
                System.out.println("Yes");
                m=true;
                break;
            }
            x=0;
        }
        if(!m)
            System.out.println("No");
    }
    
}


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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
//Write From this Line

int main()
{
	int n , k ;	
	cin >> n >> k ;	
	vector<int> x(n);
	rep(i,n) cin >>x[i];
	ll ans =0  ;
	rep(i,n){
		ans += 2*min(abs(x[i]),abs(x[i]-k));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
s = int(input())
mod = 10**9+7
def inv(x):
  y = 1
  while x != 1:
    y *= mod //x + 1
    y %= mod
    x -= mod % x
  return y
#print(inv(5))
ans = 0
for l in range(1,1000000):
  if s - 3*l < 0:
    print(ans)
    exit()
  tmp = 1
  for i in range(l-1):
    tmp *= s-2*l-1-i
    tmp *= inv(i+1)
    tmp %= mod
  #print(tmp)
  ans += tmp
  ans %= mod
#print(tmp)

Measured memory_bytes: 74008
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    string s;
    cin >> s;
    int INF = 9999999;
    int ans = INF;
    imfor(i, s.size() - 1) {
        int tmp;
        if (s[i] != s[i + 1]) {
            tmp = max(i + 1, (int)s.size() - (i + 1));
            ans = min(ans, tmp);
        }
    }
    if (ans == INF) {
        cout << s.size() << endl;
    }
    else {
        cout << ans << endl;
    }
}

Measured memory_bytes: 512
#include <stdio.h>
 
int n, q, com, x, y, bit[131073];
 
void add(int i, int c)
{
    if(c == 0) return;
    
    while(i <= n)
    {
        bit[i] += c;
         
        i += i & -i;
    }
}
 
int sum(int i)
{
    int ret = 0;
     
    while(i > 0)
    {
        ret += bit[i];
         
        i -= i & -i;
    }
     
    return ret;
}
 
int main()
{
    scanf("%d", &n);
    scanf("%d", &q);
     
    for(int i = 0; i < q; i++)
    {
        scanf("%d", &com);
        scanf("%d", &x);
        scanf("%d", &y);
         
        if(com == 0)
        {
            add(x, y);
        }
        else
        {
            printf("%d\n", sum(y) - sum(x - 1));
        }
    }
     
    return 0;
}

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

uint xor128(){
	static uint x=123456789;
	static uint y=333333333;
	static uint z=555555555;
	static uint w=88888888;
	uint t=x^(x<<11);
	x=y;y=z;z=w;
	return w=(w^(w>>19))^(t^(t>>8));
}
struct node{
	node*l,*r;
	uint pri;
	int cnt,val,Min;
};
node pool[400000];
int p;

inline int cnt(node*t){return t?t->cnt:0;}
inline int Min(node*t){return t?t->Min:INF;}

inline node*update(node*t){
	t->cnt=cnt(t->l)+cnt(t->r)+1;
	t->Min=min({t->val,Min(t->l),Min(t->r)});
	return t;
}
inline node*merge(node*l,node*r){
	if(!l)return r;
	if(!r)return l;
	if(l->pri>r->pri){
		l->r=merge(l->r,r);
		return update(l);
	}
	else{
		r->l=merge(l,r->l);
		return update(r);
	}
}
inline pair<node*,node*>split(node*t,int k){
	if(!t)return make_pair((node*)NULL,(node*)NULL);
	if(k<=cnt(t->l)){
		auto p=split(t->l,k);
		t->l=p.second;
		return make_pair(p.first,update(t));
	}
	else{
		auto p=split(t->r,k-cnt(t->l)-1);
		t->r=p.first;
		return make_pair(update(t),p.second);
	}
}

int main(){
	int n,q;scanf("%d%d",&n,&q);
	node*root=NULL;
	rep(i,n){
		int a;scanf("%d",&a);
		node*t=&pool[p++];
		*t={NULL,NULL,xor128(),1,a,a};
		root=merge(root,t);
	}
	rep(i,q){
		int x,y,z;scanf("%d%d%d",&x,&y,&z);
		if(x==0){
			z++;
			auto a=split(root,y);
			auto b=split(a.second,z-y-1);
			auto c=split(b.second,1);
			root=merge(merge(merge(a.first,c.first),b.first),c.second);
		}
		else if(x==1){
			z++;
			auto a=split(root,y);
			auto b=split(a.second,z-y);
			printf("%d\n",Min(b.first));
			root=merge(merge(a.first,b.first),b.second);
		}
		else{
			auto a=split(root,y);
			auto b=split(a.second,1);
			b.first->val=b.first->Min=z;
			root=merge(merge(a.first,b.first),b.second);
		}
	}
}


Measured memory_bytes: 9488
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string o, e;
    cin >> o >> e;
    int n = o.size();
    int m = e.size();
    rep(i, n + m) {
        if (i % 2 == 0) {
            cout << o[i / 2];
        }
        else {
            cout << e[i / 2];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    ll A;
    double B;
    cin >> A >> B;
    int ib = 100 * B + 0.5;
    A *= ib;
    A /= 100;
    printf("%lld\n", A);
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)

int main() {
	ll N; cin >> N;
	set<ll> st;
	rep(i, N) {
		ll tmp; cin >> tmp;
		st.insert(tmp);
	}
	if (st.size() == N) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 13008
import java.util.Scanner;

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

        Scanner input = new Scanner(System.in);
        int temp = input.nextInt();

        if(temp >= 30)
        {
            System.out.println("Yes");
        }
        else
        {
                System.out.println("No");
        }
    }
}


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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll W, H, N;
    cin >> W >> H >> N;

    ll x1 = 0;
    ll x2 = W;
    ll y1 = 0;
    ll y2 = H;

    for(ll i = 0; i < N; i++){
        ll x, y, a;
        cin >> x >> y >> a;
        if(a == 1) x1 = max(x1, x);
        else if(a == 2) x2 = min(x2, x);
        else if(a == 3) y1 = max(y1, y);
        else if(a == 4) y2 = min(y2, y);
    }

    if((x2-x1) < 0 || (y2-y1) < 0){
        cout << 0 << endl;
    }else{
        ll ans = (x2-x1) * (y2-y1);
        cout << ans << endl;
    }    
}

Measured memory_bytes: 256
h, w, n = gets.split.map(&:to_i)
sr, sc = gets.split.map(&:to_i)
s = gets.chomp
t = gets.chomp

step_l = 0
step_r = 0
step_u = 0
step_d = 0
flag = true
for i in 0...n do
  case s[i]
  when "L"
    step_l += 1
    if sc - step_l <= 0
      flag = false
      break
    end
  when "R"
    step_r += 1
    if sc + step_r > w
      flag = false
      break
    end
  when "U"
    step_u += 1
    if sr - step_u <= 0
      flag = false
      break
    end
  when "D"
    step_d += 1
    if sr + step_d > h
      flag = false
      break
    end
  end
  case t[i]
  when "L"
    if sc + step_r > 1
      step_r -= 1
    end
  when "R"
    if sc - step_l < w
      step_l -= 1
    end
  when "U"
    if sr + step_d > 1
      step_d -= 1
    end
  when "D"
    if sr - step_u < h
      step_u -= 1
    end
  end
end

puts flag ? "YES" : "NO"


Measured memory_bytes: 2644
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cstring>
using namespace std;
typedef long long int ll;

void solve(){
	string s,t; cin >> s >> t;
	reverse(s.begin(),s.end());
	int n=t.size();
	for(char c:s){
		if(c=='J'){
			t=t.substr(n-1,1)+t.substr(0,n-1);
		}
		if(c=='C'){
			t=t.substr(1,n-1)+t.substr(0,1);
		}
		if(c=='E'){
			t=t.substr(t.size()-t.size()/2)+t.substr(t.size()/2,t.size()%2)+t.substr(0,t.size()/2);
		}
		if(c=='A'){
			reverse(t.begin(),t.end());
		}
		if(c=='P'){
			for(int i=0;i<n;i++){
				if('0'<=t[i]&&t[i]<='9'){
					if(t[i]=='0')t[i]+=9;
					else t[i]--;
				}
			}
		}
		if(c=='M'){
			for(int i=0;i<n;i++){
				if('0'<=t[i]&&t[i]<='9'){
					if(t[i]=='9')t[i]-=9;
					else t[i]++;
				}
			}
		}
	}
	cout << t << endl;
}

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


Measured memory_bytes: 3136
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<stack>
using namespace std;

int main(){
    int a, b;
    stack<int> st;
    string s;
    getline(cin,s);
    stringstream ss;
    ss << s;
    while( ss >> s ) { // 1 2 -
        if(s=="+"){
            a = st.top(); st.pop();
            b = st.top(); st.pop();
            st.push(a+b);
        }else if(s=="-"){
            a = st.top(); st.pop();
            b = st.top(); st.pop();
            st.push(b-a);
        }else if(s=="*"){
            a = st.top(); st.pop();
            b = st.top(); st.pop();
            st.push(a*b);
        }else{
            st.push(atoi(s.c_str()));
        }
    }
    a = st.top();
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 3152
#include<iostream>
using namespace std;
#define int long long int
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    string str;
    cin>>str;
    int suffix1[n+1]={0};
    int suffix2[n+1]={0};
    int suffix3[n+1]={0};
    int i,j;
    for(j=0;j<n;j++)
    {
		if(str[j]=='R')
		{
			suffix1[j]++;
		}
		else if(str[j]=='G')
	    {
			suffix2[j]++;
		}
		else 
		{
			suffix3[j]++;
		}
	}	
	for(j=n-1;j>=0;j--)
	{
		suffix1[j]+=suffix1[j+1];
		suffix2[j]+=suffix2[j+1];
		suffix3[j]+=suffix3[j+1];
	}
	int answer=0;
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if((str[i]=='R'&&str[j]=='G')||(str[i]=='G'&&str[j]=='R'))
			{
				answer=answer+suffix3[j];
				int diff=j-i;
				int k=j+diff;
				if(k<n&&str[k]=='B')
				{
					answer--;
				}
			}
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if((str[i]=='R'&&str[j]=='B')||(str[i]=='B'&&str[j]=='R'))
			{
				answer=answer+suffix2[j];
				int diff=j-i;
				int k=j+diff;
				if(k<n&&str[k]=='G')
				{
					answer--;
				}
			}
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if((str[i]=='B'&&str[j]=='G')||(str[i]=='G'&&str[j]=='B'))
			{
				answer=answer+suffix1[j];
				int diff=j-i;
				int k=j+diff;
				if(k<n&&str[k]=='R')
				{
					answer--;
				}
			}
		}
	}
	cout<<answer<<endl;
}


Measured memory_bytes: 3716
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
using ld = long double;
 
// ------------------------------------------------------------------------------------------------

ll n, sum, sum2, val, ans;

int main() {
    fast_io; cout_precision;
    cin >> n;
    sum = 0, sum2 = 0;
    for (ll i = 0, a; i < n; i++) {
        cin >> a;
        sum += a;
        sum2 += a * a;
    }
    val = round(ld(sum) / n);
    cout << n * val * val + sum2 - 2 * val * sum << endl;
}

Measured memory_bytes: 384
isExist = [False]*2001 
n = int( input() )
A = [ int( val ) for val in input().rstrip().split( ' ' ) ]
for i in A:
	for j in range( 2000-i, 0, -1 ):
		if isExist[j]:
			isExist[ i+j ] = True
	isExist[i] = True

q = int( input() )
M = [ int( val ) for val in input().rstrip().split( ' ' ) ]
for i in range( 0, q ):
	if isExist[ M[i] ]:
		print( "yes" )
	else:
		print( "no" )

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

int main(){
    int x,y;
    cin>>x>>y;
    while(!(x==0 && y==0)){
        if(x>y){
            cout<<y<<" "<<x<<endl;
        }
        else
            cout<<x<<" "<<y<<endl;
        cin>>x>>y;
    }
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    
    int a, b, c, d, e, f, g; cin >> a >> b >> c >> d >> e >> f >> g;
    int ans = 0;

    if(a >= 1 && d >= 1 && e >= 1){
        int aa = a - 1;
        int dd = d - 1;
        int ee = e - 1;
        int tmp = b + 3 + (aa / 2) * 2 + (dd / 2) * 2 + (ee / 2) * 2;
        ans = max(ans, tmp);
    }
    
    int tmp = b + (a / 2) * 2 + (d / 2) * 2 + (e / 2) * 2;    
    ans = max(ans, tmp);
    cout << ans << endl;
    return 0;
}

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

int N,K;
bitset<43> ans(0);
vector<long long> sum;

bool calc(){
  int cnt=0;
  for(int i=0;i<N+1;i++){
    for(int j=i;j<N+1;j++){
      long long tmp=sum.at(j)-sum.at(i);
      if((ans.to_ullong()&tmp)==ans.to_ullong())  cnt++;
    }
  }
  if(cnt>=K)  return true;
  else  return false;
}

int main(){
  cin >> N >> K;
  vector<long long> a(N);
  for(int i=0;i<N;i++)  cin >> a.at(i);

  sum.resize(N+1);
  for(int i=0;i<N;i++)  sum.at(i+1)=sum.at(i)+a.at(i);
  for(int i=42;i>=0;i--){
    bool flag=true;
    ans.set(i,1);
    flag=calc();
    if(!flag) ans.set(i,0);
  }
  cout << ans.to_ullong() << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<memory>
#include<cmath>
#include<algorithm>
#include<vector>
int main(){
    int num_piece,num_spot;
    std::cin>>num_piece>>num_spot;
    std::vector<int> x(num_spot);
    for(int i=0;i<num_spot;i++) std::cin>>x[i];
    if(num_piece >= num_spot){
        std::cout<< 0 <<std::endl;
        return 0;
    }
    std::sort(x.begin(),x.end());

    //for(int i=0;i<num_spot;i++) std::cout<<x[i]<<" ";
    //std::cout<<std::endl;

    int sumD=x[num_spot-1]-x[0];

    std::vector<int> dis(num_spot-1);

    for(int i=0;i<num_spot-1;i++) dis[i]=x[i+1]-x[i];

    std::sort(dis.begin(),dis.end());

    //for(int i=0;i<num_spot-1;i++) std::cout<<dis[i]<<" ";
    //std::cout<<std::endl;

    int district=0;
    for(int i=0;i<num_piece-1;i++) district+=dis[num_spot-2-i];

    //std::cout<<district<<std::endl;

    int ans=sumD-district;
    std::cout<<ans<<std::endl;

    return 0;
}



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

int main()
{
  int N, ans;
  cin >> N;
  for(int i=N; i<=999; i++){
    if(i%10==(i/10)%10 && i%10==(i/100)){
      ans=i;
      break;
    }
  }
  cout << ans << endl;
}

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

int main(void){
    vector<int> a(5);
    rep(i, 5) cin >> a[i];
    
    int value = 10;
    for (int i = 0; i < 5; i++)
        if (a[i]%10 != 0 && a[i]%10 < value)
            value = a[i]%10;
    if (value == 10)
        value = 0;

    int ans = 0;
    rep(i, 5) {
        if (value == a[i] % 10) {
            ans += a[i];
            value = 10;
        }
        else {
            if (a[i]%10 == 0)
                ans += a[i];
            else
                ans += a[i]-a[i]%10 + 10;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a; cin >> a;
	cout << a + a * a + a * a * a;

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int main()
{
	ll x,y; read(x, y);
	if(x%y == 0){
		puts("-1");
	} else printf("%lld ", x);
	return 0;
}


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

using ll = int64_t;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  string s; std::cin >> s;
  int len = s.size(), ans = 0;
  rep(i, len-2) {
    if (s.substr(i, 3) == "ABC")
      ans++;
  }
  std::cout << ans << "\n";
}


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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	int x;
	cin >> x;
	if(x < 1200)
		cout << "ABC\n";
	else
		cout << "ARC\n";	
	return 0;
}

Measured memory_bytes: 256
def matrixChainMultiplication(n):
    # for i in range(1, n+1):
    #     m[i][i] = 0
    for l in range(2, n+1):
        for i in range(1, n-l+1+1):
            j = i + l - 1
            m[i][j] = 999999999
            for k in range(i, j):
                m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j])
    return m[1][n]

n = int(input())
squareM = [input().split(" ") for _ in range(n)]
p = [int(squareM[i][0]) for i in range(n)]
p.append(int(squareM[n-1][1]))
m = [[0]*(n+1) for _ in range(n+1)]
print(matrixChainMultiplication(n))


Measured memory_bytes: 5720
MOD = 10**9 + 7
MAX = int(5e5)


def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD


FACT = [1] * (MAX+1)
for i in range(1, MAX+1):
    FACT[i] = (i * FACT[i-1]) % MOD
INV = [1] * (MAX+1)
INV[MAX] = div(1, FACT[MAX])
for i in range(MAX, 0, -1):
    INV[i-1] = (INV[i] * i) % MOD


def combination(m, n):
    return (FACT[m] * INV[n] * INV[m-n]) % MOD


def permutation(m, n):
    return (FACT[m] * INV[m-n]) % MOD


def main():
    N, M = map(int, input().split())
    ans = 0
    for i in range(N+1):
        # 包除原理
        tmp = (combination(N, i) * permutation(M, i)
               * (permutation(M-i, N-i)**2)) % MOD
        ans = (ans + (-1)**i * tmp) % MOD

    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i = 0; i < N; i++){
    cin >> S.at(i);
  }
  set<string> item;
  for (int i = 0; i < N; i++){
    item.insert(S.at(i));
  }
  cout << item.size() << endl;
}

Measured memory_bytes: 25096
N=int(input())
S=input()

if N==1:
    print("0")
else:
    cnt_left=0
    cnt_right=S.count(".")
    cnt = cnt_left + cnt_right
    for i in range(N):
        if S[i] == "#":
            cnt_left += 1
        else:
            cnt_right -= 1

        if cnt_left + cnt_right < cnt:
            cnt = cnt_left + cnt_right
    print(cnt)


Measured memory_bytes: 3500
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
using namespace std;

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

int main(void) {

  int a, b;
  cin >> a >> b;

  cout << gcd(a, b) << endl;

  return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define INF 1000000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(lp, vec.size()) cout << vec[lp] << " "; print("");
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;

const int mod = 998244353;
class mint {
public:
    ll x;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res /= a;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

const ll MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}

ll cmb(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

void Main(){

	ll N, M, K;
	cin >> N >> M >> K;
	mint ans = 0;
	init();
	rep(i, K + 1){
		mint cnt = M;
		mint tmp = M - 1;
		tmp = tmp.pow(N - 1 - i);
		cnt *= tmp;
		cnt *= (mint)cmb(N - 1, i);
		ans += cnt;
	}
	print(ans);
	
}

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





Measured memory_bytes: 15572