akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) ll aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) string aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007



int main()
{

 int ans = 0;

int N;
string S;
    cin >> N >> S;

fx(N){
 if(S.at(x)=='.'){ans++;} 
}
    int res=ans;
  fx(N){
   if(S.at(x)=='.'){res--;} else{res++;}
    ans=min(ans,res)
;  }
    
    ce(ans)
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main ()
{
    fastio
    lli n , x , sum = 0 , cnt = 0 ;
    cin >> n >> x ; n ++ ;
    lli a[n] ;
    loop(n)
    {
        cin >> a[i] ;
        sum += a[i] ;
        cnt ++ ;
        if (sum > x)
            break ;
    }
    cout << cnt << endl ;


    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
diff = sorted([abs(x[i+1] - x[i]) for i in range(len(x)-1)])
print(abs(x[-1] - x[0]) - sum(diff[-1:-n:-1])) if n < m else print(0)


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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N, K, S;
signed main() {
    cin >> N >> K >> S;
    int x = S + 1;
    if (S == 1e9) {
        x = 1;
    }
    rep(i, K) { cout << S << " "; }
    rep(i, N - K) { cout << x << " "; }
    cout << endl;
}


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

#define INF 1e9
#define LLINF 1e18
#define pi 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+" << endl;
    }
    else if (a * b == 15) {
        cout << "*" << endl;
    }
    else cout << "x" << endl;
}

Measured memory_bytes: 3628
from math import gcd

def gcd3(a,b,c):


	r = gcd(a,b)
	 

	return gcd(r,c)
a = input()
i = int(a)
s = sum( [gcd3(a,b,c) for a in range(1,i+1) for b in range(1,i+1) for c in range(1,i+1)])
print(s)


Measured memory_bytes: 71516
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long ans=1;
  vector<long long> t(n);
  for(int i=0;i<n;i++){
	cin>>t[i];
    ans=lcm(ans,t[i]);
  }
  cout<<ans<<'\n';
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

#define debug(x) cout << #x << ": " << x << endl;
#define ll long long

int N;
ll A[1<<20], B[1<<20], ans = 0;
queue<int> q;

bool satisfy(int i) {
  int a = B[(i - 1 + N) % N];
  int b = B[i];
  int c = B[(i + 1) % N];

  return (B[i] > A[i]) && (b > (a + c));
}

void perform_ops(int i) {
  int a = B[(i - 1 + N) % N];
  int b = B[i];
  int c = B[(i + 1) % N];

  ll n = (b - A[i]) / (a + c);
  ans += n;
  B[i] -= n * (a + c);
}

/*
b - n*(a + c) >= A[i]
n <= (b- A[i])/(a+c)

*/



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

  cin >> N;
  for(int i = 0;i < N;i++) cin >> A[i];
  for(int i = 0;i < N;i++) cin >> B[i];

  for(int i = 0;i < N;i++) {
    if(B[i] < A[i]) {
      cout << "-1" << endl;
      return 0;
    }

    if(satisfy(i)) {
      q.push(i);
    }
  }

  while(! q.empty()) {
    int i = q.front();
    q.pop();

    perform_ops(i);
    if(satisfy(i)) {
      cout << "-1" << endl;
      return 0;
    }

    if(satisfy((i - 1 + N) % N)) {
      q.push((i - 1 + N) % N);
    }
    if(satisfy((i + 1) % N)) {
      q.push((i + 1) % N);
    }
  }

  for(int i = 0;i < N;i++) {
    if(B[i] != A[i]) {
      cout << "-1" << endl;
      return 0;
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << (h2 * 60 + m2) -(h1 * 60 + m1) - k << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

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

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	const ld pi = acos(-1);
	ll a, b, h, m;
	cin >> a >> b >> h >> m;
	swap(a, b);
	ld ang1 = 1.0 * m * (2 * pi) / (60.0);
	ld ang2 = 1.0 * (h * 60.0 + m) * (2 * pi) / (12 * 60.0);
	ld x1 = sin(ang1) * 1.0 * a, y1 = cos(ang1) * 1.0 * a, x2 = sin(ang2) * 1.0 * b, y2 = cos(ang2) * 1.0 * b;
	cout << sqrtl((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) << endl;
}

Measured memory_bytes: 4176
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		String Sint;
		char Cint;
        int Int=0;
		StringBuffer sb = new StringBuffer();
		Scanner sc = new Scanner(System.in);
		while(true) {
			Sint=sc.nextLine();
			if(Sint.equals("0"))
				break;
			for (int i = 0; i < Sint.length(); i++) {
				Cint=Sint.charAt(i);
				Int += Character.getNumericValue(Cint);
			}
					System.out.println(Int);
					Int=0;
		}
	}
}



