akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;
  for (char c = 'a'; c <= 'z'; c++) {
    bool exist = false;
    for (int i = 0; i < s.size(); i++) {
      if (c == s[i]) {
        exist = true;
        break;
      }
    }
    if (!exist) {
      cout << c << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


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

int main() {
  int d, n;
  cin >> d >> n;
  int hundred = 1;
  for (int k = 0; k < d; k++) {
    hundred *= 100;
  }
  int ans = hundred * n;
  if (n == 100) cout << ans + hundred << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    if (s.size()==3) reverse(whole(s));
    
    pr(s);
    return 0;
}


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

int main(){
  long long N,a,sum;
  cin>>N;
  sum=0;
  for(int i=0;i<N;i++){
    cin>>a;
    sum^=a;
  }
  if(sum==0){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
  return 0;
}


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

#define pf first
#define ps second
#define eb emplace_back

using namespace std;

vector< pair<int, int> > moves;
int W[100000];

int main() {
	int n, m;
	cin >> n >> m;
	for(int i=0;i<n;i++) {
		cin >> W[i];
	}
	sort(W, W+n);
	for(int i=0;i<m;i++) {
		int b, c;
		cin >> b >> c;
		moves.eb(c, b);
	}
	sort(moves.begin(), moves.end(), greater< pair<int, int> >());
	int i = 0, j = 0;
	while(i<m && j<n && moves[i].pf > W[j]) {
		if(moves[i].ps == 0) {
			i++;
			continue;
		}
		moves[i].ps = moves[i].ps - 1;
		W[j] = moves[i].pf;
		j++;
	}
	long long sum = 0;
	for(i=0;i<n;i++) sum += W[i];
	cout << sum << "\n";
	return 0;
}


Measured memory_bytes: 1784
from collections import*
n,m,*t=map(int,open(0).read().split())
*w,s,t=[t-1for t in t]
e=[[]for _ in range(n)]
for u,v in zip(w[::2],w[1::2]):
  e[u].append(v)
INF=10**18
f=[[INF]*3for _ in range(n)]
f[s][0]=0
q=deque([(s,0)])
while q:
  v,m=q.popleft()
  if v==t and m==0:
    print(f[v][0]//3)
    break
  for w in e[v]:
    if f[w][-~m%3]<INF:continue
    f[w][-~m%3]=f[v][m]+1
    q.append((w,-~m%3))
else:
  print(-1)

Measured memory_bytes: 93044
n = gets.chomp.to_i
a = []
i = 0
while g = gets&.chomp&.split
  i += 1
  a << [g[0], g[1].to_i, i]
end
a = a.sort{|x, y|x[0] == y[0] ? x[1] <=> y[1] : y[0] <=> x[0] }.reverse
a.each {|aaa|p aaa[2]}


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
long long x,d,k;
int main(){
	cin>>x>>k>>d;
	x=abs(x);
	long long tmp=x/d;
	if(tmp>=k){
		cout<<x-d*k<<endl;
		return 0;
	}
	else{
		x-=d*tmp;
		k-=tmp;
		if(k%2){
			cout<<abs(x-d)<<endl;
		}
		else cout<<x<<endl;
	}
	return 0;
}

Measured memory_bytes: 3632
def examA():
    N = DI()/dec(7)
    ans = N
    print(N)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    N = I()
    P = LI()
    O_ = [-1]*N
    start = P[0]-1
    for i in range(N):
        O_[P[i]-1] = i
    #print(O_,start)
    A = [1]*N
    B = [1]*N
    for i in range(start+1,N):
        cur = O_[i]-O_[i-1]
        if cur>0:
            A[i] = A[i-1] + (cur+1)
            B[i] = B[i-1] - 1
        else:
            A[i] = A[i-1] + 1
            B[i] = B[i-1] - (-cur+1)
    for i in range(start)[::-1]:
        cur = O_[i]-O_[i+1]
        if cur>0:
            B[i] = B[i+1] + (cur+1)
            A[i] = A[i+1] - 1
        else:
            B[i] = B[i+1] + 1
            A[i] = A[i+1] - (-cur+1)
    if A[0]<1:
        add = (1-A[0])
        for i in range(N):
            A[i] += add
    if B[-1]<1:
        add = (1-B[-1])
        for i in range(N):
            B[i] += add

    print(" ".join(map(str,A)))
    print(" ".join(map(str,B)))
    return

def examE():
    return

def examF():
    ans = 0
    print(ans)
    return


from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
9
7 3 9 1 8 4 5 6 2
"""

Measured memory_bytes: 15120
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    if(M1 != M2){
        cout << "1" << endl;
    }else
    {
        cout << "0" << endl;
    }
}


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

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

    ll n1 = n % 10;

    if(n1 == 3)
    {
        cout << "bon";
    }
    else if(n1 == 0 || n1 == 1 || n1 == 6 || n1 == 8)
    {
        cout << "pon";
    }
    else
    {
        cout << "hon";
    }
    


    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <iostream>
#include <string>
#include <limits>
#include <vector>
#include <math.h>
using namespace std;

int main()
{
    int n;
    string s, u;
    cin >> n;
    cin.ignore(numeric_limits<streamsize>::max(), '\n');
    getline(cin, s);
    unsigned long  res = 1;
    int count, tmp;
    for (size_t i = 0; i < 26; i++)
    {
        count = 0;
        tmp = 0;
        while (true)
        {
            tmp = s.find('a' + i, tmp);
            if (tmp == -1)
                break;
            tmp++;
            count++;
        }
        res *= (count + 1);
        res = res % ((unsigned long)pow(10, 9) + 7);
    }

    res--; 
    cout << res << "\n";
}


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

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

  bool exist=false;
  for(int ly=0; ly<N; ly++){
   for(int lx=0; lx<N; lx++){
    if(ly+M-1>=N || lx+M-1>=N){continue;}
   bool match=true;
   for(int y=0; y<M; y++){
    for(int x=0; x<M; x++){
     if(A[ly+y][lx+x]!=B[y][x]){match=false;}
    }}
     if(match){exist=true;}
   }}
    
  if(exist){cout<<"Yes"<<endl;}  
  else{cout<<"No"<<endl;}
    
}



Measured memory_bytes: 256
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int[] a_b = Stream.of(sc.nextLine().split(" "))
                    .map(Integer::parseInt)
                    .mapToInt(Integer::intValue)
                    .toArray();
            if (a_b.length != 2) {
                System.out.println("Numbers of args not match.");
            }
            int a = a_b[0];
            int b = a_b[1];
            System.out.printf("%d %d\n", a * b, (a + b) * 2);
        } catch (NoSuchElementException | NumberFormatException e) {
            System.out.println(e);
        }
    }
}



Measured memory_bytes: 32220
# -*- coding: utf-8 -*-


def main():
    n, k = map(int, input().split())
    s = list(input())

    nums = list()
    now = 1
    count = 0

    for si in s:
        if si == str(now):
            count += 1
        else:
            nums.append(count)
            now = 1 - now
            count = 1

    if count != 0:
        nums.append(count)

    if len(nums) % 2 == 0:
        nums.append(0)

    add = 2 * k + 1

    left = 0
    right = 0
    tmp = 0
    ans = 0

    for i in range(0, len(nums), 2):
        next_left = i
        next_right = min(i + add, len(nums))

        while next_left > left:
            tmp -= nums[left]
            left += 1

        while next_right > right:
            tmp += nums[right]
            right += 1

        ans = max(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4776
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

typedef struct weightEdge{
  double w;
  int a,b;
} node;

int cmp(const void *a,const void *b){
  double p=((node *)a)->w;
  double q=((node *)b)->w;
  return p==q?0:p<q?-1:1;
}

int root(int *u,int x){
  if(u[x]==x) return x;
  return u[x]=root(u,u[x]);
}

int same(int *u,int x,int y){
  return root(u,x)==root(u,y);
}

void unite(int *u,int x,int y){
  x=root(u,x);
  y=root(u,y);
  if(x==y) return;
  u[y]=x;
}

void run(void){
  int n;
  scanf("%d",&n);
  int x[15],y[15],a[15];
  int i,j,k;
  for(i=0;i<n;i++) scanf("%d%d%d",x+i,y+i,a+i);
  double d[15*15];
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      int dx=x[i]-x[j];
      int dy=y[i]-y[j];
      d[i*n+j]=sqrt((double)dx*dx+(double)dy*dy);
    }
  }
  double *dp=(double *)calloc(1<<n,sizeof(double));
  for(i=1;i<(1<<n);i++){
    double sum=0;
    int c[15];
    int len=0;
    for(j=0;j<n;j++){
      if((i>>j)&1){
	c[len++]=j;
	sum+=a[j];
      }
    }
    node t[15*15];
    int lent=0;
    for(j=0;j<len;j++) for(k=j+1;k<len;k++) t[lent++]=(node){d[c[j]*n+c[k]],c[j],c[k]};
    qsort(t,lent,sizeof(node),cmp);
    int u[15];
    for(j=0;j<len;j++) u[c[j]]=c[j];
    double weight=0;
    int cnt=0;
    for(j=0;cnt<len-1;j++){
      if(same(u,t[j].a,t[j].b)) continue;
      unite(u,t[j].a,t[j].b);
      weight+=t[j].w;
      cnt++;
    }
    double local=MAX(0,(sum-weight)/len);
    for(j=(i-1)&i;j>0;j=(j-1)&i){
      local=MAX(local,MIN(dp[j],dp[i^j]));
    }
    dp[i]=local;
  }
  printf("%.9lf\n",dp[(1<<n)-1]);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 508
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC088B solver = new ABC088B();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC088B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.next());
            }
            Arrays.sort(a, Comparator.reverseOrder());
            int alice = 0;
            int bob = 0;
            for (int i = 0; i < n; i++) {
                if (i % 2 == 0) {
                    alice += a[i];
                } else {
                    bob += a[i];
                }
            }
            int ans = alice - bob;

            // 出力
            out.println(ans);
        }

    }
}



Measured memory_bytes: 23124
#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 n, k;
    cin >> n >> k;
    cout << min(n % k,  abs(n % k - k)) << endl;
    return 0;
}

Measured memory_bytes: 256
k, n = map(int, input().split())
position_list = list(map(int, input().split())) 

def get_dis(distance_list):
    longest = 0
    sum = 0
    for num in distance_list:
        sum += num
        if num > longest:
            longest = num
    return (sum-longest)

def cover(k, n, position_list):
    distance_list = []
    for i in range(len(position_list)-1):
        distance = position_list[i+1] - position_list[i]
        distance_list.append(distance)
    # 最初と最後の距離
    distance_list.append(position_list[0]+k-position_list[-1])
    ans = get_dis(distance_list)
    return ans

print(cover(k, n, position_list))

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

using namespace std;

int main(int argc, char *argv[]) {
    int N;
    cin >> N;
    vector<int> aarr(N);
    vector<int> barr(N);
    vector<int> carr(N - 1);
    for (int i = 0; i < N; i++) {
        cin >> aarr[i];
    }
    for (int j = 0; j < N; j++) {
        cin >> barr[j];
    }
    for (int k = 0; k < N - 1; k++) {
        cin >> carr[k];
    }

    int ans = 0;
    int prev = -1;
    for (int l = 0; l < N; l++) {
        ans += barr[aarr[l] - 1];
        if (prev == aarr[l] - 1) {
            ans += carr[prev - 1];
        }
        prev = aarr[l];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <bitset>
#include <stack>
#include <deque>
using namespace std;
typedef pair<int, int> pii;
typedef long long LL;
LL N = 123;

bool cal(LL cur) {
     string s1 = to_string(cur), s2 = to_string(N);
     if (cur <= N) {
        if (s1 <= s2) return true;
        else return false;
     } else {
        if (s1 > s2) return true;
        else return false;
     }
}

bool check(LL cur) {
     printf("? %lld\n", cur);
     fflush(stdout);
     char c;
     scanf(" %c", &c);
     if (c == 'Y') {
        //printf("Y %lld\n", cur);
        return true;
     } else {
        //printf("N %lld\n", cur);
        return false;
     }
}

int main() {
    //scanf("%lld", &N);
    LL cur = 10, dig = 1;
    bool OK = true;
    for (int i = 2; i <= 10; i++) {
        if (!check(cur)) {
           //printf("cur = %lld\n", cur);
           dig = i - 1;
           OK = false;
           break;
        }
        cur *= 10;
    }
    if (OK) {
       LL tmp = 9, ans = 1;
       for (int i = 1; i <= 10; i++) {
           if (check(tmp)) {
              printf("! %lld\n", ans);
              fflush(stdout);
              return 0;
           }
           ans *= 10;
           tmp = tmp * 10 + 9;
       }
    } else {
       //printf("ans dig = %lld\n", dig);
       LL l = (LL)pow(10, dig), r = (LL)pow(10, dig + 1);
       while (l < r) {
             LL mid = (l + r) / 2;
             if (check(mid)) r = mid;
             else l = mid + 1;
       }
       printf("! %lld\n", l / 10);
       fflush(stdout);
    }
    return 0;
}


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

a = [[0 for j in range(m)] for i in range(n)]
for i in range(n):
    s = list(map(int, input().split()))
    for j in range(m):
        a[i][j] = s[j]

b = [0 for i in range(m)]
for i in range(m):
    b[i] = int(input())

c = [0 for i in range(n)]
for i in range(n):
    for j in range(m):
        c[i] += a[i][j] * b[j]

for i in range(len(c)):
    print(c[i])


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  vl a(n);
  REP(i,n) cin >> a[i];
  ll sum = 0;
  REP(i,n) sum += a[i];

  ll tmp = 0;
  ll termI = -1;
  REP(i,n){
    tmp += a[i];
    if(tmp>=sum/2){
      termI = i;
      break;
    }
  }
  ll cand1 = 2*tmp - sum;
  tmp -= a[termI];
  ll cand2 = sum - 2*tmp;
  ll ans = min(cand1,cand2);
  
  //cout << fixed << setprecision(10);
  cout << ans << endl;
  return 0;
}


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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1e9+7;
const int INF = 1<<18;
const lint INFLINT = 1LL<<60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

int main() {
    lint a, b, c, oa, ob, oc;
    cin >> a >> b >> c;
    
    lint ans = 0;
    while(a%2==0 && b%2==0 && c%2==0) {
        oa = a;
        ob = b;
        oc = c;
        a = (ob + oc) / 2;
        b = (oa + oc) / 2;
        c = (oa + ob) / 2;
        ans++;
        if(ans >= 100) {
            ans = -1;
            break;
        }
    }
    
    cout << ans;
    
    return 0;
}


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

typedef long long LL;

void solve(long long N, std::vector<long long> p) {
  LL maxim = 0;
  LL sum = 0;
  for (auto t : p) {
    sum += t;
    maxim = max(maxim, t);
  }
  cout << sum - maxim / 2 << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, p; cin >> n >> p;
	string s; cin >> s;
	long long ans = 0;
	if (p == 2 or p == 5) {
		for (int i = 0; i < n; i++) 
			if ((s[i] - '0') % p == 0) ans += i + 1;
	} else {
		map<int, int> mp;
		mp[0] = 1;
		int sum = 0, power = 1;
		for (int i = n - 1; i >= 0; i--) {
			sum = (sum + (s[i] - '0') * power) % p;
			ans += mp[sum % p]++;
			power = power * 10 % p;
		}
	}
	cout << ans;	
}

Measured memory_bytes: 900
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
vector<vector<ll>> matmul(vector<vector<ll>> a,vector<vector<ll>> b){
    ll n=a.size();
    vector<vector<ll>> ret;
    vector<ll> e;
    rep(i,0,n)e.push_back(0);
    rep(i,0,n)ret.push_back(e);
    rep(i,0,n){
        rep(j,0,n){
            ll sum=0;
            rep(k,0,n){
                sum+=(a[i][k]*b[k][j])%mod;
                sum%=mod;
            }
            ret[i][j]=sum;
        }
    }
    return ret;
}
vector<vector<ll>> matbeki(vector<vector<ll>> a,ll n){
    vector<vector<ll>> ret;
    ll m=a.size();
    vector<ll> e;
    rep(i,0,m)e.push_back(0);
    rep(i,0,m)ret.push_back(e);
    rep(i,0,m){
        rep(j,0,m){
            if(i==j)ret[i][j]=1;
            else ret[i][j]=0;
        }
    }
    
    while(n>0){
        if(n%2){
            ret=matmul(ret,a);
            
        }
        a=matmul(a,a);
        n/=2;
    }
    return ret;
}
int main(){
    ll n,k;cin>>n>>k;
    ll a[n][n];
    vector<vector<ll>> v;
    rep(i,0,n){
        rep(j,0,n)cin>>a[i][j];
    }
    rep(i,0,n){
        vector<ll> w;
        rep(j,0,n)w.push_back(a[j][i]);
        v.push_back(w);
    }
    vector<vector<ll>> ans=matbeki(v,k);
    ll anss=0;
    rep(i,0,n){
        rep(j,0,n){
            anss+=ans[i][j];
            anss%=mod;
        }
    }
    cout<<anss<<endl;
}


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

int main()
{
    int n;
    while(cin >> n)
    {
        int min = 1000;
        int max = 0;
        int t = -1;
        for(int i = 0; i < n; ++i)
        {
            cin >> t;
            if(t > max)
            {
                max = t;
            }
            if(t < min)
            {
                min = t;
            }
        }
        int ans = max - min;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
def print_dp(dp):
    i_len = len(dp)
    j_len = len(dp[0])
    tmp_dp = [[0]*i_len for _ in range(j_len)]
    for i in range(i_len):
        for j in range(j_len):
            tmp_dp[j][i] = dp[i][j]
    for i in range(j_len):
        print(tmp_dp[i])

import copy
n = int(input())
grid = [[float('inf')]*n for _ in range(n)]
for i in range(n):
    lis = list(map(int, input().split()))
    for j in range(n):
        if i == j:
            grid[i][j] = 0
        else:
            grid[i][j] = lis[j]
grid_m = copy.deepcopy(grid)

for k in range(n):
    for i in range(n):
        for j in range(n):
            grid[i][j] = min(grid[i][j],grid[i][k]+grid[k][j])

ok = True
for i in range(n):
    for j in range(n):
        if not grid[i][j] == grid_m[i][j]:
            ok = False
if not ok:
    print(-1)
else:
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if i == k or j == k:
                    continue
                if grid[i][j] == grid[i][k] + grid[k][j] and grid[i][k] != 0 and grid[k][j] != 0:
                    grid[i][j] = 0
    res = 0
    for i in range(n):
        res += sum(grid[i])
    print(res//2)

Measured memory_bytes: 79208
#include<bits/stdc++.h>
#define ll long long
#define db double
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define A first
#define B second
#define lowbit(p) (p&(-p))
using namespace std;
void read(int &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void read(ll &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void Min(int &x,int y){
	if (x>y)x=y;
}
void Min(ll &x,ll y){
	if (x>y)x=y;
}
void Max(int &x,int y){
	if (x<y)x=y;
}
void Max(ll &x,ll y){
	if (x<y)x=y;
}
bool stttt;
#define  mo 1000000007

#define M 200005
ll dp[M],sum[M];
int n,c[M];
void Add(ll &x,ll y){
	x=(x+y)%mo;
}
bool edddd;
int main(){
//	freopen("1.in","r",stdin);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//	printf("%.2f\n",(&stttt-&edddd)/1024.0/1024.0);
	read(n);
	
	int i;
	ll res=0;
	int last=0,k,tot=0;
	for (i=1;i<=n;i++){
		read(k);
		if (k==last)continue;
		else{
			last=k;
			c[++tot]=k;			
		}
	}
	n=tot;
	dp[0]=1;
	for (i=1;i<=n;i++){
		Add(sum[c[i]],dp[i-1]);
		dp[i]=sum[c[i]];
	}
	res=dp[n];
	res=(res%mo+mo)%mo;
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 4096
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{
 
    class Program
    {
        static void Main(string[] args)
        {
            int x = 1;
            bool z = true;
            string answer = "a";
            while (z)
            {
                answer = Console.ReadLine();
                if (!(answer == "0"))
                {
                    Console.WriteLine("Case " +x.ToString() + ": " + answer);
                    x++;
                }else
                {
                    z = false;
                }
            }

        }
    }
}

Measured memory_bytes: 9124
import sys
n = int(input())
# r = [int(i.strip()) for i in sys.stdin.readlines()]

d = -1e10
a = int(input())
for i in range(n-1):
    b = sys.stdin.readline()
    b = int(b)
    d = max(b - a, d)
    if b < a:a = b

print(d)


Measured memory_bytes: 5632
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int X = sc.nextInt();
		if (X <= 500*K) {
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}
}

Measured memory_bytes: 23888
use proconio::input;

fn main() {
    input! {
        n: usize,
        v: [(i64,i64); n]
    }

    let vec = {
        let mut vec = Vec::new();
        for &(x,l) in &v {
            vec.push((x-l,x+l));
        }
        vec.sort_by(|(_,x),(_,y)| x.cmp(y));
        vec
    };

    let ans = {
        let mut ans = 1;
        let mut now = vec[0].1;
        for i in 1..n {
            let (l,r) = vec[i];
            if now <= l {
                now = r;
                ans += 1;
            }
        }
        ans
    };

    println!("{}",ans)
}


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

int main() {
    int A,B,i;
    string S;
    cin >> A >> B >> S;
    
    for(i=0; i<S.size(); i++)
        if(i==A && S.at(i)!='-')
            break;
        else if(i!=A && S.at(i)=='-')
            break;

    cout << ((i==S.size()) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
const int M=1e5+10,MOD=1e9+7;
int n,m,x,a[M],f[M];
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;i++)
        cin>>x,a[x]=1;
    f[0]=1;
    f[1]=a[1]?0:1;
    for(int i=2;i<=n;i++)
        if(!a[i])
            f[i]=((ll)f[i-1]+f[i-2])%MOD;
    printf("%d\n",f[n]);
    return 0;
}


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

int main()
{
  int p[4];
  int res=0;
  rep(i,3) cin >> p[i];

  sort(p, p+3);
  res = p[0]+p[1];

  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm> 
#include <queue>
#include <functional>
#include <map>
#include <string>
using namespace std;

typedef long long ll;



int main(void){

    int n, m;
    ll d[200005], t[200005];
    
    cin>>n;

    for (int i = 0; i < n; i++){
        cin >> d[i];
    }
    
    cin>>m;

    for (int i = 0; i < m; i++){
        cin >> t[i];
    }

    sort(d, d + n);
    sort(t, t + m);

    bool flag = true;
    int id = 0;
    for (int i = 0; i < m; i++){
        for (int j = id; j < n; j++){
            if (t[i] < d[j]){
                
                flag = false;
            }
            if (d[j] == t[i]){
            
                id = j+1;
                break;
            }
        }
        if (id == n+1){
            flag = false;
        }
        if (!flag) break;
    }
    
    if (flag){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
  
 
   
}

Measured memory_bytes: 3328
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 1e9
using namespace std;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}

typedef long long ll;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

#pragma endregion

int main() {
  int r = in();

  cout << 2 * M_PI * r << endl;
  return 0;
}


Measured memory_bytes: 3800
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=100010;

ll power(ll x,ll n)
{
    if(n==0){return 1;}
    if(n==1){return x%M;}
    if(n%2==0){
        return power((x*x)%M,n/2);
    }
    else{
        return (x*power((x*x)%M,n/2))%M;
    }
}
ll dp[2100];
ll func(ll s)
{
    if(s==0||s==3){return 1;}
    if(s<3){
        return 0;
    }
    if(dp[s]==-1){
    ll ans=0;
    for(ll i=3;i<=s;++i){
        if(s-i>=0){
            ans=(ans+func(s-i))%M;
        }
    }
    dp[s]=ans;
    }
    return dp[s];
}

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

    ll s;
    cin>>s;
    if(s<3){
        cout<<"0";
        return 0;
    }
    memset(dp,-1,sizeof(dp));
    ll ans=func(s);
    cout<<ans;

    return (0);
}


Measured memory_bytes: 3644
N=int(input())
S=input()
mod=10**9+7
d=[0 for i in range(2*N)]
#L=0
#R=1
for i in range(1,2*N):
    if S[i-1]==S[i]:
        d[i]=1-d[i-1]
    else:
        d[i]=d[i-1]
if sum(d)!=N or S[0]=="W" or S[-1]=="W":
    print(0)
    exit()
Li=0
Ri=0
ans=1
for i in range(2*N):
    if d[i]==1:
        ans*=Li-Ri
        ans%=mod
    if d[i]==0:
        Li+=1
    else:
        Ri+=1
for i in range(1,N+1):
    ans=ans*i
    ans%=mod
print(ans)


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

int N,i,out_point;
int x,H[1100],X,A;        

int main() {
    cin >> N ;
    cin >> X ;
    for (int i = 0; i < N; ++i) cin >> H[i];
 
    int min = H[i],sum = 0;
    
        for (int i = 0; i < N; ++i) {           
         //cout << x << endl;
         if (H[i] <= min) {
           min = H[i]; 
           out_point = H[i];
           }

           sum = sum + H[i];
        }

        X = X - sum;
        X = X / min;
        // for (int i = 0; i < N; ++i) {           
        //  //cout << x << endl;
        //  if (H[i] <= min) {
        //    min = H[i]; 
        //    out_point = H[i];
        //    }

        

    // cout << max << endl;
  // cout << min << endl;
   // max = max - min;
    cout << N + X  << endl;
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 1e9 + 1
#define INF_LL 1LL<<60
#define ll long long
#define ALL(x)          (x).begin(),(x).end()

#define MAX_V 105

#define MAX_N 100
#define MAX_M 100

int main(){
    ll q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    q *= 4, h *= 2;

    vector<int> a(3);
    a[0] = q, a[1] = h, a[2] = s;
    sort(ALL(a));

    if(a[0] * 2 > d) {
        int tmp = n / 2;
        int tmp2 = n % 2;
        cout << d * tmp + tmp2 * a[0] << endl;
    } else {
        cout << a[0] * n << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a,b,c;
  vector<int> dp(3);
  cin >> a >> b >> c;
  dp[0] = a;
  dp[1] = b;
  dp[2] = c;
  for(int i = 1; i<n;i++){
    cin >> a >> b >> c;
    a+= max(dp[1], dp[2]);
    b+= max(dp[0], dp[2]);
    c+= max(dp[0], dp[1]);
    dp[0] = a; dp[1] = b; dp[2] = c; 
  }
  cout <<max({dp[0],dp[1],dp[2]})<<'\n';
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  string s;
  cin >> s;
  int n = s.size() + 1;
  vector<long> data(n,-10);
  rep(i,n-1){
    if(i == 0){
      if(s.at(i) == '<'){
        data.at(i) = 0;
      }
      continue;
    }
    if(s.at(i) == '<' && s.at(i-1) == '<'){
      data.at(i) = data.at(i-1)+1;
      continue;
    }
    if(s.at(i) == '<' && s.at(i-1) == '>'){
      data.at(i) = 0;
      continue;
    }
  }
  if(s.at(n-2) == '<') data.at(n-1) = data.at(n-2) + 1;
  for(int i=n-2;i>=0;i--){
    if(i == n-2){
      if(s.at(i) == '>'){
        data.at(i+1) = 0;
      }
      continue;
    }
    if(s.at(i) == '>' && s.at(i+1) == '>'){
      data.at(i+1) = data.at(i+2)+1;
      continue;
    }
    if(s.at(i) == '<' && s.at(i+1) == '>'){
      data.at(i+1) = max(data.at(i),data.at(i+2)) + 1;
      continue;
    }
  }
  if(s.at(0) == '>') data.at(0) = data.at(1) + 1;
  long ans = 0;
  rep(i,n) ans += data.at(i);
  /*rep(i,n-1){
    cout << data.at(i) << s.at(i);
  }
  cout << data.at(n-1) << endl;*/
  cout << ans << endl;
}

Measured memory_bytes: 4740
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main() 
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    ll n;
    cin>>n;
    ll a[n];
    ll b[n];
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
    }
    ll pref[n];
    ll suff[n];
    pref[0]=a[0];
    suff[n-1]=a[n-1];
    for (int i = 1; i < n; ++i)
    {
        pref[i]=pref[i-1]^a[i];
    }

    for (int i = n-2; i>=0; i--)
    {
        suff[i]=suff[i+1]^a[i];
    }

    b[0]=suff[1];
    for (int i = 1; i < n-1; ++i)
    {
        b[i]=pref[i-1]^suff[i+1];
    }
    b[n-1]=pref[n-2];
    for (int i = 0; i < n; ++i)
    {
        cout<<b[i]<<" ";
    }

    return 0;
}

Measured memory_bytes: 9836
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;


int32_t main(){
	IOS
	int n,m;cin>>n>>m;
	vector<int>degree(n+1);
	for(int i=1;i<=m;i++){
		int u,v;cin>>u>>v;
		degree[u]++;
		degree[v]++;
	}
	for(int i=1;i<=n;i++){
		cout << degree[i] << endl;
	}
		
}
/*
 * long long or int?
 * index out of bound? 
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


Measured memory_bytes: 3580
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
#############################################

N,M=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
all=sum(A)
for a in A:
    if a*4*M>=all:
        cnt+=1
Yn(cnt>=M)









Measured memory_bytes: 8004
#include<bits/stdc++.h>
#define rint register int
#define rep(i,u,z) for(rint i=u;i<=z;++i)
#define reb(i,u,z) for(rint i=u;i>=z;--i)
#define inf 0x7fffffff

using namespace std;
typedef long long ll;

const int N=60;
int n;
ll f[N],x,f2[N];

inline ll dpdfs(int lv,ll len){
	if(len<=lv)return 0;
	if(lv==1){
		if(len==5)return 3;
		return (ll)(len-1);
	}
	if(len>=f[lv]-(ll)lv&&len<=f[lv])return f2[lv];
	if(len>f[lv-1]+1)return f2[lv-1]+1ll+dpdfs(lv-1,len-f[lv-1]-2);
	return dpdfs(lv-1,len-1);
}
int main(){
	scanf("%d%lld",&n,&x);
	f[1]=5,f2[1]=3;
	rep(i,2,n){
		f[i]=2ll*f[i-1]+3ll;
		f2[i]=(f2[i-1]<<1ll)+1ll;
	}
	printf("%lld",dpdfs(n,x));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define here(x) cout << " #x = " << x << endl;
#define show(x) {for( auto ii : x) cout << ii << setw(4); cout << endl;}
#define shop(n,x) {for(int i = 0; i < n; i++) cout << x << setw(4); cout << endl;}
#define ff first
#define ss second
#define endl '\n'
#define en " "
#define pb push_back
#define mpair make_pair
ll mod = 1000000007;
ll inf = LLONG_MAX;
long double pi = 3.1415926536;
int main()
{
	fastio();
	ll r;
	cin>>r;
	long double a;
	a=2*3.141592653589793*r;
	cout<<a;
	return(0);
}
	    
	
	    
	    

Measured memory_bytes: 3800
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String input = br.readLine();
		String s = input + input.substring(0, input.length()-1);
		String p = br.readLine();
		if (s.indexOf(p) > -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 24412
import java.util.Scanner;

public class Main {

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

        char[] s = sc.next().toCharArray();

        int count = 0;
        for (char c : s) {
            if (c == 'o') {
                count++;
            }
        }

        count += 15 - s.length;

        if (count >= 8) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23892
from sys import stdin
input = stdin.readline

to_middle = set()           #  島1から渡ることのできる島
from_middle = set()         #  島Nへ渡ることのできる島
N, M = map(int, (input().split()))
for _ in range(M):
    f, t = map(int, (input().split()))
    if f == 1:
        to_middle.add(t)
    elif t == N:
        from_middle.add(f)

if to_middle & from_middle:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 18936
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str1 = br.readLine();
		String str2 = br.readLine();
		
		int sumOfIndex = 0;
		while(true){
			int index = str1.indexOf(str2);
			
			if(index == -1){
				break;
			}
			
			sumOfIndex += index;
			System.out.println(sumOfIndex);
			str1 = str1.substring(index + 1, str1.length());
			sumOfIndex++;
			if(str1.length() == 0){
				break;
			}
			//System.out.println(str1);
		}
	}

}

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

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }
const int INF = 1<<29;

void print(vector<vector<int> > &ans) {
  REP(h,ans.size()) {
    REP(w, ans[h].size()) {
      if(w > 0) cout << " ";
      cout << ans[h][w];
    }
    cout << endl;
  }
}

bool haves(string &s) {
  REP(i, s.length()) 
    if(s[i] == '#') return true;
  return false;
}
int main() {
  int H, W, K; cin>>H>>W>>K;
  vector<string> s(H);
  REP(h,H) cin>>s[h];
  vector< vector<int> > ans(H, vector<int>(W, INF));
  int starth = 0;
  REP(h,H) {
    bool tmp = haves(s[h]);
    if(tmp == true) {
      starth = h; break;
    }
  }
  int sno = 0;
  for(int h = starth; h < H; h++) {
    if(haves(s[h])) {
      bool tmp = false;
      REP(w,W) {
	if(s[h][w] == '#') {
	  sno++;
	  if(tmp == false) {
	    //	    cout << "Back"<<h<<w<<endl;
	    REP(ww, w) ans[h][ww] = sno;
	  }
	  tmp = true;
	}
	ans[h][w] = (tmp ? sno : INF);
      }
    } else {
      REP(w,W) ans[h][w] = ans[h-1][w];
    }
  }
  REP(h, starth) REP(w,W) ans[h][w] = ans[starth][w];
  print(ans);
  REP(h,H) {

  }
  return 0;
}


Measured memory_bytes: 1280
#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "functional"
#include "cmath"

using namespace std;
int main() {
    // get values from input
    int N;
    cin >> N;

    // main procedure
    int ans;

    if (N % 2 == 0) {
        ans = N / 2 - 1;
    } else {
        ans = (N - 1) / 2;
    }

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

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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, k;
	cin >> n >> k;
	vector <int> a(n);
	for (int i=0; i<n; i++) {
		cin >> a[i];
	}
	sort (a.begin(), a.end());
	ll ans = 0;
	for (int i=0; i<n-k; i++) {
		ans += a[i];
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 1024
a,b = map(int,input().split())
aaa = [list(map(int,input().split())) for i in range(b*2)]

c = set()
e = set()
for i in range(1,len(aaa),2):
  for k in aaa[i]:
     c.add(k)
    
print(a - len(c))

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

int main() {
    int n, c;
    cin >> n >> c;
    int sum = 0;
    rep(i, c) {
        int p;
        cin >> p;
        sum += p;
    }
    cout << (sum+n)/(n+1) << endl;

    return 0;
}


Measured memory_bytes: 3100