akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_intで宣言
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////
// 区間加算区間和
struct RSQRAQ {
    ll n;
    vector<ll> dat, lazy;
    
    RSQRAQ(){}
    RSQRAQ(ll n_) {
        n = 1; while(n < n_) n *= 2;
        dat.assign(n*2, 0);
        lazy.assign(n*2, 0);
    }
    
    void eval(ll len, ll k) {
        if(lazy[k] == 0) return;
        if(k*2+1 < n*2-1) {
            lazy[2*k+1] += lazy[k];
            lazy[2*k+2] += lazy[k];
        }
        dat[k] += lazy[k]*len;
        lazy[k] = 0;
    }
    
    // [a, b)
    ll update(ll a, ll b, ll x, ll k, ll l, ll r) {
        eval(r-l, k);
        if(b <= l || r <= a) return dat[k];
        if(a <= l && r <= b) {
            lazy[k] += x;
            return dat[k] + lazy[k]*(r-l);
        }
        return dat[k] = update(a, b, x, 2*k+1, l, (l+r)/2) + update(a, b, x, 2*k+2, (l+r)/2, r);
    }
    ll update(ll a, ll b, ll x) { return update(a, b, x, 0, 0, n); }
    
    // [a, b)
    ll query(ll a, ll b, ll k, ll l, ll r) {
        eval(r-l, k);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return dat[k];
        ll vl = query(a, b, 2*k+1, l, (l+r)/2);
        ll vr = query(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
    ll query(ll a, ll b) { return query(a, b, 0, 0, n); }
};
/////////////////////////////////////////
int main(){
    ll n,q;cin>>n>>q;
    RSQRAQ u(n+1);
    while(q--){
        ll v;cin>>v;
        if(v==0){
            ll s,t,x;cin>>s>>t>>x;
            u.update(s,t+1,x);
        }else{
            ll s,t;cin>>s>>t;
            cout<<u.query(s,t+1)<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 7028
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  ll n,k;
  cin>>n>>k;

  cout<<ll(k*pow(k-1,n-1))<<endl;
  return 0;
}

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

signed main(void)
{
	long long n, a, b;
	cin >> n >> a >> b;
	if ((a + b) % 2 == 0)	
		cout << (b - a) / 2 << endl;
	else
		cout << min(a - 1, n - b) + 1 + (b - a - 1) / 2 << 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;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int>a(n);
    priority_queue<int>q;
    rep(i,n){
        cin>>a[i];
        q.push(a[i]);
    }
    rep(i,m){
        int x=q.top();
        q.pop();
        x/=2;
        q.push(x);
    }
    ll ans=0;
    while(!q.empty()){
        ans+=q.top();
        q.pop();
    }
    cout<<ans<<endl;
}


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

using namespace std;
int main(){
    int n; cin>>n;

     int b[n];
     b[0]=0;

     int ans=0;

     for(int i=1;i<=n-1;i++){
         cin>>b[i];
         ans+=min(b[i],b[i-1]);

     }
     ans+=b[n-1]+b[1];


	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;

int n, ans;

int main(){
  ios_base::sync_with_stdio(false);
  
  ans = 111;

  cin >> n;

  while(ans < n){
    ans += 111;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <utility>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <cctype>

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

typedef long long int lli;

using namespace std;

int main() {

   string S;
   int n;
   cin >> S;
   n = stoi(S.substr(S.length()-1,1));
   switch (n){
            case 0:
            case 1:
            case 6:
            case 8:
               cout << "pon" << endl;
               break;
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
               cout << "hon" << endl;
               break;
            case 3:
               cout << "bon" << endl;
               break;
      }   
}

Measured memory_bytes: 3624
package main
import "fmt"
func main() {
  var h,w,n int
  fmt.Scan(&h,&w,&n)
  var a []int = make([]int,n)
  for i:=0;i<n;i++ { fmt.Scan(&a[i]) }
  var c [][]int = make([][]int,h)
  for i:=0;i<h;i++ { c[i] = make([]int,w) }
  var x,y,dy,k int
  dy = 1
  for a[n-1] > 0 {
    c[x][y] = k+1
    a[k]--
    if a[k] == 0 { k++ }
    y += dy
    if y == w {
      x++
      y = w-1
      dy = -1
    } else if y == -1 {
      x++
      y = 0
      dy = 1
    }
  }
  for i:=0;i<h;i++ {
    fmt.Print(c[i][0])
    for j:=1;j<w;j++ {
      fmt.Print(" ")
      fmt.Print(c[i][j])
    }
    fmt.Println()
  }
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  vector<int> p(n),q(n);
  for(auto&& e: p) 
  {
    cin>>e;
  }
  for(auto&& e: q) 
  {
    cin>>e;
  }
  vector<int> vec,tmp;
  for (int i = 1; i <= n; ++i)
  {
    tmp.push_back(i);
  }
  vec=tmp;
  int P=1,Q=1;
  while(vec!=p)
  {
    next_permutation(vec.begin(), vec.end());
    P++;
  }
  vec=tmp;
  while(vec!=q)
  {
    next_permutation(vec.begin(), vec.end());
    Q++;
  }
  cout<<abs(Q-P);
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
array = []
for _ in range(M):
    tmp = list(map(int, input().split()))
    array.append(tmp)
array.sort(key=lambda x: x[1], reverse=True)

_sum = 0
_num = 0

for i in range(N+M):
    if A[0] > array[0][1]:
        _sum += A.pop(0)
        _num += 1
        
    else:
        a = array[0][0] if array[0][0] < N - _num else N - _num
        _sum += array.pop(0)[1] * a
        _num += a
        if not array:
            break
        
    if _num == N:
        break
    
if _num != N:
    while _num < N:
        _sum += A.pop(0)
        _num += 1
        
print(_sum)


Measured memory_bytes: 32976
// ABC 090 D
#include<bits/stdc++.h>
 
using namespace std;
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())

#define PB(a) push_back(a)

#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------

  int n,k;
  LL ans=0;
  cin >> n >> k;
  FOR(b,k+1,n+1){
    int p = n/b;
    int r = n%b;
    ans += p*max(0,b-k);
    ans += max(0,r-k+1);
    if(k==0)ans--;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define buf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double dob;
#define MAX 2100009
#define M 1000000007
#define INF 5e17
using namespace std;
typedef vector<ll> V;
typedef queue<ll > Q;
typedef stack<ll> S;
typedef pair<ll,ll> P;
#define mp make_pair
#define mt make_tuple
#define pb push_back
bool desc(ll i, ll j) { return i > j; }
ll d, x, y;
void gcd(ll A, ll B) {
    if(B == 0) {d = A;x = 1;y = 0;}
    else {
        gcd(B, A%B);ll temp = x;x = y;y = temp - (A/B)*y;
    }
}
ll power(ll x,ll n)
{   if(n==0||x==0) return 1;
    else if(n%2 == 0) return power((x*x)%M,n/2);
    else return (x*power((x*x)%M,(n-1)/2))%M;
}
ll fac[MAX],not_prime[MAX],vis2[MAX],vis1[MAX],ar[MAX],br[MAX];
string s[MAX];
void fact(){
    fac[0]=1;
    for(ll i=1;i<=1000009;i++) fac[i]=(i*fac[i-1])%M;
}
void sieve(){
    not_prime[1]=1; not_prime[0]=1;
    for(ll p=2;p*p<=MAX;p++){
        if(!not_prime[p]){
            for(ll i=p*2;i<=MAX;i+=p) not_prime[i]=1;
        }
    }
}
ll modi(ll i){
    gcd(i,M);
    return (x%M+M)%M;
}
int main(){
    //buf; 
    //sieve(); 
    //fact();
    ll i,j,k,m,t,test,n,flag,a,l,b,c,p; string sk,st;
    test=1;
    while(test--){
        cin>>n>>m;
        for(i=1;i<=m;i++){
          cin>>ar[i]>>br[i];
          if(ar[i]==1) {
              vis1[br[i]]=1;
          }
          if(br[i]==n){
              vis2[ar[i]]=1;
          }
        } 
        flag=0;
        for(i=2;i<n;i++){
            if(vis1[i]&&vis2[i]){flag=1; break;}
        }
        if(flag) cout<<"POSSIBLE";
        else cout<<"IMPOSSIBLE";
    }
    return 0;
} 

Measured memory_bytes: 24832
using System;
using System.Linq;

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int h = arr[0];
    int w = arr[1];
    var ans = "";
    for (int i = 0; i < h; i++) {
      var s = Console.ReadLine().Split();
      for (int j = 0; j < w; j++) {
        if (s[j] == "snuke") {
          ans = string.Format($"{(char)('A' + j)}{i + 1}");
        }
      }
    }
    Console.WriteLine(ans);
  }
}

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

int main()
{
    std::string S;
    std::cin >> S;
    int count=1;
    int count2=1;
    int temp;
    for(int i=1; i<4;i++){
        if(S[0]==S[i]){
            count++;
            temp=i;
        }
    }
    if(temp!=1){
    for(int i=2; i<4; i++){
        if(S[1]==S[i]){
            count2++;
        }
    }
    }
    if(temp==1){
        if(S[2]==S[3]){
            count2++;
        }
    }
    if(count2==2 && count==2){
        std::cout << "Yes" << std::endl; 
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

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

int main(){
    char c[100];
    int i, n, count = 0;

    while(scanf("%s", c) != EOF){
        n = strlen(c);
        for(i = 0; i < n/2; i++){
            if(c[i] != c[n-i-1]) break;
        }
        if(i == n/2) count++;
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 540
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> pl;
const ll INF=100000000000000001;
const double PI=3.141592653589;


int main(){
  int n,i,j;cin>>n;
  string s;cin>>s;

  int ans=0;
  i=0;
  while(i<n){
    for(j=i;j<n;j++){
      if(s[i]!=s[j])
      break;
    }
    ans+=1;
    i=j;
    // cout<<"ans "<<ans<<" i "<<i<<endl;
  }

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(true) {
			int max = 0;
			int count = 0;
			//int chackX =0;
			//int chackY =0;
			int n = scan.nextInt(); //??¨?????°
			if(n == 0) break;
			int w = scan.nextInt(); //???
			int h = scan.nextInt(); //??????
			boolean[][] field = new boolean[h][w];
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
				field[i][j] = false;
				}
			}
			
			for(int i=0;i<n;i++){
				int x = scan.nextInt()-1;
				int y = scan.nextInt()-1;
				field[y][x] = true;
			}
			/*
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					if(field[i][j] == false){
						System.out.print("0");
					}
					else{
						System.out.print("1");
					}
				}
				System.out.println("");
			}
			*/
			int s = scan.nextInt();
			int t = scan.nextInt();
			//System.out.println("s="+s);
			//System.out.println("t="+t);
			for(int i=0;i<=h-t;i++){
				for(int j=0;j<=w-s;j++){
					for(int k=i;k<t+i;k++){
						for(int l=j;l<s+j;l++){
							if(field[k][l] == true) count++;  
							//System.out.println(max);
							/*
							if(max < count){
								chackX =l;
								chackY =k;
							}
							*/
						}
					}
					if(max < count) max = count;
					
					count = 0;
				}
			}
			//System.out.println("x="+chackX);
			//System.out.println("y="+chackY);
			System.out.println(max);
		}
	}
}

Measured memory_bytes: 43856
//
/*==========================================================*/
/*    Template ver 2017-0720    |    Created by JollyBee    */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define FOR(i,n) for(int i=0;i<n;i++)
#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define FORD(i,n) for(int i=n-1;i>=0;i--)
#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)
#define REV(i,l,r) REVV(i,l,r,1)
//random
int irand(int lo, int hi){
    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;
}
//ll to string
string toString(ll x) {
    stringstream ss;
    ss << x;
    return ss.str();
}
//string to ll
ll toNumber(string S) {
    ll ret;
    sscanf(S.c_str(),"%lld",&ret);
    return ret;
}
// std::fill(start, end, value);
// for(auto it: DS){}

const int INF=(int)2e9;
const ll MOD=(ll)1e9+7;
/*==========================================================*/
/*                     END OF TEMPLATE                      */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/

int main(){
    int dat[3]; FOR(i,3) scanf("%d", dat+i);
    sort(dat, dat+3);
    int res = 1 + (dat[0] != dat[1]) + (dat[1] != dat[2]);
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())|	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import collections
import math
from functools import reduce

#### START
N=int(input())
S=[int(input()) for i in range(N)]

sum_s = sum(S)
not_ten = [ i for i in S if i%10!=0]
if sum_s % 10 != 0:
  print(sum_s)
elif len(not_ten) > 0:
  print(sum_s-min(not_ten))
else:
  print(0)

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

using namespace std;
#define f first
#define s second
#define pb push_back
 
typedef long long ll;

void solve()
{
	string str;
	cin >> str;
	if(str<="2019/04/30") cout << "Heisei\n";
	else cout << "TBD\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
//	cin >> t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
struct combination {
vector<mint> fact, ifact;
combination(int n):fact(n+1),ifact(n+1) {
assert(n < mod);
fact[0] = 1;
for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
ifact[n] = fact[n].inv();
for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
}
mint operator()(int n, int k) {
if (k < 0 || k > n) return 0;
return fact[n]*ifact[k]*ifact[n-k];
}
};
int main(){
    combination c(110000);
    ll n;cin>>n;
    vl a(n+1);rep(i,n+1)cin>>a[i];
    ll L=-1,R=-1;
    vl cnt(n+1);
    rep(i,n+1){
        cnt[a[i]]++;
    }
    ll d;
    rep(i,n+1){
        if(cnt[a[i]]>1) d=a[i];
    }
    rep(i,n+1){
        if(L==-1&&a[i]==d) L=i;
        else if(R==-1&&a[i]==d) R=n-i;
    }
    //cout<<L<<" "<<R<<endl;
    mint ans=0;
    for(ll i=1;i<=n+1;i++){
        ans=c(n+1,i)-c(L+R,i-1);
        cout<<ans.x<<endl;
    }
    return 0;
}

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

int main(){
  vector<vector<int>>bingo(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>bingo.at(i).at(j);
    }
  }
  int n;
  cin>>n;
  vector<int>correct(n);
  for(int i=0;i<n;i++){
    cin>>correct.at(i);
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(bingo.at(j).at(k)==correct.at(i))bingo.at(j).at(k)=0;
      }
    }
  }
bool a=false;
  
for(int i=0;i<3;i++){
if((bingo.at(0).at(i)==bingo.at(1).at(i))&&(bingo.at(2).at(i)==bingo.at(1).at(i)))a=true;
if((bingo.at(i).at(0)==bingo.at(i).at(1))&&(bingo.at(i).at(2)==bingo.at(i).at(1)))a=true;
}
if((bingo.at(0).at(0)==bingo.at(1).at(1))&&(bingo.at(2).at(2)==bingo.at(1).at(1)))a=true;
if((bingo.at(0).at(2)==bingo.at(1).at(1))&&(bingo.at(2).at(0)==bingo.at(1).at(1)))a=true;

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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		long res = 0;
		long[] streets = new long[n+1];
		long[] heroes = new long[n];
		
		for (int i = 0; i < (n + 1); i++) {
			long monster = sc.nextInt();
			streets[i] = monster;
		}
		
		for (int i = 0; i < n; i++) {
			long damage = sc.nextInt();
			heroes[i] = damage;
		}
		
		long left = 0;
		
		for (int i = 0; i < n; i++) {
			long damage = heroes[i];
			long monster = streets[i];
			if (monster > 0) {
				res += left;
				monster -= left;
			}
			
			if (damage >= monster) {
				res += monster;
				left = Math.min(damage-monster, streets[i+1]);
			} else {
				res += Math.min(damage, monster);;
				left = 0;
			}
		}
		
		if (left > 0 && streets[streets.length - 1] > 0) {
			res += left;
		}
		
		System.out.println(res);
	}
	
	static class FastReader { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine()); 
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try{ 
                str = br.readLine(); 
            } catch (IOException e) { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
}


Measured memory_bytes: 45264
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    A.sort()

    ma = A[-1]
    B = [0] * (ma + 1)

    ans = 0
    prev = 0
    for a in A:
        if B[a] == 1:
            if prev == a:
                prev = 0
                ans -= 1
            continue
        for aa in range(a, ma + 1, a):
            B[aa] = 1

        prev = a
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 31440
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int Q = sc.nextInt();
    long A[] = new long[Q];
    long B[] = new long[Q];
    for (int i=0; i<Q; i++) {
      long j = sc.nextLong();
      long k = sc.nextLong();
      if (j > k) {
        A[i] = k;
        B[i] = j;
      } else {
        A[i] = j;
        B[i] = k;
      }
    }

    for (int i=0; i<Q; i++) {
      if (A[i] == B[i]) {
        System.out.println(2*(A[i]-1));
        continue;
      }
      if (B[i] - A[i] == 1) {
        System.out.println(2*(A[i]-1));
        continue;
      }
      // (A[i]-i) * (B[i]+i) are always lower than the score.
      // (B[i]+i) * (A[i]-i) are always lower than the score. 
      long score = A[i]*B[i];
      double tmp = Math.sqrt((double)score);
      long C = Math.round(tmp) + 1;
      while (C*C >= score) {
        C--;
      }
      long ans;
      if (C*(C+1) >= score) {
        ans = 2*C - 2;
      } else {
        ans = 2*C - 1;
      }
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 21844
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solove();
	}
	
	public void solove() {
		
		Scanner sc = new Scanner(System.in);
		
		String[] firstArr = sc.nextLine().split(" ");
		int n = Integer.parseInt(firstArr[0]);
		int k = Integer.parseInt(firstArr[1]);
		
		int sumOfA = 0;
		int[] aArr = new int[n];
		
		String[] strArr = sc.nextLine().split(" ");
		sc.close();
		
		for(int i = 0 ; i < n;i++) {
			int nextInt = Integer.parseInt(strArr[i]);
			aArr[i] = nextInt;
			sumOfA += nextInt;
		}
		
		ArrayList<Integer> divisorArr = new ArrayList<>();
		for(int i = 1 ; i*i <= sumOfA ; i++) {
			if(sumOfA % i == 0) {
				divisorArr.add(new Integer(i));
				divisorArr.add(new Integer(sumOfA/i));
			}
		}
		Collections.sort(divisorArr);
		
		for(int i = divisorArr.size() - 1; i >= 0 ; i--) {
			if(canDivide(aArr, divisorArr.get(i), k)) {
				System.out.println(divisorArr.get(i));
				return;
			}
		}
	}
	
	public boolean canDivide(int[] aArr, int divideValue, int k) {
		
		int sumOfR = 0;
		boolean hasZero = false;
		ArrayList<Integer> rList = new ArrayList<>();
		for(int i = 0; i < aArr.length; i++) {
			if(aArr[i] % divideValue != 0) {
				rList.add(aArr[i] % divideValue);
				sumOfR += aArr[i] % divideValue;
			}else {
				hasZero = true;
			}
		}
		
		if(sumOfR % divideValue != 0) {
			return false;
		}
		
		if(rList.size() == 0) {
			return true;
		}
		
		if(hasZero && 
				((sumOfR % divideValue == 0 && sumOfR <= k) 
						|| ((divideValue * rList.size() - sumOfR) % divideValue == 0 && (divideValue * rList.size() - sumOfR) <= k))) {
			return true;
		}
		
		Collections.sort(rList);
		
		int cumSum = 0;
		for(int i = 0; i < rList.size() - 1; i++) {
			cumSum += rList.get(i);
			int plusSum = divideValue * (rList.size() - i - 1) -  (sumOfR - cumSum);
			
//			if(cumSum < plusSum) {
//				if((plusSum - cumSum)%divideValue == 0 && plusSum <= k) {
//					return true;
//				}
//			}
//			if(plusSum < cumSum) {
//				if((cumSum - plusSum)%divideValue == 0 && cumSum <= k) {
//					return true;
//				}
//			}
			
			if(plusSum - cumSum == 0 && cumSum <= k && plusSum <= k) {
				return true;
			}
		}
		
		return false;		
	}
}


Measured memory_bytes: 40848
fn s(n: i64) -> i64 {
    match n {
        0 => 0,
        m => m%10 + s(m/10)
    }
}

fn g(n: i64) -> f64 {
    n as f64 / ((s(n)) as f64)
}


fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let k: usize = sc.read();

    let mut x: i64 = 0;

    for _ in 0..k {
        x += 1;
        let mut pow = 1;
        while pow < x {
            let d = x/pow%10;
            let y = x + (9-d)*pow;
            if g(y) < g(x) {
                x = y;
            }
            pow *= 10;
        }
        println!("{}", x);
    }
}

// thanks, ir5
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


Measured memory_bytes: 4352
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    nmax = 10**2
    ans = [0] * (10**4+1)
    for i in range(1, nmax):
        for j in range(1, nmax):
            for k in range(1, nmax):
                c = i*i + j*j + k*k + i*j + j*k + k*i
                if c > 10**4:
                    continue
                ans[c] += 1
    for i in range(1, N+1):
        print(ans[i])



main()



Measured memory_bytes: 78716
/** 
 *  Author : Parth Prajapati aka (PARTH_4399, hungry_chef)
 *  Institute : Pandit Deendayal Petroleum University
 **/
#include<bits/stdc++.h>

using namespace std; 

#define start_cooking int main()
#define food_is_ready return 0;
#define main_ingredient_added ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

void cook()
{
    // start with your recipe
    long long a, b;
    cin>>a>>b;
    cout<<a*b;
}

start_cooking
{
    main_ingredient_added
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while(t--)
        cook();
    food_is_ready
}

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

int main(){
  int a[3];
  cin >> a[0]>>a[1]>>a[2];
  sort(a,a+3);
  if(a[0]!=a[1])cout << a[0] << endl;
  else cout << a[2] << endl;
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

ll gcd(ll a, ll b) {
	while (b) { int t = a%b; a = b; b = t; } return a;
}

void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	ll k; cin >> k;
	ll sum = 0;
	for (int a = 1; a <= k; a++) {
		for (int b = 1; b <= k; b++) {
			for (int c = 1; c <= k; c++) {
				sum += gcd(c, gcd(a, b));
			}
		}
	}
	cout << sum;
}

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

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

int n, k;
vector<int> edges[100001];
int usedChildren[100001];
int used[100001];
int options[100001];
int parent[100001];

void dfs(int u) {
    used[u] = true;
    int p = parent[u];
    int choices = k-usedChildren[p];
    if (p != 0) choices--;
    if (parent[p] != 0) choices--;
    options[u] = max(choices, 0);
    usedChildren[p]++;
    for (int v: edges[u]) {
        if (used[v]) continue;

        parent[v]=u;
        dfs(v);
    }
}

int main() {
    cin >> n >> k;
    for (int i = 1; i <= n-1; i++) {
        int u, v; cin >> u >> v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }

    dfs(1);

    long long ans = 1;
    for (int i = 1; i <= n; i++) {
        ans *= options[i];
        ans %= 1000000007;
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++){
        char s;
        cin >> s;
        if(s == 'Y'){
            cout << "Four";
            return 0;
            }

    }
    cout << "Three";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,x;
int b[300005],sum[300005];
bool judge(int k,int x)
{
	int l=1,r=n,p;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(b[mid]<x&&(mid==n||b[mid+1]>=x))
		{
			p=mid;
			break;
		}
		if(b[mid]<x)l=mid+1;
		else r=mid-1;
	}
	if((n-p)*x+sum[p]>=k*x)return 1;
	return 0;
}
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		b[x]++;
	}
	sort(b+1,b+n+1);
	for(int i=1;i<=n;i++)
		sum[i]=sum[i-1]+b[i];
	x=n;
	for(int k=1;k<=n;k++)
	{
		while(x&&!judge(k,x))x--;
		cout<<x<<endl;
	}
}

Measured memory_bytes: 5504
#include <iostream>
#include <cmath>
#include <algorithm>

typedef long long ll;
using namespace std;
int main (){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    a--;
    ll ac,ad,bc,bd;
    ac=a/c;
    ad=a/d;
    bc=b/c;
    bd=b/d;
    ll acd,bcd,cd;
    cd=c*d/__gcd(c,d);
    acd=a/cd;
    bcd=b/cd;
    ll ans = (b-bc-bd+bcd)-(a-ac-ad+acd);
    cout << ans <<"\n";

}

Measured memory_bytes: 256
#include<stdio.h>
int dx[8]={-1,-1,0,1,1,1,0,-1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
int main(){
	char t[8][8];
	int i,j,k,l;
	for(i=0;i<8;i++)for(j=0;j<8;j++)scanf(" %c",&t[i][j]);
	bool mamiturn=false;
	int pass=0;
	while(1){
		mamiturn=!mamiturn;
		int mx=-1,my=-1;
		int ma=0;
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				if(t[i][j]=='.'){
					int res=0;
					for(k=0;k<8;k++){
						int l=1;
						while(i+dx[k]*l>=0&&i+dx[k]*l<8&&j+dy[k]*l>=0&&j+dy[k]*l<8&&t[i+dx[k]*l][j+dy[k]*l]==(mamiturn?'x':'o'))l++;
						if(l==1)continue;
						if(i+dx[k]*l>=0&&i+dx[k]*l<8&&j+dy[k]*l>=0&&j+dy[k]*l<8&&t[i+dx[k]*l][j+dy[k]*l]==(mamiturn?'o':'x')){
							res+=l-1;
						}
					}
					if(res==0)continue;
					if(mamiturn){
						if(res>ma){
							ma=res;
							mx=i;
							my=j;
						}
					}
					else{
						if(res>=ma){
							ma=res;
							mx=i;
							my=j;
						}
					}
				}
			}
		}
		if(mx==-1&&my==-1){
			pass++;
			if(pass>=2)break;
			continue;
		}
		else pass=0;
		t[mx][my]=mamiturn?'o':'x';
		for(i=0;i<8;i++){
			int j=1;
			while(mx+dx[i]*j>=0&&mx+dx[i]*j<8&&my+dy[i]*j>=0&&my+dy[i]*j<8&&t[mx+dx[i]*j][my+dy[i]*j]==(mamiturn?'x':'o'))j++;
			if(mx+dx[i]*j>=0&&mx+dx[i]*j<8&&my+dy[i]*j>=0&&my+dy[i]*j<8&&t[mx+dx[i]*j][my+dy[i]*j]==(mamiturn?'o':'x')){
				j--;
				while(j>0){
					t[mx+dx[i]*j][my+dy[i]*j]=mamiturn?'o':'x';
					j--;
				}
			}
		}
	}
	for(i=0;i<8;i++){
		for(j=0;j<8;j++)printf("%c",t[i][j]);puts("");
	}
}

