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


using namespace std;
#define _rep(n, a, b) for (ll n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (ll n = (a); n >= (b); --n)
#define _for(n, a, b) for (ll n = (a); n < (b); ++n)
#define _rof(n, a, b) for (ll n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f
#define ll long long
#define db double
#define eps 1e-6
#define bin(x) cout << bitset<10>(x) << endl;
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
#define pi acos(-1.0)
const ll maxn = 3e5 + 10;
const ll mod = 1e9 + 7;
ll qpow(ll a, ll b)
{
	ll ret = 1;
	for (; b; b >>= 1, a = a * a % mod)
		if (b & 1)
			ret = ret * a % mod;
	return ret;
}
ll fac[maxn];
ll C(ll n, ll m)
{
	ll ret = fac[m] * qpow(fac[n], mod - 2)%mod* qpow(fac[m - n], mod - 2)% mod;
	return ret;
}
signed main()
{
	ll n, k;
	cin >> n >> k;
	fac[0] = 1;
	_for(i, 1, maxn) fac[i] = fac[i - 1] * i % mod;
	ll res = 0;
	_rep(i, 0, min(k, n - 1)) {
		res = (res + C(i, n) * C(n-i-1, n-1) % mod)%mod;
	}
	cout << res << endl;
}

Measured memory_bytes: 2560
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <tuple>
#include <cstring>
#include <queue>
using namespace std;
using ll = long long int;

const ll MOD = 1000000007;
const int SIZE = 26;

struct PMA {
  PMA* node[SIZE + 1];
  vector<int> matched;
  PMA() { memset(node, 0, sizeof(node)); }

  vector<int> unite(const vector<int> &a, const vector<int> &b) {
    vector<int> ret;
    set_union(a.begin(), a.end(), b.begin(), b.end(), back_inserter(ret));
    return ret;
  }

  void build(vector<string> pattern) {
    PMA* root = this;
    root -> node[SIZE] = root;
    for(size_t i=0; i<pattern.size(); i++) {
      PMA* now = root;
      for(size_t j=0; j<pattern[i].size(); j++) {
        int c = pattern[i][j] - 'a';
        if(!now -> node[c]) {
          now -> node[c] = new PMA;
        }
        now = now -> node[c];
      }
      now -> matched.push_back(i);
    }

    queue<PMA*> que;
    for(int i=0; i<SIZE; i++) {
      if(!root -> node[i]) root -> node[i] = root;
      else {
        root -> node[i] -> node[SIZE] = root;
        que.push(root -> node[i]);
      }
    }

    while(que.size()) {
      PMA* now = que.front(); que.pop();
      for(int i=0; i<SIZE; i++) {
        if(now -> node[i]) {
          PMA* nxt = now -> node[SIZE];
          while(!nxt -> node[i]) nxt = nxt -> node[SIZE];

          now->node[i]->node[SIZE] = nxt->node[i];
          now->node[i]->matched=unite(now->node[i]->matched, nxt->node[i]->matched);
          que.push(now->node[i]);
        }
      }
    }
  }

  ll solve(const string s, vector<string> pattern) {
    PMA* pma = this;

    int N = s.length();
    vector<ll> dp(N+1);
    dp[0] = 1;
    for(size_t i=0; i<s.length(); i++) {
      int c = s[i] - 'a';
      while(!pma -> node[c]) pma = pma -> node[SIZE];

      pma = pma -> node[c];
      for(size_t j=0; j<pma->matched.size(); j++) {
        int r = i+1, l=r-pattern[ pma->matched[j] ].length();
        (dp[r] += dp[l]) %= MOD;
      }
    }

    return dp[N];
  }
};

int main() {
  int N; cin >> N;
  vector<string> pats(N);
  for(int i=0; i<N; i++) {
    cin >> pats[i];
  }

  string text; cin >> text;
  PMA pma;
  pma.build(pats);

  cout << pma.solve(text, pats) << endl;
  return 0;
}



Measured memory_bytes: 54044
#include <iostream>
using namespace std;
 
int main(){
    int N;
    cin >> N;
  
  int a = N/100;
  int b = (N-100*a)/10;
  int c = N-(100*a+10*b);
    
    if (a == 7 || b == 7 || c == 7) {
      cout << "Yes" << endl;
    }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3588
n, k = map(int, input().split())
h=list(map(int,input().split()))

# 体力の大きい順にソート
h=sorted(h,reverse=True)

# k > len(h) ならば　空のリストになるので
# k >= len(h) と　それ以外の場合分けが必要なくなる
h=h[k:]
print(sum(h))

Measured memory_bytes: 26764
def s(a , n , d):
  return (2 * a + (n - 1) * d) * n // 2
n = int(input())
m3 = n // 3
m5 = n // 5
print(s(1, n , 1) - s(3 , m3 , 3) - s(5 , m5 , 5) + s(15 , n // 15 , 15))

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力受け取ってやる
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]); int b = int.Parse(input[1]);

            if (a>b){
                Console.WriteLine(a-1);
            }else{
                Console.WriteLine(a);
            }
        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int arr[] = { 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};
        int n = in.nextInt();
        System.out.println(arr[n-1]);
    
    }
    
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
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;
}

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

signed main()
{
    int N;
    cin >> N;
    vi v(N);
    REP(i, N)
    cin >> v.at(i);

    int num = 1;
    FOR(i, 1, N)
    {
        num *= i;
        num %= MOD;
    }

    int ans = 0;
    int tmp = 0;
    REP(i, N - 1)
    {
        // tmp += 1 / (i + 1);
        tmp += num * modinv(i + 1, MOD) % MOD;
        ans += tmp * (v.at(i + 1) - v.at(i)) % MOD;
        ans %= MOD;
    }

    cout << ans << endl;

    // system("pause");
    return 0;
}

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

