akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//turn on extra precision
//#pragma GCC target("fpmath=387")

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef string str;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
#define fbo find_by_order
#define ook order_of_key
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define watch(x) cout << (#x) << " is : " << (x) << newl

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
vi dirx = {0,0,1,-1};
vi diry = {1,-1,0,0};
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122) return char(x-32);
    if( 65 <= int(x) && int(x) <= 90) return x;
    return -1;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122) return x;
    if( 65 <= int(x) && int(x) <= 90) return char(x+32);
    return -1;
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57) return int(x-'0');
    if(97 <= int(x) && int(x) <= 122) return int(x-96);
    if(65 <= int(x) && int(x) <= 90) return int(x-64);
    return -1;
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1 = {l1,r1};
    pii p2 = {l2,r2};
    if(p1>p2)swap(p1,p2);
    return (p2.fi <= p1.se);
}
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1%MOD;
    else if(num2==1)return num1%MOD;
    else{
        ll temp = quickpow (num1,num2>>1LL,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2&1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template

int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

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

    int n; ll d; cin >> n >> d;
    int ans = 0; d *= d;
    for(int i = 1; i <= n; ++i){
        ll x,y; cin >> x >> y;
        ll res = x * x + y * y;
        if(res <= d) ++ans;
    }
    cout << ans << newl;

    return 0;
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const int MD = 1e9+7; typedef vector<ll> VL;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s, t;
	cin >>s >>t;
	map<char, char> mp, mp2;
	bool ng=0;
	rep(i, sz(s)){
		if(mp.count(s[i])  && mp[s[i]] != t[i]) ng=1;
		if(mp2.count(t[i]) && mp2[t[i]] != s[i]) ng=1;
		mp[s[i]] = t[i];
		mp2[t[i]]= s[i];
		if(ng) break;
	}
	puts(ng? "No":"Yes");
	return 0;
}


Measured memory_bytes: 916
n, m, q = map(int, input().split())
train = [tuple(map(int, input().split())) for _ in range(m)]
quest = [tuple(map(int, input().split())) for _ in range(q)]
dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
d = {}
for l in range(n):
    for r in range(l,n):
        d[(l+1,r+1)] = 0
for p, q in train:
    d[(p,q)] += 1
for l in range(1,n+1):
    dp[l][l] = d[(l,l)]
for w in range(1,n):
    for l in range(n-w):
        dp[l+1][l+w+1] = dp[l+1][l+w] + dp[l+2][l+w+1] - dp[l+2][l+w] + d[(l+1,l+w+1)]
for l, r in quest:
    print(dp[l][r])


Measured memory_bytes: 58484
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toLong() }
    val a = readLine()!!.split(" ").map { it.toLong() }
    val sum = a.sum()
    if(n < sum)
        println(-1)
    else
        println(n - sum)
}

Measured memory_bytes: 39400
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N;
  cin >> N;
  //vector<string> S;
  map<string, int> mp;
  rep(i, N)
  {
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << mp.size() << endl;
  return 0;
}

