akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
        int count5 = 0;
        int count7 = 0;
        for(int i = 0; i < 3; i++){
        	int n = sc.nextInt();
            if(n == 5){
            	count5++;
            }else if(n == 7){
            	count7++;
            }
        }
        if(count5 == 2 && count7 == 1){
        	System.out.println("YES");
        }else{
        	System.out.println("NO");
        }
	}
}

Measured memory_bytes: 35544
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
    int h,w,d,a;
    int q, l, r;
    int px[90005]={},py[90005]={};
    int  sum[90005]={};

    cin>>h>>w>>d;
    rep(i,0,h){
        rep(j,0,w){
            cin>>a;
            px[a]=i;
            py[a]=j;
        }
    }

    rep(i,d+1,h*w+1){
        sum[i] = sum[i-d] + abs(px[i] - px[i-d]) + abs(py[i] - py[i-d]);
    }

    cin>>q;
    rep(i,0,q){
        cin>>l>>r;
        cout<<sum[r]-sum[l]<<endl;
    }
}

Measured memory_bytes: 2176
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=1e6;
ll d[mm];
ll mod=1e9+7;
int main()
{
	ll n,m,i,j,k,kk,a,b,t,s,p;
	cin>>n>>m;
	if(m>=n)
	printf("unsafe\n");
	else
	printf("safe\n");
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <string.h>

int parser(char *str);
int roman2arabic(char fig);

int main(int argc, const char *argv[])
{
	char str[100];
	while(scanf("%s", str)!=EOF){
		printf("%d\n", parser(str));
	}	
	return 0;
}

int parser(char *str)
{
	int i, len = strlen(str), sum=0, now, next;
	for(i=0; i<len; i++){
		if(i==len-1){
			sum += roman2arabic(*(str+i));
			break;
		}
		now = roman2arabic(*(str+i));
		next = roman2arabic(*(str+(i+1)));
		if(now >= next) sum += now;
		else{
			sum += next-now;
			i++;
		}
	}
	return sum;	
}

int roman2arabic(char fig)
{
	switch(fig){
	case 'I':
		return 1;
	case 'V':
		return 5;
	case 'X':
		return 10;
	case 'L':
		return 50;
	case 'C':
		return 100;
	case 'D':
		return 500;
	case 'M':
		return 1000;
	default:
		return 0; /* failure */
	}
}

Measured memory_bytes: 0
//??°??????2????????´??°???????????§???????????????. ??????????????????????????????[??£?¶??????????????????£?????????]?????????????¢????????????£??????????????????. ??????????????????????????§??????????????§????????????
//O(N^2)????????????????????§, ??¨??¨?????????????????????????????°??????.
#include <iostream>
#include <stack>
#include <algorithm>
using namespace std;

int n;
int a[1000];

bool check(int p) {
	stack<int> digit;
	
	while (p > 0) {
		digit.push(p % 10);
		p /= 10;
	}
	
	int border = digit.top(); digit.pop();
	while (!digit.empty()) {
		if (border + 1 != digit.top()) return false;
		border = digit.top();
		digit.pop();
	}
	return true;
}

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) { cin >> a[i]; }
	
	int ans = -1;
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			int p = a[i] * a[j];
			if (check(p)) { ans = max(ans, p); }
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3132
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

	int N;

	cin >> N;
	vector<int> L(N);
	int total = 0;
	for (int i = 0; i < N; i++) {
		cin >> L[i];
		total += L[i];
	}
	int max_side;
	max_side = *max_element(L.begin(), L.end());
	if (max_side < (total - max_side)) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

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

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b;
    cin>>a>>b;
    cout<<max(a+b, max(a-b, a*b))<<endl;

    return 0;
}

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

#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void input(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

int di[] = {-1,1,0,0}, dj[] = {0,0,-1,1};

void dfs(int i, int j, vector<string>& grid, vector<vector<bool>>& visited){
	if(grid[i][j]!='#')
		visited[i][j]=true;
	else
		return;
	for(int d=0;d<4;d++){
		int ni=i+di[d],nj=j+dj[d];
		if(ni>=0&&nj>=0&&ni<grid.size()&&nj<grid[0].size()&&grid[ni][nj]!='#'&&!visited[ni][nj]){
			visited[ni][nj]=true;
			dfs(ni,nj,grid,visited);
		}
	}
}