int main(){
  int n; cin >> n;
  vector<int> v(n); 
  for(int i=0;i<n;i++) cin >> v[i];
  int ans = 1000000000;
  for(int x = 0;x <= 100;x++){
    int sum = 0;
    for(auto p: v){
      sum += (p - x) * (p -x);
    }
    ans = min(sum, ans);
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int m,n;
int main(){
	scanf("%d%d",&m,&n);
	for(int i=0;i<=m;i++)
     	for(int j=0;j<=m;j++)
      		for(int k=0;i+j+k<=m;k++)
            	if(i*1000+j*5000+k*10000==n&&i+j+k==m){
                	printf("%d %d %d\n",k,j,i);
                	return 0;
            	}
    puts("-1 -1 -1");
	return 0;
}

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

int main(){
	
	ll a,b;
	cin>>a>>b;
	for(int i = 1; i <= 10000000; i++){
		ll need = 0.08*i;
		ll cc = 0.1*i;
		if(need == a && cc == b) { cout<<i<<"\n"; return 0;}
	}
	cout<<-1<<"\n";
	
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline

A = [list(map(int, readline().split())) for _ in range(3)]
N, *b = map(int, read().split())
b = set(b)

for i in A:
    for j in i:
        if j not in b:
            break
    else:
        print('Yes')
        exit()

for i in range(3):
    for j in range(3):
        if A[j][i] not in b:
            break
    else:
        print('Yes')
        exit()

c1 = [(0, 0), (1, 1), (2, 2)]
c2 = [(0, 2), (1, 1), (2, 0)]
for i, j in c1:
    if A[i][j] not in b:
        break
else:
    print('Yes')
    exit()

for i, j in c2:
    if A[i][j] not in b:
        break
else:
    print('Yes')
    exit()

print('No')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  string R = "CODEFESTIVAL2016";
  int ans = 0;
  for(int i=0; i<16; i++){
    if(S.at(i) != R.at(i)){
      ans++;
    }
  }
  cout << ans << endl;
}

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

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

    int N = scanner.nextInt();
    long M = scanner.nextInt();
    long V = scanner.nextInt();
    int P = scanner.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) A[i] = scanner.nextInt();
    Arrays.sort(A);
    reverse(A);
    long[] cum = new long[N];
    for (int i = 1; i < N; i++) cum[i] = cum[i - 1] + A[i - 1];

    int left = 0;
    int right = N;
    while (right - left > 1) {
      int mid = (right + left) / 2;
      if (possible(N, M, V, P, A, cum, mid)) {
        left = mid;
      } else {
        right = mid;
      }
    }
    System.out.println(right);
  }

  private static boolean possible(int N, long M, long V, int P, int[] A, long[] cum, int i) {
    if (i < P) return true;
    if (A[i] + M < A[P - 1]) return false;
    return M * (P - 1 + N - i) + (i - P + 1) * (A[i] + M) - (cum[i] - cum[P - 1]) >= M * V;
  }

  private static void reverse(int[] a) {
    int i = 0;
    int j = a.length - 1;
    while (i < j) {
      int tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
      i++;
      j--;
    }
  }
}


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

#pragma GCC optimize("Ofast")

#define ll long long
#define ull unsigned long long
#define all(x) (x).begin(),(x).end()
#define dlog(x) cerr<<#x<<'='<<x<<endl
#define dnew cerr<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define f first
#define s second
#define endl '\n'

using namespace std;




signed main () { //[J][O][L][S][K][E][Y]
      int n; cin>>n;
      vector<int>vec(n);
      for (int i=0; i<n; i++)
            cin>>vec[i];

      sort (all(vec));

      int res=INT_MAX;
      for (int p=0; p<=100; p++) {
            int cnt=0;
            for (int i=0; i<n; i++) {
                  cnt += (p-vec[i])*(p-vec[i]);
            }
            res=min(res,cnt);
      }


      cout<<res;
      //1,9
      return 0;
}

Measured memory_bytes: 256
from collections import Counter
import itertools

n = int(input())
s = [input()[:1] for _ in range(n)]
s = Counter([i for i in s if i in ['M', 'A', 'R', 'C', 'H']])

li = list(itertools.combinations(['M', 'A', 'R', 'C', 'H'], 3))

if len(s)<3:
    print(0)
    exit()

ans = 0
for i, j, k in li:
    ans += s[i]*s[j]*s[k]
print(ans)