Measured memory_bytes: 19148
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
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);
}
int main()
{
    ll N;
    cin >> N;

    auto dp = make_v<ll>(N + 1, 3), A = make_v<ll>(N, 3);

    rep(i, N)
    {
        rep(j, 3)
        {
            cin >> A[i][j];
        }
    }
    rep(i, N)
    {
        rep(j, 3)
        {
            dp[i + 1][j] = max(dp[i][(j + 1) % 3], dp[i][(j + 2) % 3]) + A[i][j];
        }
    }
    cout << max({dp[N][0], dp[N][1], dp[N][2]});
    return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>

typedef long long ll;
using namespace std;
#define rep(i,b) for(ll i=0;i<(b);++i)
#define rep1(i,b) for(ll i=1;i<=(b);++i)
#define vec vector
#define FOR(I,A,B) for(ll I=(A);I<(B);++I)
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

int main() {
   string S;
   cin >> S;
   ll cnt = 0;
   ll dnt = 0;
   for (auto j=0;j<S.size();j++) {
      char t = S[j] - '0';
      if (t == j%2) {
         cnt++;
      } else {
         dnt++;
      }
   }
   cout << min(cnt, dnt) << endl;
}


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

int main() {
    int64_t h, w;
    cin >> h >> w;
    vector<pair<int64_t, int64_t>> d { { h, w }, { w, h } };
    int64_t ans = 1e9;
    for (auto& e : d) {
        int64_t ho = e.first, ve = e.second;
        for (int64_t i = 1; i < ho; i++) {
            int64_t hs = (ho - i) / 2;
            int64_t h1 = ve * i, h2 = ve * hs, h3 = ve * (ho - i - hs);
            ans = min(ans, max({ h1, h2, h3 }) - min({ h1, h2, h3 }));
            int64_t vs = ve / 2;
            int64_t v1 = ve * i, v2 = (ho - i) * vs, v3 = (ho - i) * (ve - vs);
            ans = min(ans, max({ v1, v2, v3 }) - min({ v1, v2, v3 }));
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
mod = 10**9+7
N = int(input())
p = list(map(float, input().split()))
dp = [[0]*(N+1) for _ in range(N)]
dp[0][0] = 1-p[0]
dp[0][1] = p[0]
for i in range(1, N):
    for j in range(N+1):
        if j == 0:
            dp[i][j] = dp[i-1][j]*(1-p[i])
        else:
            dp[i][j] = dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i])
print(sum(dp[-1][(N+1)//2:]))








Measured memory_bytes: 259720
#include <iostream>
using namespace std;
static const int WHITE = 1;
static const int BLACK = 0;
int P[10000];
int color[10000];
int cnt = 0;

void prime(int n){
    for(int i=0; i<n; i++){
        if(color[i]!=BLACK){
            for(int j=3; j*j<=P[i]; j+=2){
                if(P[i]%j==0){
                    color[i]=BLACK;
                }
            }
        }
    }
}

int main(){
    int n;
    cin >> n;
    
    for(int i=0; i<n; i++){
        cin >> P[i];
        color[i] = WHITE;
    }
    
    for(int i=0; i<n; i++){
        if(P[i]==2) continue;
        if(P[i]%2==0){
            color[i] = BLACK;
        }
    }
    
    prime(n);
    
    for(int i=0; i<n; i++){
        if(color[i]==WHITE){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define N 200010
using namespace std;

int cnt[N],n,k;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		int k; scanf("%d",&k);
		cnt[k]++;
	}
	sort(cnt+1,cnt+1+n);
	int Ans=n;
	for(int i=n;i>n-k;i--)
		Ans-=cnt[i];
	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; ++i) cin >> s[i];
    map<char, ll> mp;
    ll A[10];
    for (int i = 0; i < n; ++i) {
        mp[s[i][0]]++;
    }

    A[0] = mp['M'] * mp['A'] * mp['R'];
    A[1] = mp['M'] * mp['A'] * mp['C'];
    A[2] = mp['M'] * mp['A'] * mp['H'];
    A[3] = mp['M'] * mp['R'] * mp['C'];
    A[4] = mp['M'] * mp['R'] * mp['H'];
    A[5] = mp['M'] * mp['C'] * mp['H'];
    A[6] = mp['A'] * mp['R'] * mp['C'];
    A[7] = mp['A'] * mp['R'] * mp['H'];
    A[8] = mp['A'] * mp['C'] * mp['H'];
    A[9] = mp['R'] * mp['C'] * mp['H'];
    ll ans = 0;
    for (int i = 0; i < 10; ++i) ans += A[i];
    cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 6144
inf = float("inf")

minPaths = {}
weights = {}

stone = int(input())
wei = tuple(map(int, input().split()))

for i in range (stone):
  minPaths[i+1] = inf
  weights[i+1] = wei[i]

#find shortest paths
minPaths[1] = 0

for node in range(1, stone + 1):
  cWeight = minPaths[node]
  
  #calculate to nwxt 2 nodes
  try:
    toP1 = abs(weights[node] - weights[node+1])
    if toP1 + cWeight < minPaths[node+1]:
      minPaths[node+1] = toP1 + cWeight

    toP2 = abs(weights[node] - weights[node+2])
    if toP2 + cWeight < minPaths[node+2]:
      minPaths[node+2] = toP2 + cWeight
  except KeyError:
    None
print (minPaths[stone])


Measured memory_bytes: 31632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // 基本的にはimos法を用いる
    // 前からやればO(N)
    int n, k;
    ll mod = 998244353;
    cin >> n >> k;
    vector<ll> dp(500000);
    vector<ll> ans(500000);
    ans[0] = 1;
    vector<int> l(k);
    vector<int> r(k);
    rep(i, k)
    {
        cin >> l[i] >> r[i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < k; j++)
        {
            dp[i + l[j]] += ans[i];
            dp[i + l[j]] %= mod;
            dp[i + r[j] + 1] += mod - ans[i];
            dp[i + r[j] + 1] %= mod;
        }
        dp[i + 1] += dp[i];
        dp[i + 1] %= mod;
        ans[i + 1] = dp[i + 1];
    }
    cout << ans[n - 1] << endl;
}

Measured memory_bytes: 11104
#coding:utf-8

#数字をグループ分けしておく。リストの番号が0始まりなので、最初わざと0を入れる
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().split())


if group[x] == group[y]:
  print('Yes')
else:
  print('No')



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

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

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}

int A,B;
int main(){
    cin >> A >> B;
    int a = 6;
    cout << a - A- B << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	
	
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		HashMap<String,Integer> h = new HashMap<>();
		h.put("AC",0);
		h.put("TLE",0);
		h.put("RE",0);
		h.put("WA",0);
		while(n--!=0) {
			String c = s.next();
			h.put(c, h.get(c)+1);
		}
		System.out.println("AC x "+h.get("AC"));
		System.out.println("WA x "+h.get("WA"));
		System.out.println("TLE x "+h.get("TLE"));
		System.out.println("RE x "+h.get("RE"));
		
	}

}


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

using namespace std;
using ll = long long;

int a[5];

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

	for(int i=0; i<3; i++){
		int t1, t2;
		cin >> t1 >> t2;

		a[t1]++;
		a[t2]++;
	} 

	bool ans = true;
	for(int i=1; i<=4; i++){
		if(a[i]>2)
			ans = false;
	}

	cout << (ans ? "YES" : "NO") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Dice{
	int x[6];
	void input(){
		for(int i=0;i<6;i++){
			cin>>x[i];
		}
	}
	void rollforward(){
		int tmp=x[0];
		x[0]=x[1];
		x[1]=x[5];
		x[5]=x[4];
		x[4]=tmp;
	}
	void rollside(){
		int tmp=x[1];
		x[1]=x[3];
		x[3]=x[4];
		x[4]=x[2];
		x[2]=tmp;
	}
	bool operator==(Dice a){
		for(int i=0;i<6;i++){
			if(x[i]!=a.x[i])	return false;
		}
		return true;
	}
};
bool check(Dice a,Dice b){
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(a==b)	return true;
			a.rollside();
		}
		a.rollforward();
	}
	a.rollside();
	a.rollforward();
	for(int i=0;i<4;i++){
		if(a==b)	return true;
		a.rollside();
	}
	a.rollforward();
	a.rollforward();
	for(int i=0;i<4;i++){
		if(a==b)	return true;
		a.rollside();
	}
	return false;
}
int main(){
	int n;	cin>>n;
	Dice a[n];
	for(int i=0;i<n;i++)	a[i].input();
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(check(a[i],a[j])){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<algorithm>
using namespace std;
int n,a,t,h,s,id;
main()
{
	cin>>n>>t>>a;
	t=(t-a)*1000;
	s=1e9;
	for(int i=0;i<n;i++)
	{
		cin>>h;
		h*=6;
		if(abs(t-h)<s)
		{
			s=abs(t-h);
			id=i+1;
		}
	}
	cout<<id<<endl;
}


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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n;
vector <int> a;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(10);
    cin >> n;
    a.resize(n);
    for(auto &i : a) cin >> i;
    sort(a.begin(), a.end());
    double cur = a[0];
    for(int i = 1 ; i < n ; i++){
        cur = (cur + a[i]) / 2;
    }
    cout << cur << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
	double l[10],v1,v2,x;
	double ans;
	char c;
	while(cin>>l[0]>>c>>l[1]>>c>>l[2]>>c>>l[3]>>c>>l[4]>>c>>l[5]>>c>>l[6]>>c>>l[7]>>c>>l[8]>>c>>l[9]>>c>>v1>>c>>v2){
		x=0;
		for(int i=0;i<10;i++){
			x+=l[i];
		}
		ans=x*v1/(v1+v2);
		int n=0,s=0;
		while(1){
			s+=l[n];
			if(ans<=s){
				cout<<n+1<<endl;
				break;
			}
			n++;
		}
	}
	return 0;
}

Measured memory_bytes: 1224
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#define N 210000
#define M 210000
using namespace std;
int a[210000];
int main()
{
	int n;
	cin>>n;
	long long l=2;
	long long r=l;
	for(int i=0;i<=n-1;i++)scanf("%d",&a[i]);
	for(int i=n-1;i>=0;i--)
	{
		if(r/a[i]==(l-1)/a[i]){ puts("-1"); return 0; }
		l = ((l - 1)/a[i] + 1)*a[i];
		r = (r/a[i] + 1)*a[i]-1;
	}
	printf("%lld %lld\n",l,r);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
  int N,b;
  cin>>N;
  b=pow(N, 1.0 / 2.0)/1+1;
  vector<int> vec(N*10000);
 for (int i = 1; i < b+1; i++) {
    for (int j = 1; j < b+1; j++) {
      for (int k = 1; k < b+1; k++) {
        vec.at(i*i+j*j+k*k+i*j+j*k+k*i-1)++;
      }
    }
 }
  vec.erase(vec.begin() + N, vec.begin() + N*10000);
  for (int i = 0; i < N; i++) {
  cout<<vec.at(i)<<endl;
  }
}

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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    double cookie,segundos,tempo;
    int produzidos = 0;

    cin >> segundos >> cookie >> tempo;

    if (segundos > tempo)
    {
        cout << produzidos << endl;
    }
    for (double i = segundos ; i < tempo + 0.5 ; i += segundos)
    {
        produzidos += cookie;

    }
    if(produzidos != 0)
    {
        cout << produzidos << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import bisect

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

p = [0 for _ in range(n)]

if not (n == 0):
    p = [int(s) for s in input().split()]
    p_s = set(p)
    mn = x
    mx = x
    ans = 0
    while True:
        if not (mn in p_s):
            ans = mn
            break
    
        if not (mx in p_s):
            ans = mx
            break
        
        mn -= 1
        mx += 1
    
    print(ans)
else:
    print(x)

Measured memory_bytes: 9212
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
string s;
//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>s;
		if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes";
		else cout<<"No";

}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    
}