Measured memory_bytes: 956
n,m = map(int,input().split())

menu = [i for i in range(1,m+1)]
cnt = [0]*m
a = []

for i in range(n):
    ka = list(map(int,input().split()))
    ka.pop(0)
    a.append(ka)
    
for i in menu:
    for j in a:
        if i in j:
            cnt[i-1] += 1
            
print(cnt.count(n))

Measured memory_bytes: 9132
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
typedef long long ll;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,cnt,st[N],tp;
char s[N];
ll ans;

int main() {
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=1;i<=n;i++) cnt+=(s[i]=='0');
	if(cnt==n) return cout<<0,0;
	for(int i=n-cnt-1;i;i--) ans+=(i+1)/2;
	for(int i=1;i<=n;i++)
		if(s[i]=='0') st[++tp]=0;
		else if(st[tp]==1) --tp,ans+=cnt+1;
		else st[++tp]=1;
	int sum=0;
	for(int i=1,p=0;i<=tp;i++) {
		if(st[i]==0) ++sum;
		else {
			++p;
			if(p&1) ans+=cnt+1-(sum+1)/2;
			else ans+=cnt+1-(sum/2+1);
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 4716
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline


x, = map(int,readline().split())
k, = map(int,readline().split())
*r, = map(int,readline().split())
q, = map(int,readline().split())
r.append(1<<30)

INF = 1<<30
ID_M = (-INF,INF,0)
def compose(lst1,lst2):
    return (funcval(lst1[0],lst2),funcval(lst1[1],lst2),lst1[2]+lst2[2])

def funcval(x,lst):
    a,b,c = lst
    if x <= a-c: return a
    elif x >= b-c: return b
    else: return x+c

#seg = segment_tree_dual(q, compose, funcval, ID_M)
#seg.build([a for a,t,i in ati])

seg = (0,x,0)

tai = []
for i in range(q):
    t,a = map(int,readline().split())
    tai.append((t,a,i))

tai.sort(key=lambda x:x[0])

idx = 0
ans = [0]*q
t0 = 0
coeff = -1
for i,ri in enumerate(r):
    while idx < q and tai[idx][0] < ri:
        t,a,j = tai[idx]
        v = funcval(a,seg)
        ans[j] = min(x,max(v+coeff*(t-t0),0))
        idx += 1
        
    seg = compose(seg,(0,x,coeff*(ri-t0)))
    
    t0 = ri
    coeff *= -1    

    #print(seg)

print(*ans,sep="\n")




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

using namespace std;
#define int long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define vi vector <int>
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define piii pair< int,pair<int,int> >
#define tiii tuple <int,int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define rall(v) v.rbegin(),v.rend()
#define endl '\n'
#define matrix vector <vector <int> >
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define NAYAN freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define N 21
#define mod 1000000007
#define mod2 998244353
#define inf 1e18

int dp[(1ll<<N)][N];
int a[N][N];
int n;

int solve(int mask,int j)
{
   // int n_bits=__builtin_popcount(mask);
    if(j==n)
        return 1;

    int &ans=dp[mask][j];

    if(ans!=-1)
        return ans;
    ans=0;

    for(int i=0;i<n;i++)
    {
        if(a[i][j]==1 && !(mask & (1ll<<i)))
        {
            //cout << mask << " " << i << " " << j << endl;
            ans=(ans+solve(mask|(1ll<<i),j+1))%mod;
        }
    }

    return ans;

}


int32_t main()
{
    boost
    // #ifndef ONLINE_JUDGE 
    // NAYAN
    // #endif

    
    cin >> n;
    
    int i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            cin >> a[i][j];
        }
    }

    memset(dp,-1,sizeof dp);

    int ans=solve(0,0);
    cout << ans;
    
    
    
}

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

