akhauriyash/Code-Regression huggingface dataset:
from sys import stdin

N, M = [int(x) for x in stdin.readline().rstrip().split()]
D = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]
for d in D:
    if d[0] > d[1]:
        d[0], d[1] = d[1], d[0]

D.sort(key=lambda x: (x[0], x[1]))
left = -1
right = N
ans = 0

for d in D:
    left = max(d[0], left)
    right = min(d[1], right)
    if left >= right:
        ans += 1
        left = d[0]
        right = d[1]

print(ans + 1)


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

int main(){
  int H,W;
  cin >> H >> W;
  char S[H][W];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>S[i][j];
    }
  }
  
  for(int i=0;i<W+2;i++){
    cout<<"#";
  }
  cout<<endl;
    

  for(int i=0;i<H;i++){
        cout<<"#";
    for(int j=0;j<W;j++){
    cout<<S[i][j];
    }
    cout<<"#"<<endl;
  }

  for(int i=0;i<W+2;i++){
    cout<<"#";
  }
  cout<<endl;
  return 0;
}

      

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#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) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;
const char ENDL = '\n';

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    VI a(n), b(n);
    REP(i, n - 1) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    VVI edge(n, VI());
    REP(i, n) {
        edge[a[i]].PB(b[i]);
        edge[b[i]].PB(a[i]);
    }


    int ans = 0;

    if (k % 2 == 0) {
        k /= 2;
        REP(i, n) {
            VI c(n, -1);
            int d = 1;

            queue<int> q;
            q.push(i);
            c[i] = 0;
            while (!q.empty()) {
                int t = q.front();
                q.pop();
                if (c[t] < k) {
                    for (auto j : edge[t]) {
                        if (c[j] < 0) {
                            c[j] = c[t] + 1;
                            q.push(j);
                            d++;
                        }
                    }
                }
            }
            ans = max(ans, d);
        }
    }else{
        k /= 2;
        REP(i, n-1) {
            VI c(n, -1);
            int d = 2;

            queue<int> q;
            q.push(a[i]);
            q.push(b[i]);
            c[a[i]] = 0;
            c[b[i]] = 0;
            while (!q.empty()) {
                int t = q.front();
                q.pop();
                if (c[t] < k) {
                    for (auto j : edge[t]) {
                        if (c[j] < 0) {
                            c[j] = c[t] + 1;
                            q.push(j);
                            d++;
                        }
                    }
                }
            }
            ans = max(ans, d);
        }
    }

    cout << n - ans << ENDL;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

bool OI(string &s,int loc){
	int len = s.size();
	if(loc+1<len && loc+2<len && s[loc+1]=='O' && s[loc+2]=='I') return true;
	return false;
}