Measured memory_bytes: 10576
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll r,d,x;
    cin>>r>>d>>x;
    for(int i=0;i<10;i++)
    {
        x=(r*x-d);
        cout<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
//Anshul Gupta


#include<iostream>
#include <fstream>
#include<algorithm>
#include<vector>
#include<utility>
#include<climits>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<assert.h>
#include<iomanip>

using namespace std;
	
#define f first
#define s second
#define sz(a) int((a).size()) 
#define pb push_back 
#define mp make_pair
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef long long ll;

typedef struct node{
	ll val,more=0,less=0;
	bool operator <(const node& a){
		return val<a.val;
	}
}node;

typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef pair<pi,pi > pi2;

typedef pair<ll,ll> pl;
typedef pair<pl,ll> pll;
typedef pair<pl,pl > pl2;

typedef vector<node> vn;

typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
typedef vector<pi2 > vpi2;

typedef vector<ll> vl;
typedef vector<pl> vpl;
typedef vector<pll> vpll;
typedef vector<pl2 > vpl2;

const int M=1000000007;


int main(){

	/*int n,k;
	cin>>n>>k;
	ll div=pow(n/k,3);
	if(k&1){
		return cout<<div,0;
	}
	ll fac=pow((n-1)/k+1,3);
	ll r=3*k/2;
	ll temp=(r+2)*(r+1)*r/6-3*(r-k+2)*(r-k+1)*(r-k)/6;
	temp*=fac;
	if(n%k==0){
		temp+=(r)
	}*/

	int l;
	cin>>l;

	/*if(l<60){
		cout<<2<<" "<<l<<"\n";
		for(int i=0;i<l;i++)
			cout<<1<<" "<<2<<" "<<i<<"\n";
		return 0;
	}*/
	int cnt=1,a=l,edges=0,wt;
	while(a>1){
		edges+=a&1;
		cnt++;
		a>>=1;
	}
	edges+=(cnt-1)<<1;
	cout<<cnt<<" "<<edges<<"\n";
	wt=1<<(cnt-2);
	for(int i=1;i<cnt;i++){
		cout<<i<<" "<<i+1<<" "<<wt<<"\n";
		cout<<i<<" "<<i+1<<" "<<0<<"\n";
		wt>>=1;
	}
	wt=1<<(cnt-1);
	int i=0;
	while(l>1){
		if(l&1){
			cout<<1<<" "<<cnt<<" "<<wt<<"\n";
			wt+=1<<i;
		}
		++i;
		l>>=1;
		cnt--;
	}
	return 0;
}

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

using namespace std;

int main()
{
  string S; cin >> S;

  int idx = S.size() - 1;
  while (S[idx] == '9') idx--;
  if (idx <= 0) cout << (S[0] - '0') + 9*(S.size() - 1) << endl;
  else cout << (S[0] - '0' - 1) + 9*(S.size() - 1) << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[int(input())for i in range(n)]
now_p=next_p=cnt=0
while cnt<=n:
    next_p=a[now_p]-1
    now_p=next_p
    cnt+=1
    if now_p==1:
        print(cnt)
        exit()
else:
    print(-1)


Measured memory_bytes: 7084
#include <iostream>
#include <complex>
using namespace std;

typedef complex<double> P;

#define EPS 1e-10
#define EQ(a, b) (abs((a)-(b)) < EPS)

double cross(P a, P b){
  return (a.real()*b.imag() - a.imag()*b.real());
}

int is_parallel(P a1, P a2, P b1, P b2){
  return EQ(cross(a1-a2, b1-b2), 0.0);
}

int main(void){
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    P a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
    if(is_parallel(a, b, c, d)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

int main(){
    ll  n , m , k ;
    cin >> n >> m >> k ;
    vector<ll> A(n+1) ;
    vector<ll> B(m) ;
    A[0] = 0 ;
    rep(i,n) cin >> A.at(i+1) ;
    rep(i,m) cin >> B.at(i) ; 
    rep(i,n) A[i+1] = A[i+1] + A[i] ;
    rep(i,m-1) B[i+1] = B[i+1] + B[i] ;
    ll ans = 0 ;
    for(ll i = 0 ; i < n + 1 ; i++ ){
      if ( k - A[i] < 0 ) continue ;
      auto Iter1 = upper_bound(B.begin(),B.end(), k - A[i] );
      ll j =  Iter1 - B.begin() ;
      //cout << i + 1 << ' ' <<  j << endl ; 
      ans = max(i+j,ans) ;
    }
    cout << ans << endl ;
}


Measured memory_bytes: 6392
def sol():
    h,w=map(int,input().split())
    l=[]
    x=[[0]*w for i in range(h)]
    y=[[0]*w for i in range(h)]
    for i in range(h):
        s=input()
        l.append(s)
    for i in range(h):
        for j in range(w):
            if j==0 and l[i][j]==".":
                x[i][j]=1
            elif l[i][j]==".":
                x[i][j]=x[i][j-1]+1
    for i in range(h):
        for j in range(1,w):
            t=-1*(j+1)
            if l[i][t]==".":
                x[i][t]=max(x[i][t],x[i][t+1])

    for i in range(w):
        for j in range(h):
            if j==0 and l[j][i]==".":
                y[j][i]=1
            elif l[j][i]==".":
                y[j][i]=y[j-1][i]+1
    for i in range(w):
        for j in range(1,h):
            t=-1*(j+1)
            if l[t][i]==".":
                y[t][i]=max(y[t][i],y[t+1][i])
    ans=chk=0
    for i in range(h):
        for j in range(w):
            ans=max(ans,x[i][j]+y[i][j]-1)
    print(ans)

if __name__=="__main__":
    sol()

Measured memory_bytes: 124892
#include<stdio.h>
int main(void){
    int nu,x,y;
    char bomb[14][14]={0};
    int num[14][14];
    int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;
    scanf("%d",&nu);
    for(a=0;a<nu;a++){
        for(b=3;b<11;b++){
            scanf("%s",bomb[b]);
        }
        for(c=0;c<8;c++){
            for(d=7;d>=0;d--){
                bomb[c+3][d+3]=bomb[c+3][d];
                bomb[c+3][d]=0;
            }
        }
        for(e=0;e<14;e++){
            for(f=0;f<14;f++){
                if(bomb[e][f]=='\0'){
                    bomb[e][f]='0';
                }
            }
        }
        for(g=0;g<14;g++){
            for(h=0;h<14;h++){
                num[g][h]=bomb[g][h]-'0';
            }
        }
        scanf("%d%d",&x,&y);
        num[y+2][x+2]=3;
        while(1){
            p=0;
            for(i=3;i<11;i++){
                for(j=3;j<11;j++){
                    for(k=0;k<7;k++){
                        if(num[i-3+k][j]==3||num[i][j-3+k]==3){
                            if(num[i][j]==1){
                                num[i][j]=2;
                            }
                        }
                    }
                }
            }
            for(l=3;l<11;l++){
                for(m=3;m<11;m++){
                    if(num[l][m]==3){
                        num[l][m]=0;
                        p++;
                    }
                }
            }
            for(n=3;n<11;n++){
                for(o=3;o<11;o++){
                    if(num[n][o]==2){
                        num[n][o]=3;
                    }
                }
            }
            if(p==0){
                break;
            }
        }
        printf("Data %d:\n",a+1);
        for(q=3;q<11;q++){
            for(r=3;r<11;r++){
                printf("%d",num[q][r]);
            }
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 600
q=int(input())

import math
import numpy as np
def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]



numbers=[0]*100000
prime=primes(100_000)

for j in prime:
    numbers[j-1]=1

deci=numbers.copy()

for p in prime:
    n_2 = (p+1)//2

    if deci[n_2-1]==1:
        continue
    else:
        numbers[p-1]=0

cum=np.cumsum(numbers)

for i in range(q):
    l,r=map(int,input().split())

    if l==1:
        ans=cum[r-1]
    else:
        ans=cum[r-1] - cum[l-2]

    print(ans)

Measured memory_bytes: 32920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n,m,s,g;
  cin >> n >> m >> s >> g;
  s--;g--;
  vector<map<ll,pll>> G(n);
  for(ll i=0;i<m;i++) {
    ll u,v,a,b;
    cin >> u >> v >> a >> b;
    u--,v--;
    G[u][v]=pll(a,b);
    G[v][u]=pll(a,b);
  }
  vec en(n,-1),sn(n,-1);
  priority_queue<pll,vector<pll>,greater<pll>> q;
  q.push(pll(0,s));
  while(q.size()) {
    ll f=q.top().second;
    ll d=q.top().first;
    q.pop();
    if(en[f]>-1) continue;
    en[f]=d;
    for(auto p:G[f]) {
      ll t=p.first;
      ll nd=d+p.second.first;
      q.push(pll(nd,t));
    }
  }
  q.push(pll(0,g));
  while(q.size()) {
    ll f=q.top().second;
    ll d=q.top().first;
    q.pop();
    if(sn[f]>-1) continue;
    sn[f]=d;
    for(auto p:G[f]) {
      ll t=p.first;
      ll nd=d+p.second.second;
      q.push(pll(nd,t));
    }
  }
  for(ll i=0;i<n;i++) {
    q.push(pll(en[i]+sn[i],i));
  }
  for(ll i=0;i<n;i++) {
    while(q.top().second<i) q.pop();
    ll ans=1e15;
    ans-=q.top().first;
    cout << ans << endl;
  }
}

Measured memory_bytes: 22256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vp;
typedef vector<vp> vvp;
const int inf=1<<30;

ll n,m,V,E,d[3];
vvp g;
vi a;
vp b;

bool dfs(int v){
	V++;
	bool A=0,B=0,flag=0;
	for(auto p:g[v]){
		int u=p.first,t=p.second;
		if(a[u]==inf){
			a[u]=(a[v]+t+1)%3;
			flag|=dfs(u);
		}
		else{
			if(t) b.push_back({u,v});
			else b.push_back({v,u});
		}
		if(t) A=1,E++;
		else B=1;
	}
	d[a[v]]++;
	if(A&&B) flag=1;
	return flag;
}

ll f(int x){
	a[x]=V=E=0;
	b.clear();
	fill(d,d+3,0);
	if(!dfs(x)) return E;
	bool B=0;
	for(auto p:b) if((a[p.first]-a[p.second]+4)%3>0) B=1;
	if(B) return V*V;
	return d[0]*d[1]+d[1]*d[2]+d[2]*d[0];
}

int main(){
	cin>>n>>m;
	a=vi(n,inf);
	g=vvp(n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back({v,0});
		g[v].push_back({u,1});
	}
	ll res=0;
	for(int i=0;i<n;i++) if(a[i]==inf) res+=f(i);
	cout<<res<<endl;
}

Measured memory_bytes: 17908
/******************************************
* AUTHOR : AMAN SAXENA *
* Nick : blue-meth *
* "There's some good in this world, and it's worth fighting for." *
* INSTITUTION : KIET Group of Institutions *
******************************************/
#include <bits/stdc++.h>
 
const long long MODULO=1000000007;
const long long N = 1e5 + 7;
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define FOR1(i,a,n) for(int i=a;i<=n;i++)
#define FOR2(i,a,n) for(int i=a;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pi 3.14159265359
 
using namespace std;
 
ll amanpower(ll a, ll b) {
    ll r = 1;
    while (b > 0) 
    {
        if (b & 1) r = r * a;
        a = a * a;
        b >>= 1;
    }
    return r;
}
 
ll amanlcm(ll a, ll b)
{
     return a*(b/__gcd(a,b));
}
//Prime Numbers
 
vector<bool>prime(N+1,true);
void sieve()
{
    ll i,j,k;
    prime[0]=prime[1]=false;
    for(i=2;i*i<=N;i++)
    {
        if(prime[i])
        {
            for(j=i*i;j<=N;j+=i)
            {
                prime[j]=false;
            }
        }
    }
}
 
//Exponentiation
 
ll power(ll a,ll b)
{
    ll r=1;
    while(b)
    {
        if(b%2==1)
            r=r*a;
        b/=2;
        a*=a;
    }
    return r;
}
ll power(ll a,ll b,ll m)
{
    a=a%m;
    ll r=1;
    while(b)
    {
        if(b%2==1)
            r=(r*a)%m;
        b/=2;
        a=(a*a)%m;
    }
    return r;
}
 
//Prime Factors
 
vector<ll> factors(ll n)
{
    vector<ll>r;
    ll i,j;
    for(i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            r.push_back(i);
            if(n/i!=i)
                r.push_back(n/i);
        }
    }
    return r;
}
 
 
//********* CODE START *********
 
 
void solve()
{
    double n, t, s;
    cin >> n >> t >> s;
    if(n/s <= t)
    {
        cout << "Yes";
    }
    else cout << "No";
}
 
void test()
{
    int t;
    cin>>t;
    while(t--) //for(int j=1;j<=t;j++) cout << "Case #" << j << ": ";
    {
        solve();
    }
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif
    
    // test();
    solve();
 
    
    return 0;
}


Measured memory_bytes: 3776
N, M = map(int, input().split())
X = list(map(int, input().split()))
x_sub = [0] * (M -1)

X = sorted(X, key = lambda x: x)

for i in range(len(X) - 1):
    x_sub[i] = X[i+1] - X[i]

x_sub = sorted(x_sub, key = lambda x: -x)


print(sum(x_sub[(N-1):]))

Measured memory_bytes: 13968
#include<stdio.h>

int main () {
	double r, pi, s, l;
	pi = 3.141592653589;
	
	scanf ( "%lf", &r );
	
	s = pi * r * r;
	l = 2 * pi * r;
	
	printf ( "%f %f\n", s, l);
	
	return 0;
}


Measured memory_bytes: 2056
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stack>

using namespace std;

int minimum=-1;


int main(){
	int n,row,num,col;
	scanf("%d",&n);
	int table[n][n];
	for(int i=0;i<n;i++){
		for(int k=0;k<n;k++){
			table[i][k] = 0;
		}
	}

	for(int i=0;i<n;i++){
		scanf("%d %d",&row,&num);
		for(int k=0;k<num;k++){
			scanf("%d",&col);
			table[row-1][col-1]=1;
		}
	}

	for(int i=0;i<n;i++){
		for(int k=0;k<n-1;k++){
			printf("%d ",table[i][k]);
		}
		printf("%d\n",table[i][n-1]);
	}

    return 0;
}

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

#define ll long long
#define pb push_back
#define eb emplace_back
//#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 1e6 + 69;
const int base = 311;


// dung inverse module de tinh nCk
// beginer 87
// mbeginer 161
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<pair<ll,ll>>adj[e];
//vector<ll>adj[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n ;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t*t);
    else return ((t * t) * n);
}*/

/*ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}*/

int main()
{
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;

    //s = ' ' + s;
    vector<ll>lf, rg;
    ll can = 1e18;
    for(int i=0; i<n; i++)
    {
        if(s[i] == 'o' && can >= c) lf.pb(i), can = 0;
        else can ++;
        if(lf.size() == k) break;
    }
    can = 1e18;
    for(int i=n-1; i>=0; i--)
    {
        if(s[i] == 'o' && can >= c) rg.pb(i), can = 0;
        else can ++;
        if(rg.size() == k) break;
    }
    reverse(rg.begin(), rg.end());
    for(int i=0; i<k; i++)
    {
        if(lf[i] == rg[i]) cout << lf[i] + 1 <<"\n";
    }
    //cout << ans;
}
/*

*/


Measured memory_bytes: 5108
#include<stdio.h>
int main()
{
    char c;
    scanf("%c",&c);
    switch(c)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u': printf("vowel");break;
        default :
            printf("consonant");
    }
    return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

#define N_MAX 100000
#define INF 1000000000

void solv()
{
	int N; scanf("%d", &N);
	int W[N_MAX];
	for (int i = 0; i < N; i++){
		scanf("%d", W + i);
	}

	int ret = INF;
	for (int i = 1; i < N; i++){
		ret = min(ret, abs(std::accumulate(W, W + i, 0) - accumulate(W + i, W + N, 0)));
	}

	printf("%d", ret);

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

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

using namespace std;
#define int long long 
#define inf 999999999999
#define N 666666
vector<int> v;
int arr1[N],arr2[N],arr3[N];
map<int,int> mp;
bool cmp(int a,int b){
	return a>b;
}
signed main(){
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	for(int i=1;i<=a;i++) scanf("%lld",&arr1[i]);
	for(int i=1;i<=b;i++) scanf("%lld",&arr2[i]);
	for(int i=1;i<=c;i++) scanf("%lld",&arr3[i]);
	sort(arr1+1,arr1+1+a,cmp);
	sort(arr2+1,arr2+1+b,cmp);
	sort(arr3+1,arr3+1+c,cmp);
	for(int i=1;i<=x;i++) v.push_back(arr1[i]);
	for(int i=1;i<=y;i++) v.push_back(arr2[i]);
	sort(v.begin(),v.end());
	int cnt=0;
	for(int i=1;i<=c;i++){
		if(arr3[i]>v[cnt]){
			v[cnt]=arr3[i];
			cnt++;
			if(cnt>=v.size()) break;
		}
	}
	int ans=0;
	for(int i=0;i<v.size();i++) ans+=v[i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 7284
fun main(args: Array<String>) {
  fun divRec(count: Int, numList: List<Int>): Int {
    return if (numList.all { it % 2 == 0 }) {
      divRec(count + 1, numList.map { it / 2 })
    } else {
      count
    }
  }

  readLine()!!
  val list = readLine()!!.split(" ").map { it.toInt() }
  println(divRec(0, list))
}

Measured memory_bytes: 38024
while True:
	m, f, r = map(int, input().split())
	if m == -1 and f == -1 and r == -1:
		break
	p = m + f
	if -1 in [m, f]:
		print('F')
	elif p >= 80:
		print('A')
	elif p < 80 and p >= 65:
		print('B')
	elif p >= 50 and p < 65:
		print('C')
	elif p >= 30 and p < 50:
		print('C' if r >= 50 else 'D')
	elif p < 30:
		print('F')


Measured memory_bytes: 5600
n,x = map(int,input().split())
a = list(map(int,input().split()))

res = float('inf')
for b in (a,a[::-1]):
    tmp = 0
    for i in range(n-1):
        if b[i]+b[i+1]>x:
            tmp += b[i] + b[i+1] - x
            if b[i]>x:
                b[i],b[i+1] = x,0
            else:
                b[i+1] = x - b[i]
    res = min(res,tmp)

print(res)


Measured memory_bytes: 14068
#include <bits/stdc++.h>
#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    long res = 0;
    for (int i = 0; i < 60; i++) {
        vector<int> cnt(2);
        for (int j = 0; j < n; j++) {
            cnt[(a[j] >> i) & 1]++;
        }
        const long MOD = 1000000007;
        long s = 1ll * cnt[0] * cnt[1];
        s %= MOD;
        for (int j = 0; j < i; j++) {
            s = s * 2;
            s %= MOD;
        }
        res += s;
        res %= MOD;
    }
    cout << res << "\n";

    return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

int main()
{
    int N;
    cin >> N;
    vector<vector<long long>> a(N, vector<long long>(N));
    REP(i, N){
        REP(j, N) cin >> a[i][j];
    }

    // count[i]: i の bit が立っているうさぎで一つのグループを作るときの点数
    vector<long long> count(1<<N);
    REP(i, 1<<N){
        REP(j, N){
            FOR(k, j+1, N){
                if(i & (1<<j) and i & (1<<k)) count[i] += a[j][k];
            }
        }
    }
    // dp[i]: i の bit が立っているうさぎのグループが決まっているとした場合の得点の最大値
    vector<long long> dp(1<<N);
    REP(i, 1<<N){
        for(int j = i; j > 0; j = (j-1)&i){
            dp[i] = max(dp[i], dp[i-j]+count[j]);
        }
        //cout << dp[i] << " " << count[i] << endl;
    }
    cout << dp[(1<<N)-1] << endl;

    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
using namespace std;
int mp[3][3],dx[] = {0,0,-1,1},dy[] = {1,-1,0,0};
int n;
char s,t,b;
int memo[16][3][3],visited[16][3][3];
void saiki(int x,int y,int bat){
  visited[bat][x][y] = 1;
  if(n == bat) {
    if((t-'A')%3==x&&(t-'A')/3==y)memo[bat][x][y]=1;
    return;
  }
  for(int i=0;i<4;i++){
    int nx = x+dx[i],ny = y+dy[i];
    if(((b-'A')%3==nx && (b-'A')/3==ny)||nx<0||ny <0||nx>=3||ny>=3) {
      if(visited[bat+1][x][y]==1) memo[bat][x][y] += memo[bat+1][x][y];
      else saiki(x,y,bat+1),memo[bat][x][y] += memo[bat+1][x][y];
    }
    else {
      if(visited[bat+1][nx][ny]==1) memo[bat][x][y] += memo[bat+1][nx][ny];
      else saiki(nx,ny,bat+1),memo[bat][x][y] += memo[bat+1][nx][ny];
    }
  }
}
int main() {
  while(1) {
    cin >> n;
    if(n==0) break;
    cin >> s >> t >> b;
    for(int i=0;i<=n;i++)
      for(int j=0;j<3;j++)
	for(int k=0;k<3;k++) memo[i][j][k] = visited[i][j][k]=0;
    saiki((s-'A')%3,(s-'A')/3,0);
    int ans = memo[0][(s-'A')%3][(s-'A')/3];
    printf("%.8f\n",1.0*ans/(1<<(2*n)));
  }
  return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<bitset>
#include<sstream>
#include<list>
#include<climits>

using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define nrep(i,i0,n) for(int i=(i0);i<(int)(n);++i)
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vii;
typedef long long ll;


int main(){
	int n;
	scanf("%d",&n);
	int a[2][101];
	rep(i,2)rep(j,n)cin>>a[i][j];
	int upSum[101]={},loSum[101]={};
	int ret=0;
	rep(i,n){
		if(i){
			upSum[i]=upSum[i-1]+a[0][i];
			loSum[n-1-i]=loSum[n-i]+a[1][n-1-i];
		}
		else{
			upSum[i]=a[0][i];
			loSum[n-1-i]=a[1][n-1-i];
		}
	}
	rep(i,n)ret=max(ret,upSum[i]+loSum[i]);
	cout<<ret<<endl;
	return 0;
}



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

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


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

Measured memory_bytes: 3628
n,a=map(int,input().split())
x=list(map(int,input().split()))
l=max(max(x)*n+3,a*n+3)
dp=[[l*[0]for _ in range(n+1)]for _ in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  for j in range(i+1):
    for k in range(l):dp[i][j][k]=dp[i-1][j][k]
  for j in range(1,i+1):
    for k in range(x[i-1],l):dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]]
ans=0
for j in range(1,n+1):
  ans+=dp[-1][j][j*a]
print(ans)


Measured memory_bytes: 92764
#include<stdio.h>

int main(void)
{
	int S, h, m, s;
	scanf("%d", &S);

	h = S / 3600;
	m = S % 3600 / 60;
	s = S % 60;
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
int main(){
  ll X,K,D;scanf("%lld%lld%lld",&X,&K,&D);
  X = abs(X);
  ll a = X-min(K-1,X/D)*D,b = a-D;
  if(b >= 0) printf("%lld\n",b);
  else{
    K -= X/D;
    printf("%lld\n",K&1 ? -b:a);
  }
}

Measured memory_bytes: 3820
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

ll N, M;
vector<LP> v;

void init()
{
}

void solve()
{
    sort(ALL(v));
    ll ans = 0;
    REP(i, N){
        int b = min(M, v[i].se);
        ans += v[i].fi * b;
        M -= b;
        if(M <= 0) break;
    }
    cout << ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    v.resize(N);
    REP(i, N) cin >> v[i].fi >> v[i].se;
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 1792
#!/usr/bin/python
# -*- coding: utf-8 -*-

import numpy as np

def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

N = int(input())

f = [0]*(N+1)

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            if x**2+y**2+z**2+x*y+y*z+z*x <= N:
                f[x**2+y**2+z**2+x*y+y*z+z*x] += 1

for i in range(1,N+1):
    print(f[i])

Measured memory_bytes: 27304
use proconio::input;
use proconio::marker::{Chars};
use std::iter::Iterator;
use std::collections::HashSet;

fn main() {
    input! {
    n: Chars,
    }

    if n[1] == 'B' {
        println!("ARC");
    }else{
        println!("ABC")
    }

}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
const ll MODA=998244353;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
vector<ll> find_divisor(ll N){
  ll k=1;
  while(k*k<=N){
    k++;
  }
  vector<ll> A(1);
  rep(i,k){
    if(i==1)A.at(0)=1;
    else if(i>=2){
      if(N%i==0)A.push_back(i);
    }
  }
  ll t=0;
  t=A.size();
  rep(i,t){
    if(A.at(t-i-1)*A.at(t-i-1)!=N)A.push_back(N/A.at(t-1-i));
  }
  return A;
}
vector<ll> fac;
vector<ll> finv;
vector<ll> inv;
void COMinit(ll N,ll P){
    rep(i,N+1){
        if(i==0){
            fac.push_back(1);
            finv.push_back(1);
            inv.push_back(1);
        }
        else if(i==1){
            fac.push_back(1);
            finv.push_back(1);
            inv.push_back(1);
        }
        else{
            fac.push_back(fac.at(i-1)*i%P);
            inv.push_back(P-inv.at(P%i)*(P/i)%P);
            finv.push_back(finv.at(i-1)*inv.at(i)%P);
        }
    }
}

ll COM(ll n,ll k,ll P){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac.at(n)*(finv.at(k)*finv.at(n-k)%P)%P;
}
int main()
{
    string S;
    cin>>S;
    if(S=="RRR")cout<<3<<endl;
    else if(S=="RRS")cout<<2<<endl;
    else if(S=="SRR")cout<<2<<endl;
    else if(S=="SSS")cout<<0<<endl;
    else cout<<1<<endl;
}

Measured memory_bytes: 3628
def actual(r, D, x_2000):
    x_list = []
    x_n = x_2000

    for _ in range(1, 10 + 1):
        x_next = r * x_n - D
        x_n = x_next

        x_list.append(x_next)

    return '\n'.join([str(x) for x in x_list])

r, D, x_2000 = map(int, input().split())
print(actual(r, D, x_2000))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define M 100005

int ara[M];

int main()
{
    int n;
    scanf("%d", &n);

    for(int i = 1; i <= n; i++) scanf("%d", ara+i);

    sort(ara+1, ara+n+1);

    bool ans;

    if(ara[1] == ara[n]) ans = (ara[1] == n-1 || 2*ara[1] <= n);
    else if(ara[1]+1 == ara[n])
    {
        int x = 0, y = 0;

        for(int i = 1; i <= n; i++)
        {
            if(ara[i] == ara[1]) x++;
            else y++;
        }

        int p = n-x;
        int q = ara[n]-x;

        if(q <= 0) ans = false;
        else ans = (2*q <= p);
    }
    else ans = false;

    printf("%s\n", ans? "Yes": "No");

    return 0;
}


Measured memory_bytes: 640
//! Framework <https://github.com/vain0x/procon>

#![allow(non_snake_case)]
#![allow(unused_imports)]

use std::collections::*;

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

fn main() {
    let mut scan = Scan::new();

    let X = scan.word::<i64>();

    let mut t = 100;
    let mut y = 0;

    while t < X {
        t += t / 100;
        y += 1;
    }

    println!("{}", y);
}


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

#define INF 1e9
using namespace std;
using ll = long long;

int main() {

    int n, a, b; cin >> n >> a >> b;

    ll ans = 0;

    for (int i = 1; i <= n; ++i) {
        string s = to_string(i);

        int sum = 0;
        for (int j = 0; j < s.size(); ++j) {
            sum += s[j] - '0';
        }

        if (a <= sum && sum <= b) {
            ans += i;
        }
    }

    cout << ans << endl;
}

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

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

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

    int cnt = 0;
    //3桁のパスワードを000~999まで当て決めする
    rep(i, 1000){
        int key[3] = {i / 100, (i / 10) % 10, i % 10};
        //当て決めした3桁のパスワードの左から何文字目を見るか指定する変数
        int v = 0;
        //3桁のパスワードを作れるような文字の並びが存在するかどうかを調べる
        rep(j, N){
            //パスワードの左からv番目のところと一致する値がSに含まれていれば、見る桁を変える(v++)
            if(S[j] == ('0' + key[v])) v++;
        }
        if(v == 3) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3680
D = int(input())
c_list = list(map(int, input().split()))
s_list = [list(map(int, input().split())) for _ in range(D)]

last_open = [0] * 26
res = 0

res_list = []
for i in range(D):
    t = int(input())
    res += s_list[i][t-1]

    bad = 0
    last_open[t-1] = i+1
    for ci in range(26):
        bad += c_list[ci]*(i+1 - last_open[ci])

    res -= bad
    print(res)
    res_list.append(res)


Measured memory_bytes: 69816
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
Int dp[2][2020];
signed main(){
  Int n,m,l;
  cin>>n>>m>>l;
  vector<Int> k(n),s(m);
  for(Int i=0;i<n;i++) cin>>k[i];
  for(Int i=0;i<m;i++) cin>>s[i];
  vector<Int> a(m+1,0);
  for(Int i=0;i<m;i++) a[i+1]=a[i]+s[i];
  memset(dp,-1,sizeof(dp));
  sort(k.begin(),k.end());
  auto calc=[&](Int x,Int y){
    if(k[x]>k[y]) swap(x,y);
    return (a[k[y]]-a[k[x]-1])/l;
  };
  Int inf=1LL<<55LL;
  for(Int j=0;j<2020;j++) dp[1][j]=inf;
  dp[1][0]=calc(1,0);
  for(Int i=2;i<n;i++){
    bool f=i&1;
    for(Int j=0;j<n;j++) dp[f][j]=inf;
    for(Int j=0;j<n;j++){
      dp[f][i-1]=min(dp[f][i-1],dp[!f][j]+calc(i,j));
      dp[f][j]=min(dp[f][j],dp[!f][j]+calc(i,i-1));
    }
  }
  Int ans=inf;
  for(Int i=0;i<n;i++)
    ans=min(ans,dp[(n-1)&1][i]+calc(n-1,i));
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4388
#include<iostream>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
int N,M;
P t[10000];

int main(){
  while(1){
    cin>>N>>M;
    if(N==0&&M==0)break;
    for(int i=0;i<N;i++)cin>>t[i].second>>t[i].first;
    sort(t,t+N);
    reverse(t,t+N);
    int ans=0;
    for(int i=0;i<N;i++){
      int d=min(M,t[i].second);
      M-=d;
      ans+=t[i].first*(t[i].second-d);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll h, n;std::cin >> h >> n;
  vvl d = vv(n, 2, 0, ll);
  re(i, n) std::cin >> d[i][0] >> d[i][1];
  vvl dp = vv(n+1, h+10001, 1000000000000000, ll);
  dp[0][0] = 0;
  for(int i=1;i<=n;i++){
    for(int j=0;j<h+10001;j++){
      dp[i][j] = min(dp[i][j], dp[i-1][j]);
      if(j<d[i-1][0]) continue;
      dp[i][j] = min({dp[i][j], dp[i-1][j-d[i-1][0]]+d[i-1][1], dp[i][j-d[i-1][0]]+d[i-1][1]});
    }
  }
  ll ans = 1000000000000000000;
  for(int i=h;i<h+10001;i++){
    ans = min(ans, dp[n][i]);
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 160640
package main

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

func main() {

	for {

		//var n [2]int
		n := ScanedLinetoIntSlice()
		///fmt.Scanln(&n[0], &n[1])

		if (n[0] == 0) && (n[1] == 0) {
			break
		}
		if n[0] > n[1] {
			n[0], n[1] = swap(n[0], n[1])
		}
		fmt.Println(n[0], n[1])
	}

}

func swap(a, b int) (int, int) {
	return b, a
}

func ScanedLinetoIntSlice() []int {

	line := readLine()

	words := strings.Fields(line)

	var numbers []int

	for _, v := range words {
		number, _ := strconv.Atoi(v)
		numbers = append(numbers, number)
	}

	return numbers
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}



Measured memory_bytes: 9996
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

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

    cout << (N + 1) / 2 << endl;

    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ls x<<1
#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=998244353;
const int maxn=2e5+100;

void solve(){
	ll n,k;cin>>n>>k;
	cout<<min(n%k,k-n%k)<<endl;
}
int main(){
    //IOS;
    //freopen("D://data.txt","r",stdin);
    solve();
    
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;                                             ;;
	;;         ;;            ;;;;;;;;;       ;;    ;;
	;;        ;; ;;        ;;                ;;    ;;
	;;       ;;   ;;       ;;                ;;    ;;
	;;      ;;;;;;;;;      ;;                ;;    ;;
	;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
typedef vector<int> vi;
typedef vector<pii> vpii;
 
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define so(v) sort(v.begin(),v.end())
#define re(s) reverse(s.begin(),s.end())
#define lb(v,a) lower_bound(v.begin(),v.end(),a)
#define ub(v,a) upper_bound(v.begin(),v.end(),a)
#define mp1(a,b,c) piii(a,pii(b,c))
 
const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const ll mod=1e9+7;

int n,k,l,m=INF,d[20]={0};

int dfs(int s){
  int m=INF;
  if(s>=n) return s;
  for(int i=0;i<10;i++) if(!d[i]) m=min(m,dfs(s*10+i));
  return m;
}
int main(){

  cin>>n>>k;
  l=10-k;
  rep(i,k){int a; cin>>a; d[a]=1;}
  int MIN=INF;
  for(int i=1;i<10;i++) if(!d[i]) MIN=min(MIN,dfs(i));
  cout<<MIN<<endl;
  return 0;
}


Measured memory_bytes: 256