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

#define f(i,a,b) for (int i = a; i < b; i++)
using vi = vector<int>;
#define pb push_back

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m;
	cin >> m >> n;
	int a[n];
	f(i,0,n) cin>>a[i];
	int cnt = 0;
	f(i,0,n) cnt += a[i]&1;
	if (n == 1) {
		cout << a[0] << endl;
		if (a[0] == 1) cout << 1 << endl << 1 << endl;
		else cout << 2 << endl << a[0]-1 << " " << 1 << endl;
		return 0;
	}
	if (cnt>2) {
		cout << "Impossible" << endl;
		return 0;
	}
	f(i,0,n) if (a[i]&1) swap(a[i],a[0]);
	f(i,1,n) if (a[i]&1) swap(a[i],a[n-1]);
	vi ans;
	f(i,0,n) if (!i && a[i]-1) ans.pb(a[i]-1);
		else if (i) ans.pb(a[i] + (i==n-1));
	stringstream ss;
	f(i,0,n) ss << a[i] << " ";
	ss << endl << ans.size() << endl;
	for (int x : ans) ss << x << " ";
	cout << ss.str() << endl;
	return 0;
}



Measured memory_bytes: 256
s=input()

from collections import deque

stack=deque()

for i in s:
  if i=="S":
    stack.append(i)
  if i=="T":
    if len(stack)>0 and stack[-1]=="S":
      stack.pop()
    else:
      stack.append(i)
      
  #print(stack)
print(len(stack))

Measured memory_bytes: 5096
use std::cmp::max;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: String = read();
    let mut cnt = 0;
    let mut tmp = 0;
    for i in s.chars() {
        if i == 'A' || i == 'C' || i == 'G' || i == 'T' {
            tmp += 1;
        } else {
            cnt = max(tmp, cnt);
            tmp = 0;
        }
    }
    println!("{}", max(cnt, tmp));
}

Measured memory_bytes: 4352
K = int(input())

if K == 1:
    print("ACL")
elif K == 2:
    print("ACLACL")
elif K == 3:
    print("ACLACLACL")
elif K == 4:
    print("ACLACLACLACL")
else:
    print("ACLACLACLACLACL")


Measured memory_bytes: 9152
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  int n, i = 0;
  cin >> n;
  for (; i * i <= n; ++i);
  cout << (i - 1) * (i - 1) << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
//#include <random>
#include <map>
//#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <time.h>
//#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
//#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
double pi = 3.141592653589793;
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }



int main() {
	ll n;
	cin >> n;
	ll ans = 0;
	FOR(i, 1, n + 1) {
		ll c = n / i;
		ll c2 = c * (c + 1) / 2;
		ans += c2 * i;
	}

	cout << ans << endl;
}






Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll ans;
string a="abcdefghijklmnopqrstuvwxyz";
int biao[26];
inline ll gcd(ll x,ll y){
	if(x%y==0) return y;
	else return gcd(y,x%y);
}