int main(){
    long A,B,N;

    cin >> A >> B >> N;

    long x = 1,max = 0,maxIdx = 0;
    long estimator;
    /*
    for(x = 100000000;x <= N;x++){
        estimator = floor((double)A*x/B) - A * floor((double)x/B);  
        if(estimator > max){
            max = estimator;
            maxIdx = x;
        }
        printf("(x,estimator) = (%d,%d)\n",x,estimator);
    }*/

    if(N < B){
        maxIdx = N;
        max = A*N/B - A * floor((long double)N/B);
    }else{
        maxIdx = B - 1;
        max = A*(B-1)/B;
    }

    cout << max << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int h,w,k;
    cin >> h >> w >> k;
    string s[310];
    vector<vector<int>> ans(h,vector<int>(w,0));
    for (int i = 0;i < h;++i) cin >> s[i];
    int cnt = 0;
    for (int i = 0;i < h;++i) {
        for (int j = 0;j < w;++j) if (ans[i][j] == 0) {
            if (s[i][j] == '#') {
                cnt++;
                int a = i,b = j;
                for (int y = j-1;y >= -1;--y) if (y < 0 || s[i][y] == '#' || ans[i][y]) {
                    b = y+1;
                    for (int x = i-1;x >= 0;--x) {
                        bool ok = true;
                        for (int z = y+1;z < j+1;++z) if (s[x][z] == '#' || ans[x][z]) ok = false;
                        if (ok) a = x;
                        else break;
                    }
                    break;
                }
                int c = j;
                for (int y = j+1;y < w;++y) {
                    bool ok = true;
                    for (int x = a;x <= i;++x) if (s[x][y] == '#' || ans[x][y]) ok = false;
                    if (!ok) break;
                    c = y;
                }
                for (int x = a;x < h;++x) {
                    bool ok = true;
                    for (int y = b;y <= c;++y) if ((x != i || y != j) && (s[x][y] == '#' || ans[x][y])) ok = false;
                    if (ok) for (int z = b;z <= c;++z) ans[x][z] = cnt;
                    else break;
                }
            }
        }
    }
    // for (int i = 0;i < h;++i) p_ary(ans[i],0,w);
    for (int i = 0;i < h;++i) {
        for (int j = 0;j < w;++j) cout << ans[i][j] << " \n"[j == w-1];
    }
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int R[2005]={0};
int main(){
  int n,x,y;
  cin>>n>>x>>y;
    for(int i=1;i<=n-1;i++){
      for(int j=i+1;j<=n;j++){
        if(j<=x||y<=i)R[j-i]++;
        else if(i<=x&&y<=j)R[(x-i)+(j-y)+1]++;
        else if(x<=i&&j<=y)R[min((y-j)+(i-x)+1,j-i)]++;
        else if(i<x&&j<y)R[min(j-i,(x-i)+1+(y-j))]++;
        else R[min(j-i,(j-y)+1+(i-x))]++;
      }
    }
  for(int i=1;i<=n-1;i++)cout<<R[i]<<endl;
}


Measured memory_bytes: 256
n, k = [int(i) for i in input().split()]

t = []
for i in range(0, n):
  t.append(int(input()))

t.sort()
min = max(t) - min(t)

for i in range(0, n - k + 1):
  d = t[i + k - 1] - t[i]
  if min > d:
    min = d

print(min)

Measured memory_bytes: 7384
s = input()
l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n',
     'o','p','q','r','s','t','u','v','w','x','y','z', 'a']
