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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    for (int i = 0; i+K < N; ++i) {
        if (A[i] < A[i+K]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 4840
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

double d2[50][50];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<int> x(n),y(n);
    int i,j,k;
    for(i=0; i<n; i++) {
        scanf("%d%d", &x[i], &y[i]);
    }

    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            d2[i][j]=((double)x[i]-x[j])*((double)x[i]-x[j])+((double)y[i]-y[j])*((double)y[i]-y[j]);
        }
    }

    double ans=HUGE_VAL;
    const double eps=1e-8;
    for(i=0; i<n; i++) {
        for(j=i+1; j<n; j++) {
            for(k=j+1; k<n; k++) {
                double aa=d2[j][k], bb=d2[i][k], cc=d2[i][j];
                double tmp0=aa*(bb+cc-aa);
                double tmp1=bb*(aa+cc-bb);
                double tmp2=cc*(aa+bb-cc);
                double xx=tmp0*x[i]+tmp1*x[j]+tmp2*x[k];
                double yy=tmp0*y[i]+tmp1*y[j]+tmp2*y[k];
                double tmp=tmp0+tmp1+tmp2;
                if(fabs(tmp)<eps) continue;
                xx/=tmp;
                yy/=tmp;

                double r2=0;
                int p;
                for(p=0; p<n; p++) {
                    double dd=(xx-x[p])*(xx-x[p])+(yy-y[p])*(yy-y[p]);
                    r2=MAX(r2,dd);
                }
                ans=MIN(ans,r2);
            }
        }
    }

    for(i=0; i<n; i++) {
        for(j=i+1; j<n; j++) {
            double xx=((double)x[i]+x[j])/2;
            double yy=((double)y[i]+y[j])/2;

                double r2=0;
                int p;
                for(p=0; p<n; p++) {
                    double dd=(xx-x[p])*(xx-x[p])+(yy-y[p])*(yy-y[p]);
                    r2=MAX(r2,dd);
                }
                ans=MIN(ans,r2);
        }
    }

    printf("%.10lf\n", sqrt(ans));

    return 0;
}




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

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;


template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}

const int maxn=2000005;
int p[maxn];
int sz[maxn];
int cnt=0;
void clear(int n=maxn){
    rep(i,0,n+1)p[i]=i,sz[i]=1;
    cnt=n;
}
int root(int x){
   while(x!=p[x]){
       p[x]=p[p[x]];
       x=p[x];
   }
   return x;  
}
void merge(int x,int y){
    int p1=root(x);
    int p2=root(y);
    if(p1==p2)return;
    cnt--;
    if(sz[p1]>=sz[p2]){
        p[p2]=p1;
        sz[p1]+=sz[p2];
        sz[p2]=0;
    }
    else{
        p[p1]=p2;
        sz[p2]+=sz[p1];
        sz[p1]=0;
    }
}

int solve(){
 	string s,t;cin>>s>>t;
 	int mi=t.length();
 	int m=t.length();
 	int n=s.length();
 	auto func=[&](int l,int r){
 		int cnt=0;
 		for(int i=l;i<=r;i++){
 			if(s[i]!=t[i-l])cnt++;
 		}
 		return cnt;
 	};
 	for(int i=0;i+m-1<n;i++){
 		mins(mi,func(i,i+m-1));
 	}cout<<mi<<endl;
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
 

Measured memory_bytes: 3636
#include <stdio.h>

int main(){
  int n, a, b;
  scanf("%d", &n);
  if(n == 1)
    printf("Hello World\n");
  else {
    scanf("%d", &a);
    scanf("%d", &b);
    printf("%d\n", a+b);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e6+10;
const int p=998244353;
int n, a[N], c[N], t[N];
inline int pw(int x, int y){
	int ans=1; while(y){
		if(y&1)ans=1ll*ans*x%p;
		x=1ll*x*x%p; y>>=1;
	}
	return ans;
}
int main(){
	scanf("%d",&n); int mx=0;
	for(int i=1; i<=n; ++i)scanf("%d",&a[i]),t[a[i]]++,mx=max(mx,a[i]);
	for(int i=1; i<=mx; ++i)c[i]=pw(i,p-2);
	for(int i=1; i<=mx; ++i)
		for(int j=i*2; j<=mx; j+=i)
			c[j]=(c[j]-c[i]+p)%p;
	LL ans=0;
	for(int i=1; i<=mx; ++i){
		LL x=0, y=0;
		for(int j=i; j<=mx; j+=i)x=(x+1ll*t[j]*j)%p,y=(y+1ll*t[j]*j%p*j)%p;
		ans=(ans+(1ll*x*x%p-y)*c[i])%p;
	}
	printf("%d", (ans*pw(2,p-2)%p+p)%p);
	return 0;
}

Measured memory_bytes: 10496
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    System.out.println(c-(a-b)<0?"0":c-(a-b));
  }
}

Measured memory_bytes: 22608
#!/usr/bin/env python3
import sys
import itertools

def solve(S: str):
    a = itertools.groupby(S)
    print(len(list((a)))-1)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n;
    cin >> n;

    vector<int> v(n);
    bool fl = true;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        if (v[i] & 1)fl = false;
    }
    if (fl)cout << "second";
    else cout << "first";
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3952
#include <iostream>