int main(void){
	string s;
	while(cin>>s){
		int count1=0,flag1=0;
		for(int i=0;i<s.size();++i){
			if(s[i]=='J' && OI(s,i)) ++count1;
		}
		cout<<count1<<endl;

		int count2=0,flag2=0;
		for(int i=0;i<s.size();++i){
			if(s[i]=='I' && OI(s,i)) ++count2;
		}
		cout<<count2<<endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
   
int main(){
  int m,f,b;
  cin>>m>>f>>b;
  if(b-m>f){
    cout<<"NA"<<endl;
  }else{
    cout<< max(b-m,0) <<endl;
  }
  return 0;
}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if ( a == b && b == c ) cout << 1 << endl;
  else if ( a != b && b != c && c != a) cout << 3 << endl;
  else cout << 2 << endl;
  return 0;
}


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

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

int main() {
  int n;
  cin >> n;
  map<P, int> mp;
  auto f = [&](int x) {
    int a = x % 10;
    int b = 0;
    while (x) {
      b = x;
      x /= 10;
    }
    return P(a, b);
  };
  for (int i = 1; i <= n; i++) {
    P p = f(i);
    mp[p]++;
  }
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    P p = f(i);
    P q(p.second, p.first);
    ans += mp[q];
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		(1000000)
#define Rep(i,n) for(int i = 0; i < (n); i++ )

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define	show(x)	 copy( (x).begin(), (x).end(), ostream_iterator<int>(cout, ",") );	// container<int>を全て表示

using namespace std;

typedef long long ll;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);


map<ll, ll> prime_factor2(ll N)
{
	map<ll, ll> ret;

	for (ll i = 2; i * i <= N; ++i ) {
		while ( N % i == 0 ) {
			ret[i]++;
			N /= i;
		}
	}

	if (N != 1) ret[N]++;
	return ret;
}

int main()
{
	string S;

	cin >> S;

	Rep(i, S.length()) {
		if (S[i] == ',') {
			S[i] = ' ';
		}
	}

	cout << S << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
#include <bitset>
//#include <iostream>
//#include <sstream>
using namespace std;
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define test_ fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> in <<<<<<<<<<<<<<<<<<<<")
#define deb(x) cerr << ">>>>>>>>>>>>>>>>>>>> " << #x << " = " << x << " <<<<<<<<<<<<<<<<<<<<\n"
#define debd(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %d <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define debs(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %s <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define debll(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %lld <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define deblf(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %lf <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mems(a) memset(a, 0, sizeof(a))
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//bitmask
int onbit(int x, int pos) {x |= (1 << pos); return x;}
int offbit(int x, int pos) {x &= ~(1 << pos); return x;}
int test(int x, int pos) {return x & (1 << pos);}
int flip(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int onbitall(int x, int pos) {x = (1 << pos)-1; return x;}
//constants
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
//moves
const int dx1[] = {0, 1, 0, -1};
const int dy1[] = {1, 0, -1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy2[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
//  freopen("input.in", "r", stdin);
	int n; sf("%d", &n);
	if(!(n & 1)) pf("%d\n", (n/2)*(n/2));
	else pf("%d\n", (n/2)*(n/2 + 1));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<int> A(N);
    rep(n,0,N) cin>>A.at(n);

    vector<int> V(100001,0);
    for(auto a:A){
        if(a-1>=0) V.at(a-1)++;
        V.at(a)++;
        if(a+1<=100000) V.at(a+1)++;
    }

    int ans=0;
    for(auto v:V) ans=max(ans,v);

    cout<<ans<<endl;
}

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

#include <vector>
#include <iostream>

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

using namespace std;

typedef long long ll;

/*
vector.push_back()
vector<int> hoge(3,-1); {-1,-1,-1}
vector<vector<int>> hogehoge(2,vector<int>(2,-1)); {{-1,-1},{-1,-1}} 
cin >>temp;
scanf("%d %d %d",&A,&B,&Q);
sort(a.begin(),a.end());
a.push_back(4000000000000);
a.insert(a.begin(),-1000000000000);
upper_bound(a.begin(),a.end(),x); // list[i] > x のイテレータ取得. *itrで数値化 
    std::priority_queue<
      int,
      std::vector<int>,
      decltype(compare) // 比較関数オブジェクトを指定
    > que(comp);
*/
template <typename T> void debug(T arr);
template <typename T> void debug (T arr, int dim);



int main(void){
    ll a,b;
    string c;
    cin >> a >> c >> b;
    if (c == "+"){
        cout  << a+b << endl;
    }else{
        cout << a-b << endl;
    }
};


template <typename T> void debug(T arr){
    for (auto col:arr){
        cout << col << " ";
    }
    cout <<endl;
};

template <typename T> void debug (T arr, int dim){
    for (auto raw:arr){
        for(auto col:raw){
            cout << col << " ";
        }
        cout << endl;
    }
};


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
	int n,taro_point = 0,hanako_point = 0,j;
	char taro_card[101],hanako_card[101];
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%s %s",taro_card,hanako_card);
		for(j = 0; taro_card[j] != '\0' && hanako_card[j] != '\0' && taro_card[j] == hanako_card[j];j++);
		if(taro_card[j] == '\0'){
			if(hanako_card[j] == '\0'){
				taro_point += 1;
				hanako_point += 1;
			}else{
				hanako_point += 3;
			}
		}else if(hanako_card[j] == '\0'){
			taro_point += 3;
		}else if(hanako_card[j] > taro_card[j]){
			hanako_point += 3;
		}else{
			taro_point += 3;
		}
	}
	printf("%d %d\n",taro_point,hanako_point);
}


Measured memory_bytes: 2696
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), a + n
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define MOD(x) ((x) % (1e9 + 7))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const double EPS = 1e-10;
const double PI = acos(-1.0);

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	if((0<a&&a<10) && (0<b&&b<10)){
		printf("%d\n", a * b);
	}else{
		puts("-1");
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
s=list(map(int,input().split()))
ok=True
isitok=0
if N>=2:

    for num in range(N-1):
        if s[num+1]-s[num]<=-2:    
            ok=False
            break
        if s[num+1]-s[num]==-1:
            isitok+=1
        if s[num+1]==s[num]:
        
            continue
        if s[num+1]>s[num]:
            isitok=0
            
        if isitok==2:
            ok=False
            break
        else:
            continue
    if ok:
        print("Yes")
    else:
        print("No")
        
elif N==1:
    print("Yes")

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

int main(){
  vector<char> mas(3);
  int sum = 0;
  for(int i = 0; i < 3; i++){
  	cin >> mas.at(i);
    if(mas.at(i) == '1') sum += 1;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  int b;
  int c;
  cin>>a>>b;
  c=a+b;
  if(c%2==0){
    cout<<c/2<<endl;
  }
  else{
    cout<<(c+1)/2<<endl;
  }
}
    
    


Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;


int main(){
    int n;
    while(cin>>n){
        int c=0;
        int data[1001][1001]={};
        if(n==0)break;
        
        rep(i,1001){
            data[i][i]=i;
        }
        REP(i,1,1000){
            REP(j,i+1,1000+1){
                data[i][j]=data[i][j-1]+j;
                if(data[i][j]==n){
                    c++;
                }
            }
        }
        cout<<c<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 5080
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define Max (a>b?a:b)
int cache[3005][3005];
vector<char> ch;
int main()
{
	memset(cache,-1,sizeof(cache));
	string a,b;
	cin>>a;
	cin>>b;
	
	int i,j;
	int n1=a.length();
	int n2=b.length();
	for(i=0;i<n2;i++)
	{
		if(a[0]!=b[i])
		{
			cache[0][i]=0;
		}
		else break;
	}
	for(;i<n2;i++)
	cache[0][i]=1;
	for(i=0;i<n1;i++)
	{
		if(a[i]!=b[0])
		{
			cache[i][0]=0;
		}
		else break;
	}
	for(;i<n1;i++)
	cache[i][0]=1;
for(i=1;i<n1;i++)
{
	for(j=1;j<n2;j++)
	{
		if(a[i]==b[j])
		cache[i][j]=cache[i-1][j-1]+1;
		else
		cache[i][j]=cache[i-1][j]>cache[i][j-1]?cache[i-1][j]:cache[i][j-1];
	}
}
	//cout<<cache[n1-1][n2-1];
int r=n1-1;
int c=n2-1;
while(r!=0&&c!=0)
{
	
	 if(cache[r][c]==cache[r-1][c])
	{
		//ch.push_back(a[r]);
		r--;
	}
		else if(cache[r][c]==cache[r][c-1])
	{
		//ch.push_back(a[r]);
		c--;
	}
	else if(cache[r][c]==cache[r-1][c-1]+1)
	{
		ch.push_back(a[r]);
		r--;
		c--;
	}
	}
	if(r==0)
	{
		if (cache[r][c]==1)
		ch.push_back(a[0]);
	}
		else if(c==0)
	{
		if (cache[r][c]==1)
		ch.push_back(b[0]);
	}
int n=ch.size();
for(i=n-1;i>=0;i--)
cout<<ch[i];
	
	
	
	
	
	
	
	
	
	
}

Measured memory_bytes: 35712
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

string S;
set<char> ACGT{'A','C','G','T'};
vi vec;

signed main(){

    in(S);
    vec.pb(0);
    rep(i,S.size()){
        if(ACGT.find(S[i])==ACGT.end()){
            vec.pb(i+1);
        }
    }
    vec.pb(S.size()+1);
    show(vec);
    int ans=0;
    REP(i,1,vec.size()){
        if(ans<vec[i]-vec[i-1]-1){
            ans=vec[i]-vec[i-1]-1;
        }
    }
    out(ans);

    return 0;
}


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

#define ll long long
#define vec vector<ll>
#define rev(a); reverse(a.begin(), a.end());
#define sorta(a); sort(a.begin(), a.end());
#define sortd(a); sort(a.begin(), a.end(), greater<int>());
#define FOR(i,a,b) for (ll i = (ll)(a); i < (b); i++)
#define ROF(i,a,b) for (ll i = (ll)(b)-1; i >= (a); i--)
#define printarray(a) FOR(Q,0,(int)(a).size()) cout<<(a)[Q]<<" "; cout<<'\n';
#define pb push_back
#define mp make_pair

ll MOD = 1000000007;
ll INF = 1LL << 60;

/*****************************************************************************/


void solve() {
	
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;cin>>n;
	ll out=0;
	FOR(i,1,n+1) {
		if (i%3!=0 && i%5!=0) out+= i;
	}
	cout<<out;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=998244353;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vl a,b;

int main(){
	cin>>n;
	a=b=vl(n+1);
	for(auto &i:a) cin>>i;
	if(n==0){
		if(a[0]==1) cout<<1<<endl;
		else cout<<-1<<endl;
		return 0;
	}
	if(a[0]){
		cout<<-1<<endl;
		return 0;
	}
	b[0]=1;
	for(int i=1;i<=n;i++){
		b[i]=min(INF,2*b[i-1]-a[i]);
		if(b[i]<0){
			cout<<-1<<endl;
			return 0;
		}
	}
	ll t=0,res=1;
	for(int i=n;i>0;i--){
		t+=a[i];
		res+=t;
		if((t+1)/2>b[i-1]){
			cout<<-1<<endl;
			return 0;
		}
		if(t>b[i-1]) t=b[i-1];
	}
	if(t!=1) res=-1;
	cout<<res<<endl;
}

Measured memory_bytes: 4772
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
#include<iomanip>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a; i < b; i++)

int main() {

	int h, w;
	cin >> h >> w;

	vector<vector<char>> a(h, vector<char>(w));
	rep(i, 0, h) {
		rep(j, 0, w) cin >> a[i][j];
	}

	vector<int> s(100, 0), v(100, 0);

	rep(i, 0, h) {
		int j = 0;
		while (a[i][j] == '.') {
			if (j == w - 1) {
				s[i] = 1;
				break;
			}
			j++;
		}
	}

	rep(i, 0, w) {
		int j = 0;
		if (w != 1) {
			while (a[j][i] == '.') {
				if (j == h - 1) {
					v[i] = 1;
					break;
				}
				j++;
			}
		}
	}

	rep(i, 0, h) {
		if (s[i] != 1) {
			rep(j, 0, w) {
				if (v[j] != 1) cout << a[i][j];
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 3624
import numpy as np

n, k = map(int, input().split())

A = np.array(input().split(), np.int64)

A.sort()

posA = A[A > 0]
negA = A[A < 0]
zeros = (A==0).sum()

left = -10**18
right = 10**18

while left+1 < right:
    num = (left+right)//2
    
    less_count = 0
    
    if num >= 0:
        less_count += zeros * n
    
    limit_pair_for_pos = num // posA
    limit_idxs = np.searchsorted(A, limit_pair_for_pos, side='right')
    less_count += limit_idxs.sum()

    limit_pair_for_neg = -(num // -negA)
    limit_idxs = n - np.searchsorted(A, limit_pair_for_neg, side='left')
    less_count += limit_idxs.sum()

    duplicate_cases = (A**2 <= num).sum()
    less_count -= duplicate_cases
    less_count //= 2
    
    if less_count >= k:
        right = num
    else:
        left = num

print(right)


Measured memory_bytes: 34624
/*
 * wafuIroha.cpp
 *
 *  Created on: 2020/02/23
 *      Author: black
 */
#include <iostream>
using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	int count = 1;

	for(int i = 1; i < n; ++i){
		count = count *(k-1);
	}
	count*=k;

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int maxx=0;
  for(int i=0; i<s.size()-1; i++){
    set<char> alp;
    for(int j=0; j<=i; j++){
      alp.insert(s[j]);
    }
    int cnt=0;
    for(int j=1; i+j<s.size(); j++){
      if(alp.count(s[i+j])){
        cnt++;
        alp.erase(s[i+j]);
      }
    }
    maxx = max(maxx, cnt);
  }
  cout << maxx << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> P;
typedef pair<lint, lint> PL;

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int n, h, w; cin >> n >> h >> w;
    cout << (n-h+1) * (n-w+1) << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/perl

sub main() {
  chomp(my $N = <>);
  my $ans = prob($N);
  print $ans;
}

sub prob() {
  my ($N) = @_;
  if($N%2==0){
    return ((($N-2)/2*($N-1)) + $N-1);
  }
  else {
    return(($N-1)/2*$N);
  }
}

&main();

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int H, W;
        int N;
        int[] A;

        // write your code
        void solve(InputReader in, PrintWriter out) {
            H = in.nextInt();
            W = in.nextInt();
            N = in.nextInt();
            A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }

            int[][] ans = new int[H][W];
            int cur = 0;
            for (int i = 0; i < N; i++) {
                while (A[i] > 0) {
                    int h = cur / W;
                    int w = cur % W;
                    if (h % 2 != 0) {
                        w = W - w - 1;
                    }
                    ans[h][w] = i + 1;
                    A[i]--;
                    cur++;
                }
            }

            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if (j != 0) {
                        out.print(" ");
                    }
                    out.print(ans[i][j]);
                }
                out.println();
            }
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}


int main() {
	int n;
	cin >> n;
	ll a = -1e18;
	ll b = -1e18;
	ll c = -1e18;
	ll d = -1e18;
	rep(i, n) {
		ll x, y;
		cin >> x >> y;
		a = max(a, x + y);
		b = max(b, x - y);
		c = max(c, -x + y);
		d = max(d, -x - y);
	}
	ll ans = -1e18;
	ans = max(a + d, b + c);
	cout << ans << endl;
}

Measured memory_bytes: 3452
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n = 0;
    cin >> n;
    int max = 0;
    int enter = 0;
    int counter = 0;
    for(int i = 0; i < n; i++) {
        cin >> enter;
        if(enter >= max) {
            max = enter;
            counter++;
        }
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
import math

N, K = map(int, input().split())

P = 0
P_log2 = 1

for i in range(1, N+1):
    if i < K:
#         T = int(math.log2(K / i)) + 1
        T = math.ceil(math.log2(K / i))
        P += 1/ N * 1 / (2 ** T)
#         print(i, T)
    else:
        P += 1 / N
# P += 1/ N * 1 / (2 ** P_log2)
            
print(P)

Measured memory_bytes: 3060
#include <cstdio>
int main() {
  int w, h, x, y, r; scanf("%d%d%d%d%d",&w,&h,&x,&y,&r);
  if (x-r>=0&&x+r<=w&&y-r>=0&&y+r<=h) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 2692
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;

class Program
{


    static void Main(string[] args)
	{

        string[] input = Console.ReadLine().Split(' ');
        long D = long.Parse(input[0]);
        long T = long.Parse(input[1]);
        long S = long.Parse(input[2]);


        if(D <= T * S)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }

    }
}

Measured memory_bytes: 17860
#include<stdio.h>

int main(){
  int s[10000],t[500];
  int n,q,i,j,num=0;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&s[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&t[i]);

  i=0;
  j=0;
  while(j<q){
    s[n] = t[j];
    while(t[j] != s[i])
      i++;
    if(i != n)
      num++;
    i =0;
    j++;
  }

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

  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,m,i;
  double s;
  cin>>n>>m;
  vector<int> a(n);
  s=0;
  for(i=0;i<n;i++) {
    cin>>a.at(i);
    s+=a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  if (a.at(m-1)>=s/4/m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = 0

for i in range(n):
    A[i] = (A[i] + 1) / 2

for i in range(n - k + 1):
    if i == 0:
        p = sum(A[i : i + k])
    else:
        p = p + A[i + k - 1] - A[i - 1]
    ans = max(ans, p)

print(ans)

Measured memory_bytes: 24804
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<String> list = new ArrayList<>(); 
		int h = sc.nextInt();
		int w = sc.nextInt();
		int a[][] = new int[h][w];
		for (int i=0;i<h;i++)
			for (int j=0;j<w;j++) {
				a[i][j] = sc.nextInt()%2;
			}
		
		for (int i=0;i<h;i++)
			for (int j=0;j<w;j++) {
				if (a[i][j]==1 && j<w-1) {
					a[i][j] = 0;
					a[i][j+1]=(a[i][j+1]+1)%2;
					list.add((i+1)+" "+ (j+1) + " " + (i+1)+" "+ (j+2));
				}
				if (a[i][j]==1 && i<h-1) {
					a[i][j] = 0;
					a[i+1][j]=(a[i+1][j]+1)%2;
					list.add((i+1)+" "+ (j+1) + " " + (i+2)+" "+ (j+1));
				}
			}
		System.out.println(list.size());
		for (int i=0;i<list.size();i++) {
			System.out.println(list.get(i));
		}
	}
}


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

#define ll long long

using namespace std;

bool check(ll x, ll pos) { return (x & (1LL << pos)); }

vector <ll> v;

ll gelim(ll X)
{
    ll ind = 0;
    for(ll i = 60; i >= 0; i--)
    {
        if((X >> i & 1) == 0)
        {
            ll x = ind;
            while(x < v.size() && !check(v[x], i)) x++;
            if(x == v.size()) continue;
            swap(v[ind], v[x]);
            for(ll j = 0; j < v.size(); j++)
            {
                if(j != ind && check(v[j], i)) v[j] ^= v[ind];
            }
            ind++;
        }
    }
    ll ans = 0;
    for(ll i = 0; i < v.size(); i++) ans ^= v[i];
    return ans;
}


int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,x;
    cin >> n;
    ll all = 0;
    for(ll i = 0; i < n; i++)
    {
        cin >> x;
        all ^= x;
        v.push_back(x);
    }
    sort(v.rbegin(), v.rend());
    ll ans = gelim(all);
    cout << ans + (ans ^ all);
}


Measured memory_bytes: 1400
#include <stdio.h>
int main (void)
{
   int n,i,j;
   scanf("%d",&n);

   for(i=1;i<=9;i++)
           for(j=1;j<=9;j++){
      if(i*j==n){
            printf("Yes\n");
            return 0;
      }
           }

             puts("No");
}


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

using namespace std;

u_int seed = 3;
u_int xor_shift()
{
    seed ^= seed << 1;
    seed ^= seed >> 3;
    seed ^= seed << 10;
    return seed;
}

chrono::system_clock::time_point start_time;
int elapsed()
{
    auto cur = chrono::system_clock::now();
    return chrono::duration_cast<chrono::milliseconds>(cur - start_time).count();
}

int main(){
    int h, w, m;
    cin >> h >> w >> m;
    start_time = chrono::system_clock::now();
    set<array<int, 2>> bomb;
    vector<int> cnt_h(h), cnt_w(w);
    for (int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        bomb.insert({--a, --b});
        cnt_h[a]++;
        cnt_w[b]++;
    }

    auto max_ = [](vector<int>& A){return accumulate(A.begin(), A.end(), 0, [](auto &l, auto &r){return max(l, r);});};
    int ma_h = max_(cnt_h);
    int ma_w = max_(cnt_w);

    bool flag = false;
    vector<int> H, W;
    for (int i = 0; i < h; i++){
        if (cnt_h[i] != ma_h)
            continue;
        H.push_back(i);
    }

    for (int j = 0; j < w; j++){
        if (cnt_w[j] != ma_w)
            continue;
        W.push_back(j);
    }

    flag |= H.size() * W.size() > m;
    
    if (!flag){
        for (const auto &hh: H){
            for (const auto &ww: W){
                flag |= !bomb.count({hh, ww});
            }
        }
    }
    
    cout << (ma_h + ma_w - (flag ? 0 : 1)) << endl;
}

Measured memory_bytes: 23744
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;



int main(){
  long long a,b,k;
  cin >> a >> b >> k;
  if(a>=k){
    cout << a-k << " " << b << endl;
  }else if(a+b>=k){
    cout << 0 << " " << b-(k-a) << endl;
  }else{
    cout << 0 << " " << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
    int n, m;
    cin >> n >> m;
    map<int, int> k;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        k[a]++, k[b]++;
    }
    for (int i = 1; i <= n; i++) {
        cout << k[i] << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
int main(){
  int n, count=0;
  cin >> n;
  if(n/1000==2)count++;
  n-=n/1000*1000;
  if(n/100==2)count++;
  n-=n/100*100;
  if(n/10==2)count++;
  n-=n/10*10;
  if(n==2)count++;
  cout << count << endl;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	ll N;
	cin >> N;

	vector <ll> nin(5);
	for (int ii = 0; ii < 5; ++ii){
		cin >> nin[ii];
	}
	sort(nin.begin(), nin.end());

	ll div = nin[0];
	ll ans = (N + div - 1 ) / div + 4;

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3644
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr= input.trim().split("\n");
var [h,w] = arr.shift().split(" ").map(Number);
var yx=arr.map(v=>v.split(" ").map(Number));
var min=Infinity;
for(var i=0;i<h;i++){
   for(var j=0;j<w;j++){
      var sum=0;
      for(y=0;y<h;y++){
         for(x=0;x<w;x++){
            sum+=yx[y][x]*Math.min(Math.abs(y-i),Math.abs(x-j));
         }
      }
      min=Math.min(min,sum);
   }
}
console.log(min);


Measured memory_bytes: 16080
# -*- coding: utf-8 -*-
import bisect
N = int(input())

As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
Cs = list(map(int, input().split()))

As.sort()
Bs.sort()
Cs.sort()

ans = 0
# for a in As:
#     for b in Bs:
#         if a >= b:
#             continue
#         for c in Cs:
#             if b >= c:
#                 continue
#             #print(a,b,c)
#             ans += 1
#
# print(ans)

Bcnt = [0 for i in range(N)]
i = 0
for b in Bs:
    cnt = N - bisect.bisect_right(Cs, b)
    # print(b, cnt)
    Bcnt[i] = cnt
    i += 1

Bsum = [0 for i in range(N)]
Bsum[N-1] = Bcnt[N-1]
for i in range(N-2, -1, -1):
    Bsum[i] = Bsum[i+1] + Bcnt[i]
    # print(i, Bsum)

for a in As:
    cnt = bisect.bisect_right(Bs, a)
    if cnt == N:
        ans += 0
    else:
        ans += Bsum[cnt]

# print(Bcnt)
# print(Bsum)
print(ans)

Measured memory_bytes: 24096
#include<iostream>
using namespace std;
int n,i;
int f(int n)
{
	if(n==1) return 1;
	else if(n%2==0) return f(n/2);
	else return 0;
}
int main()
{

	while(cin>>n)
	{
		for(i=n;i>0;i--)
		{
			if(f(i))break;
		}
	cout<<i<<endl;
	}
}

Measured memory_bytes: 256
#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import Counter

def main():
    N = int(input())
    S = [tuple(map(int,input().split())) for _ in range(N)]

    if N == 1:
        print(1)
    else:
        cnt = []
        for i in range(N-1):
            xi, yi = S[i]
            for j in range(i+1,N):
                xj, yj = S[j]
                cnt.append((xi-xj, yi-yj))
                cnt.append((xj-xi, yj-yi))
        A = Counter(cnt)
        ll = max(A.values())
        print(N-ll)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9656
from decimal import *

integers = list(map(int, input().split(" ")))
a = integers[0]
b = integers[1]

d = a // b
r = a % b
f = Decimal(str(a)) / Decimal(str(b))

print(d, r, f.quantize(Decimal("0.00001"),rounding=ROUND_HALF_UP))


Measured memory_bytes: 6400
N = gets.to_i

array = Array.new

a = -1
b = -1
N.times do
    n = gets.to_i
    array.push(n)

    if a <= n
        b = a
        a = n
    elsif b <= n
        b = n
    end
end

for i in 0...N do
    puts (a == array[i] ? b : a);
end


Measured memory_bytes: 5172
/*
         ██╗ ██████╗ ██╗███╗   ██╗    ██╗   ██╗███████╗
         ██║██╔═══██╗██║████╗  ██║    ██║   ██║██╔════╝
         ██║██║   ██║██║██╔██╗ ██║    ██║   ██║███████╗
    ██   ██║██║   ██║██║██║╚██╗██║    ██║   ██║╚════██║
    ╚█████╔╝╚██████╔╝██║██║ ╚████║    ╚██████╔╝███████║
     ╚════╝  ╚═════╝ ╚═╝╚═╝  ╚═══╝     ╚═════╝ ╚══════╝
*/
//password:+BdCHpO8dQvpo5fnV3/u
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 5e5 + 6;
const int inf = 0x3f3f3f3f;
const ll mod=1e9+7;
ll prime[maxn],v[maxn],phi[maxn];
ll sphi[maxn];
ll m=0;
void euler(ll n){
  memset(v,0,sizeof(v));
  m=0;
  for(ll i=2;i<=n;i++){
    if(v[i]==0){
      v[i]=i;
      prime[++m]=i;
      phi[i]=i-1;
    }
    // cout<<i<<"\n";
    for(ll j=1;j<=m;j++){
      if(prime[i]>v[i]||prime[j]>n/i) break;
      v[i*prime[j]]=prime[j];
      phi[i*prime[j]]=phi[i]*(i%prime[j]?prime[j]-1:prime[j]);
     }
  }
  phi[1]=1;
  for(ll i=1;i<=n;i++)
  sphi[i]=(sphi[i-1]+phi[i])%mod;
}
inline ll mpow(ll a,ll n){
  ll ans=1%mod;
  while(n){
    if(n&1) ans=ans*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return ans;
}
map<ll,ll>sp;
inline ll getphi(ll n){
  if(n<maxn) return sphi[n];
  if(sp.count(n)) return sp[n];
   ll ret = 1ll * n * (n + 1) %mod;
   ret=ret*mpow(2,mod-2)%mod;
   for(ll l = 2, r; l <= n; l = r + 1) {
    r = n / (n / l); ret =(ret- (r - l + 1) * getphi(n / l)%mod+mod)%mod;
    // 同上，因为两个的 g 都是 I 
  } return sp[n] = ret; // 记忆化
}

inline ll solve(ll n,ll k){
  long long res = 0, pre = 0, cur;
  for (long long i = 1, j; i <= k; i = j + 1){
    j = k / (k / i),pre=getphi(i-1),cur = getphi(j),
    //  cout<<mpow(k/i,n)<<" "<<cur - pre<<"#";cout<<i<<" "<<j<<"\n";
    res = (res + (mpow(k/i,n) * (cur - pre)%mod) % mod) % mod, pre = cur;
  }
  return (res + mod) % mod;
}


int main() {
  euler(500005);
  // cout<<1<<"\n";
  ll n,k;
  scanf("%lld%lld",&n,&k);
  printf("%lld\n",solve(n,k));
  return 0;
}

Measured memory_bytes: 15876
import sys
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline()
def read(): return int(input())
def reads(): return [int(i) for i in input().split()]

a, b = [i for i in input().split()]
ab = int(a + b)

ans = 'No'
for i in range(400):
	if i ** 2 == ab:
		ans = 'Yes'
		break
print(ans)

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }


int main(){
    int a, b, c;
    double fa, fb, fc;
    char sa[128], sb[128], sc[128];

    int N = in();

    INT nTotal = 0;
    for (int i = 1; i <= N; ++i) {
        if (i % 3 != 0 && i % 5 != 0) {
            nTotal += i;
        }
    }

    printf("%ld", nTotal);


    return 0;
}







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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int K;
    cin >> K;
    for (int i=0;i<s.size();i++){
        int p = s[i] - 'a';
        if (i==s.size()-1){
            s[i] = (char)(((p+K)%26) + 'a');
        } else if (p != 0 && 26 - p <= K) {
            K -= 26 - p;
            s[i] = 'a';
        }
    }
    cout << s << "\n";
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    string s,t,u;
    int a,b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if( s == u ) a--;
    if( t == u ) b--;
    printf ("%d %d\n", a, b );


    return 0;
}



Measured memory_bytes: 256
def f():return map(int,raw_input().split())
n,m,l=f()
A = [f() for _ in [0]*n]
B = [f() for _ in [0]*m]
C = [[0 for _ in [0]*l] for _ in [0]*n]
for i in range(n):
  for j in range(l):
    print sum([A[i][k]*B[k][j] for k in range(m)]),
  print

Measured memory_bytes: 4728
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val s, t = sc.next
    sc.close()

    var ans = 0
    s.zipWithIndex.foreach {
      case (e: Char, i: Int) => if (t(i) == e) ans += 1
    }
    println(ans)
  }
}

Measured memory_bytes: 25796
def main():
	X, K, D = map(int, input().split())

	if abs(X) > K * D:
		print(abs(X) - K * D)
	elif abs(X) <= K * D:
		s = abs(X) // D
		if abs(X) % D == 0:
			if s % 2 == 0 and K % 2 == 0:
				print(0)
			elif s % 2 == 0 and K % 2 == 1:
				print(D)
			elif s % 2 == 1 and K % 2 == 0:
				print(D)
			elif s % 2 == 1 and K % 2 == 1:
				print(0)
		else:
			if s % 2 == 0 and K % 2 == 0:
				print(abs(X) - s * D)
			elif s % 2 == 0 and K % 2 == 1:
				print(abs(abs(X) - s * D - D))
			elif s % 2 == 1 and K % 2 == 0:
				print(abs(abs(X) - s * D - D))
			elif s % 2 == 1 and K % 2 == 1:
				print(abs(X) - s * D)
			

 
if __name__ == "__main__":
  	main()

Measured memory_bytes: 9256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>

using namespace std;
using llint = long long int;

int n, m;
vector<llint> collect;

int main()
{
  cin >> n;
  collect.resize(n);

  cin >> collect[0];
  if (collect[0] != 0)
  {
    cout << -1 << endl;
    return 0;
  }

  for (int i = 1; i < n; i++)
  {
    cin >> collect[i];
    if (collect[i] - collect[i - 1] > 1)
    {
      cout << -1 << endl;
      return 0;
    }
  }

  llint ans = 0;
  int x = 0;
  for (int i = n - 1; i > 0; i--, x--)
  {
    if (collect[i] == 0)
    {
      continue;
    }
    if (x == collect[i])
    {
      continue;
    }

    int to = collect[i];
    ans += to;
    x = to;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
from math import ceil
time=[int(input()) for i in range(5)]
amari=[]
ans=0
for i in time:
    if i%10!=0:
        amari.append([i%10,ceil(i/10),i])

    else:
        amari.append([114514,ceil(i/10),i])
amari.sort()
amari.reverse()
for i in range(len(amari)):
    ans+=amari[i][1]*10
ans-=amari[-1][1]*10
ans+=amari[-1][2]
print(ans)

Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

typedef long double Real;
typedef complex<Real> Point;
typedef pair<Point, Point> Line;
typedef pair<Point, Real> Circle;
typedef vector<Point> Poly;

Real eps = 1e-9;

vector<Point> CCintersect (Circle c, Circle d) {
    vector<Point> ret;
    const Real dist = abs(c.first - d.first);
    const Real cr = c.second;
    const Real dr = d.second;

    if (dist > cr + dr) return ret;
    if (dist < abs(cr - dr)) return ret;

    const Real s = (cr + dr + dist) / 2.;
    const Real area = sqrt(s * (s - cr) * (s - dr) * (s - dist));
    const Real h = 2 * area / dist;

    Point v = d.first - c.first; v /= abs(v);
    const Point m = c.first + sqrt(cr * cr - h * h) * v;
    const Point n = v * Point(0, 1);

    ret.push_back(m + n * h);
    ret.push_back(m - n * h);
    return ret;
}

int main(){
    int n,k;cin >> n >> k;
    vector<long double> x(n),y(n),c(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> c[i];
    }
    long double l = 0, r = 1e9;
    while(abs(r-l)>eps){
        long double m = (r + l) / 2;
        vector<Circle> v(n);
        for (int i = 0; i < n; i++) {
            v[i].fs = Point(x[i],y[i]);
            v[i].sc = m / c[i];
        }
        vector<Point> p;
        for (int i = 0; i < n; i++) {
            for (int j = i+1; j < n; j++) {
                auto q = CCintersect(v[i],v[j]);
                for (int k = 0; k < q.size(); k++) {
                    p.pb(q[k]);
                }
            }
            p.pb(v[i].fs);
        }
        bool f = false;
        for (int i = 0; i < p.size(); i++) {
            int cnt = 0;
            for (int j = 0; j < n; j++) {
                double r = abs(p[i] - v[j].fs);
                if(r <= v[j].sc + eps) cnt++;
            }
            if(cnt >= k) f = true;
        }
        if(f) r = m;
        else l = m;
    }
    cout << setprecision(30) << fixed << r << endl;
    return 0;
}


Measured memory_bytes: 440
def is_prime(x):
    if x == 2:
        return 1
    elif x % 2 == 0:
        return 0
    l = x ** 0.5
    for i in range(3, int(x ** 0.5) + 1, 2):
        if x % i == 0:
            return 0
    return 1

import sys

def solve():
    file_input = sys.stdin
    N = file_input.readline()
    cnt = 0
    for l in file_input:
        cnt += is_prime(int(l))
    print(cnt)

solve()

Measured memory_bytes: 7736