for i in range(26):
  if s == l[i]:
    print(l[i+1])
    break

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

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

#define NL cout<<"\n";
#define ALL(a) a.begin(), a.end()
#define DBG(a) cout<< #a <<" --> "<<(a)<<endl;
#define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define IN freopen("input.txt","r+",stdin)
#define OUT freopen("output.txt","w+",stdout)

template < class T1,class T2>
ostream &operator <<(ostream &os,const pair < T1,T2 > &p)
{
    os<<"{"<<p.first<<","<<p.second<<"}";
    return os;
}

const int N=2e5+5;
const int oo=1e9+7;
vector<int > g[N],G[N];
int nc=0,Nc=0;
int vis[N],Vis[N];
vector<int > nodes[N],Nodes[N];
int tocomp[N],Tocomp[N];
void bfs(int u,int nc)
{
    queue<int > q;
    vis[u]=1;
    q.push(u);
    while(!q.empty())
    {
        u= q.front();
        tocomp[u]=nc;
        nodes[nc].push_back(u);
        q.pop();
        for(int v : g[u])
        {
            if(vis[v]) continue;
            vis[v]=1;
            q.push(v);
        }
    }
}
void Bfs(int u,int nc)
{
    queue<int > q;
    Vis[u]=1;
    q.push(u);
    while(!q.empty())
    {
        u= q.front();
        Tocomp[u]=nc;
        Nodes[nc].push_back(u);
        q.pop();
        for(int v : G[u])
        {
            if(Vis[v]) continue;
            Vis[v]=1;
            q.push(v);
        }
    }
}
map<pair<int,int >  ,int > ans;