using namespace std;

int main() {
	float n, m, total = 0, a[1000];
	cin >> n >> m;
	
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		total += a[i];
	}
	
	float limit = (total / (4 * m));
	
	int cnt = 0;
	for(int i = 0; i < n; i++) {
		if(a[i] >= limit) cnt++;
	}
	
	if(cnt >= m) cout << "Yes" << endl; else cout << "No" << endl;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
kabu=0
money=1000
for i in range(len(A)-1):
    if A[i]<A[i+1]:
        kabu+=int(money/A[i])
        money-=int(money/A[i])*A[i]
    elif A[i]>A[i+1]:
        money+=kabu*A[i]
        kabu=0
money+=kabu*A[-1]
kabu=0
print(money)

Measured memory_bytes: 9192
'use strict'

const INF = 900719925474099;


function Main(input){
    let temp = input.trim().split('\n');
    let temp2 = temp[0].split(' ').map((v)=>parseInt(v));
    let n = temp2.shift();
    let m = temp2.shift();
    let a = temp[1].split(' ').map((v)=>parseInt(v));

    let b = new Array(m);

    for(let i=2;i<=m+1;i++){
        temp2 = temp[i].split(' ').map((v)=>parseInt(v));
        b[i-2] = {b:temp2[0],c:temp2[1]};
    }
    a.sort((a,b)=>a-b);
    b.sort((d,e)=>e.c-d.c);

    let t = 0;
    let count = 0;
    //console.log('----------------',b);
    for(let i=0;i<n;i++){
        //console.log(a,'t:',t,'count:',count,b[t]);
        if(b[t].c <= a[i]){
            //console.log('break');
            break;
        }
        count++;
        a[i] = b[t].c;
        if(b[t].b <= count){
            t++;
            if(t>=m) break;
            count = 0;
        }
    }

    let sum=0;
    for(let i=0;i<n;i++){
        sum += a[i];
    }

    console.log(sum);
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 60800
import java.util.*;

public class Main {
  public static void main(String args[]) {
     Scanner sc = new Scanner(System.in);
     int n = sc.nextInt();
     Set<String> box = new HashSet<String>() {};
     for (int i = 0 ; i < n; i ++) {
        String a = sc.next();
        if(box.contains(a)) {
           box.remove(a);
        } else {
           box.add(a);
        }
     }
     System.out.println(box.size());
  }
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();

            foreach(var i in  Enumerable.Range(0, S.Length))
            {
                var rotateS = (S + S[0]).Substring(1);
                if(rotateS == T)
                {
                    Console.WriteLine("Yes");
                    return;
                }
                else
                {
                    S = rotateS;
                }
            }
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 13268
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 9223372036854775807
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

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

  string s;
  cin >> s;
  
  bool f = true;
  REP(i,s.size()-1){
    if(s[i+1] == '9') continue;
    f = false;
  }
  
  if(f) cout << s[0]-'0' + 9*(s.size()-1) << endl;
  else{
    if(s.size() == 1) cout << s[0]-'0' << endl;
    else			  cout << 9*(s.size()-1) + s[0]-'0'-1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#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>;

int main() {
  int x;
  cin >> x;

  int cnt = 8;
  for(int i=600;i <= 2000;i+=200) {
    if(x < i) {
      break;
    }
    cnt--;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3632
/**
 * @Author: harshkhajuria
 * @Date:   09-May-2020 05:39:30 pm
 * @Email:  khajuriaharsh729@gmail.com
 * @Filename: D - I hate Factorization.cpp
 * @Last modified by:   harshkhajuria
 * @Last modified time: 09-May-2020 06:25:09 pm
 */

#include <bits/stdc++.h>
#define ll long long
#define mp(a, b) make_pair(a, b)
#define newline cout << endl;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(),v.end()
using namespace std;

template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p)
{
		out << '(' << p.ff << ", " << p.ss << ')';
		return out;
}

template <typename T> ostream& operator<<(ostream& out, vector<T> const& v)
{
		int l = v.size();
		for (int i = 0; i < l - 1; i++)
				out << v[i] << ' ';
		if (l > 0)
				out << v[l - 1];
		return out;
}

template <typename T> void trace(const char* name, T&& arg1) {
		cout << name << " : " << arg1 << endl;
}

template <typename T, typename ... Args> void trace(const char* names, T&& arg1, Args&&... args)
{
		const char* comma = strchr(names + 1, ',');
		cout.write(names, comma - names) << " : " << arg1 << " | ";
		trace(comma + 1, args ...);
}

/*Input*/
const ll powSize = 405;
vector<ll> values, pow5(powSize);
map<ll, pair<ll,ll> > s;
/*Input*/

ll solvePow5(ll n){
		return n*n*n*n*n;
}

void solve() {
		const ll maxRange = 400, midRange = 200;
		for(int i=1; i<=maxRange; i++) {
				if(i <= midRange)
						pow5[i] = solvePow5(i);
				else
						pow5[i] = solvePow5(midRange-i);
		}
		for(int i=1; i<=maxRange; i++) {
				for(int j=1; j<=maxRange; j++) {
						ll val;
						val = pow5[i] - pow5[j];
						if(val > 0) {
								s.insert(mp(val, mp(i <=midRange ? i : midRange-i,j <=midRange ? j : midRange-j)));
						}
				}
		}
		// for(auto it:s) {
		// 		trace("a,b,c", it.ff, it.ss.ff, it.ss.ss);
		// }
}

int main()
{
		//ios::sync_with_stdio(false);
		//cin.tie(0);
		//cout.tie(0);
		clock_t tStart = clock();
		int test;
		test = 1;
		// cin >> test;
		solve();
		while (test--) {
				ll n;
				cin >> n;
				if(n==0) {
						cout << "0 0\n";
				} else if(n==1) {
						cout << "1 0\n";
				} else {
						auto ans = s.find(n);
						cout << ans->ss.ff << ' ' << ans->ss.ss << endl;
				}
		}
#ifdef LOCAL_DEFINE
		printf("Time taken: %.2fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC);
#endif
		return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;vector<int>X(26,50);
  for(int i=0;i<n;i++){
    string S;cin>>S;
    for(int j=0;j<26;j++){
      int x=count(S.begin(),S.end(),char('a'+j));
      X.at(j)=min(X.at(j),x);
    }
  }
  for(int i=0;i<26;i++)for(int j=0;j<X.at(i);j++)cout<<char('a'+i);
  cout<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>
#define rep(i,n) for(int i = 0; i <(n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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


int main(void) {
	int A[4], tmp, i, j, k;

	scanf("%d", &tmp);

	rep(i, 4) {
		A[i] = tmp % 10; tmp /= 10;
	}
	
	if (A[3] + A[2] + A[1] + A[0] == 7) {
		printf("%d+%d+%d+%d=7", A[3], A[2], A[1], A[0]);
	}
	else if (A[3] - A[2] + A[1] + A[0] == 7) {
		printf("%d-%d+%d+%d=7", A[3], A[2], A[1], A[0]);
	}
	else if (A[3] - A[2] - A[1] + A[0] == 7) {
		printf("%d-%d-%d+%d=7", A[3], A[2], A[1], A[0]);
	}
	else if (A[3] - A[2] - A[1] - A[0] == 7) {
		printf("%d-%d-%d-%d=7", A[3], A[2], A[1], A[0]);
	}
	else if (A[3] + A[2] - A[1] + A[0] == 7) {
		printf("%d+%d-%d+%d=7", A[3], A[2], A[1], A[0]);
	}
	else if (A[3] + A[2] + A[1] - A[0] == 7) {
		printf("%d+%d+%d-%d=7", A[3], A[2], A[1], A[0]);
	}
	else if (A[3] + A[2] - A[1] - A[0] == 7) {
		printf("%d+%d-%d-%d=7", A[3], A[2], A[1], A[0]);
	}
	else if (A[3] - A[2] + A[1] - A[0] == 7) {
		printf("%d-%d+%d-%d=7", A[3], A[2], A[1], A[0]);
	}


	return 0;
}

Measured memory_bytes: 256
class Dice():
    def __init__(self,rot,Face):
        self.rot= rot
        self.Face = Face
    def Rotate(rot,Face):
        r=len(rot)
        intFace=[int(Face[i]) for i in range(6)]

        for i in range(r):
            Temp=[intFace[i] for i in range(6)]

            if rot[i]== "E":
                intFace[0]=Temp[3]
                intFace[1]=Temp[1]
                intFace[2]=Temp[0]
                intFace[3]=Temp[5]
                intFace[4]=Temp[4]
                intFace[5]=Temp[2]

            elif rot[i]== "W":
                intFace[0]=Temp[2]
                intFace[1]=Temp[1]
                intFace[2]=Temp[5]
                intFace[3]=Temp[0]
                intFace[4]=Temp[4]
                intFace[5]=Temp[3]

            elif rot[i]== "N":
                intFace[0]=Temp[1]
                intFace[1]=Temp[5]
                intFace[2]=Temp[2]
                intFace[3]=Temp[3]
                intFace[4]=Temp[0]
                intFace[5]=Temp[4]


            elif rot[i]== "S":
                intFace[0]=Temp[4]
                intFace[1]=Temp[0]
                intFace[2]=Temp[2]
                intFace[3]=Temp[3]
                intFace[4]=Temp[5]
                intFace[5]=Temp[1]


        return intFace
#returnしてなかったわ インデント幅も注意

Face = input().split()
rot=input()
dice=Dice(rot,Face)
finFace= Dice.Rotate(rot,Face)
print(finFace[0])



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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(long long i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const double EPS = 1e-9;
const ll powll = 1LL<<1;

/*
while(!frag && cin >> a >>b, a|b)
*/

int main(void){
    int n; cin >> n;
    int a[n]; rep(i,0,n) cin >> a[i];

    int ans = 0;
    rep(i,0,n){
        if(i%2==0 && a[i]%2) ans++;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 3584
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
# -*- coding: utf-8 -*-


class UnionFind:
    def __init__(self, size):
        self.parent = [i for i in range(size)]
        self.rank = [0 for _ in range(size)]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)


N, M = map(int, input().split())
Un = UnionFind(N+1)
A = list(map(int, input().split()))

for _ in range(M):
    a, b = map(int, input().split())
    Un.union(a, b)

ans = 0
for i in range(N):
    if Un.same(A[i], i+1):
        ans += 1
print(ans)


Measured memory_bytes: 18544
#include <iostream>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll n;
    cin >> n;
    
    ll a[n];
    
    for(ll i = 0; i < n; i++)cin >> a[i];
    
    ll counter1 = 0;
    ll counter2 = 0;
    
    ll total = 0;
    
    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            total += a[i];
            
            if(total == 0){
                total = 1;
                counter1++;
            }
            
            if(total < 0){
                counter1 += abs(total - 1);
                total = 1;
            }
        } else {
            total += a[i];
            
            if(total == 0){
                total = -1;
                counter1++;
            }
            
            if(total > 0){
                counter1 += abs(total - (-1));
                total = -1;
            }
        }
    }
    
    total = 0;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            total += a[i];
            
            if(total == 0){
                total = -1;
                counter2++;
            }
            
            if(total > 0){
                counter2 += abs(total - (-1));
                total = -1;
            }
        } else {
            total += a[i];
            
            if(total == 0){
                total = 1;
                counter2++;
            }
            
            if(total < 0){
                counter2 += abs(total - 1);
                total = 1;
            }
        }
    }
    
    ll ans = min(counter1, counter2);
    cout << ans << endl;
}


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

int main() {
    int A[3][3];
    bool map[3][3];
    int N;
    int b[100];

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
            map[i][j] = false;
        }
    }
    cin >> N;
    for (int k = 0; k < N; k++) {
        cin >> b[k];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (A[i][j] == b[k]) map[i][j] = true;
            }
        }
    }
    for (int i = 0; i < 3; i++) {
        if (map[i][0] && map[i][1] && map[i][2]) {
            cout << "Yes" << endl;
            return 0;
        }
        if (map[0][i] && map[1][i] && map[2][i]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if ((map[0][0] && map[1][1] && map[2][2]) || (map[2][0] && map[1][1] && map[0][2])) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


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

using namespace std;

int main(){
 long long int  a, b,c;
  cin >> a >> b >> c;
  
  if((a != 0)){
    cout << (b/c)-(a-1)/c << endl;
    
  }
  else{
    cout << (b/c)+1 <<endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
	long long int x,y;
	scanf("%lld%lld",&x,&y);
	long long int z=y/x,s=1,s1=0;
	while(s<=z){
		s*=2,++s1;
	}
	printf("%lld\n",s1);
}

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

int main() {
  int A, B;
  cin >> A >> B;
  if (A == 1) {
    A += 13;
  }
  if (B == 1) {
    B += 13;
  }
  if (A == B) {
    cout << "Draw" << endl;
  } else if (A > B) {
    cout << "Alice" << endl;
  } else {
    cout << "Bob" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i=0; i < n; i++)
using namespace std;

int main()
{
    int a,k, n, min;
    cin >> k >> n;
    vector<int> house(n);
    vector<int> totalR(n);
    vector<int> totalL(n);
    
    rep(i, n)
    {
        cin >> a;
        house.at(i) = a;
    }


    rep(i, n){
        if (i == 0) {
            totalR.at(i) += house.at(n-1) - house.at(i);
        }
        else {
            totalR.at(i) += k - (house.at(i) - house.at(i - 1));
        }
    }

    rep(i, n)
    {
        if (i == n-1) {
            totalL.at(i) += house.at(n-1) - house.at(0);
        }
        else {
            totalL.at(i) += house.at(i) +  k - house.at(i + 1);
        }
    }
    min = totalL.at(0);
    rep(i, n)
    {
        if (totalL.at(i) < min) min = totalL.at(i);
        if (totalR.at(i) < min) min = totalR.at(i);
    }
    
    cout << min << endl;
    return 0;
}

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

const ll mod = 1e9 + 7;

ll rcalc(ll n){
  if(n == 0) return 1;
  return (n * rcalc(n-1)) % mod;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ABC065C - Reconciled?
  // 階乗の計算
  // Mの階乗*Nの階乗(M=Nのときはさらに*2)
  // abs(M-N)>1の場合は0
  // M=Nまたはabs(M-N)=1なので、階乗計算は1回のみでできる
  ll M, N;
  cin >> M >> N;
  
  if(abs(M - N) > 1){
    cout << 0 << endl;
  }else if(abs(M - N) == 1){
    ll tmp = rcalc(min(M, N));
    cout << (tmp * tmp % mod) * max(M, N) % mod << endl;
  }else{
    ll tmp = rcalc(M);
    cout << (tmp * tmp % mod) * 2 % mod << endl;  
  }
}

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

using namespace std;

using int64 = long long;

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

  int n, c; int64 k;
  cin >> n >> c >> k;
  vector<int64> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }
  sort(xs.begin(), xs.end());

  deque<int64> q;
  int count = 0;
  for (int i = 0; i < n; i++) {
    int64 x = xs[i];
    while (!q.empty() && x - q.front() > k) {
      count++;
      for (int j = 0; j < c; j++) {
        if (!q.empty()) {
          q.pop_front();
        }
      }
    }
    q.push_back(x);
  }
  count += (q.size() + c - 1) / c;
  cout << count << endl;
}

Measured memory_bytes: 1024
// Tazoe

#include <iostream>
using namespace std;

int main()
{
int n;
cin >> n;
for(int k=0; k<n; k++){
	int P[9][9];
	for(int i=0; i<9; i++){
		for(int j=0; j<9; j++){
			cin >> P[i][j];
		}
	}

	char C[9][9];
	for(int i=0; i<9; i++){
		for(int j=0; j<9; j++){
			C[i][j] = ' ';
		}
	}

	for(int i=0; i<9; i++){
		int cnt[10] = {0};
		for(int j=0; j<9; j++){
			cnt[P[i][j]]++;
		}

		for(int j=0; j<9; j++){
			if(cnt[P[i][j]]>1){
				C[i][j] = '*';
			}
		}
	}

	for(int j=0; j<9; j++){
		int cnt[10] = {0};
		for(int i=0; i<9; i++){
			cnt[P[i][j]]++;
		}

		for(int i=0; i<9; i++){
			if(cnt[P[i][j]]>1){
				C[i][j] = '*';
			}
		}
	}

	for(int I=0; I<3; I++){
		for(int J=0; J<3; J++){
			int cnt[10] = {0};
			for(int i=3*I; i<3*I+3; i++){
				for(int j=3*J; j<3*J+3; j++){
					cnt[P[i][j]]++;
				}
			}

			for(int i=3*I; i<3*I+3; i++){
				for(int j=3*J; j<3*J+3; j++){
					if(cnt[P[i][j]]>1){
						C[i][j] = '*';
					}
				}
			}
		}
	}
if(k>=1)  cout << endl;
	for(int i=0; i<9; i++){
		for(int j=0; j<9; j++){
			cout << C[i][j] << P[i][j];
		}
		cout << '\n';
	}
}
	return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner (System.in);
		int len = in.nextInt();
		int[] currency = new int[len];
		for(int i = 0; i < len; i++) {
			currency[i] = in.nextInt();
		}
		System.out.println(compute_maxprofit(len, currency));
		in.close();
	}
	
	/* Algorithm 1
	static int compute_maxprofit(int n, int[] r) {
		int max_profit = r[1] - r[0];
		for(int i = 0; i < n; i ++) {
			for(int j = i + 1; j < n; j++) {
				if(r[j] - r[i] > max_profit)
					max_profit = r[j] - r[i];
			}
		}
		return max_profit;
	}
	*/
	
	/*Algorithm 2*/
	static int compute_maxprofit(int n, int[] r) {
		int min = r[0];
		int max = r[1] - r[0];
		for(int i = 1; i < n; i++) {
			max = Math.max(max, r[i] - min);
			min = Math.min(min, r[i]);
		}
		return max;
	}
}


Measured memory_bytes: 100396
import sys
readline = sys.stdin.readline

P = 998244353
def mod_prod(a,b):
    return (a % P) * (b % P) % P

def mod_fact(a):
    ret = 1
    for i in range(a):
        ret = ret * (i + 1) % P
    return ret

def mod_pow(a, n):
    ret = 1
    while n > 0:
        if n % 2 == 1:
            ret = ret * a % P
        a = a * a % P
        n = n >> 1
    return ret

def mod_div(a, b):
    b_inv = mod_pow(b, P - 2)
    return a * b_inv % P

def mod_comb(a,b):
    ret = 1
    b = min(b, a - b)
    for i in range(b):
        ret *= a - i
        ret %= P
    ret = mod_div(ret, mod_fact(b))
    return ret

def solve():
    A, B, C, D = map(int, readline().split())

    dp = [[0] * D for i in range(C)]

    dp[A - 1][B - 1] = 1

    for i in range(C):
        for j in range(D):
            if i >= A or j >= B:
                dp[i][j] = (
                    (dp[i - 1][j] * (j + 1) if i > 0 else 0)
                    + (dp[i][j - 1] * (i + 1) if j > 0 else 0)
                    - (dp[i - 1][j - 1] * i * j if i > 0 and j > 0 else 0)
                   ) % P
    print(dp[-1][-1])

solve()

Measured memory_bytes: 138532
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long[][] XYs = new long[N][];
            for (long i = 0; i < N; i++)
            {
                XYs[i] = Read(Console.ReadLine());
            }


            List<long[]> Ds = new List<long[]>();
            for (int i = 0; i < N-1; i++)
            {
                for (int j = i+1; j < N; j++)
                {
                    bool same = false;
                    long[] D = new long[3] { XYs[j][0] - XYs[i][0], XYs[j][1] - XYs[i][1], 0 };
                    for (int k = 0; k < Ds.Count; k++)
                    {
                        if (Ds[k][0] == D[0] && Ds[k][1] == D[1]|| Ds[k][0] == -1*D[0] && Ds[k][1] == -1*D[1])
                        {
                            Ds[k][2]++;
                            same = true;
                            break;
                        }
                    }
                    if (!same) Ds.Add(D);
                }
            }

            long M = 0;
            for (int i = 0; i < Ds.Count; i++)
            {
                if (Ds[i][2] > M) M = Ds[i][2];
            }



            if (N == 1)
            {
                Console.WriteLine(1);
                return;
            }

            Console.WriteLine(N-M-1);
        }

        private static long Stair(long N)
        {
            if (N < 0) return 0;
            long twoM = N / 2;
            long ans = 0;
            for (long two = 0; two < twoM+1; two++)
            {
                long one = N - 2 * two;
                ans += Combination(one + two,two);
            }
            return ans;
        }

        private static long Combination(long N,long M)
        {
            
            long ans = Product(N) / (Product(M) * Product(N - M));
            return ans;

        }

        private static long Product(long N)
        {
            if (N == 0||N ==1) return 1;
            long ans = N;
            for (long i = 1; i < N; i++)
            {
                ans *= i;
            }
            return ans;
        }





        //private static string ReplaceOneChar(string S ,long index,string newS)
        //{
        //    string s1 = S.Substring(0, index-1);
        //    string s2 = S.Substring(index);
        //    return s1 + newS + s2;
        //}

        private static long[] Read(string input)
        {
            string[] inputs = input.Split(' ');
            long num = inputs.Length;
            long[] longs = new long[num];
            for (long i = 0; i < num; i++)
            {
                longs[i] = long.Parse(inputs[i]);
            }
            
            return longs;
        }


    }


}