Measured memory_bytes: 26612
n=int(input())
d,x=map(int,input().split())

cnt=0

for i in range (n):
	a=int(input())
	cnt=cnt+1
	for j in range (1,d):
		if ((j*a)+1)<=d:
			cnt=cnt+1

		
			
    		
print(cnt+x)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 998244353
using namespace std;
void dfs(int now, vector<vector<int>> &edge, vector<vector<int>> &dp) {
    for(auto next : edge[now]) {
        bool flag = false;
        if(dp[0][next] == -1 && dp[1][now] == 1) {
            dp[0][next] = 1;
            flag = true;
        }
        if(dp[1][next] == -1 && dp[0][now] == 1) {
            dp[1][next] = 1;
            flag = true;
        }
        if(flag) {
            dfs(next, edge, dp);
        }
    }
}
int main() {
    ll n, m;
    cin >> n >> m;
    vector<vector<int>> edge(n);
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    vector<vector<int>> dp(2, vector<int>(n, -1));
    dp[0][0] = 1;
    dfs(0, edge, dp);
    ll ans = 0;
    for(int i = 0; i < n; i++) {
        if(dp[0][i] == 1 && dp[1][i] == 1) {
            cout << n * (n - 1) / 2 - m << endl;
            return 0;
        }
    }
    ll s = count(all(dp[0]), 1);
    ll t = count(all(dp[1]), 1);
    cout << s * t - m << endl;
}

Measured memory_bytes: 7072
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384626433832795

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int partition(vi& a) {
	int x = a.back();
	int i = -1;
	for (int j = 0; j < a.size(); j++) {
		if (a[j] <= x) {
			i++;
			swap(a[i], a[j]);
		}
	}
	//swap(a[i + 1], a[a.size() - 1]);
	return i + 1;
}

int main() {
	int n,in;
	vi a;
	cin >> n;
	rep(i, n) {
		cin >> in;
		a.push_back(in);
	}
	int p=partition(a);
	rep(i, n) {
		if (i != p - 1)cout << a[i];
		else cout << "[" << a[i] << "]";
		cout << (i != n - 1 ? " " : "");
	}
	cout << endl;
}