Measured memory_bytes: 2560
N = gets.chomp.to_i

previous_time = 0
previous_x_pos = 0
previous_y_pos = 0

N.times do
	a = gets.chomp.split(" ").map(&:to_i)
 	# array(time, x_pos, y_pos)
  	# condition 1
	# calcurate distance between current position and previous
	dist = (a[1] - previous_x_pos).abs + (a[2] - previous_y_pos).abs
 	time_difference = a[0] - previous_time
  	if dist > time_difference
      puts "No"
      exit
    end
  	# condition 1
	if a[0]%2 != (a[1].abs + a[2].abs)%2
      puts "No"
      exit
    end
end

puts "Yes"

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

using namespace std;

void solve()
{
	int k, a, b;
	cin >> k >> a >> b;
	
	int p = a / k;
	p *= k;
	
	if(p < a)
		p += k;
	
	if(p <= b)
	{
		cout << "OK\n";
	}
	else
	{
		cout << "NG\n";
	}
}

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

//	cin >> t;

	for(; t; --t)
	{
		solve();
	}
}

Measured memory_bytes: 3652
package main

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

func main() {
	nextReader = newScanner()
	n := nextInt()
	as := make([]int, n)
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		a := nextInt()
		as[i] = a
		m[a]++
	}

	sum := 0
	for _, v := range m {
		sum += v * (v - 1) / 2
	}

	for k := 1; k <= n; k++ {
		v := m[as[k-1]]
		ans := sum - (v * (v - 1) / 2)
		if v > 1 {
			ans += (v - 1) * (v - 2) / 2
		}
		fmt.Println(ans)
	}
}