void solveTest(){
	int n,m;
	cin>>n>>m;
	vector<string> grid(n);
	bool ans = true;
	for(int i=0;i<n;i++){
		cin>>grid[i];
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(grid[i][j]=='B'){
				for(int d=0;d<4;d++){
					int ni=i+di[d];
					int nj=j+dj[d];
					if(ni>=0&&ni<n&&nj>=0&&nj<m){
						if(grid[ni][nj]=='G')
							ans= false;
						else if(grid[ni][nj]!='B')
							grid[ni][nj]='#';
					}
				}
			}
		}
	}
	vector<vector<bool>>visited(n,vector<bool>(m));
	dfs(n-1,m-1,grid,visited);
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(grid[i][j]=='G'&&!visited[i][j])
				ans=false;
		}
	}
	cout<<(ans ? "YES":"NO")<<endl;
	
}

int main(){
	fastio();
	//input();

	/*int t;
	cin>>t;
	while(t--){
		solveTest();
	}*/

	int a,b;
	cin>>a>>b;
	int ans=0;
	int outlet=1;
	while(outlet<b){
		outlet--;
		outlet+=a;
		ans++;
	}
	//cout<<outlet<<endl;
	cout<<ans<<endl;
	return 0;
}
     

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;


int main(){

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(d >= abs(c-a)) cout << "Yes" << endl;
    else if((d >= abs(b - a)) && (d >= abs(c - b))) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

const int N = 1e5+23;

int h[N];

void solve() {
	int n; scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		int a; scanf("%d", &a);
		++h[a];
	}
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		ans = max(h[i]+(i>0?h[i-1]:0)+(i<(N-1)?h[i+1]:0), ans);
	}
	printf("%d", ans);
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;




int main() 
{
	int x,l;
	while(cin >> x >> l && ( x!=0 || l!=0 ))
	{
	
		//input
		int a[21][6]={};
		REP(i,l){
			a[0][i] = x/(int)(pow(10,l-i-1));
			x %=  (int)(pow(10,l-i-1));}
		
		for(int i=1;i<21;i++)
		{ 
			int max[6],min[6];
			REP(j,6){max[j]=a[i-1][j];min[j]=a[i-1][j];}
			sort(min,min+l);
			sort(max,max+l);
			reverse(max,max+l);
			
			REP(j,6){
				if(max[5-j]-min[5-j] < 0)
						{	a[i][5-j] = max[5-j]-min[5-j] +10;max[5-j-1]--;}
				else{a[i][5-j] = max[5-j]-min[5-j];}
			}
			
			bool tmp = true;
			REP(j,i)
			{
				tmp = true;
				REP(k,l)
				{
					if(a[j][k]!=a[i][k]){tmp = false;break;}
				}
				if(tmp)
				{
					cout << j << " ";
					int ans =0;
					REP(m,l){ans += a[i][m]*(int)pow(10,l-m-1);}
					cout << ans << " ";
					cout << i-j << endl;
					break;
				}
			}
			if(tmp) break;
		}
	}
	return 0 ;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define repb(i, n) for(int i = n;i >= 0;i--)
#define reps(i, m, n) for(int i = m;i < n;i++)
#define repsb(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long ll;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
string s[100];
int cal(int &index,int d){

  if(isdigit(s[index][d]))  return(s[index++][d]-'0');

  else if(s[index++][d]=='+'){
    int t=0;
    while ((int)s[index].size()>d+1){
      t+=cal(index,d+1);
    }
    return t;
  }
  else{
    int t=1;
    while ((int)s[index].size()>d+1) {
      t*=cal(index,d+1);
    }
    return t;
  }

  }
int main(int argc, char const *argv[]) {
  int n;
  	while(1){
  		cin>>n;
  		if(n==0)	break;
  		rep(i,n){
  			cin>>s[i];
  		}
      s[n]="";
      int index=0;
      cout<<cal(index,0)<<endl;
    }

  return 0;
}



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

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
  int N,f=0,t=0,o=0;
  string ans="No";
  cin >> N;
  vector<int> a(N);
  rep(i,N) {
    cin >> a[i];
    if(a[i]%4==0) f++;
    else if(a[i]%2==0) t++;
    else o++;
  }
  
  if(f>o-1) ans = "Yes";
  else if(f>o-2) {
    if(t==0) ans = "Yes";
    else if(t==0) ans = "No";
  }
  cout << ans << endl;
  
  return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  if (s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

ans1 = 0
for i in reversed(range(1,10)):
	if n % i == 0:
		ans1 = i
		break

if ans1 == 0:
	print('No')
else:
	if n // ans1 < 10:
		print('Yes')
	else:
		print('No')


Measured memory_bytes: 2940
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    char sc[1000];
    string s;
    int n;
    cin>>n>>s;
    if(n%2==1){cout<<"No"<<endl;return 0;}
    for(int i=0;i<n/2;i++){
     if(s[i]!=s[n/2+i]){cout<<"No"<<endl;return 0;}   
    }
    cout<<"Yes"<<endl;return 0;
    // Your code here!
    
}


Measured memory_bytes: 256
#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 main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, k; cin >> n >> k;
	double mx = 0, s = 0;
	vi p(n); rep(i, n) cin >> p[i];
	rep(i, n){
		s += p[i] + 1;
		mx = max(mx, s);
		if(i >= k - 1) s -= p[i - k + 1] + 1;
	}
	printf("%.20f\n", mx / 2);
	return 0;
}