int main(){
	string s;
	cin>>s;
	int len=s.length();
	for(int i=0;i<len;i++){
		biao[int(s[i]-'a')]=1;
	}
	
	if(len==26){
		for(int i=24;i>=0;i--){
			biao[s[i+1]-'a']=0;
			for(int j=0;j<26;j++){
				if(!biao[j]&&j>s[i]-'a'){
					for(int k=0;k<i;k++) cout<<s[k];
					cout<<a[j];
					return 0;
				}
			}
		}
		cout<<"-1";
		return 0;
	}
	
	cout<<s;
	for(int i=0;i<26;i++){
		if(biao[i]==0){
			cout<<a[i]<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;
 
ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}
ll powerm(ll base,ll exp,ll mod) 
{ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
/*{{ x | (1 << k) sets the kth bit of x to one
x & ~(1 << k) sets the kth bit of x to zero
x ^ (1 << k) inverts the kth bit of x.
x & (x-1) sets the last one bit of x to zero
x & -x sets all the one bits to zero, except for the last one bit. 
x | (x-1) inverts all the bits after the last one bit.}} SOME BIT MANIPULATION*/
//__builtin_clz(x): the number of zeros at the beginning of the number
//__builtin_ctz(x): the number of zeros at the end of the number
//__builtin_popcount(x): the number of ones in the number
//__builtin_parity(x): the parity (even or odd) of the number of ones 
struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
	{
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const 
	{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
/*//DSU 
int parent[200005];
int rankr[200005];
int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}
void make_set(int v) {
    parent[v] = v;
    rankr[v] = 0;
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rankr[a] < rankr[b])
            swap(a, b);
        parent[b] = a;
        if (rankr[a] == rankr[b])
            rankr[a]++;
    }
} */

int main()
{  
	fast; 
	ll x; cin>>x;
	if(x <= 599)
		cout << 8 << endl;
	else if(x <= 799)
		cout << 7 << endl;
	else if(x <= 999)
		cout << 6 << endl;
	else if(x <= 1199)
		cout << 5 << endl;
	else if(x <= 1399)
		cout << 4 << endl;
	else if(x <= 1599)
		cout << 3 << endl;
	else if(x <= 1799)
		cout << 2 << endl;
	else
		cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#define MAX 100005
#define NIL -1
  
struct Node{
  int l, p, r;
};
struct Node T[MAX];
int n;
 
int getDepth(int u){
  int d=0, i=0;
  while(1){
    if(T[u].p == NIL)break;
    d++;
    u=T[u].p;
  }
  return d;
}
void print(int u){
  
  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,getDepth(u));
     
  if( T[u].p == NIL) printf("root, [");
   
else if(T[u].l == NIL) printf("leaf, [");
   
else printf("internal node, [");
     
  if( T[u].l != NIL){
    while(1){
       
if(T[T[u].l].r == NIL){
    printf("%d",T[u].l);
    break;
      }
       
else {
    printf("%d, ",T[u].l);
    T[u].l = T[T[u].l].r;
      }
    }
  }
    
  printf("]\n");
}
  
int main(){
  int i, j, k, id, c, l, t;
  
  scanf("%d", &n);
    
  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = T[i].r = NIL;
  }
    
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &id, &k);
    for ( j = 0; j < k; j++ ){
      scanf("%d", &c);
        
      if(j == 0){
    T[id].l = c;
    T[c].p = id;
    t = c;
      }
      else{
    T[t].r = c;
    T[c].p = id;
    t = c;
      }
    }
  }
    
  for ( i = 0; i < n; i++ ){
 
 print(i);
  } 
return 0;
}

Measured memory_bytes: 1784
using System;
public class Hello{
    public static void Main(){
        
        string str=Console.ReadLine();
        int len=str.Length;
        int count=0;
        for(int i=0;i<len/2;i++){
            if(str.Substring(i,1)!=str.Substring(len-i-1,1)){
                count++;
                
            }
        }
        System.Console.WriteLine(count);
    }
}


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

std::vector<int> z_algorithm(std::string s) {
	int n = s.size();
	std::vector<int> z(n);
	z[0] = n;
	int l = 0, r = 0;
	for(int i = 1; i < n; i++) {
		if (r < i) {
			l = i; r = i;
			for(int j = 0; r < n; j++, r++) {
				if (s[j] != s[r]) break;
			}
			z[i] = r - l;
		} else {
			int p = i - l, q = r - i;
			if (z[p] != q) {
				z[i] = std::min(z[p], q);
			} else {
				l = i;
				for(int j = q; r < n; j++, r++) {
					if (s[j] != s[r]) break;
				}
				z[i] = r - l;
			}
		}
	}
	return z;
}

vector<int> zalgo_wrap(string s, string ref) {
	int l = s.size();
	string s1 = ref + '$' + s;
	auto z = z_algorithm(s1);
	return vector<int>(z.begin() + ref.size() + 1, z.end());
}

int main() {
	string s, t;
	cin >> s >> t;
	int slen = s.size(), tlen = t.size();
	string s2 = s;
	while(s2.size() < slen + tlen) s2 += s;
	auto z = zalgo_wrap(s2, t);
	vector<bool> startable(slen, false);
	rep(i, slen) {
		if (z[i] == tlen) startable[i] = true;
	}
	int ans = 0;
	vector<bool> visited(slen, false);
	rep(i, slen) {
		if (!startable[i] || visited[i]) continue;
		visited[i] = true;
		int t = 1;
		for(int p = (i + tlen) % slen; startable[p]; p = (p + tlen) % slen) {
			if (visited[p]) {
				cout << -1 << endl;
				return 0;
			}
			visited[p] = true;
			t += 1;
		}
		for(int p = ((i - tlen) % slen + slen) % slen; startable[p]; p = ((p - tlen) % slen + slen) % slen) {
			visited[p] = true;
			t += 1;
		}
		ans = max(ans, t);
	}
	cout << ans << endl;

}


Measured memory_bytes: 18832
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int num[100010];

int main () {
        int n, x;
        ios::sync_with_stdio (false);
        cin >> n >> x;
        for (int i = 1; i <= n; i++)    cin >> num[i];
        long long ans = 0;
        num[0] = 0;
        for (int i = 1; i <= n; i++) {
                if (num[i] + num[i - 1] > x) {
                        ans += (num[i] +num[i - 1] - x);
                        num[i] = x - num[i - 1];
                }
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve(ll A, ll B, ll C) {
  map<ll,int> m;
  m[A]++;
  m[B]++;
  m[C]++;
  for (auto p: m)
    if (p.second == 1) cout << p.first << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll B;
	ll C;
	ll A;
	scanf("%lld", &A);
	scanf("%lld", &B);
	scanf("%lld", &C);
	solve(A, B, C);
	return 0;
}


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


Measured memory_bytes: 2112
// Aizu 0288: Knocker of the Gigas Cedar
// 2017.9.10 bal4u@uu

#include <stdio.h>
#include <string.h>
#define INF 0x11111111

int a[102], e[102], r[102];
int dp[102][102];

int main()
{
	int d, n, i, j, k, f, ans;

	while (scanf("%d%d", &d, &n) && d > 0) {
		for (f = i = 0; i < n; i++) {
			scanf("%d%d%d", a+i, e+i, r+i);
			if (a[i] > 0) f = 1;
		}
		if (!f) { puts("NA"); continue; } 
	
		memset(dp, INF, sizeof(dp));
		dp[d][0] = 0;
		for (i = d; i >= 0; i--) for (j = 0; j <= 100; j++) {
			for (k = 0; k < n; k++) if (j >= r[k]) {
				int ni, nj;
				ni = 0;   if (i > a[k])       ni = i-a[k];
				nj = 100; if (j + e[k] < 100) nj = j + e[k];
				if (dp[ni][nj] > dp[i][j] + 1) dp[ni][nj] = dp[i][j] + 1;
			}
		}

		for (ans = INF, i = 0; i <= 100; i++) if (dp[0][i] < ans) ans = dp[0][i];
		if (ans == INF) puts("NA");
		else printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1836
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

def main():
    S = input()

    win = S.count("o")

    if (15 - len(S)) + win >= 8:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <cstdlib>  // abs() for integer
#include <cmath>
#include <stdio.h>

using namespace std;

int main() {
    // int x;
    // cin >> x;
    // cout << x * x * x << endl;
    unsigned N;
    cin >> N;
    
    unsigned int src_t = 0, src_x = 0, src_y = 0;
    unsigned int dst_t = 0, dst_x = 0, dst_y = 0;
    int t, x, y, a;
    bool possible = true;
    for (unsigned int i = 0; i < N; i++) {
        // cin >> dst_t >> dst_x >> dst_y;
        scanf("%d %d %d", &dst_t, &dst_x, &dst_y);
        t = dst_t - src_t;
        x = dst_x - src_x;
        y = dst_y - src_y;
        a = abs(x) + abs(y);
        // cout << t << " " << x << " " << y << " " << a << endl;

        // if ((x <=  t || x >= -t) && (y <=  t || y >= -t) && (x % 2 == t % 2) && (y % 2 == t % 2)) {
        if ((a <=  t && a >= -t) && (a % 2 == t % 2)) {
            continue;
        } else {
            // cout << i << endl;
            possible = false;
            break;
        }
    }

    if (possible) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define ri register int
#define il inline
typedef long long LL;
template<class T>il void in(T &x)
{
	x=0; char c=getchar(); bool f=0;
	while(!isdigit(c)) f|=(c=='-'),c=getchar();
	while(isdigit(c)) x=x*10+(c^'0'),c=getchar();
	f?x=-x:0;
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[30]; short tp=0;
	if(x<0) putchar('-'),x=-x;
	do st[++tp]=x%10,x/=10; while(x);
	while(tp) putchar('0'|st[tp--]);
	putchar(c);
}
template<class T>il void err(const T &x,const char c='\n') {cerr<<x<<c;}
template<class T,class ...Args>il void err(const T &x,const Args &...args) {err(x,' '),err(args...);}
const int md=924844033;
il int qpow(int a,int b) {int r=1; for(;b;b>>=1,a=(LL)a*a%md) if(b&1) r=(LL)r*a%md; return r;}
il int fit(const int x) {return x>=md?x-md:x;}
il void inc(int &x,const int v) {(x+=v)>=md?x-=md:0;}
namespace i207M
{
const int N=2005;
int n,K;
int fac[N]; //ifac[N];
int a[N],tot;
bool vis[N];
il void dfs(int x)
{
	a[++tot]=x,vis[x]=1;
	if(x+K<=n&&!vis[x+K]) dfs(x+K);
}
int f[N][N][2][2]; // last, self be pointed ? 
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
#endif
	in(n),in(K);
	fac[0]=1;
	for(ri i=1;i<=n;++i) fac[i]=(LL)fac[i-1]*i%md;
	//ifac[n]=qpow(fac[n],md-2);
	//for(ri i=n;i>=1;--i) ifac[i-1]=(LL)ifac[i]*i%md;
	for(ri i=1;i<=n;++i)
		if(!vis[i]) dfs(i);
	a[0]=a[n+1]=1e9;
	for(ri i=1;i<=n;++i)
	{
		f[i][0][0][0]=1;
		bool okl=(a[i]-a[i-1]==K),okr=(a[i+1]-a[i]==K);
		for(ri j=0;j<=i;++j)
		{
			// no
			inc(f[i+1][j][0][0],fit(f[i][j][0][0]+f[i][j][1][0]));
			inc(f[i+1][j][1][0],fit(f[i][j][0][1]+f[i][j][1][1]));
			// left
			if(okl)
			{
				inc(f[i+1][j+1][0][0],f[i][j][0][0]);
				inc(f[i+1][j+1][1][0],f[i][j][0][1]);
			}
			// right
			if(okr)
			{
				inc(f[i+1][j+1][0][1],fit(f[i][j][0][0]+f[i][j][1][0]));
				inc(f[i+1][j+1][1][1],fit(f[i][j][0][1]+f[i][j][1][1]));
			}
		}
	}
	int ans=0;
	for(ri i=0,t;i<=n;++i)
	{
		t=fit(f[n+1][i][0][0]+f[n+1][i][1][0]);
		//err(i,t,(LL)t*fac[n-i]%md);
		t=(LL)t*fac[n-i]%md;
		inc(ans,(i&1)?md-t:t);
	}
	out(ans);
	return 0;
}
}
signed main()
{
	i207M::main();
	return 0;
}

Measured memory_bytes: 61184
#include <iostream>
#include <math.h>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int  ans = 0;
    int d, n;

    cin >> d >> n;

    if(n == 100) {
        ans = pow(100, d) * (n + 1);
    } else {
        ans = pow(100, d) * n;
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
#define mem(x,n) memset(x,n,sizeof(x))
#define all(x) x.begin(), x.end()
#define endl "\n"

int main()
{
	faster;

	int n;
	cin >> n;

	set<int> a;
	for(int i = 0; i < n; i++){
		int in;
		cin>>in;
		a.insert(in);
	}

	if(n == a.size()) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

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

int main() {
  int A, B, ans;
  cin >> A >> B;
  ans = max(0, A - 2 * B);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");



i64 a;
cin>>a;
cout<<a+a*a+a*a*a;
    return 0;
  }


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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

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

const long long MOD = 2;

void solve(long long N, std::vector<long long> a) {
    vector<int> sw(N+1, 0);
    for(int i = N ; i >= 1 ; i--){
        int tot = 0;
        for (int j = i; j <= N; j += i) {
            tot ^= sw[j];
        }

        if (a[i-1] != tot) {
            sw[i] = 1;
        }
    }
    vector<int> r;
    for (int i = 1; i <= N; i++)
        if (sw[i]) r.push_back(i);

    cout << r.size() << endl;
    for (auto i : r) cout << i << endl;
}


int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> a(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &a[i]);
    }
    solve(N, std::move(a));
    return 0;
}

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

using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1000000000;
using Graph = vector<vector<int>>;
// typedef pair<int, int> pair;

int main() {
  int n;
  cin >> n;
  vector<pair<ll, ll>> x(n);
  for (int i = 0; i < n; i++) {
    int k1, k2;
    cin >> k1 >> k2;
    x[i] = make_pair(k1 + k2, k1 - k2);
  }
  SORT(x);

  ll ans = 0, t = -1000000010;
  for (int i = 0; i < n; i++) {
    if (t <= x[i].second) {
      ans++;
      t = x[i].first;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
def f(A, i, j, k, nex,res):
    if A[i] == A[j] == 0:
        print("No")
        exit()
    elif A[i] == A[j] == 1 and A[k] == 0:
        if i in nex:
            A[i] += 1
            A[j] -= 1
            return "ABC"[i]
        else:
            A[i] -= 1
            A[j] += 1
            return "ABC"[j]
    else:
        A[i] += 1
        A[j] -= 1
        return "ABC"[i]
    

def main():
    N, A, B, C = [int(_n) for _n in input().split()]
    S = []
    for i in range(N):
        s = input()
        S.append(s)
    if [A,B,C].count(0) == 3:
        print("No")
        return
    res = ""
    arr = [A,B,C]
    S.append("")
    for i,s in enumerate(S[:-1]):
        n = []
        if S[i+1] == "AB":
            n = [0,1]
        if S[i+1] == "BC":
            n = [2,1]
        if S[i+1] == "AC":
            n = [0,2]
        if s == "AB":
            if arr[0] > arr[1]:
                res += f(arr, 1, 0, 2, n,res)
            else:
                res += f(arr,0,1,2,n,res)
        elif s == "BC":
            if arr[1] > arr[2]:
                res += f(arr, 2, 1, 0, n,res)
            else:
                res += f(arr,1,2,0,n,res)
        elif s == "AC":
            if arr[0] > arr[2]:
                res += f(arr, 2,0, 1, n,res)
            else:
                res += f(arr,0,2,1,n,res)
    print("Yes")
    for s in res:
        print(s)
main()

Measured memory_bytes: 148280
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<string>
using namespace std;
string str[102];
int n,l;
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>l;
	for(int i=1;i<=n;i++)
	{
		cin>>str[i];
	}
	sort(str+1,str+n+1);
	for(int i=1;i<=n;i++)
	{
		cout<<str[i];
	}
	cout<<"\n";
	return 0;
}

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

// fundamental
using ll = long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define FOR(i,s,n) for (ll i = (s); i < (n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(x) ((ll)1e##x)
#define MAXC(c,x) (c = max(c, x))
#define MINC(c,x) (c = min(c, x))
const ll mod = TEN(9) + 7;

// vector
using vl = vector<ll>; using vvl = vector<vl>; using vvvl = vector<vvl>;
template<class T, size_t N, class A = size_t> auto mdv(A size = 0) -> typename enable_if<N==1, vector<T>>::type { return vector<T>(size); }
template<class T, size_t N, class A = size_t> auto mdv(A size = 0) -> vector<decltype(mdv<T, N - 1>())> { return vector<decltype(mdv<T, N - 1>())>(size); }
template<class T, size_t N, class A, class... B> auto mdv(A size, B... rest) -> typename enable_if<N!=1, vector<decltype(mdv<T, N - 1>(rest...))>>::type { return vector<decltype(mdv<T, N - 1>(rest...))>(size, mdv<T, N - 1>(rest...)); }
template<class T, class... A> auto mdv(A... size) -> decltype(mdv<T, sizeof...(size), A...>(size...)) { return mdv<T, sizeof...(size), A...>(size...); }
// template<size_t N, class A, class... B> auto mdvl(A size, B... rest) -> decltype(mdv<N, ll, A, B...>(size, rest...)) { return mdv<N, ll, A, B...>(size, rest...); }

// template<class T, class A> auto mdv(A size) -> vector<T> { return vector<T>(size); }
// template<class T, class A, class... B> auto mdv(A size, B... rest) -> vector<decltype(mdv<T>(rest...))> { return vector<decltype(mdv<T>(rest...))>(size, mdv<T>(rest...)); }

// io
template<class T> istream& operator >>(istream& is, vector<T>& vec){ for(T& x: vec) is >> x; return is; }
template<class T, class U> istream& operator >>(istream& is, pair<T, U>& p){ is >> p.first >> p.second; return is; }
template<class T> void input(T& t) { cin >> t; assert(cin); } template<class T, class... Ts> void input(T& t, Ts&... ts) { cin >> t; input(ts...); }
template<class T> void print(T&& t) { cout << t; } template<class T, class... Ts> void print(T&& t, Ts&&... ts) { cout << t; print(ts...); }
template<class T> void println(T&& t) { cout << t << endl; } template<class T, class... Ts> void println(T&& t, Ts&&... ts) { cout << t; println(ts...); }
template<class T> string join(const vector<T>& v, const string & sep) { stringstream ss; REP(i, v.size()) ss << (i != 0 ? sep : "") << v[i]; return ss.str(); }

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(50);

	ll n, k; cin >> n >> k;
	if (n == 1 && k == 1 || k >= (1 << n)) {
		cout << -1 << endl;
		return 0;
	}

	vl ans;
	REP(i, 1 << n) if (i != k) ans.push_back(i);
	if (k == 0)	ans.push_back(k);
	ans.push_back(k);
	REP(i, 1 << n) if ((1 << n) - 1 - i != k) ans.push_back((1 << n) - 1 - i);
	if (k != 0) ans.push_back(k);

	REP(i, ans.size()) cout << ans[i] << (i != ans.size() - 1 ? " " : "");
	cout << endl;
}


Measured memory_bytes: 4080
n = list(map(int, list(input())))
count = 0
n = n[::-1] + [0]

for idx, num in enumerate(n):
    if num == 10:
        n[idx+1] += 1
    elif num == 5:
        if n[idx+1] >= 5:
            n[idx+1] += 1
            count += 10 - num
        else:
            count += num

    elif num <= 4:
        count += num
    else:
        count += 10 - num
        n[idx+1] += 1

print(count)

Measured memory_bytes: 26472
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long double ldb;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
	return x*f;
}
const ldb pi=acos(-1.0),eps=1e-12;
ldb a,b,x,ans;
inline bool check(ldb alp)
{
	if(a*tan(alp)>=b)
	{
		ldb y=b/tan(alp);
		return y*b/2<=x;
	}
	ldb t=b-a*tan(alp);
	return (t+b)*a/2<=x;
}
int main()
{
	cin>>a>>b>>x;
	x/=a;
	ldb L=eps,R=pi/2-eps;
	while(fabsl(R-L)>eps)
	{
		ldb mid=(L+R)/2;
		if(check(mid)) R=mid,ans=mid;
		else L=mid;
	}
	printf("%.12Lf\n",ans/pi*180);
	return 0;
}

Measured memory_bytes: 256
<?php
  list($D,$G) = explode(" ", trim(fgets(STDIN)));

  $p=[];
  $c=[];
  for ($i=0; $i<$D; $i++) {
    list($p[],$c[]) = explode(" ", trim(fgets(STDIN)));
  }

  $ans = PHP_INT_MAX;
  for($i=0; $i<1<<$D; $i++){
    $cnt = 0;
    $point = 0;
    for($j=0; $j<=$D; $j++){
      if($i >> $j & 1){
        $cnt += $p[$j];
        $point += $p[$j]*100*($j+1)+$c[$j];
      }
    }
//    echo $point." ";
    if($G <= $point){
      $ans = min($ans, $cnt);
    }else{
      for($j=$D-1; $j>=0; $j--){
        if(!($i >> $j & 1)){
//          echo "j:".$j." ";
          for($k=0; $k<$p[$j]; $k++){
            $point += 100*($j+1);
            $cnt++;
            if($G <= $point){
              $ans = min($ans, $cnt);
              break;
            }          
          }
          break;
        }
      }
    }
//    echo "e:".$point." ";
//    echo "ans:".$ans.PHP_EOL;
  }

  echo $ans;

Measured memory_bytes: 16204
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	double n,t,a;
	cin>>n>>t>>a;
	double h[1100]={};
	fori(n){cin>>h[i];}

	double score=INF;int ans=0;
	fori(n){
		double s=fabs(a-(t-h[i]*0.006));
		if(s<score){
			score=s;
			ans=i;
		}
	}
	cout<<ans+1;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
signed main()
{
	int A1 = gi(), A2 = gi(), A3 = gi() ;
	int A = A1 + A2 + A3 ; 
	if( A >= 22 ) puts("bust") ;
	else puts("win") ; 
	return 0 ;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    //double ans = 1.0/(1.0+1.0+1.4);
    // 2*S/(a+b+c);

    /*
    double S, a, b, c;
    a = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c = sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));

    if (a < b) {
        if (b < c) {
            c /= 2.0;
        } else {
            b /= 2.0;
        }
    } else {
        if (a < c) {
            c /= 2.0;
        } else {
            a /= 2.0;
        }
    }
    
    S = (abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)))/4.0;
    double ans = 2.0*S/(a+b+c);
    cout << fixed << setprecision(10) << ans << endl;
    */
    double S = 0;
    double a, b, c;

    a = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c = sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    S = (a+b+c)/2.0;

    double r = sqrt(S*(S-a)*(S-b)*(S-c))/S;
    double ans = 0;
    if (a < b) {
        if (b < c) {
            ans = (r*c)/(2.0*r+c);
        } else {
            ans = (r*b)/(2.0*r+b);
        }
    } else {
        if (a < c) {
            ans = (r*c)/(2.0*r+c);
        } else {
            ans = (r*a)/(2.0*r+a);
        }
    }
    
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

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

const int INF = 1001001001;

int main(){
  ll n;
  cin >> n;
  ll maxl = 0,minr = 10e9,distmax = 0,case1 = 0,case2 = 0;
  vector<pair<ll,ll>> lr;
  for(int i=0;i<n;i++){
    ll l; cin >> l;
    ll r; cin >> r;
    maxl = max(l,maxl);
    minr = min(r,minr);
    lr.push_back(make_pair(l,r));
    distmax = max(distmax,r-l);
  }

  //右端が一番左側にあるpairと左端が一番右がわにあるpairを同じ集合に含む
  if(minr-maxl >= 0) case1 = minr - maxl + 1 + distmax + 1;
  case1 = max(case1,distmax+1);

  //別々の集合に含まれる
  {
    for(int i=0;i<n;i++){
      lr.at(i).first = max(minr-lr.at(i).first + 1,0ll);
      lr.at(i).second = max(lr.at(i).second-maxl + 1,0ll);
      lr.at(i).second *= -1;
    }
    sort(lr.begin(),lr.end());
    for(int i=0;i<n;i++){
      lr.at(i).second *= -1;
    }
    ll mina = INF,minb = INF;
    for(int i=0;i<n-1;i++){
      mina = lr.at(i+1).first;
      minb = min(minb,lr.at(i).second);
      case2 = max(case2,mina + minb);
    }
  }
  cout << max(case1,case2) << endl;
}

Measured memory_bytes: 2420
#include <stdio.h>

static int a, b, c;

int main(void) {
    scanf("%d%d%d", &a, &b, &c);
    if (a == b + c || b == c + a || c == a + b) {
        puts("Yes");
    } else {
        puts("No");
    }
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
ll const MOD = 1e9 + 7;

int main() {
  ll N;
  cin >> N;
  vector<vector<char>> M(2, vector<char>(N));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++) {
      cin >> M[i][j];
    }
  }
  ll ans = 1;
  bool wide = true;
  for (int i = 0; i < N; i++) {
    if (M[0][i] == M[1][i]) {
      if (i == 0)
        ans = ans * 3 % MOD;
      else if (!wide)
        ans = ans * 2 % MOD;
      wide = false;
    } else {
      if (i == 0)
        ans = ans * 6 % MOD;
      else if (!wide)
        ans = ans * 2 % MOD;
      else if (wide)
        ans = ans * 3 % MOD;
      i++;
      wide = true;
    }
  }
  cout << ans << endl;
  return 0;
}

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

const int N = 5e5 + 10, inf = 1e9;

typedef long long ll;

ll sum[N], a[N], ans[N];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	for (int i = 0; i < n; i++)
		sum[i + 1] = sum[i] + a[i];
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if(sum[i + 1] * 2 >= a[i + 1]) {
			ans[i] = 1;
		}
	}
	for (int i = n - 1; ~i; i--) {
		if(!ans[i])	break;
		cnt++;
	}
	cout << cnt << "\n";
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	string S; cin >> S;
	int ans = 0;
	char now = S[0], pre;
	for(int i = 1; i < S.size(); i++) {
		pre = now;
		now = S[i];
		if(now != pre) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

char str[11];

int main()
{
scanf("%s", str);
if(str[0] == 'Y' && str[1] == 'A' && str[2] == 'K' && str[3] == 'I') printf("Yes\n");
else printf("No\n");
}

Measured memory_bytes: 256
# -coding: utf-8 -
import numpy as np

n = int(input())
a = list(map(int, input().split()))

np_a = np.array(a)

count = 0
while(True):
    if sum(np_a%2!=0) >= 1: #Falseがあるなら
        break
    else:
        count += 1
        np_a = np_a//2

print(count)        



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

int main () {
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  vector<int> s = a;
  sort(s.rbegin(),s.rend());
  rep(i,n) {
    int ans = s.at(0);
    if (s.at(0) == a.at(i)) ans = s.at(1);
    cout << ans << endl;
  }
}


Measured memory_bytes: 3200
import sys
input = sys.stdin.readline

def solve():
    dxys = [(-1,0), (1,0), (0,-1), (0,1)]

    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    Sss = ['#'*(W+4)] + ['#'*(W+4)] + ['##'+input().rstrip()+'##' for _ in range(H)] + ['#'*(W+4)] + ['#'*(W+4)]

    Ch, Cw, Dh, Dw = Ch+1, Cw+1, Dh+1, Dw+1

    usedss = [[0]*(W+4) for _ in range(H+4)]
    for x in range(H+4):
        for y in range(W+4):
            if Sss[x][y] == '#':
                usedss[x][y] = 1

    ans = 0
    vs = set([(Ch, Cw)])
    vNews = set([(Ch, Cw)])
    usedss[Ch][Cw] = 1
    while True:
        while vs:
            v2s = set()
            for x, y in vs:
                for dx, dy in dxys:
                    x2, y2 = x+dx, y+dy
                    if usedss[x2][y2]: continue
                    v2s.add((x2, y2))
                    vNews.add((x2, y2))
                    usedss[x2][y2] = 1
            vs = v2s

        if usedss[Dh][Dw]:
            print(ans)
            break

        if not vNews:
            print(-1)
            break

        vs = set()
        for x, y in vNews:
            for dx in range(-2, 3):
                for dy in range(-2, 3):
                    x2, y2 = x+dx, y+dy
                    if usedss[x2][y2]: continue
                    vs.add((x2, y2))
                    usedss[x2][y2] = 1

        ans += 1
        vNews = set(vs)


solve()


Measured memory_bytes: 20428
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;
typedef pair<ll,ll> P;

vector<vector<pair<ll,ll>>> to(100001,vector<pair<ll,ll>>(0));
vector<ll> dist(100001,0);

void dfs(ll n,ll p,ll d){
  dist[n] = d;
  for(auto next : to[n]){
    if(next.first == p) continue;
    dfs(next.first,n,d+next.second);
  }
  return;
}

int main(){
  ll n;
  cin >> n;
  rep(i,n-1){
    ll a,b,c;
    cin >> a >> b >> c;
    to[a].push_back(make_pair(b,c));
    to[b].push_back(make_pair(a,c));
  }//rep_i
  ll q,k;
  cin >> q >> k;
  dfs(k,0,0);
  rep(i,q){
    ll x,y;
    cin >> x >> y;
    cout << dist[x]+dist[y] << endl;
  }
}


Measured memory_bytes: 14336
#include <cstdio>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #include <set>
    #include <map>
    #include <string>
    #include <cmath>
    #include <cstdlib>
    #include <ctime>
    using namespace std;
    typedef long long LL;
     
    char a[5][5];
     
    int main()
    {
    	for(int i = 1; i <= 2; i++) {
    		for(int j = 1; j <= 3; j++) scanf("%c", &a[i][j]);
    		getchar();
    	}
    	bool ok = 1;
    	if(a[1][1] != a[2][3]) ok = 0;
    	if(a[1][2] != a[2][2]) ok = 0;
    	if(a[1][3] != a[2][1]) ok = 0;
    	if(!ok) printf("NO\n");
    	else printf("YES\n");
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<double,int> PD;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 50005

ll bit[MAX_N+1];
int nn = MAX_N; //　1-index

void adds(int a, ll w){
    for(int x = a; x <= nn; x += x & -x) bit[x] += w;
}
ll sums(int a){ // bit[1,a]の和を返す.
    ll ret = 0;
    for(int x = a; x > 0; x -= x & -x) ret += bit[x];
    return ret;
}

int main() {
    int n;
    cin >> n;
    double a[n], b[n], c[n];
    rep(i,n) cin >> a[i] >> b[i] >> c[i];
    vector<pair<double,int>> v;
    rep(i,n){
        double grad = -a[i] / b[i];
        v.push_back(PD(grad,i));
    }
    sort(v.begin(), v.end());
    int f[n] = {};
    rep(i,n) f[v[i].second] = i + 1;

    // x座標を決め打ち
    double l = -1e10, r = 1e10;
    rep(_,100){
        double m = (l+r)/2;
        rep(i,MAX_N) bit[i] = 0;
        vector<PD> u;
        rep(i,n){
            double y = (c[i]-a[i]*m)/b[i];
            u.push_back(PD(y,i));
        }
        sort(u.begin(), u.end());
        int cnt = 0;
        rep(i,n){
            int id = u[i].second;
            cnt += sums(f[id]); // 左(x座標が小さい)交点の数
            adds(f[id],1);
        }
        if(cnt >= (n*(n-1)/2+1)/2) r = m;
        else l = m;
    }
    cout << fixed << setprecision(12) << r << ' ';

    // 時計回りに90°回転
    rep(i,n){
        swap(a[i], b[i]);
        b[i] *= -1;
    } 

    v.clear();
    rep(i,n){
        double grad = -a[i] / b[i];
        v.push_back(PD(grad,i));
    }
    sort(v.begin(), v.end());
    rep(i,n) f[v[i].second] = i + 1;

    // x座標を決め打ち
    l = -1e10, r = 1e10;
    rep(_,100){
        double m = (l+r)/2;
        rep(i,MAX_N) bit[i] = 0;
        vector<PD> u;
        rep(i,n){
            double y = (c[i]-a[i]*m)/b[i];
            u.push_back(PD(y,i));
        }
        sort(u.begin(), u.end());
        int cnt = 0;
        rep(i,n){
            int id = u[i].second;
            cnt += sums(f[id]); // 左(x座標が小さい)交点の数
            adds(f[id],1);
        }
        if(cnt >= (n*(n-1)/2+1)/2) r = m;
        else l = m;
    }
    cout << fixed << setprecision(12) << r << endl;

    return 0;
}




Measured memory_bytes: 7176
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var X = sc.nextInt();
        if (X == 3 || X == 5 || X == 7) {
            WriteLine("YES");
        } else {
            WriteLine("NO");
        }
    }
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
const ll P = 1e9+7;
typedef vector<boost::variant<bool, ll, int, string, double>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
template<typename T> inline void debug(const vector<T> &xs){
#ifdef DEBUG
	pr(xs);
#endif
}

int main(){
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	vector<int> B(M);
	for(int i=0; i<N; i++) cin >> A[i];
	for(int i=0; i<M; i++) cin >> B[i];

	set<int> am, bm;
	for(int i=0; i<N; i++){
		if(am.count(A[i])){
			cout << 0 << endl;
			return 0;
		}
		am.insert(A[i]);
	}
	for(int i=0; i<M; i++){
		if(bm.count(B[i])){
			cout << 0 << endl;
			return 0;
		}
		bm.insert(B[i]);
	}
	int n_done = 0, m_done = 0;
	ll ans = 1;

	for(int i=N*M; i>0; i--){
		if(am.count(i)>0&&bm.count(i)>0){
			if(n_done==N||m_done==M){
				ans = 0;
			} else {
				n_done++;
				m_done++;
			}
		} else if(am.count(i)>0){
			if(n_done==N){
				ans = 0;
			} else {
				ans *= m_done;
				ans %= P;
				n_done++;
			}
		} else if(bm.count(i)>0){
			if(m_done==M){
				ans = 0;
			} else {
				ans *= n_done;
				ans %= P;
				m_done++;
			}
		} else {
			ans *= (n_done*m_done-(N*M-i));
			ans %= P;
		}
		debug(any{i, ans, n_done, m_done});
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int indexA = 0;
		while(str.charAt(indexA) != 'A'){
			indexA++;
		}
		int indexB = str.length();
		while(str.charAt(indexB - 1) != 'Z'){
			indexB--;
		}

		System.out.println(indexB - indexA);
    }
}

Measured memory_bytes: 26324
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	ll a;
	string b;

	cin >> a >> b;
	string B;
	for (char c : b) {
		if (c != '.')
			B += c;
	}
	int bi = stoi(B);
	cout << (a * bi) / 100 << endl;

}

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	solve();
}


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

int main(){
  ll N = 0;
  cin >> N;
  rep(i,47000){
    if(i * 108 / 100 == N){
      cout << i;
      return 0;
    }
    if(i * 108 / 100 > N){
      cout << ":(";
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const ll mod = 1e9 + 7;
const int maxv = 200100;
const int maxn = 3100;
ll fact[maxv], ifact[maxv];

ll power(ll x, ll y) {
    if(y == 0) return 1LL;
    else if(y == 1) return 1LL * x % mod;
    else {
        if(y % 2 == 0) {
            ll half = power(x, y/2);
            return (half * half) % mod;
        }
        else return (x*power(x, y-1))%mod;
    }
}

void preprocess() {
    fact[0] = 1LL;
    ifact[0] = power(fact[0], mod-2);
    for(ll i=1LL;i<maxv;i++) {
        fact[i] = fact[i-1] * i;
        fact[i] %= mod;
        ifact[i] = power(fact[i], mod-2);
    }
}

ll ncr(ll x, ll y) {
    return 1LL * ((fact[x] * ifact[y])%mod * ifact[x-y])%mod;
}

int n, m, k;
vector<pair<int,int> > points;
ll cntunique[maxn];

int main() {
    preprocess();
    cin>>n>>m>>k;
    int x, y;
    for(int i=0;i<k;i++) {
        cin>>x>>y;
        points.pb(mp(x, y));
    }

    sort(points.begin(), points.end());
    ll result = ncr(n+m-2, n-1);
    for(int i=0;i<k;i++) {
        cntunique[i] = ncr(points[i].first + points[i].second - 2, points[i].first-1);
        for(int j=0;j<k;j++) {
            if(points[j].first <= points[i].first && points[j].second <= points[i].second && i != j) {
                int diffx = points[i].first - points[j].first;
                int diffy = points[i].second - points[j].second;
                cntunique[i] = (cntunique[i] - (cntunique[j] * ncr(diffx+diffy, diffy))%mod + mod) % mod;
                cntunique[i] %= mod;
            }
        }
        int diffx = n - points[i].first;
        int diffy = m - points[i].second;
        result = (result - (cntunique[i] * ncr(diffx+diffy, diffy))%mod + mod) %mod;
        result %= mod;
    }
    cout<<result<<"\n";
    return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <math.h>
#include <string>
using namespace std;


int main()
{
	int N;
	int ta = 0, xa = 0, ya = 0, tb, xb, yb; //a:before b:after
	string s = "Yes"; //何もなければそのまま出力
	cin >> N;


	for (int i = 0; i < N; i++) {
		cin >> tb >> xb >> yb;

		if (tb % 2 != (xb + yb) % 2) { //そもそも到達し得ない
			s = "No";
			break;
		}
		else if (tb-ta < (abs(xb-xa)+abs(yb-ya))) { //マンハッタン距離が時間より短いと間に合わない
			s = "No";
			break;
		}
		ta = tb;
		xa = xb;
		ya = yb;
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256