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

int main() {
  int k;
  string s;
  cin>>k>>s;
  int n=s.size();
  if(n<=k) cout<<s<<endl;
  else{
    for(int i=0;i<k;i++){
      cout<<s[i];
      if(i==k-1) cout<<"..."<<endl;
    }
  }
}

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

#define int long long

signed main() {
    int a, b, c, x;
    cin >> a >> b >> c >> x;

    int ans = 0;
    for(int i=0; i<=a; ++i) {
        for(int j=0; j<=b; ++j) {
            for(int k=0; k<=c; ++k) {
                if((500*i+100*j+50*k)==x) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long 
#define ii pair<int,int>
#define iii pair<int,ii>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1<<(x))
#define inf 1000000005
#define MOD 924844033 
#define N 2005
#define M 1000003
#define LOG 20
#define KOK 250
#define EPS 0.0000001
using namespace std;

int dp[N][N][2][2];

int mul(int x,int y) {
	
	return (ll)x*y%MOD;

}

int add(int x,int y) {

	x+=y;

	if(x>=MOD) x-=MOD;
	if(x<0) x+=MOD;

	return x;

}

int main() {

	int n,k;

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

	vector<int> ord;

	for(int i=0;i<k;i++) {

		for(int j=i;j<n;j+=k) ord.pb(j); 

	}

	dp[0][0][0][0]=1;

	for(int i=0;i<n;i++) {

		for(int j=0;j<=i;j++) {

			for(int to=0;to<2;to++) {

				for(int out=0;out<2;out++) {

//					printf("%d %d %d %d %d\n",i,j,to,out,dp[i][j][to][out]);

					bool nxt=(ord[i]+k<n);

					dp[i+1][j+1][nxt&1][nxt&1]=add(dp[i+1][j+1][nxt&1][nxt&1],dp[i][j][to][out]);
					
					if(j) {
					
						dp[i+1][j][nxt&1][0]=add(dp[i+1][j][nxt&1][0],mul(j-to,dp[i][j][to][out]));
						dp[i+1][j][0][nxt&1]=add(dp[i+1][j][0][nxt&1],mul(j-out,dp[i][j][to][out]));
						dp[i+1][j-1][0][0]=add(dp[i+1][j-1][0][0],mul(mul(j-out,j-to),dp[i][j][to][out]));
					
					}
					dp[i+1][j][0][0]=add(dp[i+1][j][0][0],dp[i][j][to][out]);

				}

			}

		}

	}

	printf("%d",dp[n][0][0][0]);

}

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

const int MAX = 55;
long long A[MAX], B[MAX];

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) scanf("%lld", &A[i]);
    long long cnt, ans, maxa;
    cnt = ans = 0;
    maxa = N;
    while (maxa >= N) {
        maxa = 0;
        for (int i = 0; i < N; i++) {
            B[i] = A[i] / N;
            cnt += B[i];
            A[i] = A[i] % N;
        }
        for (int i = 0; i < N; i++) {
            A[i] += cnt - B[i];
            B[i] = 0;
            maxa = max(maxa, A[i]);
        }
        ans += cnt;
        cnt = 0;
    }
    printf("%lld\n", ans);
    return 0;
}


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

int give(int num,int N){
	if(N==0)
		return num;
	
	num+=N;
	
	return give(num,--N);
}

int main(){ 
	
	int a;
	cin >> a;
	
	cout << give(0,a) << endl;
	
	return 0;
}


Measured memory_bytes: 256
/*=====Bismillahir Rahmanir Rahim=====*\
!                                      !
!(^,^)Ron is back(-o,o-)               !
!         MD. TAREK MAHMUD RONY        !
!            CSE 12th Batch            !
!           Comilla University         !
\*====================================*/
//Think positive, be positive and never use negative words
#include<bits/stdc++.h>
#define ll               long long int
#define test             ll t;cin>>t;while(t--)
#define nl               endl
#define mp(a,b)          make_pair(a,b)
#define F                first
#define S                second
#define vc               vector<int>
#define vcl              vector<ll>
#define pb               push_back
#define vc_sum(a)        accumulate(a.begin(),a.end(),0)
#define vc_max(a)        *max_element(a.begin(),a.end())
#define vc_min(a)        *min_element(a.begin(),a.end())
#define vc_sort(a)       sort(a.begin(),a.end())
#define vc_gsort(a)      sort(a.begin(),a.end(),greater<int>())
#define vc_uni(a)        a.erase(unique(a.begin(),a.end()),a.end())
#define ulta(a)          reverse(a.begin(),a.end())
#define RON              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define yes              cout<<"YES"<<nl
#define no               cout<<"NO"<<nl
#define M                1000000007
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
using namespace std;
int main()
{
    RON;
    ll n, k;
    cin>>n>>k;
    ll i, a[n];
    for(i=0; i<n; i++) cin>>a[i];
    sort(a,a+n);
    ll sum=0;
    for(i=0; i<k; i++) sum+=a[i];
    cout<<sum<<nl;
    return 0;
}



Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N=200010;
int a[N];
int n, m;
int main(){
	int t;
	cin>>t;
	map<string, int> mp;
	while(t--){
		string s;
		cin>>s;
		++mp[s];
	}
	cout<<"AC"<<" x "<<mp["AC"]<<endl;
	cout<<"WA"<<" x "<<mp["WA"]<<endl;
	cout<<"TLE"<<" x "<<mp["TLE"]<<endl;
	cout<<"RE"<<" x "<<mp["RE"]<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	int n;
	while(cin >> n && n) {
		int m = n * (n-1) / 2;
		vector<int> v(m);
		rep(i,m) cin >> v[i];

		int sum = 0;
		rep(i,m) {
			sum += v[i];
		}

		cout << sum / (n-1) << endl;
	}


	return 0;
}

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

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



Measured memory_bytes: 3084
# 3  つの整数  A , B , C  が与えられます。 
# 整数  C  が  A  以上 かつ  B  以下であるかを判定してください。
A,B,C =map(int,input().split())
 
if C>=A and C<=B:
	print('Yes')
else:
	print('No')

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

int main(){
  int a,b;
  cin >> a >> b;
  if( (a == 1 && b == 13) || (2 <= a && a <= 13 && 2 <= b && b <=13  && a > b)) cout << "Alice" << endl;
  else if ( a == b) cout << "Draw" << endl;
  else cout << "Bob" << endl;  
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n; 
    cin >> n;
    vector<int> v(n);
    REP(i,n) cin >> v[i];
    sort(v.begin(),v.end());

    double tmp = v[0] + v[1];
    tmp /=  2.0;

    for(int i = 2; i < v.size(); i++) {
        tmp += v[i];
        tmp /= 2.0;
    }
    cout << setprecision(10) ;
    cout << tmp << endl;;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N;
  cin >> N;
  vector<i64> A(N);
  for (i64 i = 0; i < N; i++)
    cin >> A[i];
  sort(A.rbegin(), A.rend());
  i64 ans = A[0];
  i64 j = 1, cnt = 0;
  for (i64 i = 2; i < N; i++)
  {
    cnt++;
    ans += A[j];
    if (cnt == 2)
    {
      cnt = 0;
      j++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
    long long ans=0;
    int N,X,a[100010]={};
    cin>>N>>X;

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

        if(i!=1){
            if(a[i-1]+a[i]>X){
                ans+=a[i-1]+a[i] - X;
                
                a[i]=max(0,X-a[i-1]);
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 +c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
char s[MAXN];
int num[MAXN];
void Solve() {
    read(N);
    scanf("%s",s);
    for(int i = 0 ; i <= 1 ; ++i) {
        for(int j = 0 ; j <= 1 ; ++j) {
            num[0] = i;num[1] = j;
            for(int k = 2 ; k < N ; ++k) {
                num[k] = (s[k - 1] == 'x') ^ num[k - 2] ^ num[k - 1];
            }
            int t0 = num[N - 1] ^ num[1] ^ num[0] ^ (s[0] == 'x');
            int tN = num[0] ^ num[N - 2] ^ num[N - 1] ^ (s[N - 1] == 'x');
            if(t0 == 0 && tN == 0) {
                for(int i = 0 ; i < N ; ++i) {
                    if(num[i] == 0) putchar('S');
                    else putchar('W');
                }
                enter;
                return;
            }
        }
    }
    puts("-1");
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 16;

int A[MAX_N][MAX_N];

int N;
int dp[1<<MAX_N];
int groupScore[1<<MAX_N];

signed main()
{
  cin >> N;
  REP(i,N) {
    REP(j,N) {
      cin >> A[i][j];
    }
  }

  REP(mask,1<<N) {
    REP(i,N) {
      REP(j,i) {
        if(((mask >> i) & 1) && ((mask >> j) & 1)) {
          groupScore[mask] += A[i][j];
        }
      }
    }
    dp[mask] = -INF_LL;
  }

  dp[0] = 0;

  REP(mask,1<<N) {
    int subMask = ((1 << N)-1) ^ mask;
    for(int nS = subMask; 0 <= nS; nS--) {
      nS &= subMask;
      dp[mask | nS] = max(dp[mask | nS], dp[mask] + groupScore[nS]);
    }
  }

  cout << dp[(1<<N)-1] << endl;

  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq  priority_queue<double, std::vector<double>, std::greater<double>>

int lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

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







int main(){
    int N;
    cin >> N;
    int X;
    cin >> X;
    vector<int> A(N);
    for (int i = 0; i < N;i++)
    {
        cin >> A[i];
    }
    ll ans = 0;
    sort(A.begin(), A.end());
    
    for (int i = 0; i < N;i++)
    {
        if(i != N-1){
            if(A[i] <= X){
                X -= A[i];
                ans++;
            }
            else{
                break;
            }
        }
        else{
            if(A[i] == X){
                ans++;
                X -= A[i];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int cnt=0;
   long long k,l,ans=0,am=0,a=7,b=0,c=0;
   cin >> k;
    l=k;
    bool flag1=true;
    bool flag2=true;
    while(l>0){
        cnt++;
        l/=10;
    }
    for(int i=0; i<cnt; i++){
        b=a%k;
        am+=a%k;
        am%=k;
        a*=10;
        ans++;
        if(am==0) {
            flag1=false;
            break;
        }
    }

    while(flag1&&flag2){
        b*=10;
        b%=k;
        c+=b;
        c%=k;
        if(c==0) flag2=false;
        am+=b;
        am%=k;
        if(am==0) flag1=false;
        ans++;
    }
    if(flag2) cout << ans;
    else cout << -1;
}

Measured memory_bytes: 3576
#include<stdio.h>
#include<string.h>
int main(void)
{
    char a[101];
    int i,n,x,y;
   
	while(1)	{
        scanf("%s",a);
		if(a[0]=='0')	break;
		n=strlen(a);
		x=0;
		y=0;
		for(i=1; i<n;i++){
			if(a[i]=='A')    x++;
			if(a[i]=='B')    y++;
		}
        if(x>y){
		    x++;
		}
		if(y>x){
		    y++;
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string a,b,c;
  cin >> a >> b >> c;
  cout << a.at(0) << b.at(1) << c.at(2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
	bool c[20002];
int main() {
	ll n;
	cin>>n;
	string s;
	cin>>s;

	ll R=0,B=0,G=0;
	vector <ll>a,b;
	for(ll i=0;i<n;i++){
		if(s[i]=='B'){
			c[i]=true;
		}
		else if(s[i]=='R'){
			a.push_back(i);
		}
		else{
			b.push_back(i);
		}
	}
	ll ans=a.size()*b.size()*(n-a.size()-b.size());
//	cout <<ans;
	for(ll i=0;i<b.size();i++){
		ll now=b[i];
	//	cout << now<<endl;
		for(ll j=0;j<a.size();j++){
			ll next=a[j];
	//	cout << next;
		ll dex=abs(now-next);
		if(c[next+dex]&&next+dex<n){
			ans--;
		}
		if(c[next-dex]&&next-dex>=0){
			ans--;
		}
		if(c[now+dex]&&now+dex<n){
			ans--;
		}
		if(c[now-dex]&&now-dex>=0){
			ans--;
		}
		if(dex%2==0){
			if(c[(now+next)/2]){
				ans--;
			}
		}
		}
		//cout <<ans;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

int main()
{
  int n, m;
  int t = 0;
  while (scanf("%d %d", &n, &m) != EOF)
  {
    if (t++) printf("----------------\n");
    int mid = m / 2;
    for (int i = mid, j = 0; i > 0; i--, j++)
    {
      int spacing = 2*i;
      printf("%d %d\n", 1 + j, 1 + j + spacing);
    }
    for (int i = mid - !(m & 1), j = n / 2 + !(m & 1); i >= 0; i--, j++)
    {
      int spacing = 2*i + 1;
      printf("%d %d\n", 1 + j, 1 + j + spacing);
    }
  }
  return 0;
}

Measured memory_bytes: 3828
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (300006)
int main(){
	// no distinct black group of squares share the a corner or side
	FAST
	ll q;
	cin>>q;
	vector<ll> p3(31, 0);
	p3[0]=1; FOR(i,1,31)p3[i]=p3[i-1]*3;
	while(q--){
		array<ll, 2> a, b;
		cin>>a[0]>>a[1]>>b[0]>>b[1];--a[0],--a[1],--b[0],--b[1];
		ll ans=0;
		FOR(i,0,30){
			if(a[0] / p3[i] == b[0] / p3[i] && a[1] / p3[i] == b[1] / p3[i]) continue;
			cerr<<"hi: "<<i<<'\n';
			// check if got p3[i] square blocking
			// belongs to p3[i+1] (if u consider whole grid)
			// check row
			if(a[0] / p3[i] == b[0] / p3[i] && 
				a[0] / p3[i] % 3 == 1 &&
				llabs(a[1]/p3[i]-b[1]/p3[i]) != 1
			) {
				cerr<<i<<"!\n";
				ans=max(ans,min(
					a[0]%p3[i+1]-p3[i]+1 + b[0]%p3[i+1]-p3[i]+1,
					p3[i]*2-a[0]%p3[i+1] + p3[i]*2-b[0]%p3[i+1]
				) - llabs(a[0]-b[0]));
			}
			if(a[1] / p3[i] == b[1] / p3[i] && 
				a[1] / p3[i] % 3 == 1 && 
				llabs(a[0]/p3[i]-b[0]/p3[i]) != 1
			) {
				cerr<<i<<"!\n";
				ans=max(ans,min(
					a[1]%p3[i+1]-p3[i]+1 + b[1]%p3[i+1]-p3[i]+1,
					p3[i]*2-a[1]%p3[i+1] + p3[i]*2-b[1]%p3[i+1]
				) - llabs(a[1] - b[1]));
			}
			// take out prev squares
		}
		cerr<<ans<<'\n';
		ans = llabs(a[0]-b[0]) + llabs(a[1]-b[1]) + ans;
		cout<<ans<<'\n';
	}
}


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

public class Program
{

    public void Proc()
    {
        int len = int.Parse(Reader.ReadLine());

        int[] line1 = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        int[] line2 = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int[] line1total = new int[len];
        line1total[0] = line1[0];
        for (int i = 1; i < line1.Length; i++) {
            line1total[i] = line1[i] + line1total[i - 1];
        }
        int[] line2total = new int[len];
        line2total[len - 1] = line2.Last();
        for (int i = len - 2; i >= 0; i--) {
            line2total[i] = line2[i] + line2total[i + 1];
        }
        int ans = 0;
        for (int i = 0; i < len; i++) {
            ans = Math.Max(ans, line1total[i] + line2total[i]);
        }
        Console.WriteLine(ans);
    }


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





1
2
3

";
    }

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


Measured memory_bytes: 13396
S = input()
cnt = 0
kiro = 0
for i in range(len(S)):
        if (S[i] == 'A') or (S[i] == 'T') or (S[i] == 'C') or (S[i] == 'G'):
                cnt += 1
        else:
                cnt = 0
        kiro = max(cnt,kiro)
print(kiro)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vi A, B;
string S, T;

void input() {
  int x, y, z;
  cin >> N >> S >> M;
  ;
}
void solve() {
  if (S == "+") {
    cout << N + M << endl;
  } else {
    cout << N - M << endl;
  };
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
def main():
    a, b, c = map(int, input().split())
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
        print("0")
    else:
        if a == b == c:
            print("-1")
        else:
            ans = 0
            while a%2 == 0 and b%2 == 0 and c%2 == 0:
                a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
                ans += 1
            print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
n, b, r = gets.split.map(&:to_i)

cnt = 0
br = b + r

if b >= n
  puts n
  exit
end

if br > n
  if b > n
    puts 0
  else
    puts b
  end
  exit
end

c = n / br
cnt += c * b

if c * br < n
  if n - (c * br) > b
    cnt += b
  else
    cnt += n - (c * br)
  end
end
puts cnt

Measured memory_bytes: 3836
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	t := getNextInt64(scanner)
	tt := make([]int64, n)

	var ans int64
	for i := 0; i < n; i++ {
		tt[i] = getNextInt64(scanner)
	}

	ans = t
	for i := n - 2; i >= 0; i-- {
		add := t
		if tt[i+1]-tt[i] < add {
			add = tt[i+1] - tt[i]
		}
		ans += add
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}


Measured memory_bytes: 4608
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
ans = []
if R - L >= 2019:
    print(0)
else:
    if l >= r:
        print(0)
    else:
        for i in range(l, r):
            for k in range(l+1, r+1):
                ans.append(i * k % 2019)                
    print(min(ans))                

Measured memory_bytes: 147604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
const int N = 1e5+ 2, mod = 1e9 + 7;

void solve() {
	int n, k, t;
	cin >> n >> k >> t;
	cout << (n + k - 1)/k*t;
}

int main() {
	// reopen("input.txt", "r", stdin); 
 //    freopen("output.txt", "w", stdout); 
	int tt = 1;
	// cin >> tt;
	for (int tc = 1; tc <= tt; tc++) {
		// cout << "Case #:" << tc << " ";
		solve();
	}
}

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

typedef long long ll;
ll MOD = 1000000007;

int main(){
  int N;cin >> N;
  vector<int> A(2*N);
  for(int i = 0;i < 2*N;i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  int ans = 0;
  for(int i = 0;i < N;i++){
    ans += min(A[2*i],A[2*i+1]);
  }
  cout << ans << endl;
}

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

using namespace std;

int a, b, c;

int main() {
  scanf("%d %d %d", &a, &b, &c);
  int cur = a;
  for (int i = 0; i < 100; i++) {
    if (cur % b == c % b) return puts("YES"), 0;
    cur += a;
  }
  puts("NO");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
  /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    pair<ll,int> a[n];
    vector<vector<ll>> v(n+1);
    for(int i=0;i<n;i++){
        int t; ll d; cin>>t>>d;
        v[t].push_back(d);
        a[i]={d,t};
    }
    sort(a,a+n); reverse(a,a+n);
    for(int i=1;i<=n;i++){
    	sort(v[i].begin(),v[i].end());
    	reverse(v[i].begin(),v[i].end());
    }
    ll s=0;
    unordered_map<int,int> m1;
    for(int i=0;i<k;i++){
        s+=a[i].first;
        m1[a[i].second]++;
    }
    ll z=m1.size();
    s+=z*z;
      ll ans=s;
    vector<ll> v2;
    for(int i=1;i<=n;i++){
        if(m1.count(i)==1){
            for(int j=1;j<m1[i];j++) v2.push_back(v[i][j]);
        }
    }
    sort(v2.begin(),v2.end());
    vector<ll> v1;
    for(int i=1;i<=n;i++){
        if(m1.count(i)==0 && v[i].size()>=1) v1.push_back(v[i][0]);
    }
    sort(v1.begin(),v1.end()); reverse(v1.begin(),v1.end());
    vector<ll> V1(v1.size());
    for(int i=0;i<v1.size();i++){
        V1[i]=v1[i];
        if(i>0) V1[i]+=V1[i-1];
    }
    vector<ll> V2(v2.size());
    for(int i=0;i<v2.size();i++){
        V2[i]=v2[i];
        if(i>0) V2[i]+=V2[i-1];
    }
    for(int i=0;i<min(v1.size(),v2.size());i++){
        ans=max(ans,s+V1[i]-V2[i]+(z+i+1)*(z+i+1)-z*z);
    }
    cout<<ans;
}


Measured memory_bytes: 10376
#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;
vector< ll> v[20];
ll power(ll x,ll y)
{
  ll res=1;
  while(y)
  {
     if(y%2)
      res=res*x;
    x=x*x;
    y=y>>1;
  }
  return res;
}
int main()
{
  IOS
  ll n,m;
  cin>>n>>m;
  ll i,x,j,k;
  for(i=1;i<=m;i++)
  {
    cin>>x;
    for(j=1;j<=x;j++)
    {
       ll y;
       cin>>y;
       v[i].pb(y);
    }
  }
  ll p[m+5];
  for(i=1;i<=m;i++)
    cin>>p[i];
  ll ans=0;
  ll cnt[n+5];
  for(i=0;i<power(2,n);i++)
  {
     memset(cnt,0,sizeof(cnt));
     for(j=0;j<n;j++)
      if(i&(1<<j))
        cnt[j+1]=1;
     for(j=1;j<=m;j++)
     {
       ll c=0;
       for(k=0;k<v[j].size();k++)
        if(cnt[v[j][k]])
          c++;
        if((c%2)!=(p[j]%2))
          break;
          
     }
     if(j>m)
      ans++;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) b.rbegin(),v.rend()
typedef long long ll;
//isPrime
//modpow modinv
int main() {
  string s;
  cin >> s;
  int n=s.size();
  vector<int> a(n);
  rep(i,n){
    a[i]=s.at(i)-'0';
  }
  ll ans=0;
  for(int bit=0; bit<(1<<(n-1)); bit++){
    ll num=0;
    ll cur=a[0];
    for(int i=0; i<n-1; i++){
      if(bit&(1<<i)){
        num=num+cur;
        cur=a[i+1];
      }else{
        cur=cur*10+a[i+1];
      } 
    }
    num+=cur; 
    ans+=num;
  }
  cout << ans << endl;
}

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

using namespace std;

#define int long long
#define MOD 1000000007

#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 all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int n,k,q;


signed main()
{

    cin >> n>>k>>q;

    vector<int> a(q);
    rep(i,q){
        cin>>a[i];
        a[i]--;
    }

    map<int,int> index;

    rep(i,q){
        index[a[i]]++;
    }    

    rep(i,n){
        if((k-(q-index[i]))>0){
            print("Yes");
        }
        else{
            print("No");
        }

    }



    return 0;
}


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

int main() {
	int n, a, tmp, ans = 100;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		tmp = 0;
		while (a % 2 == 0) {
			tmp += 1;
			a /= 2;
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int a, b, c;
  cin >>  a >> b >>c ;
  int ans = 3;
  if(a == b){
    ans--;
  }
  if(b == c){
    ans--;
  }
  if(c == a && ans != 1){
    ans--;
  }
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 500000

typedef struct{
  int key, left, right;
}Node;

Node tree[N+1];
int size;

void insert(int x){
  int a = 0;
  while(1){
    if(x < tree[a].key){
      if(tree[a].left == -1){
        tree[a].left = size;
        tree[size++].key = x;
        break;
      }else a = tree[a].left;
    }else{
      if(tree[a].right == -1){
        tree[a].right = size;
        tree[size++].key = x;
        break;
      }else a = tree[a].right;
    }
  }
}

void inorder(int a){
  if(tree[a].left != -1) inorder(tree[a].left);
  printf(" %d", tree[a].key);
  if(tree[a].right != -1) inorder(tree[a].right);
}

void preorder(int a){
  printf(" %d", tree[a].key);
  if(tree[a].left != -1) preorder(tree[a].left);
  if(tree[a].right != -1) preorder(tree[a].right);
}

main(){
  int n, i, f;
  f = 1;
  scanf("%d", &n);
  if(n > N)exit(1);

  for(i = 0 ; i <= n ; i++) tree[i].key = tree[i].left = tree[i].right = -1;

  size = 0;
  while(n--){
    char str[100];
    scanf("%s", str);
    if(!strcmp(str, "insert")){
      int in;
      scanf("%d", &in);
      if(f){
        tree[size++].key = in;
        f = 0;
      }
      else insert(in);
    }else{
      inorder(0);
      printf("\n");
      preorder(0);
      printf("\n");
    }
  }
  return 0;
}



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

int x[200000];
int need(int n){
	return n*2-1;
}
int main(){
	int n;scanf("%d",&n);
	rep(i,n)scanf("%d",&x[i]);
	ll ans=1;
	int s=-1;
	rep(i,n){
		while(need(s+2-i)<=x[s+1])s++;
		if(need(s+1-i)+1<=x[s+1])s++;
		(ans*=(s+1-i))%=MOD;
	}
	cout<<ans<<endl;
}


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

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

    std::map<int, int> attendMap;
    int key = 0;
    for(int i = 1; i <= n; ++i) {
        cin >> key;
        attendMap[key] = i;
    }

    for(auto i = attendMap.begin(); i != attendMap.end(); ++i) {
        std::cout << i->second << " ";
    }
    return 0;
}


Measured memory_bytes: 5504
N = int(input())
h = list(map(int, input().split()))
ans = 0
# 下から順に処理していく
for dan in range(max(h)):
    # 同じ"段"での処理
    for i in range(N-1):
        # 途中に0がある場合は手前まで水やり
        if h[i] != 0 and h[i+1] == 0:
            ans += 1
        if h[i] != 0:
            h[i] -= 1
    # 右端まで水やり
    if h[N-1] != 0:
        h[N-1] -= 1
        ans += 1
print(ans)

Measured memory_bytes: 3064
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N, T;
	
	cin >> N >> T;

	ll t[N];

	ll sum = 0;

	rep(i, N)
	{
		cin >> t[i];
		
		if (i == 0)
		{
			sum = T;
		}
		else
		{
			if (t[i] - t[i-1] < T)
			{
				sum = sum + (t[i] - t[i-1]);
			}
			else
			{
				sum = sum + T;
			}
		}
		

	}

	cout << sum << endl;
	
	return 0;
}


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

using namespace std;
#define ll long long

bool is_prime(int n) {
    for(int i = 2; i * i <= n; i++) {
        if(n % i == 0) return false;
    }
    return n != 1;
}

int main() {
    int Q;
    cin >> Q;
    int l, r;
    vector<bool> pf(1e5 + 1, false);
    for(int i = 1; i <= 1e5; i++) {
        if(is_prime(i) && is_prime((i + 1) / 2)) {
            pf[i] = true;
        }
    }
    vector<int> csum(1e5 + 1, 0);
    for(int i = 0; i <= 1e5; i++) {
        if(pf[i]) {
            csum[i + 1] = csum[i] + 1;
        } else {
            csum[i + 1] = csum[i];
        }
    }
    for(int i = 0; i < Q; i++) {
        cin >> l >> r;
        cout << csum[r + 1] - csum[l] << endl;
    }
    return 0;
}

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

int main() {
  int n;
  string s, s2;
  cin >> n >> s;
  string ans = "No";
  if (n % 2 == 0) {
    s2 = s.substr(0, n / 2);
    s2 += s2;
    if (s == s2) ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

int main(void)
{
    int n;
    string s, t;
    int i;

    cin >> n >> s >> t;

    rep(i, 0, n)
    {
        cout << s[i] << t[i];
    }

    cout << endl;
}

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

int main(){
	long long int n;
  	int m;
  	cin>>n>>m;
  	int a[m];
  	long long int sum=0;
  	for(int i=0;i<m;i++){
    	cin>>a[i];
      	sum+=a[i];
    }
  	
  	long long int d;
  	if(sum<=n){
    	d=n-sum;
    }else{
    	d=-1;
    }
  	cout<<d<<endl;
  	
  	return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>

int main(){
    int i,j;
    int a[10];
     int swap;
    for(i=0;i<10;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<3;i++)
    {for(j=0;j<9-i;j++){
        if(a[j]>a[j+1])
       { swap=a[j+1];
        a[j+1]=a[j];
        a[j]=swap;}
        }
    }
    printf("%d\n%d\n%d\n",a[9],a[8],a[7]);
    return 0;
}

Measured memory_bytes: 600
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,p,q = LI()
    c = IR(n)
    cp = [c[i]+p*i for i in range(n)]
    cp.sort(reverse=True)
    ans = 0
    s = 0
    for i in range(n):
        s += cp[i]
        ns = s+p*(i+1)*(i+2-(q+2*n))
        if ans < ns:
            ans = ns
    print(ans+p*(n*q+(n*(n-1))//2))
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 49604
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

bool isPrime(long long x){
    if(x == 2) return true;
    if(x%2 == 0 || x <= 2) return false;
    double r = sqrt(x);
    for(long long i=3; i<=r; i+=2) if(x%i == 0) return false;
    return true;
}

int main(){
    Init();
    vi num(100001, 0);

    for(ll i=1; i<100001; i+=2){
        if(i != 1) num[i] = num[i-2];
        if(isPrime(i)){
            if(isPrime((i+1)/2)){
                // どっちも素数
                num[i]++;
            }
        }
    }

    ll q; cin >> q;
    rep(i, q){
        ll l, r; cin >> l >> r;
        if(l != 1) l -= 2;
        cout << num[r] - num[l] << endl;
    }
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef long double ld;
#define A 1000000007
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define M 4000
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less_equal<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

int main() 
{
    FAST;
    ll n;
    cin>>n;
    string s;
    string ans[4]={"AC","WA","TLE","RE"};
    ll val[4]={0,0,0,0};
    for(int i=0;i<n;i++)
    {
        cin>>s;
        for(int j=0;j<4;j++)
            if(s==ans[j])
                val[j]++;
    }
    for(int i=0;i<4;i++)
        cout<<ans[i]<<" x "<<val[i]<<'\n';
    subt;
    return 0;
}

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

int main() {
    int n;
    int t[100010];
    int x[100010];
    int y[100010];
    string ans = "Yes";
    cin >> n;
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    for (int i=1; i<=n; i++) {
        cin >> t[i] >> x[i] >> y[i];
    }
    for (int i=0; i<n; i++) {
        int dt = t[i+1]-t[i];
        int dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        if (dist > dt || dt % 2 != dist % 2) ans = "No";
        else continue;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
char a[7];
int main()
{
	for(int i=1;i<=6;i++)
	cin>>a[i];
	if(a[3]==a[4]&&a[5]==a[6])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 998244353

int main() {
    int n;cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    if(a[0]!=0){
        cout << 0 << endl;
        return 0;
    }
    if(n==2){
        if(a[1]!=1){
        cout << 0 << endl;
        return 0;
        }
    }

    sort(a.begin(),a.end());
    vector<int> b(a[n-1]+1);
    for(int i = 1; i < n; i++) {
        b[a[i]]++;
    }
    if(b[0]>0){
        cout << 0 << endl;
        return 0;
    }

    ll ans=1;
    for(int i = 2; i < a[n-1]+1; i++) {
        for(int j = 0; j < b[i]; j++) {
            ans *= b[i-1];
            ans %= INF;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3940
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector< pair<int, int> > child(n);
  for (int i = 0; i < n; i++){
    int id, left, right;
    cin >> id >> left >> right;
    child[id] = make_pair(left, right);
  }
  vector<int> parent(n, -1);
  for (int i = 0; i < n; i++){
    if (child[i].first != -1){
      parent[child[i].first] = i;
    }
    if (child[i].second != -1){
      parent[child[i].second] = i;
    }
  }
  int root;
  for (int i = 0; i < n; i++){
    if (parent[i] == -1){
      root = i;
      break;
    }
  }
  vector<int> t(n);
  stack<int> S;
  cout << "Preorder" << endl;
  for (int i = 0; i < n; i++){
    t[i] = 0;
  }
  S.push(root);
  while (!S.empty()){
    int v = S.top();
    S.pop();
    if (t[v] == 0){
      cout << ' ' << v;
    }
    if (t[v] == 0){
      S.push(v);
      if (child[v].second != -1){
        S.push(child[v].second);
      }
      S.push(v);
      if (child[v].first != -1){
        S.push(child[v].first);
      }
    }
    t[v]++;
  }
  cout << endl;
  cout << "Inorder" << endl;
  for (int i = 0; i < n; i++){
    t[i] = 0;
  }
  S.push(root);
  while (!S.empty()){
    int v = S.top();
    S.pop();
    if (t[v] == 1){
      cout << ' ' << v;
    }
    if (t[v] == 0){
      S.push(v);
      if (child[v].second != -1){
        S.push(child[v].second);
      }
      S.push(v);
      if (child[v].first != -1){
        S.push(child[v].first);
      }
    }
    t[v]++;
  }
  cout << endl;
  cout << "Postorder" << endl;
  for (int i = 0; i < n; i++){
    t[i] = 0;
  }
  S.push(root);
  while (!S.empty()){
    int v = S.top();
    S.pop();
    if (t[v] == 2){
      cout << ' ' << v;
    }
    if (t[v] == 0){
      S.push(v);
      if (child[v].second != -1){
        S.push(child[v].second);
      }
      S.push(v);
      if (child[v].first != -1){
        S.push(child[v].first);
      }
    }
    t[v]++;
  }
  cout << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;

  int size1 = a.size()-1;
  int size2 = b.size()-1;
  int size3 = c.size()-1;

  if(a[size1] == b[0] && b[size2] == c[0]) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main {
  def main(args: Array[String]) {
    val Array(a, b, c) = readLine().split(" ").map(_.toInt)
    var i = 0
    (a to b).foreach(j => if(c % j == 0) i += 1)

    println(i)
  }
}

Measured memory_bytes: 44088
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N,M;
  cin>>N>>M;
  vector<int>P(M),Y(M);
  for(int i=0;i<M;i++){
    cin>>P[i]>>Y[i];
  }
  vector<vector<int>>city(N+1);
  for(int i=0;i<M;i++){
   city[P[i]].push_back(Y[i]);
  }
  for(int i=0;i<N+1;i++){
    sort(city[i].begin(),city[i].end());
  }
  for(int i=0;i<M;i++){
    printf("%06d",P[i]);
    int d=lower_bound(city[P[i]].begin(),city[P[i]].end(),Y[i])-city[P[i]].begin();
    printf("%06d\n",d+1);
  }
  return 0;
}

Measured memory_bytes: 9432
/**Bismillahir Rahmanir Rahim.**/
/*
         Md.Fagun Molla
         18ICTCSE006
         BSMRSTU(SHIICT)
*/
#include <bits/stdc++.h>
using namespace std;


#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  ll               long long
#define  vi               std::vector<int>
#define  pb               push_back
#define  MAX              100007
#define  End              return 0;
#define  pi               acos(-1)

map<string,int>v;
int main () {
    ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    int aa[n];
    int s=0;
    for(int i=0; i<n; i++){
        cin>>aa[i];
        s+=aa[i];
    }
    int ans=0;
    for(int i=0; i<n; i++)
    if(aa[i]*m*4>=s) ans++;
    if(ans>=m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    End
}
/* pray for me
Do before die
*/


Measured memory_bytes: 256
// C - Back and Forth

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	string ans = "";

	for (int i=sx; i<tx; i++) {
		ans += "R";
	}

	for (int i=sy; i<ty; i++) {
		ans += "U";
	}

	ans += "R";

	for (int i=ty; i>sy-1; i--) {
		ans += "D";
	}

	for (int i=tx+1; i>sx; i--) {
		ans += "L";
	}

	ans += "U";

	for (int i=sy; i<ty; i++) {
		ans += "U";
	}

	for (int i=sx; i<tx; i++) {
		ans += "R";
	}

	ans += "U";

	for (int i=tx; i>sx-1; i--) {
		ans += "L";
	}

	for (int i=ty+1; i>sy; i--) {
		ans += "D";
	}

	ans += "R";

	cout << ans << endl;

	return 0;
}

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

int field[21][21];
int w, h, res;
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

void dfs(int x, int y, int n) {
	if (n >= res) return;
	for (int i = 0; i < 4; i++) {
		int tx = x + dir[i][0];
		int ty = y + dir[i][1];
		
		if (tx < 0 || tx >= w || ty < 0 || ty >= h) continue;
		if (field[ty][tx] == 1) continue;
		if (field[ty][tx] == 3) { res = n; return; }
		
		while (true) {
			tx += dir[i][0];
			ty += dir[i][1];
			if (tx < 0 || tx >= w || ty < 0 || ty >= h) break;
			if (field[ty][tx] == 3) { res = n; return; }
			if (field[ty][tx] == 1) {
				field[ty][tx] = 0;
				dfs(tx - dir[i][0], ty - dir[i][1], n + 1);
				field[ty][tx] = 1;
				break;
			}
		}
	}
}

int main()
{	
	int x, y;
	while (cin >> w >> h, w | h) {
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> field[i][j];
				if (field[i][j] == 2) {
					x = j;
					y = i;
				}
			}
		}
		res = 11;
		dfs(x ,y, 1);
		cout << (res > 10 ? -1 : res) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
const int mod=1e9+7; 
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	//MessageBox(GetForegroundWindow(),"标题","内容",MB_YESNO);
	int n;
	cin>>n;
	int a[n+1],f[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]%=mod;
		f[i]=a[i];
	}
	for(int i=n-1;i>=1;i--){
		f[i]+=f[i+1];
		f[i]%=mod;
	}
	int sum=0;
	for(int i=1;i<=n-1;i++){
		int s=a[i]*f[i+1];
		s%=mod;
		sum+=s;
		sum%=mod;
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 6732
#include<stdio.h>

int main(void)
{
	int S,h,m,s;
	
	scanf("%d",&S);
	
	h=S/3600;
	m=S/60-h*60;
	s=S-h*3600-m*60;
	
	printf("%d:%d:%d\n",h,m,s);
	
	return 0;
}


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

int main(){
  int r,c,i,j,sumyoko=0,sumtate=0,sumzen=0;

  cin >> r >> c;
  int data[r][c];

  for ( i = 0; i < r ; i++){
    sumyoko = 0;
    for ( j = 0 ; j < c ; j++){
      cin >> data[i][j] ;
      sumyoko = sumyoko + data[i][j];
      sumzen = sumzen + data[i][j];
      cout << data[i][j] << " " ;
    }
    cout << sumyoko <<"\n";
  }

  for ( j = 0 ; j < c ; j++){
    sumtate = 0;
    for( i = 0  ; i < r ; i++){
      sumtate = sumtate + data[i][j];
    }
      cout << sumtate << " " ;
  }

  cout << sumzen <<endl;

 
  return 0;
}

Measured memory_bytes: 1196
def resolve():
    '''
    code here
    '''
    A, B = [int(item) for item in input().split()]

    res = 0
    for i in range(A, B+1):
        temp_num_str = str(i)
        for j in range(len(temp_num_str)//2):
            if temp_num_str[j] != temp_num_str[-1 * (j+1)]:
                break
        else:
            res += 1

    print(res)
if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9200