Measured memory_bytes: 1024
using System;

namespace _169E_Count_Median
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long[] A = new long[n];
            long[] B = new long[n];
            long min, max = 0;
            for (int i=0;i<n;i++)
            {
                int[] ab = Array.ConvertAll(System.Console.ReadLine().Split(' '), int.Parse);
                A[i] = ab[0];
                B[i] = ab[1];
            }
            Array.Sort(A);
            Array.Sort(B);
            if ( n%2==0)//
            {
                min = (A[n/ 2 - 1] + A[n/2]);
                max = (B[n/2-1] + B[n/2]);
                max = max - min+1;
            }
            else
            {
                min = A[n / 2 ];
                max = B[n  / 2];
                max = max - min + 1;
            }
            System.Console.WriteLine(max);

        }
    }
}


Measured memory_bytes: 43656
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ll n,i,ctr=0;
  cin>>n;
  map <string,int> ma;
  for(i=0;i<n;i++)
  {
    string s;
    cin>>s;
    sort(s.begin(), s.end());
    ma[s]++;

  }
  for(auto it:ma)
  {
    ll k = it.second;
    ctr = ctr+(k*(k-1))/2;
  }
  cout<<ctr<<endl;
  }
  
  




Measured memory_bytes: 11136
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
const LL MOD = 1e9 + 7;
const int N = 1000005;
#define IOS                                                                    \
    cin.tie(nullptr);                                                          \
    cout.tie(nullptr);                                                         \
    ios_base::sync_with_stdio(false);
bitset<N> is_notp;
vector<int> p;
map<int, int> cnt;

void primeTable()
{
    is_notp.reset();
    is_notp[0] = is_notp[1] = 1;
    for (int i = 2; i < N; i++)
    {
        if (!is_notp[i])
        {
            p.push_back(i);
        }
        for (int j = 0; j < (int)p.size() && i * p[j] < N; j++)
        {
            is_notp[i * p[j]] = 1;
            if (i % p[j] == 0)
            {
                break;
            }
        }
    }
}

void Update(int idx, int val)
{
    if(cnt.find(idx) == cnt.end())
    {
        cnt[idx] = val;
    }
    else
    {
        cnt[idx] = max(cnt[idx], val);
    }
    return;
}

void Factorization(LL x)
{
    for (int i = 0, tmp; i < (int)p.size() && p[i] * p[i] <= x; ++i)
    {
        tmp = 0;
        while(x % p[i] == 0)
        {
            x /= p[i];
            ++tmp;
        }
        Update(p[i], tmp);
    }
    if(x != 1)
    {
        Update((int)x, 1);
    }
    return;
}

LL calcLCM() {
    LL ret = 1;
    for (auto it: cnt)
    {
        while(it.second--)
        {
            ret = (ret * it.first) % MOD;
        }
    }
    return ret;
}

LL pow2(LL a, LL b)
{ 
    LL ret = 1;
    for (;b; b >>= 1)
    {
        if((b & 1) != 0)
        {
            ret = (ret * a) % MOD;
        }
        a = (a * a) % MOD;
    }
    return ret;
}