void sol(int n)
{
    for(int i=1;i<=n;i++)
    {
        if(vis[i]) continue;
        bfs(i,++nc);
    }
    for(int i=1;i<=n;i++)
    {
        if(Vis[i]) continue;
        Bfs(i,++Nc);
    }
    for(int i=1;i<=nc;i++)
    {
        map<int ,int > dat;
        for(int u : nodes[i])
        {
            dat[Tocomp[u]]++;
        }
        for(auto x : dat)
        {
            ans[{i,x.first}]=x.second;
        }
    }
}
int32_t main()
{
    FastIO;
    int n,k,l;
    cin>>n>>k>>l;
    while(k--)
    {
        int p,q;
        cin>>p>>q;
        g[p].push_back(q);
        g[q].push_back(p);
    }
    while(l--)
    {
        int p,q;
        cin>>p>>q;
        G[p].push_back(q);
        G[q].push_back(p);
    }
    sol(n);
    for(int i=1;i<=n;i++)
    {
        cout<<ans[{tocomp[i],Tocomp[i]}]<<" ";
    }
    NL;
}


Measured memory_bytes: 47872
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>

using namespace std;
using lint = int64_t;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (lint i = 1; i < (n); ++i)
#define repn(i, a, b) for(lint i = (a); i < (b); ++i)
#define rep_inv(i, n) for (lint i = (n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define cend printf("\n")