// ---------------------------------------------------------------
// I/O
// ---------------------------------------------------------------
var nextReader func() string

func newScanner() func() string {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1024), int(1e11))
	sc.Split(bufio.ScanWords)
	return func() string {
		sc.Scan()
		return sc.Text()
	}
}

func nextString() string { return nextReader() }

func nextInt() int { n, _ := strconv.Atoi(nextReader()); return n }

func nextInts(size int) []int {
	ns := make([]int, size)
	for i := 0; i < size; i++ {
		ns[i] = nextInt()
	}
	return ns
}


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

int main()
{
  char abcd[9];
  scanf("%s",abcd);
  char ans[20];
  for(int t=0;t<(1<<3);t++)
  {
    int num = abcd[0] - '0';
    for(int i=0;i<3;i++)
    {
      if(t & (1<<i))
      {
        num += abcd[i+1] - '0';
      }
      else
      {
        num -= abcd[i+1] - '0';
      }
    }
    if(num == 7)
    {
      cout << abcd[0];
      for(int i=0;i<3;i++)
      {
        if(t & (1<<i))
        {
          cout << '+';
        }
        else
        {
          cout << '-';
        }
        cout << abcd[i+1];
      }
      cout << '=' << '7' << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int l,r,d;
  cin>>l>>r>>d;
  int c=0;
  for(int i=l;i<=r;i++){
    if(i%d==0)
      c++;
  }
  cout<<c<<"\n";
  return 0;
}

Measured memory_bytes: 3620
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;

void main()
{
  auto rd = readln.split.map!(to!real), a = rd[0], b = rd[1], t = rd[2];
  t = t * PI / 180;

  auto h = b * sin(t);
  auto s = a * h / 2;
  auto c = hypot(h, a - b * cos(t));

  writefln("%.5f", s);
  writefln("%.5f", a + b + c);
  writefln("%.5f", h);
}

Measured memory_bytes: 2528
def main():
    n, y = map(int, input().split())
    for i in range(n+1):
        for j in range(n-i+1):
            k = n - i - j
            money = i * 10000 + j * 5000 + k * 1000
            if money == y:
                print(i, j, k)
                return
    print(-1, -1, -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38896
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int Compare_Func_A(const int &arg_a, int &arg_b);
int Compare_Func_B(const int &arg_a, int &arg_b);

const int MIN_TAKO = 1;
const int LIMIT_TIME = 1000;
const int ERROR = -1;

int main()
{
	int Int_N = 0;
	int Int_X = 0;
	int Int_T = 0;

	int Result_N = 0;
	int Result_T = 0;
	int Total_Time = 0;

	std::cin >> Int_N >> Int_X >> Int_T;

	Result_N = Compare_Func_A(MIN_TAKO, Int_N);
	if (ERROR == Result_N)
	{
		return -1;
	}

	Result_T = Compare_Func_B(LIMIT_TIME, Int_T);
	if (ERROR == Result_T)
	{
		return -1;
	}

	while (0 < Int_N)
	{
		Total_Time = Total_Time + Int_T;
		Int_N = Int_N - Int_X;
	}
	   
	std::cout << Total_Time << std::endl;

	return 0;
}

int Compare_Func_A(const int &arg_a, int &arg_b)
{
	if (arg_a > arg_b)
	{
		return ERROR;
	}
	return 0;
}

int Compare_Func_B(const int &arg_a, int &arg_b)
{
	if (arg_a < arg_b)
	{
		return ERROR;
	}
	return 0;
}

Measured memory_bytes: 3528
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdint>
using namespace std;
const int64_t INF = 1ll << 60;

int main(){
    uint A, B, Q;
    cin >> A >> B >> Q;
    vector<int64_t> s(A+2), t(B+2), result(Q);
    s[0] = t[0] = -INF;
    s[A+1] = t[B+1] = INF;
    for (int i = 1; i < A+1; i++) cin >> s[i];
    for (int i = 1; i < B+1; i++) cin >> t[i];
    for (int i = 0; i < Q; i++){
        int64_t x;
        cin >> x;
        auto b = lower_bound(s.begin(), s.end(), x) - s.begin();
        auto d = lower_bound(t.begin(), t.end(), x) - t.begin();
        int64_t ret = INF;
        for (auto e1 : {s[b-1], s[b]}){
            for (auto e2 : {t[d-1], t[d]}){
                ret = min(ret, min(abs(x-e1)+abs(e1-e2), abs(x-e2)+abs(e2-e1)));
            }
            result[i] = ret;
        }
    }
    for (const auto& e : result) cout << e << endl;
}


Measured memory_bytes: 3712
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
/*---------------------------------------------------------------------*/
const int N = 15;
const int INF = (int)1e9+5;

int main()
{
    _SAD();
    int a,b;
    cin>>a>>b;
   // a--;
    ll ans=((a*(a-1))/2)+((b*(b-1))/2);
    /*if(b>0)
    {
    	cout<<ans+b<<nl;return 0;
    }*/
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define MAX_N (int)2e5 + 1

int par[MAX_N];
int ran[MAX_N];
int nan[MAX_N];

// initialize for n items
void init(int n){
  for(int i=0;i<n;i++){
    par[i] = i;
    ran[i] = 0;
    nan[i] = 1;
  }
}

// get the root of the tree of x
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

// unite the sets of x and y
void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y)
    return;

  if(ran[x] < ran[y]){
    par[x] = y;
    nan[y] = nan[y] + nan[x];
  } else {
    par[y] = x;
    nan[x] = nan[x] + nan[y];
    if(ran[x] == ran[y])
      ran[x]++;
  }
}

bool same(int x,int y){
  return find(x) == find(y);
}

int main(void){
  int N,M;
  cin >> N >> M;
  int a,b;
  init(N+1);
  for(int n=0;n<M;n++){
    cin >> a >> b;
    unite(a,b);
  }
  //nanの最大値をだせばよい
  int ans = 1;
  for(int n=1;n<=N;n++){
    int num = nan[n];
    if(ans < num){
      ans = num;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



namespace ConsoleApplication2
    {
        class Adaytakahashi
        {
            public static void Main()
            {

                string[] str = Console.ReadLine().Split();
                int a = int.Parse(str[0]);
                int b = int.Parse(str[1]);

                if (a <= b && a<=12 && b <= 31 )
                {
                    Console.WriteLine("{0}", a);
                }
                else if (a > b && a<=12 && b<=31)
                {
                    Console.WriteLine("{0}", (a - 1));
                }

            }
        }
    }

Measured memory_bytes: 11220
#include <iostream>
#include <stdio.h>
#include <numeric>
#include <algorithm>
using namespace std;
int main(){
    int t,y;
    cin>>t>>y;
    int a[101][101]={};
    for(int i=0;i<t;++i){
        for(int j=0;j<y;++j){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<t;++i){
        for(int j=0;j<y;++j){
            a[i][y]+=a[i][j];
        }
    }
    for(int i=0;i<=y;++i){
        for(int j=0;j<t;++j){
            a[t][i]+=a[j][i];
        }
    }
    for(int i=0;i<=t;++i){
        for(int j=0;j<=y;++j){
            cout<<a[i][j];
            if(j!=y){
                cout<<" ";
            }
        }
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3116
program HonestOrUnkind2
  implicit none
  integer xy(15,15),a(15)
  integer n,ans,i,j,x,y,bit
  logical ok
  read(*,*) n
  xy(:,:)=-1
  do i=1,n
     read(*,*) a(i)
     do j=1,a(i)
        read(*,*) x,y
        xy(i,x)=y
     end do
  end do
  ans=0
  do bit=1,ishft(1,n)-1
     ok=.true.
     iloop:do i=1,n
        if(iand(ishft(bit,-i+1),1)==0) cycle
        do j=1,n
           if((xy(i,j)/=-1).and.(iand(ishft(bit,-j+1),1)/=xy(i,j))) then
              ok=.false.
              exit iloop
           end if
        end do
     end do iloop
     if(ok) then
        ans=max(ans,popcnt(bit))
     end if
  end do
  print*,ans
end program HonestOrUnkind2


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int ans = 0;
int n;
int digit[] = {0, 3, 5, 7};

int solve(int leading_0, int pos, int arr[], int flag, long long val) {
	if (pos < 0) {
		if (val > n)
			return 1;
		if ((flag & 0x0e) == 0x0e) {
			ans++;
		}
		return 0;
	} else {
		for (int i = (leading_0 ? 0 : 1); i <= 3; i++) {
			arr[pos] = digit[i];
			if (solve(leading_0 & (i == 0), pos - 1, arr, flag | (1 << i), val + digit[i] * pow(10, pos)))
				return 1;
		}
		return 0;
	}
}

int main() {
	int arr[10];
	cin >> n;
	solve(1, 9, arr, 0, 0);
	cout << ans << endl;
	return 0;
}



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

using namespace std;
using ll = long long;

int main() {
	ll mod = 7 + 1e9;
	ll n, ans = 0;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i,n) {
		cin >> a[i];
		if (i != 0) b[i] += b[i - 1] + a[i];
	}
	rep(i,n) {
		ll k = a[i] * ((b[n - 1] - b[i]) % mod) % mod;
		ans += k;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6428
n=int(input())
a=[int(i) for i in input().split()]
cnt4=0
cnt2=0
oddcnt=0

for i in range(n):
  if a[i]%4==0:
    cnt4+=1
  elif a[i]%2==0:
    cnt2+=1
  else:
    oddcnt+=1

if oddcnt<=cnt4:
  print("Yes")
else:#oddcnt>cnt4
  if cnt2==0 and oddcnt-cnt4==1:
    print("Yes")
  else:
    print("No")
  
  
  

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

namespace AtTest.AGC_Challenge
{
    class _014_B
    {
        static void Main(string[] args)
        {
            Method(args);
            ReadLine();
        }

        static void Method(string[] args)
        {
            int[] nm = ReadInts();
            int n = nm[0];
            int m = nm[1];
            int[] cnts = new int[n];
            for(int i = 0; i < m; i++)
            {
                int[] ab = ReadInts();
                cnts[ab[0] - 1]++;
                cnts[ab[1] - 1]++;
            };
            for(int i = 0; i < n; i++)
            {
                if (cnts[i] % 2 > 0)
                {
                    WriteLine("NO");
                    return;
                }
            }
            WriteLine("YES");
        }

        private static string Read() { return ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <map>
#include <queue>
#define mp make_pair
#define pb push_back
#define p push
#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long
#define abs(x) (x<0 ? (-x) : x)
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d %d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld %lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define SIZE 1000000007

using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef vector<long long> vl;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long,long long>> vpl;
typedef vector<vector<pair<long long,long long>>> vvpl;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef pair <ll,ll> pll;
const  double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
/*ios_base::sync_with_stdio(false);cin.tie(0);*/

ll gcd(ll n,ll m){
    if (n==0)return m;
    return gcd(m%n,n) ;
}

long long fast_exp(long long n,long long k){
    if(k == 0)
        return 1;
    if(k==1)
        return n;

    long long temp = fast_exp(n,k>>1);

    if((k&1)==1)
        return (n*temp*temp)%SIZE;
    return (temp*temp)%SIZE;

}

int main() {
 ll n ;
 cin >> n;
 ll count =0;
 vl vec(n);
 ll tmp;
 cin >> vec[0];
 tmp = vec[0];
 ll mx=0;
    for (int i = 1; i <n ; ++i) {

        cin >> vec[i];
        if ( vec[i] <= tmp ){
            count++;
        }
        else{
            mx = max(mx,count);

            count =0;
        }
        tmp = vec[i];
        //cout << count <<"\n";
    }
    mx = max(mx,count);
    cout << mx;
    return 0;
}


Measured memory_bytes: 1024
from collections import defaultdict

def sieve_of_eratosthenes(n):
    sr_n = int(n ** 0.5)
    f = [True] * (sr_n + 1)
    res = []
    for i in range(2, sr_n+1):
        if f[i]:
            res.append(i)
            for j in range(2*i, sr_n+1, i):
                f[j] = False
    return res

def trial_division(n):
    pn = sieve_of_eratosthenes(n)
    res = defaultdict(lambda: 0)
    for p in pn:
        while n % p == 0:
            res[p] += 1
            n //= p
    if n > 1:
        res[n] += 1
    return res

def nCr(n, r):
    r = min(r, n-r)
    fact = 1
    inv = 1
    for i in range(r):
        fact *= (n - i)
        fact %= MOD
        inv *= (i + 1)
        inv %= MOD
    return fact * pow(inv, MOD-2, MOD) % MOD

MOD = 10 ** 9 + 7
N, M = map(int, input().split())
n_pf = trial_division(M).values()
ans = 1
for r in n_pf:
    ans *= nCr(N-1+r, r)
    ans %= MOD
print(ans)

Measured memory_bytes: 3692
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x[] = new int[]{0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};

		System.out.println(x[a] == x[b] ? "Yes" : "No");

		sc.close();

	}

}

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

using namespace std;

long long A[100005], pf[100005];

int main(){
    int N, ans = 1, count = 0;
    cin >> N;

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

    sort(A + 1, A + N + 1);

    pf[1] = A[1];
    for(int i=1; i<N; i++){
        if(i > 1)
            pf[i] = pf[i-1] + A[i];
        if(pf[i]*2 >= A[i+1]) count++;
        else count = 0;
    }

    cout << ans + count << endl;
}

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

#ifndef DEBUG
#define dump(...)
#endif

inline void outs() { std::cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
    std::cout << head << (sizeof...(tail) ? " " : "");
    outs(std::forward<Tail>(tail)...);
}

template <class T>
inline void outs(std::vector<T> &vec) { for (auto &e : vec) std::cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(std::vector<std::vector<T>> &df) { for (auto &vec : df) outs(vec); }

signed main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    size_t N;
    std::cin >> N;

    std::vector<int> a(N + 1);
    for (size_t i = 1; i <= N; ++i) {
        std::cin >> a[i];
    }

    std::vector<int> buff;
    std::vector<int> x(N + 1);
    for (size_t i = N; i >= 1; --i) {
        int cnt = 0;
        for (size_t j = i; j <= N; j += i) {
            cnt += x[j];
        }
        if (cnt % 2 != a[i]) {
            x[i] = 1;
            buff.emplace_back(i);
        }
    }

    std::cout << buff.size() << "\n";
    outs(buff);

    return 0;
}


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

#define rep(i, a) for (int i = 0; i < (a); i++ )

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int N,K;
    string S;
    cin >> N >> K >> S;

    int a = 0;
    rep(i,N) {
        if (i==0) continue;
        if (S[i]!=S[i-1]) a++;
    }
    int ans = min(N-1, N-(a-K*2)-1);
    cout << ans << endl;
}


Measured memory_bytes: 3676
fun main(args: Array<String>) {
    val (N, x) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    var pre = 0
    var answer = 0L
    for (i in 0 until N) {
        val sum = pre + a[i]
        if (sum > x) {
            a[i] -= (sum - x)
            answer += (sum - x)
        }
        pre = a[i]
    }
    println(answer)
}

Measured memory_bytes: 73784
import java.util.Scanner;
import java.util.ArrayList;

public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int five = 0;
        int seven = 0;

        String[] numbers = str.split(" ");
        for(String num: numbers){
            if(num.equals("5")){
                five++;
            }else if(num.equals("7")){
                seven++;
            }
        }

        if(five == 2 && seven == 1){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 9428
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,d;cin>>n>>d;
    cout << (int)(n+(2*d))/(2*d+1) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	int N;

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int A = nextInt();
		int B = nextInt();

		long res = lcm(A,B);
		out.println(res);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

	long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}

	 long lcm(long m, long n) {
	        return m * n / gcd(m, n);
	 }
}

Measured memory_bytes: 23380
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double
 
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    cout<<(n^1);
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
using namespace std;
bool isPalindrome(string str) 
{ 
    // Start from leftmost and rightmost corners of str 
    int l = 0; 
    int h = str.length() - 1; 
  
    // Keep comparing characters while they are same 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
            return false;
        } 
    } 
    return true;
} 
main () {
	string s, kondisi= "No";
	cin>>s;
	int cek1 = ((s.length() - 1)/ 2) - 1;
	int cek2 = ((s.length() + 3) / 2)- 1;
	//cout<<cek1<<" "<<cek2<<endl;
	int i =0;
	if (isPalindrome(s)) {
		while (i <= cek1 && cek2 < s.length()) {
			if (s[i] != s[cek2]) {
				kondisi = "No";
			} else {
				kondisi = "Yes";
			}
			i++;
			cek2++;
			//cout<<i<<" "<<cek2;
		}
	}
	cout<<kondisi<<endl;
}

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

int main(){

  int n=0;
  
  while(scanf("%d",&n) != EOF){
    int sum=1;
    
    for(int i=1;i<=n;i++){ 
      sum = (sum-i) + i*2;
    }

    printf("%d\n",sum);
  }

  return 0;

}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

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

//好きな数字を書き換える=邪魔な数字を無視する
//最大公約数はどこから計算しても変わらない
int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);

    vector<int> lgcd(n); //A[i]より左側にある数字のgcd
    vector<int> rgcd(n); //A[i]より右側にある数字のgcd
    
    lgcd[0]=a[0];
    for(int i=1;i<n;i++) lgcd[i] = gcd(lgcd[i-1],a[i-1]);

    rgcd[n-1]=a[n-1];
    for(int i=n-2;i>=0;i--) rgcd[i] = gcd(rgcd[i+1],a[i+1]);

    int ans=0;

    //両橋(i=0とi=n-1)は別処理にする
    ans = max(ans,rgcd[0]);
    for(int i=1;i<n-1;i++){
        ans = max(ans,gcd(lgcd[i],rgcd[i]));
    }
    ans=max(ans,lgcd[n-1]);

    cout << ans << endl;





}

Measured memory_bytes: 4500
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str1 = sc.next();
        char[] c1 = str1.toCharArray();
        String str2 = sc.next();
        char[] c2 = str2.toCharArray();
        
        for (int offset = 0; offset < n; offset++) {
            boolean ok = true;
            for (int i = 0; i < n-offset; i++) {
                if (c1[i+offset] != c2[i]) {
                    ok = false;
                    break;
                }
            }
            
            if (ok) {
                System.out.println(n*2 - (n-offset));
                return;
            }
        }
        
        System.out.println(n*2);
    }
}

Measured memory_bytes: 20948
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int A =sc.nextInt();
		int B =sc.nextInt();
		int N =0;
		int ans =0;
			
		for(int i=1; i<=9; i++){
			for(int j=0; j<=9; j++){
				for(int k=0; k<=9; k++){
					N = i*10001+j*1010+k*100;
					if(A<=N && N<=B){
						ans++;
					}
				}
			}
		}
			System.out.println(ans);
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} 



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

int N; cin >> N;
VI X(N); invec(X);

i64 mini = INF;
rep(P, 1, 101){
    i64 sum = 0;
    for(int x: X) sum += pow(x - P, 2);
    mini = min(mini, sum);
}

cout << mini << "\n";
return 0;
}
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vector<ll> p(a+b+c);
    rep(i,a+b+c)cin>>p[i];
    vector<int> ord(a+b+c);
    iota(ord.begin(),ord.end(),0);
    sort(ord.begin(),ord.end(),[&](int s, int t){
        return p[s]>p[t];
    });
    ll ans = 0;
    int z = x+y;
    for(auto i:ord){
        if(!z)break;
        if(i<a){
            if(x){
                ans += p[i];
                --x;
                --z;
            }
        }
        else if(i<a+b){
            if(y){
                ans += p[i];
                --y;
                --z;
            }
        }
        else {
            ans += p[i];
            --z;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3840