int main()
{
    IOS;
    int n;
    vector<LL> v;
    primeTable();
    cin >> n;
    v.resize(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
        Factorization(v[i]);
    }
    LL ans = 0, LCM = calcLCM();
    for (int i = 0; i < n; ++i)
    {
        LL tmp = (LCM * pow2(v[i], MOD - 2)) % MOD;
        // cout << tmp << " \n"[i == n - 1];
        ans = (ans + tmp) % MOD;
    }
    cout << ans << '\n';

}


Measured memory_bytes: 1272
#include <iostream>
#include <algorithm>

struct Player {
	int id;
	float time;
	Player() {}
	Player(int id, float time) : id(id), time(time) {}
};
bool operator < (const Player& p1, const Player& p2) { return p1.time < p2.time; }

int main()
{
	Player reserve[6];
	for (int group=0; group<3; group++) {
		Player players[8];
		for (int i=0; i<8; i++) {
			int id;
			float time;
			std::cin >> id >> time;
			players[i] = Player(id, time);
		}
		std::sort(players, players + 8);
		std::cout << players[0].id << " " << players[0].time << std::endl;
		std::cout << players[1].id << " " << players[1].time << std::endl;
		reserve[2*group] = players[2];
		reserve[2*group + 1] = players[3];
	}
	std::sort(reserve, reserve + 6);
	std::cout << reserve[0].id << " " << reserve[0].time << std::endl;
	std::cout << reserve[1].id << " " << reserve[1].time << std::endl;
	
	return 0;
}




Measured memory_bytes: 3220
#include<stdio.h>                                                 
                                                                  
int main(void){                                                   
   int a,b,i,c,n;                                                 
   scanf("%d %d",&a,&b);                                          
   if(a > b){                                                     
      c = b;                                                      
      n = a;                                                      
   } else {                                                       
      c = a;                                                      
      n = b;                                                      
   }                                                              
   for(i = 0; i < n; i++){                                        
      printf("%d",c);                                             
   }                                                              
   return 0;                                                      
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
int a,b,c,x,y,s,b1,s1,s2,s3;
int minn=2100000000;
char ss,bb;
int main()
{
	cin>>a>>b>>c>>x>>y;
	s1=a*x+b*y;
	if(x>y)
	{
		bb='A';
		ss='B';
		b1=x;
		s=y;
	}
	else
	{
		bb='B';
		ss='A';
		s=x;
		b1=y;
	}
	if(bb=='B')
		s2=c*x*2+(y-x)*b;
	else s2=c*y*2+(x-y)*a;
	int maxn=max(x,y);
	s3=c*maxn*2;
	minn=min(s1,s2);
	minn=min(minn,s3);
	cout<<minn<<endl;
	return 0;
}

Measured memory_bytes: 256
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

x = INT()
if x == 1:
  print(0)
else:
  print(1)


Measured memory_bytes: 27068
import sys

A, B = map(int, input().split())
S = input()
l = ["0","1","2","3","4","5","6","7","8","9"]
if S[A] != "-":
    print("No")
    sys.exit()
for i in range(len(S)):
    if i == A:
        continue
    elif S[i] not in l:
        print("No")
        sys.exit()
print("Yes")

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)

#define PI M_PI
#define INF 1000000000
#define MOD 1000000007;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;