//constexpr lint mod = 998'244'353LL;
constexpr lint Mod = 1000'000'007LL;
constexpr lint Inf = 3'000'000'000'000'000'007LL; //3e18+7
constexpr double Pi = 3.141592653589793;

template<class T> using prique     = priority_queue<T>;
template<class T> using prique_inv = priority_queue<T, vector<T>, greater<T>>;
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& rhs) { return is >> rhs.first >> rhs.second; }
template<class T, class U>inline ostream& operator<<(ostream& os, const pair<T, U>& rhs) { return os << rhs.first << " " << rhs.second; }
template<class InputIterator> void arrin(InputIterator first, InputIterator last) { for (; first != last; ++first) cin >> (*first); }
template<class InputIterator> void arrout(InputIterator first, InputIterator last) {
	for (; first != last; ++first) {
		cout << (*first) << ((first + 1) != last ? " " : "\n");
	}
}

bool pri(lint x) { 
	for (lint i = 2; i * i <= x; ++i) {
		if (x % i == 0) return false;
	}
	return 1 < x; 
}

lint fact[3000000];
void fact_init(lint n, lint m = Mod) {
	if (3000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1] % m;
	}
}

lint modpow(lint x, lint n, lint m = Mod) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

lint intpow(lint x, lint n) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res *= x;
		x *= x;
		n >>= 1;
	}
	return res;
}