Measured memory_bytes: 3392
P=10**9+7
inv2=(1+P)//2
def exp(a,k):
    if k==0:
        return 1
    elif k%2==0:
        return (exp(a*a,k//2))%P
    else:
        return (a*exp(a*a,k//2))%P
D=dict()
def f(N):
    if N in D:
        return D[N]
    if N<=1:
        D[N]=N
        return N
    i=0
    while(1):
        if 2**i<=N<2**(i+1):
            break
        i+=1
    if N==2**i:
        D[N]=((1+exp(3,i))*inv2)%P
        return D[N]
    D[N]=(f(N-2**i)-f(2**(i+1)-N-1)+exp(3,i))%P
    return D[N]
print(f(int(input())+1))

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

int main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    ll n;
    cin>>n;
    ll res[n],t;
    for(auto i=0;i<n;++i)
    {
        cin>>t;
        res[t-1]=i;
    }
    for(auto i=0;i<n;++i)
    {
        cout<<res[i]+1<<" ";
    }
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>

using namespace std;

char str[8][9];

bool check(int x, int y) {
	return x >= 0 && x < 8 && y >= 0 && y < 8;
}

void dfs(int x, int y){
	str[y][x] = '0';
	for (int i = -3; i <= 3; i++){
		int nx = x, ny = y + i;
		if (!check(nx, ny) || str[ny][nx] == '0') continue;
		 dfs(nx, ny);
	}
		
	for (int i = -3; i <= 3; i++) {
		int nx = x + i, ny = y;
		if (!check(nx, ny) || str[ny][nx] == '0') continue;
		dfs(nx, ny);
	}
}

int main(){
	int n, x, y;
	scanf("%d\n", &n);
	for (int i = 0; i < n; i++){
		for (int j = 0; j < 8; j++){
			scanf("%s", &str[j]);
		}
		scanf("%d%d", &x, &y);
		dfs(x-1, y-1);
		printf("Data %d:\n", i+1);
		for (int j = 0; j < 8; j++){
			puts(str[j]);
		}
	}
	return 0;
}

Measured memory_bytes: 1196
A = int(input())
B = int(input())
C = int(input())
X = int(input())
con = 0
for i in range(A + 1):
  for j in range(B + 1):
    for k in range(C + 1):
      if 500 * i + 100 * j + 50 * k == X:
        con += 1
print(con)
    
    

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

int main(){

  ll N=0;
  cin>>N;
  
  cout<<N*(N-1)/2<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector> 
#include <math.h> 
#include <algorithm>
#include <map>
using namespace std;
int main(void){
    int n, m; cin >> n >> m;
    int i = 0;
    int max = 0;
    int min = 100000000;
    while (i < m) {
        int a, b;
        cin >> a >> b;
        if (a > max) max = a;
        if (b < min) min = b;
        i++;
    }
    if (min - max < 0) cout << 0 << endl;
    else cout << min - max + 1 << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
ll dp[35]; 
ll DP(ll m){
    dp[0] = 1, dp[1] = 2, dp[2] = 4;
    rep(i, 31){
        dp[i + 3] = dp[i] + dp[i + 1] + dp[i + 2];
    }
    return dp[m - 1];
}

int main(){ 
    while(true){
        int n; cin >> n;
        if(n == 0){
            break;
        }
        int ans = (DP(n) / 10) / 365 + 1;
        cout << ans << endl;
    }
}



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

#define WHITE 0
#define GRAY 1
#define BLACK 2

int G[101][101];
int color[101];
int n;
int d[101], f[101], t;

void search_loop(int i)
{
	int next;
	d[i] = ++t;
	color[i] = GRAY;

	for(next = 1; next <= n; next++){
		if(i == next && G[i][i] > 0) break;
		if(G[i][next] > 0 && color[next] == WHITE){
			search_loop(next);
		}
	}
	f[i] = ++t;
	color[i] = BLACK;

	return;
}

void dfs()
{
	int i;
	for(i = 1; i <= n; i++) color[i] = WHITE;  // initialize.

	t = 0;
	for(i = 1; i <= n; i++){
		if(color[i] == WHITE) search_loop(i);
	}
	for(i = 1; i <= n; i++){
		cout << i << " " << d[i] << " " << f[i] << endl;
	}
	return ;
}

int main()
{
	int i, j, k, e;
	cin >> n;
	for(i = 1; i <= n; i++){
		for(j = 1; j <= n; j++){
			G[i][j] = 0;
		}
	}
	do{
		cin >> i >> e;
		for(j = 1; j <= e; j++){
			cin >> k;
			G[i][k] = 1;
		}
	}while(i < n);

	dfs();

	cin >> n;

	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
#include <stack>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cassert>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    int n,m,k;
    cin >> n >> m >> k;
    if(k%n==0 || k%m==0){
        cout << "Yes" << endl;
        return 0;
    }
    rep(i,n){
        rep(j,m){
            if(i*j+(n-i)*(m-j)==k){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
n = int(input())
p = []
for _ in range(n):
  x,y = map(int,input().split())
  p += [(0, x, y)]
for _ in range(n):
  x,y = map(int,input().split())
  p += [(1, x, y)]
  
p = sorted(p, key = lambda x:x[1])
ys = set()
ans = 0
for i in range(2*n):
  if p[i][0] == 0:
    ys.add(p[i][2])
  else:
    yr = p[i][2]
    yb = -1
    for y in list(ys):
      if y < yr:
        yb = max(yb, y)
    if yb != -1:
      ans += 1
      ys.remove(yb)

print(ans)      
      

Measured memory_bytes: 3064
# ARC095C - Many Medians (ABC094C)
def main():
    n = int(input())
    x = tuple(map(int, input().rstrip().split()))
    l, h = sorted(x)[n // 2 - 1 : n // 2 + 1]
    for i in x:
        if i <= l:
            print(h)
        else:
            print(l)


if __name__ == "__main__":
    main()

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  REP(i,10){
    if(i==0) continue;
    if(n%i==0 && 1<=n/i && n/i<=9){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int freq[300];
string s;
int l,ch;

int main() {
	IO
	string s;
	cin>>s;
	char q='\0';
	char w=q;
	int sz= s.size();
	for (int i=0;i<sz;i++)
    {
		if (s[i]==q)
		{
			cout<<(i)<<" "<<(i+1)<<endl;
			return 0;
		}
		if (s[i]==w)
		{
			cout<<(i-1)<<" "<<(i+1)<<endl;
			return 0;
		}
		w=q;
		q=s[i];
	}
	cout<<"-1 -1"<<endl;
	return 0;
}


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

ll solve() {
    ll N;
    cin >> N;
    ll num = 0, p, s = 0;
    for ( int i = 1; i <= N; i++ ) {
        cin >> p;
        if ( s > 0 ) {
            s = 0;
            continue;
        }
        if ( p == i ) {
            num++;
            s++;
        }
    }
    return num;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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


int main(){
    string s1,s2;
    cin>>s1;
    cin>>s2;
    int l1=s1.length();
    string temp="";
    for(int i=0;i<l1;i++){
        temp=temp+s1[l1-1];
        for(int j=0;j<l1-1;j++)
        {
            temp=temp+s1[j];
        }
        s1=temp;
        if(s1==s2)
        {
            cout<<"Yes";
            return 0;
        }
        temp="";
        
    }
   // cout<<s1<<endl;
  //  cout<<s2<<endl;
    cout<<"No";
    return 0;
}


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

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

int main()
{
    int A, P;
    cin >> A >> P;
    cout << (3 * A + P) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define all(x) x.begin(), x.end()
#define VI vector<int>
#define VS vector<string>
#define ll long long
#define INF 2e9
#define fir first
#define sec second
using namespace std;

void Main() {
    int N;
    cin >> N;
    VI D(N);
    rep(i, 0, N) { cin >> D[i]; }
    sort(all(D));  // 難易度昇順に並び替える。
    // ARCの一番簡単な問題とABCの一番難しい問題の差がKとなる。
    int diff = D[N / 2] - D[N / 2 - 1];
    if (diff > 0) {
        cout << diff << endl;
    } else {
        cout << 0 << endl;
    }
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15) << endl;
    Main();
    return 0;
}

Measured memory_bytes: 640
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

long long A,B;
bool ok(long long key,long long index){
    string S = to_string(index);
    long long nagasa = S.size();
    if(index*A+nagasa*B > key) return true;
    else if(index*A+nagasa*B <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    long long X;cin >> X;
    long long now = 100;

    for(int i = 0;i<1000000;i++){
        if(now >= X){
            cout << i << endl;
            return 0;
        }
        now *= 1.01;
    }

    // PLEASE GIVE ME THE "ACCEPTED" !
}


Measured memory_bytes: 3640
def resolve():
    X, Y, Z, K = list(map(int, input().split()))
    A = sorted(list(map(int, input().split())), reverse=True)
    B = sorted(list(map(int, input().split())), reverse=True)
    C = sorted(list(map(int, input().split())), reverse=True)

    ABC = []
    for i in range(X):
        for j in range(Y):
            for k in range(Z):
                if ((i+1)*(j+1)*(k+1) > K):
                    break
                ABC.append(A[i]+B[j]+C[k])
    ABC = sorted(ABC, reverse=True)
    [print(ABC[i]) for i in range(K)]

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 47748
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr const int INF  = 0x3f3f3f3f;
constexpr const i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr const int MOD  = int(1e9) + 7;
// }}}

// Library {{{
// }}}


signed main()
{
    int N;
    priority_queue<pii, vector<pii>, greater<pii> > pq;

    cin >> N;
    rep(i, 0, N) {
        i64 a, b;
        cin >> a >> b;
        pq.emplace(b, a);
    }

    bool ok = true;

    i64 now = 0;
    while(pq.size()) {
        auto p = pq.top(); pq.pop();
        auto limit = p.first;
        auto len = p.second;

        now += len;
        if (now > limit) {
            ok = false;
            break;
        }
    }

    cout << ((ok) ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,k;
    cin>>n>>k;
    vector<int> p(n),c(n);
    for(int i=0;i<n;i++) {
        cin>>p[i];
        p[i]--;
    }
    for(int i=0;i<n;i++) {
        cin>>c[i];
    }
    long long ans=-1e18;
    for(int i=0;i<n;i++) {
        int v=i;
        long long cs=0;
        int cc=0;
        while(1) {
            cc++;
            cs+=c[v];
            v=p[v];
            if (v==i) {
                break;
            }
        }
        long long path=0;
        int cnt=0;
        while(1) {
            cnt++;
            path+=c[v];
            if (cnt>k) {
                break;
            }
            int num=(k-cnt)/cc;
            long long sce=path+max(0ll,cs)*num;
            ans=max(ans,sce);
            v=p[v];
            if(v==i) {
                break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int n, x[100010], l, q;
int dp[20][100010];

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	cin >> n;
	rep(i, n) cin >> x[i];
	cin >> l >> q;
	
	rep(i, n){
		int p = upper_bound(x + i, x + n, x[i] + l) - x;
		dp[0][i] = p - 1;
	}
	rep(i, 19) rep(j, n) dp[i + 1][j] = dp[i][dp[i][j]];
	
	while(q--){
		int a, b, ans = 0; cin >> a >> b; a--; b--;
		if(a >= b) swap(a, b);
		for(int i = 19; i >= 0; i--) if(dp[i][a] < b) ans += 1 << i, a = dp[i][a];
		
		cout << ans + 1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 9088
#include <stdio.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))

int
main(int argc, char *argv[])
{
  int n, a[2][100];
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d", &a[0][i]);
  for(int i = 0; i < n; i++) scanf("%d", &a[1][i]);

  int ca; int max = 0;

for(int i = 0; i < n; i++){
ca = 0;
for(int j = 0; j <= i; j++) ca += a[0][j];
for(int j = i; j < n; j++) ca += a[1][j];
max = Max(max, ca);
}

printf("%d\n", max);

return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,n) for(ll i=0;i<n;i++)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define all(v) v.begin(),v.end()
#define mod 1000000007
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
	// cin>>t;
	while(t--){
		int n,m;
		cin>>n>>m;
		pair<int,int> arr[n];
		forn(i,n) arr[i] = {0,0};
		forn(i,m){
			int x;string y;
			cin>>x>>y;
			x--;
			if(y=="AC"){
				arr[x].second = 1;
			}
			else{
				if(arr[x].second!=1)
					arr[x].first += 1;
			}
		}
		int cnt1 = 0,cnt2 = 0;
		forn(i,n){
			if(arr[i].second){
				cnt1++;
				cnt2 += arr[i].first;
			}
		}
		cout<<cnt1<<" "<<cnt2<<"\n";
	}
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val (e, y) = readLine()!!.split(" ").map { it.toInt() }
    println(
        when (e) {
            0 -> toWareki(y)
            1 -> 1868 + y - 1
            2 -> 1912 + y - 1
            3 -> 1926 + y - 1
            4 -> 1989 + y - 1
            else -> throw IllegalArgumentException()
        }
    )
}

fun toWareki(y: Int) = when (y) {
    in 1868..1911 -> "M${y - 1868 + 1}"
    in 1912..1925 -> "T${y - 1912 + 1}"
    in 1926..1988 -> "S${y - 1926 + 1}"
    in 1989..2016 -> "H${y - 1989 + 1}"
    else -> throw IllegalArgumentException()
}


Measured memory_bytes: 33692
n = int(input())
nl = list(range(1,n+1))
cl = [0]*(n+1)
mc = 0

for i in range(n):
  while(1):
    if nl[i]%2 == 0 and nl[i] != 0:
      cl[i+1]+=1
      nl[i]/=2
    else:
      if cl[i+1] > cl[mc]:
        mc = i+1
      break
      
print(mc if mc != 0 else 1)

Measured memory_bytes: 3064
//package com.company;

import java.io.*;
import java.util.*;

public class Main {
    public static class Task {

        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            int H = sc.nextInt();
            int W = sc.nextInt();
            int A = sc.nextInt();
            int B = sc.nextInt();
            for (int i = 0; i < B; i++) {
                for (int j = 0; j < A; j++) {
                    pw.print("0");
                }
                for (int j = A; j < W; j++) {
                    pw.print("1");
                }
                pw.println();
            }
            for (int i = B; i < H; i++) {
                for (int j = 0; j < A; j++) {
                    pw.print("1");
                }
                for (int j = A; j < W; j++) {
                    pw.print("0");
                }
                pw.println();
            }
        }
    }

    static long TIME_START, TIME_END;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("input"));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("output"));

        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
        System.err.println("Memory increased: " + (usedMemoryAfter - usedMemoryBefore) / 1000000);
        System.err.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader s) throws FileNotFoundException {
            br = new BufferedReader(s);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}


Measured memory_bytes: 23936
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k;
  double ans,a;
  vector<double> p(n);
  cin >> n >> k;
  for(int i =0;i<n;i++)cin >> p.at(i);
  for(int i =0;i<=n-k;i++){
    if(i==0){
      for(int j=0;j<k;j++)a+=(p.at(j)-1)/2+1;
    }else{
      a=a-((p.at(i-1)-1)/2)+((p.at(i+k-1)-1)/2);
    };
    if(ans<a) ans=a;
  };
  cout << fixed << setprecision(15);
  cout <<ans <<endl;
}

Measured memory_bytes: 33024
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

ll mod=1e9+7;
ll dp[70][300300][2];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<ll> a(n),b(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	b=a;
	ll sum=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<70;j++){
			dp[j][i][a[i]%2]++;
			a[i]/=2;
		}
	}
	for(int i=1;i<n;i++){
		for(ll j=0;j<70;j++){
			if(b[i]%2){
				sum+=(1LL<<j)%mod*dp[j][i-1][0]%mod;
			}
			else{
				sum+=(1LL<<j)%mod*dp[j][i-1][1]%mod;
			}
			sum%=mod;
			(dp[j][i][0]+=dp[j][i-1][0])%=mod;
			(dp[j][i][1]+=dp[j][i-1][1])%=mod;
			b[i]/=2;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 333440
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(a[k-1])

Measured memory_bytes: 3316
/**
 * Created by hiramekun at 21:33 on 2019-11-12.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string s;
    cin >> s;
    ll n = s.size();
    vl ltor(n + 1), rtol(n + 1);
    rep(i, n) {
        if (s[i] == '<') ltor[i + 1] = ltor[i] + 1;
        else ltor[i + 1] = 0;
    }
    repr(i, n) {
        if (s[i] == '>') rtol[i] = rtol[i + 1] + 1;
        else rtol[i] = 0;
    }
    ll ans = 0;
    rep(i, n+1) ans += max(rtol[i], ltor[i]);
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


Measured memory_bytes: 8708
a, b = map(int, input().split())
a, b = min(a, b), max(a, b)
def f(a):
    if a % 2 == 0:
        return a ^ (a+1)//2%2
    else:
        return (a+1)//2%2
    
print(f(b) ^ f(a-1))


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  string a,b,c;cin >> a >> b >> c;
  int count = 0;
  rep(i,N){
    if(a[i] == b[i] && b[i] == c[i])continue;
    else if(a[i] == b[i] || b[i] == c[i] || c[i] == a[i])++count;
    else count += 2;
  }
  cout << count << endl;
  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  
  int64_t sum = 0;
  for(int i = 1; i <= n; i++){
    if( (i % 3 != 0) && (i % 5 != 0) ){
      sum += i;
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 3568
#include <stdio.h>

#define L 3

int main(void) {
  int A[L][L];
  int i,j,k;
  int N;
  int b[10];
  int sum;
  int bingo = 0;

  // ビンゴカード
  for (i=0; i<L; i++) {
    for (j=0; j<L; j++) {
      scanf("%d", &A[i][j]);
    }
  }

  // 数字選び
  scanf("%d", &N);
  for (k=0; k<N; k++) {
    scanf("%d", &b[k]);
  }

  // 印付け
  for (i=0; i<L; i++) {
    for (j=0; j<L; j++) {
      for (k=0; k<N; k++) {
        if (A[i][j] == b[k]) {
          A[i][j] = 0;
          break;
        }
      }
    }
  }

  // ビンゴ確認
  // for (i=0; i<L; i++) {
  //   for (j=0; j<L; j++) {
  //     printf("%d ", A[i][j]);
  //   }
  //   printf("\n");
  // }
  // printf("\n");

  for (i=0; i<L; i++) {
    sum = 0;
    for (j=0; j<L; j++) {
      sum += A[i][j];
    }
    // printf("sum: %d\n", sum);
    if (sum == 0) bingo = 1;
  }
  for (j=0; j<L; j++) {
    sum = 0;
    for (i=0; i<L; i++) {
      sum += A[i][j];
    }
    if (sum == 0) bingo = 1;
  }
  if (A[0][0] + A[1][1] + A[2][2] == 0) bingo = 1;
  if (A[0][2] + A[1][1] + A[2][0] == 0) bingo = 1;

  if (bingo) printf("Yes");
  else printf("No");
  printf("\n");
  return (0);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans0, ans1;
int A[3][MAXN], B[MAXN];
bool mark[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n;
	for (int j:{0, 1, 2}) for (int i=0; i<n; i++) cin>>A[j][i], A[j][i]--;
	for (int i=0; i<n; i++){
		if (A[1][i]%3!=1) kill("No")
		int a=A[0][i]/3, b=A[1][i]/3, c=A[2][i]/3;
		if (a!=b || a!=c) kill("No")
		if (A[0][i]%3){
			if (i&1) ans0^=1;
			else ans1^=1;
		}
		B[i]=a;
		if (B[i]%2!=i%2) kill("No")
	}
	for (int i=0; i<n; i++) if (!mark[i]){
		int x=i;
		while (!mark[x]){
			mark[x]=1;
			x=B[x];
		}
		if (i&1) ans1^=1;
		else ans0^=1;
	}
	if ((n+1)/2%2) ans0^=1;
	if (n/2%2) ans1^=1;
	if (ans0 || ans1) kill("No")
	kill("Yes")
	
	return 0;
}


Measured memory_bytes: 5292
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		int count1 = 0,count2 = 0;
		for( int i=0; i<S.length(); i++ ){
			char ch = S.charAt(i);
			if( i%2==0 ){
				if( ch=='0' ){
					count1++;
				}else{
					count2++;
				}
			}else{
				if( ch=='1' ){
					count1++;
				}else{
					count2++;
				}
			}
		}
		System.out.println(Math.min(count1,count2));
	}
}


Measured memory_bytes: 26296
a = input()
b = input()
c = "No"
for i in range(0,len(a)):
    if len(b) > len(a[i:i+len(b)]):
        n = len(b) - len(a[i:i+len(b)])
        if a[i:i+len(b)] + a[0:n] == b:
            c = "Yes"
    else:
        if a[i:i+len(b)] == b:
            c ="Yes"
print(c)

Measured memory_bytes: 7476
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		int N=sc.nextInt();
		long sum=0;
		long[] A=new long[N];
		for (int i=0;i<N;++i) {
			A[i]=sc.nextLong();
			sum^=A[i];
		}
		PrintWriter pw=new PrintWriter(System.out);
		for (int i=0;i<N;++i) {
			pw.print((A[i]^sum)+(i==N-1?"\n":" "));
		}
		pw.flush();
	}

	void tr(Object...o) {System.out.println(Arrays.deepToString(o));}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
        	ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    
    public double nextDouble() { return Double.parseDouble(next());}
}


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

using namespace std;

#define endl '\n'

int main(){

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

  int n,m,k;

  cin >> n >> m >> k;

  vector <long long> prefA(n+1,0);
  vector <long long> prefB(m+1,0);
  
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    prefA[i+1] = prefA[i] + x; 
  }
  
  for(int i=0;i<m;i++){
    int x;
    cin >> x;
    prefB[i+1] = prefB[i] + x; 
  }

  int ans = 0;

  for(int i=0;i<=n;i++){
    if(k < prefA[i])
      continue;
    
    long long rest = k-prefA[i];
    int j = upper_bound(prefB.begin(),prefB.end(),rest) - prefB.begin()-1;

    ans = max(ans,i+j);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6324