int main()
{
	int N, Y;
	cin >> N >> Y;
	int ans[3] = { -1, -1, -1 };

	rep(i, N + 1)
	{
		rep(j, N - i + 1)
		{
			if (i * 10000 + j * 5000 + (N - i - j) * 1000 == Y)
			{
				ans[0] = i; ans[1] = j; ans[2] = N - i - j;
				goto END;
			}
		}
	}
	END:
	cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main() {
    int n;
    cin >> n;
    ll a[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    vector<ll> vec;
    vec.push_back(a[1]);
    for (int i = 2; i <= n; i++) {
        int start = 0;
        int end = vec.size() - 1;
        while (end - start > 1) {
            int med = (start + end) / 2;
            if (vec[med] < a[i]) {
                start = med;
            }
            else {
                end = med;
            }
        }
        if (vec[end] < a[i]) {
            vec[end] = a[i];
        }
        else if (vec[start] < a[i]) {
            vec[start] = a[i];
        }
        else {
            vec.insert(vec.begin(), a[i]);
        }
    }
    cout << vec.size() << endl;
   return 0;
}

Measured memory_bytes: 5068
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ll a; int b1, b2;
    scanf("%lld %d.%d", &a, &b1, &b2);
    ll b = b1*100 + b2;
    ll ans = a * b;
    ans /= 100;
    cout << ans << endl;
}


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


// vector<vector<int>> a[15][15];

int main(){
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n, -1));
  rep(i,n){
    int m;
    cin >> m;
    rep(j,m){
      int x, y;
      cin >> x >>y;
      x--;
      a[i][x] =y;
    }
  }
  
  int ans =0;
  for (int bit = 0; bit < (1<<n); ++bit) {
    int count =0;
    vector<int> check(n,0);
    for (int i = 0; i < n; ++i) {
      if (bit & (1<<i)) {
        count +=1;
        check[i]=1;
      }
    }
    bool condition=true;
    rep(i,n){
      if(check[i]==1){
        rep(j,n) {
          if(a[i][j]==1 && check[j]==0) condition=false;
          if(a[i][j]==0 && check[j]==1) condition=false;
        }
      }
    }
    if(condition) ans = max(ans,count);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
s=list(input())
chk=list("abcdefghijklmnopqrstuvwxyz")
flag="WA"
n=len(s)

if s[0]=="A":
    temp=s[2:n-1]
    if temp.count("C")==1:
        ind=temp.index("C")
        ind+=2
        del s[0]
        del s[ind-1]
        for st in s :
            if st in chk:
                pass
            else:
                flag="WA"
                break
            flag="AC"
print(flag)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define gg {puts("No");exit(0);}
using namespace std;
int n,a[100010],vis[100010],mn=1e9,mx=-1;
int check()
{
	if(mx>mn)
	{
		for(int i=1;i<=n;i++)vis[a[i]]++;
		n-=vis[mn],mx-=vis[mn];
		if(mx<=0)return 0;
		if(n<mx*2)return 0;
		return 1;
	}
	else if(mx==mn)
	{
		if(n==mn+1)return 1;
		if(n>=mx*2)return 1;
		return 0;
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]),mn=min(mn,a[i]),mx=max(mx,a[i]);
	if(mx-mn>1)gg;
	if(check())puts("Yes");
	else puts("No");
} 

Measured memory_bytes: 640
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    
    int k,s;
    cin >> k >> s;
    
    ll ans  = 0;

    rep(x,0,k+1){
	rep(y,0,k+1){
	    int z = s-x-y;

	    if(0 <= z && z <= k)ans++;
	    
	}
    }

    P(ans);
    
    return  0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int main(){
    int N; cin >> N;
    int ans = 0;
    vector<int> H(N);
    for(int &h:H)
        cin >> h;
    
    bool u = true;
    bool d = true;
    for(int i=0; i<N-1; i++){
        
        if(u && H[i]>H[i+1]){
            u = false;
            d = true;
            ans += H[i];
        }
        if(d && H[i]<H[i+1]){
            u = true;
            d = false;
            ans -= H[i];
        }
    }
    if(u) ans+=H[N-1];
    else ans-=H[N-1];

    int yama = 0;
    u = true;
    d = true;
    for(int i=0; i<N-1; i++){
        
        if(u && H[i]>H[i+1]){
            yama++;
            u = false;
            d = true;
        }
        if(d && H[i]<H[i+1]){
            if(yama==0) ans += H[i];
            u = true;
            d = false;
        }
    }

    yama = 0;
    u = true;
    d = true;
    for(int i=N-1; i>0; i--){
        
        if(u && H[i]>H[i-1]){
            yama++;
            u = false;
            d = true;
        }
        if(d && H[i]<H[i-1]){
            if(yama==0) ans += H[i];
            u = true;
            d = false;
        }
    }
    
    
    
    cout << ans << endl;
}


Measured memory_bytes: 256
from collections import defaultdict


def solve():
    _ = int(input())
    a = list(map(int, input().split()))
    
    counter = defaultdict(int)
    for ai in a:
        counter[ai] += 1
        counter[ai + 1] += 1
        counter[ai - 1] += 1
    
    ans = 0
    for val in counter.values():
        ans = max(ans, val)
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 20056
S = input()
length = len(S)