lint comb(lint n, lint r, lint m = Mod) {
	if (r == 0 || r == n) return 1;
	lint res = fact[n] * modpow(fact[n - r], m - 2, m) % m * modpow(fact[r], m - 2, m) % m;
	return res < 0 ? res + m : res;
}

map<lint, lint> factring(lint n) {
	map<lint, lint> res;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++res[i];
		}
	}
	if (n != 1) ++res[n];
	return res;
}

int n, r, w, ans;
string s;
int main() {
	cin >> n >> s;
	rep(i, n) {
		char c = s[i];
		if (c == 'W') w++;
		else r++;
	}
	rep(i, r) {
		if (s[i] == 'W') ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	ll a, b;
	cin >> a >> b;
	if(a > 9 || b > 9)
		cout << -1 << endl;
	else
		cout << a * b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    #define rt0 return 0
    #define rep(i,n) for(int i=0;i<n;i++)
    #define repn(i,n) for(int i=1;i<=n;i++)
    #define LL long long
    #define pii pair<int,int>
    #define pb push_back
    #define fi first
    #define se second
    #define mpr make_pair
     
    using namespace std;
     
    const LL MOD=1e9+7;
     
    LL n,k,ans=0;
    bool isk[200010];
     
    int main()
    {
    	cin>>n>>k;
    	repn(i,n) if(2*i%k==0) isk[i]=true;
    	repn(i,n)
    	{
    		if(!isk[i]) continue;
    		LL p=(n-(LL)i)/k+1LL;
    		ans+=p*p*p;
    		for(int j=i+k;j<=n;j+=k) isk[j]=false;
    		//cout<<p*p*p<<endl;
    	}
    	cout<<ans<<endl;
    	rt0;
    }    

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

class Program
{
    static void Main()
    {
        Console.ReadLine();
        List<int> input = Console.ReadLine().Split(' ').ToList().Select(x => int.Parse(x)).ToList();
        Console.WriteLine(GetShiftCount(input));
    }

    static int GetShiftCount(List<int> nums, int count = 0)
    {
        if (!nums.All(x => x % 2 == 0)) return count;

        return GetShiftCount(nums.Select(x => x / 2).ToList(), count + 1);
    }
}

Measured memory_bytes: 13396
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 c = sc.nextInt();
		int d = sc.nextInt();
		int x = 0;
		int y = 0;
		if (a > b) {
			x = b;
		}else {
			x = a;
		}
		if (c > d) {
			y = d;
		}else {
			y = c;
		}
		System.out.println(x + y);
	}

}


Measured memory_bytes: 35864
n = input()

v_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))
maximam = 0
vc_li = [i- j for i, j in zip(v_li , c_li)]
vc_li.sort(reverse = True)
ans = 0
for i in vc_li:
    if i <= 0:
        break
    ans += i


print(ans)

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

int main()
{
  int N;
  cin >> N;
  if (N % 1000 == 0 || (N % 1000) % 111 == 0 || (N / 10) % 111 == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256