Measured memory_bytes: 11220
nums=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(nums[k-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    char c;
    cin >> c;
    c++;
    cout << c;



    
}

/*
*/



Measured memory_bytes: 256
#include <iostream>
    #include <algorithm>
    #include <vector>
    #include <cstdio>
    #include <bits/stdc++.h>
    #include <unordered_map>
    #include <unordered_set>
    #include <queue>
     
    using namespace std;
    typedef long long ll;
     
     
    bool debug = false;
     
     
    ll a[200];
     
    int main()
    {
    	std::ios::sync_with_stdio(false);
     
    	
        ll n,k;
        cin >> n >> k;

        for (int i = 0; i < k; i++)
        {
            ll d;
            cin >> d;

            for (int j = 0 ; j < d; j++)
            {
                ll ai;
                cin >> ai;
                a[ai]++;
            }
        }

        ll res = 0;

        for (int i = 1;  i <= n; i++)
            if (!a[i]) res++;

        cout << res << endl;
    	

    	return 0;
    }

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#define int long long
using namespace std;

signed main() {
	int N;
	cin >> N;
	int A = 1;
	int B = N - 1;
	int answer = 1e9;
	for(int i = 0;i < N - 1;i++) {
		int C = A;
		int D = B;
		int count = 0;
		while(C != 0) {
			count += C % 10;
			C = C / 10;
		}
		while(D != 0) {
			count += D % 10;
			D = D / 10;
		}
		answer = min(answer,count);
      	A++;
      	B--;
	}
	cout << answer << endl;
}

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

#define dcm(x) cerr << #x << ": " << x << endl;

using namespace std;

typedef long long int lli;
typedef vector<int> vi;

int main() {
    //clock_t start = clock();
    ios::sync_with_stdio(false); cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n; cin >> n;
    cout << n*(n+1)/2 << endl;
    //clock_t stop = clock();
    //cout << (double)(stop-start)/CLOCKS_PER_SEC << " (s)" << endl;
    return 0;
}


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

using namespace std;

int main(void)
{
    int a, b, c;
    cin >> a >> b >> c;

    if (a == b && a != c) {
        cout << "Yes" << endl;
    } else if (a == c && a != b) {
        cout << "Yes" << endl;
    } else if (b == c && a != c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
using namespace std;

int main(){
  string S;
  cin >> S;
  ll n=0,w=0,s=0,e=0;
  rep(i,S.size()){
    if(S[i]=='N') n++;
    if(S[i]=='W') w++;
    if(S[i]=='S') s++;
    if(S[i]=='E') e++;
  }
  if(n>0 && w>0 && s>0 && e>0){
    cout << "Yes" << endl;
  }else if(n>0 && s>0 && e==0 && w==0){
    cout << "Yes" << endl;
  }else if(e>0 && w>0 && n==0 && s==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

namespace C_ABC163
{
    class MainClass
    {

        static int[] s,a;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            a = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            long[] l = new long[s[0]];
            for(int i = 0;i<s[0]-1;i++){
                l[a[i]-1]++;
            }
            foreach(long item in l){
                WriteLine(item);
            }
        }
    }
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

int N, M, X;
int A[30][30];
int C[30];

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

	cin >> N >> M >> X;
	rep(i, 0, N)
	{
		cin >> C[i];
		rep(j, 0, M)
		{
			cin >> A[i][j];
		}
	}

	int ans = INF;
	rep(i, 0, 1 << N)
	{
		vector<int> RES(M, 0);
		int cost = 0;
		rep(j, 0, N)
		{
			if ((i >> j) & 1)
			{
				cost += C[j];
				rep(k, 0, M)
				{
					RES[k] += A[j][k];
				}
			}
		}
		bool ok = true;
		for (auto v : RES)if (v < X)ok = false;
		if (ok)
		{
			chmin(ans, cost);
		}
	}

	if (ans == INF)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
    int n,k,x,ans = 0;
    cin >> n >> k;
    for(int i = 0;i < n;i++)
    {
        cin >> x;
        if(abs(k - x) < x){ans += abs(k - x) * 2;}
        else{ans += x * 2;}
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
const int inf=1<<28;
int N=17;
struct node{
	int c1,k1,c2,k2;
	node() {c1=c2=-inf;}
};
struct trnode{
	int lc,rc;
	node c;
}tr[6000010];int root=0,tot=0;
int a[300010];
node operator + (node c1,node c2)
{
	node ans;
	if(c1.c1>c2.c1)
	{
		ans.c1=c1.c1;ans.k1=c1.k1;
		if(c1.c2>c2.c2) ans.c2=c1.c2,ans.k2=c1.k2;
		else ans.c2=c2.c2,ans.k2=c2.k2;
		if(c2.k1!=ans.k1&&c2.c1>ans.c2) ans.c2=c2.c1,ans.k2=c2.k1;
	}
	else
	{
		ans.c1=c2.c1;ans.k1=c2.k1;
		if(c1.c2>c2.c2) ans.c2=c1.c2,ans.k2=c1.k2;
		else ans.c2=c2.c2,ans.k2=c2.k2;
		if(c1.k1!=ans.k1&&c1.c1>ans.c2) ans.c2=c1.c1,ans.k2=c1.k1;
	}
	return ans;
}
int n;
void insert(int &x,int c,int d,int v,int num)
{
	if(!x) x=++tot;
	if(d==-1) {node t;t.c1=v;t.k1=num;t.c2=-inf;tr[x].c=tr[x].c+t;return;}
	int op=(c&(1<<d))?1:0;
	if(op) insert(tr[x].lc,c,d-1,v,num);
	else insert(tr[x].rc,c,d-1,v,num);
	tr[x].c=tr[tr[x].lc].c+tr[tr[x].rc].c;
}
bool flag=false;
int merge(int x1,int x2,int d)
{
	int x=++tot;
	if(d!=-1) tr[x1].c=tr[tr[x1].lc].c+tr[tr[x1].rc].c;
	if(d!=-1) tr[x2].c=tr[tr[x2].lc].c+tr[tr[x2].rc].c;
	if(!x1||!x2) tr[x]=tr[x1+x2];
	else if(d==-1) tr[x].c=tr[x1].c+tr[x2].c;
	else
	{
		tr[x].lc=merge(tr[x1].lc,tr[x2].lc,d-1);
		tr[x].rc=merge(tr[x1].rc,tr[x2].rc,d-1);
		tr[x].c=tr[tr[x].lc].c+tr[tr[x].rc].c;
	}
	return x;
}
void dfs(int x,int d)
{
	if(!x||d==-1) return;
	dfs(tr[x].lc,d-1);dfs(tr[x].rc,d-1);
	tr[x].lc=merge(tr[x].lc,tr[x].rc,d-1);
	tr[x].c=tr[tr[x].lc].c+tr[tr[x].rc].c;
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<1<<n;i++) scanf("%d",&a[i]),insert(root,i,N,a[i],i);
	dfs(root,N);
	for(int i=1;i<(1<<n)-1;i++)
	{
		int x=root,ans=-inf,k=i+1;
		for(int j=N;j>=0;j--)
		{
			int c=(k&(1<<j))?1:0;
			if(c) ans=max(ans,tr[tr[x].rc].c.c1+tr[tr[x].rc].c.c2),x=tr[x].lc;
			else x=tr[x].rc;
		}
		printf("%d\n",ans);
	}
	printf("%d",tr[root].c.c1+tr[root].c.c2);
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> S(M);
  for (int i = 0; i < M; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int s;
      cin >> s;
      s--;
      S[i].emplace_back(s);
    }
  }
  vector<int> P(M);
  for (int i = 0; i < M; i++) {
    cin >> P[i];
  }
  int res = 0;
  for (int bit = 0; bit < (1 << N); bit++) {
    bool flag = true;
    for (int i = 0; i < M; i++) {
      int cnt = 0;
      for (int s : S[i]) {
        if ((bit >> s) & 1) cnt++;
      }
      if (cnt % 2 != P[i]) flag = false;
    }
    if (flag) res++;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char str[4];

    scanf("%s", str);

    if((str[0]==str[1] && str[2]==str[3] && str[0]!=str[2])  || (str[0]==str[2] && str[1]==str[3] && str[0]!=str[1]) || (str[0]==str[3] && str[1]==str[2] && str[0]!=str[1])){
        printf("Yes\n");
    } else printf("No\n");

    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int N;
double a[310];
double dp[310][310][310];

double f(int a, int b, int c) {
  //cout << a << " " << b << " " << c <<  "\n";

  if (dp[a][b][c] != INF) return dp[a][b][c];

  double ans = N;

  if (a != 0) {
    if (dp[a-1][b][c] == INF)
      dp[a-1][b][c] = f(a-1,b,c);

    ans += dp[a-1][b][c] * a;
  }

  if (b != 0) {
    if (dp[a+1][b-1][c] == INF)
      dp[a+1][b-1][c] = f(a+1,b-1,c);

    ans += dp[a+1][b-1][c] * b;
  }

  if (c != 0) {
    if (dp[a][b+1][c-1] == INF)
      dp[a][b+1][c-1] = f(a,b+1,c-1);

    ans += dp[a][b+1][c-1] * c;
  }

  ans /= (a + b + c);

  //cout << a << " " << b << " " << c << " " << ans << "\n";

  dp[a][b][c] = ans;
  return dp[a][b][c];
}

int main () {
  cin >> N;
  rep(i, N) cin >> a[i];

  int ct_a = 0;
  int ct_b = 0;
  int ct_c = 0;

  rep(i, N) {
    if (a[i] == 1) ct_a++;
    else if (a[i] == 2) ct_b++;
    else ct_c++;
  }

  Rep(i, N+1) {
    Rep(j, N+1) {
      Rep(k, N+1) dp[i][j][k] = INF;
    }
  }
  dp[0][0][0] = 0;

  //cout << ct_a << " " << ct_b << " " << ct_c << " " << "\n";


  printf("%.16f\n", f(ct_a, ct_b, ct_c));
}

Measured memory_bytes: 227584
import sys
import math


def solve(a: int, b: int, n: int) -> int:
    x = min(n, b - 1)
    return math.floor(a * ((x / b) - int(x / b)))


def main():
    input = sys.stdin.buffer.readline
    a, b, n = map(int, input().split())
    print(solve(a, b, n))


if __name__ == '__main__':
    main()


Measured memory_bytes: 62212
#include<bits/stdc++.h>
using namespace std;
int a,b,i,j;
void JB(int x){
	for(i=2;i<a;i++){
		for(j=i+1;j<=a;j++){
			if(!x)return;
			cout<<i<<" "<<j<<endl,x--;
		}
	}
}
int main(){
	cin>>a>>b;
	if(b>(a-1)*(a-2)/2)cout<<-1;
	else {
		cout<<a-1+(a-1)*(a-2)/2-b<<endl;
		for(i=2;i<=a;i++)cout<<1<<" "<<i<<endl;
		JB((a-1)*(a-2)/2-b);
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int pos(int n){
	if(n<0) n*=-1;
	return n;
}
int main(){
	int n;
	cin>>n;
	vector<int>arr(n+2,0);
	for(int i=1; i<=n; i++) cin>>arr[i];
	int cost = 0;
	for(int i=1; i<=n+1; i++) cost+=pos(arr[i]-arr[i-1]);
	for(int i=1; i<=n; i++){
		cout<<cost-pos(arr[i]-arr[i-1])-pos(arr[i+1]-arr[i])+pos(arr[i+1]-arr[i-1])<<'\n';
	}
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll n,p;
    cin>>n>>p;
    if(n==1){
        cout<<p;
        return 0;
    }
    ll ans=1,cnt,tmp;
    for(ll i=2;i*i<=p;i++){
        cnt=0,tmp=p;
        if(tmp%i==0){
            while(tmp/i>0&&tmp%i==0){
                cnt++;
                tmp/=i;
                if(cnt==n) ans=i;
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3608
/**
 *   Author: Praveen Ojha
 *   Created: 23 February 2019
 *   Time: 16:45:31
**/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

int main(){__
	int n;
	cin>>n;
	vector <int> dp(3,0);//dp[i] is maximum upto the index where i is used at last
	int vac[3];
	for(int days=0;days<n;days++){
		vector <int> ndp(3,0);
		cin>>vac[0]>>vac[1]>>vac[2];
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(i!=j){
					ndp[j]=max(ndp[j],dp[i]+vac[j]);
				}
			}
		}
		dp=ndp;
	}
	cout<<max(dp[0],max(dp[1],dp[2]))<<"\n";
return 0;
}

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

int main(void){
    int i,n,count;
    int ans = 10000;
    int A;
    
    cin >> n;

    for(i=0;i<n;i++){
        cin >> A;
        count = 0;

        while(A%2==0){
            A = A/2;
            count += 1;
        }
        if(count < ans){
            ans = count;
            count = 0;
        }
    }
    cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  pair<double, string> A[N];
  double sum = 0;
  for(int i=0;i<N;i++){
    cin >> A[i].first >> A[i].second;
    if(A[i].second == "JPY"){
      sum += A[i].first;
    }
    else {
      sum += A[i].first * 380000;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

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

  int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
  --a; --b; --c; --d;
  string s; cin >> s;
  // ## があるとアウト



  if (c > d) { // 追い越しあり : ... が必要
    for (int i = a + 1; i <= c - 2; ++i) {
      if (s[i] == '#' && s[i + 1] == '#') {
        print("No"); return 0;
      }
    }
    for (int i = c + 1; i <= d - 2; ++i) {
      if (s[i] == '#' && s[i + 1] == '#') {
        print("No"); return 0;
      }      
    }
    bool flag = false;
    for (int i = b - 1; i <= d - 1; ++i) {
      if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.') {
        flag = true; break;
      }
    }
    if (flag) print("Yes");
    else print("No");
  } else {
    //bool flag = true;
    for (int i = a + 1; i <= c - 2; ++i) {
      if (s[i] == '#' && s[i + 1] == '#') {
        print("No"); return 0;
      }
    }
    for (int i = c + 1; i <= d - 2; ++i) {
      if (s[i] == '#' && s[i + 1] == '#') {
        print("No"); return 0;
      }      
    }
    print("Yes");
  }

  return 0;
}

Measured memory_bytes: 592