sum = 0
for i in range(1 << (length - 1)):
    s = S[0]
    for j in range(length - 1):
        if i & (1 << j):
            s += "+"
        s += S[j + 1]
    sum += eval(s)
print(sum)



Measured memory_bytes: 3060
N, D = (int(nd) for nd in input().split())
X = []
for _ in range(N):
    X.append([int(x) for x in input().split()])

index = 0
count = 0
for x in X:
    for y in X[index+1:]:
        dist = sum([(x[i]-y[i])**2 for i in range(D)])**(1/2)
        if dist == int(dist):
            count += 1
    index += 1

print(count)

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

int main(){
  
  int N;
  char S[110];
  cin >> N;
  for( int i = 0; i < N; i++ ) cin >> S[i];
  
  string ans = "Three";
  for( int i = 0; i < N; i++ ){
    
    if( S[i] == 'Y' ){
      ans = "Four";
      break;
    }
    
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll>P;
void Yes(bool Yes){cout << (Yes ? "Yes" : "No") << endl;};
void YES(bool YES){cout << (YES ? "YES" : "NO") << endl;};


int main(){

    ll N;
    cin >> N;
    vector<P>v;
    for(ll i = 0; i < N; i++){
        ll a, b;
        cin >> a >> b;
        v.push_back(P(b, a));
    }
    sort(v.begin(), v.end());
    ll flg = 1, t = 0;
    for(ll i = 0; i < N; i++){
        t += v[i].second;
        if(t > v[i].first)flg = 0;
    }
    Yes(flg);

    return 0;
}

Measured memory_bytes: 6512
use std::cmp::max;
fn main() {
    proconio::input! {
        n: usize,
        a: [i64; n],
    }
    let mut dp = [[std::i64::MIN/2; 3]; 2];
    dp[0][1]=0;
    dp[1][1]=0;
    for (i,a) in a.iter().enumerate() {
        let b=i&1;
        for j in 0..2 {
            dp[b][j] = max(dp[b][j]+a,dp[1-b][j+1-b]);
        }
    }
    let b=1-(n&1);
    println!("{}",dp[b][b]);
}

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

int main() {
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;

    ll dist = abs(a - b);
    ll speed = v - w;
    if(speed < 1 || dist > speed * t){
        puts("NO");
        return 0;
    }
    puts("YES");
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<string>
#include<utility>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)


int N;
int A[205];
int B[205];


int main() {
	cin>>N;
	rep(i,N) cin>>A[i];
	rep(i,N) B[i] = 0;
	rep(i,N){
		rep(j,40){
			if(A[i]%2==0){
				A[i]=A[i]/2;
				B[i]++;
			}
			else break;
		}
	}
	sort(B+1,B+N+1);
	cout<<B[1]<<endl;
	
	return 0;
}

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

#define debug(x) cout << #x << ": " << (x) << endl
#define For(i, j, k) for (int i = j; i <= k; ++ i)
#define Forr(i, j, k) for (int i = j; i >= k; -- i)

using namespace std;

inline void File() {
	freopen("D.in", "r", stdin);
	freopen("D.out", "w", stdout);
}

const int N = 1e5 + 10;
char s[N]; int n;

int main() {

	scanf("%s", s + 1), n = strlen(s + 1);

	For(i, 1, n - 2) {
		if (s[i] == s[i + 1]) return printf("%d %d\n", i, i + 1), 0;
		if (s[i] == s[i + 2]) return printf("%d %d\n", i, i + 2), 0;
	}

	if (s[n - 1] == s[n]) return printf("%d %d\n", n - 1, n), 0;
	printf("-1 -1\n");

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int n,q,w;
int a[100000];
bool cmp(int a,int b){
	return a>b;
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++){
		if(i%2==1)
			q+=a[i];
		if(i%2==0)
			w+=a[i];
	}
	cout<<q-w;
}

Measured memory_bytes: 256
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 六  9/16 20:00:18 2017
 *Ended  Time*  : 六  9/16 20:22:44 2017
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

int a, b, c, d, e, f;

int main()
{
    while(~scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f)){
        int ansa = 0, ansb = 0;
        int water = 0, sugar = 0, cnt = 0;
        for(int i  = 0; i * a * 100 <= f; i++){
            for(int j = 0; j * b * 100 <= f; j++){
                if(i == 0 && j == 0) continue;
                if((i*a + j*b) * 100 > f) break;
                for(int k = 0; ; k++){
                    if((i*a + j*b) * 100 + k * c > f) break;
                    for(int l = 0; ; l++){
                        int tempa = (i*a + j*b) * 100; 
                        int tempb = c * k + d * l;
                        int cnt = (i*a + j*b) * e;
                        if(tempa + tempb > f) break;
                        if(tempb <= cnt){
                            if(ansa == 0 && ansb == 0){
                                ansa = tempa, ansb = tempb;
                            }
                            else if(1.0 * tempb / (tempa + tempb) > 1.0 * ansb / (ansa + ansb)){
                                ansa = tempa, ansb = tempb;
                            }
                        }
                    }
                }
            }
        }
        printf("%d %d\n", ansa + ansb, ansb);
    }
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

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

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int H, W; cin >> H >> W;
	vector<vector<int> > a(H, vector<int>(W));
	rep(y, H) rep(x, W) cin >> a[y][x];
	vector<vector<int> > dp(H + 1, vector<int>(H + 1, INT_MIN));
	dp[0][0] = 0;
	rep(z, H + W - 2) {
		vector<vector<int> > _dp(H + 1, vector<int>(H + 1, INT_MIN));
		rep(y1, H) rep(y2, H) {
			int x1 = z - y1, x2 = z - y2;
			if (!(0<=x1 && x1<W && 0<=x2 && x2<W)) continue;
			int unko = dp[y1][y2] + a[y1][x1];
			if (y1 != y2) unko += a[y2][x2];
			_dp[y1][y2] = max(_dp[y1][y2], unko);
			_dp[y1 + 1][y2] = max(_dp[y1 + 1][y2], unko);
			_dp[y1][y2 + 1] = max(_dp[y1][y2 + 1], unko);
			_dp[y1 + 1][y2 + 1] = max(_dp[y1 + 1][y2 + 1], unko);
		}
		dp = _dp;
	}
	cout << dp[H - 1][H - 1] + a[H - 1][W - 1] << endl;
}


Measured memory_bytes: 792
import numpy as np

n, k = list(map(int, input().split()))
MOD = 10 ** 9 + 7
l = int(n ** 0.5)
coe = []
for i in range(l, 0, -1):
    coe.append(n // i - l)
coe.append(0)
coe.reverse()
coe = np.array(coe, dtype=np.int64)

dp1 = np.ones(l + 1, dtype=np.int64)
dp2 = coe.copy()
dp1[0] = 0
for i in range(k - 1):
    dp1acc = np.add.accumulate(dp1) % MOD
    dp12acc = np.add.accumulate((dp1 * coe % MOD)[::-1])[::-1]
    s = dp1acc[-1]
    dp1acc = np.roll(dp1acc, 1)
    dp1acc[0] = 0
    dp12acc[0] = 0
    dp1[1:] = (s + dp2[1:]) % MOD
    dp2 = dp12acc + dp1acc * coe % MOD
ans = (dp1.sum() + dp2[1]) % MOD
print(ans)


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


int main()
{
    int N, even=-1, odd=-1, count=0;
    cin >> N;
    vector<int> num(N);


    for (int i = 0; i < N;i++){
        cin >> num.at(i);
    }

    while (1){
        for (int i = 0; i < N;i++){
            if(num.at(i)%2==0){
                num.at(i) /= 2;
                //cout<<"even:" <<num.at(i)<<endl;
            }
            else{
                //cout << "odd:" << num.at(i) << endl;
                odd = 1;
                break;
            }
        }
        if(odd==1){
            break;
        }
        else{
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bits/allocator.h>
#include<bits/basic_ios.h>
#include<bits/basic_string.h>
#include<bits/basic_string.tcc>
#include<bits/c++config.h>
#include<bits/char_traits.h>
#include<bits/cpp_type_traits.h>
#include<bits/cxxabi_forced.h>
#include<bits/ios_base.h>
#include<bits/locale_classes.h>
#include<bits/localefwd.h>
#include<bits/ostream_insert.h>
#include<bits/postypes.h>
#include<bits/range_access.h>
#include<bits/stl_algobase.h>
#include<bits/stl_function.h>
#include<bits/stl_iterator.h>
#include<bits/stl_iterator_base_funcs.h>
#include<bits/stl_iterator_base_types.h>
#include<bits/stringfwd.h>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwchar>
#include<cwctype>
#include<debug/debug.h>
#include<deque>
#include<exception>
#include<ext/atomicity.h>
#include<ext/numeric_traits.h>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<math.h>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<valarray>
#include<vector>
using namespace std;
int c[5][5];
int main()
{
	cin>>c[0][0]>>c[0][1]>>c[0][2];
	cin>>c[1][0]>>c[1][1]>>c[1][2];
	cin>>c[2][0]>>c[2][1]>>c[2][2];
	if (c[1][0]-c[0][0]==c[1][1]-c[0][1]&&c[1][2]-c[0][2]==c[1][1]-c[0][1])
		if (c[2][0]-c[1][0]==c[2][1]-c[1][1]&&c[2][2]-c[1][2]==c[2][1]-c[1][1])
			cout<<"Yes";
		else
			cout<<"No";
	else
		cout<<"No";
	return 0;
}

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

int main() {

    // input from txt （提出時にこの箇所は削除すること）
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    int N, M;
    cin >> N >> M;
    int ans = N;
    for(int i=0; i<M; i++){
        int x;
        cin >> x;
        ans -= x;
    }
    
    if(ans >= 0){
        cout << ans << endl;
    }
    else{
        cout << -1 << endl;
    }
    
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {
  private static long solve(int n) {
    long result = 0;
    int i = 1;
    while (i <= n) {
      if (i % 3 != 0 && i % 5 != 0) {
        result += i;
      }
      i ++;
    }
    return result;
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    System.out.println(solve(sc.nextInt()));
    sc.close();
  }
}



Measured memory_bytes: 35684
#include<stdio.h>
#define N 2000001

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


Measured memory_bytes: 9576
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))

int main()
{
    int S[4];
    int s;
    int num = 1000;
        
    scanf("%d", &s);
    for(int i = 0; i < 4; i++){
        S[i] = s / num;
        s    = s - S[i] * num;
        num = num / 10;
    }
    
    for(int i = 1; i < 4; i++){
        if(S[i] == S[i-1]) {printf("Bad\n"); return 0;}
    }
    printf("Good\n");
    
    return 0;
}


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

int main(){
    int n,mod=1000000007;
    scanf("%d",&n);
    vector <int> h(n);
    for (auto&e:h) scanf("%d",&e);
    int dp[n+1];
    for (int i=0;i<n+1;i++) dp[i]=mod;
    dp[1]=0;
    for (int i=1;i<n;i++) {
        dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i-1]));
        if (i+2<=n) dp[i+2]=min(dp[i+2],dp[i]+abs(h[i+1]-h[i-1]));
    }
    printf("%d\n",dp[n]);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int n,h,w;
    cin>>n>>h>>w;
    int a[1100];
    int b[1100];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    int count=0;
    for(int i=0;i<n;i++){
        if(a[i]>=h && b[i]>=w)count++;
    }
    cout<<count<<endl;
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
    long long a, b, k;
    cin >> a >> b >> k;

    if(a >= k) {
        a -= k;
        cout << a << " " << b << endl;
        return 0;
    }

    k -= a;
    a = 0;

    if(b >= k) {
        b -= k;
    } else {
        b = 0;
    }

    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

//↑template↑

ll a,b,sum;
int main(){
  cin>>a>>b;
  priority_queue<ll>pq;
  vector<ll>v(a);
  for(int i=0;i<a;++i){
    cin>>v[i];
    pq.push(v[i]);
  }
  while(b){
    ll mon=pq.top()/2;
    pq.pop();
    pq.push(mon);
    --b;
  }
  for(int i=0;i<a;++i){
    sum+=pq.top();pq.pop();
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    int x,n;
    cin>>x>>n;
    if(n==0)
    {
        cout<<x;
        return 0;
    }
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    int mindis=100;
    int ans=x;
    for(int i=-1;i<=101;i++)
    {
        int can=*lower_bound(a.begin(),a.end(),i);
        if(i!=can)
        {
            if(mindis>abs(x-i))
            {
                mindis=abs(x-i);
                ans=i;
            }

        }
    }
    cout<<ans;
}


Measured memory_bytes: 3568