akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int n;
  cin >> n;

  cout << ((n + 1) * n) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;

ll gcd(ll x,ll y){
    return y ? gcd(y,x%y) : x;
}

ll lcm(ll x,ll y){
    return x/gcd(x,y)*y;
}

int main(){
    int n;
    cin>>n;
    ll ans=1;
    for(int i=0;i<n;i++){
        ll t;
        cin>>t;
        ans=lcm(ans,t);
    }
    cout<<ans<<endl;
}

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

int main() {
        int n, x;
        cin >> n;
        for (x = 1; x < 10001; x++) {
                if (x > n) break;
                if (x % 3 == 0) cout << " " << x;
                else if ( x % 10 == 3 ) cout << " " << x;
                else if ( ( x / 10 ) % 10 == 3) cout << " " << x;
                else if ( ( x / 100 ) % 10 == 3) cout << " " << x;
                else if ( ( x / 1000 ) % 10 == 3) cout << " " << x;
        }
        cout << endl;
}

Measured memory_bytes: 3096
'use strict';

function main(input) {
  const arr = input.trim().split('\n');
  const a = Number(arr[0]);
  let b = 0;
  let isKuku = false;

  for (let i = 1; i <= 9; i++) {
    if (a % i === 0) {
      b = a / i;
      if (b >= 1 && b <= 9) {
        isKuku = true;
      }
    }
  }

  console.log(isKuku ? 'Yes' : 'No');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
char s[9];
int vis[30];
bool check(){
	for(int i=1;i<=4;i++)vis[s[i]-'A']++;
	for(int i=1;i<=4;i++)if(vis[s[i]-'A']!=2)return false;
	return true;
}
int main(){
	scanf("%s",s+1);
	if(check())printf("Yes");
	else printf("No");	
}

Measured memory_bytes: 256
def main():
    N, T = map(int, input().split())
    ans = 1001
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= T:
            ans = min(c, ans)
    if ans == 1001:
        print("TLE")
    else:
        print(ans)


if __name__ == "__main__":
    main()


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

int main(void){
    int len, count = 0;
    char s[101];
    
    cin >> s;
    
    len = strlen(s);
    for(int i = 0; i < len/2; i++){
        if(s[i] != s[len - i - 1]) count++;
    }
    
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 256
def main():
    Q = 998244353
    N, K = map( int, input().split())
    LR = [ tuple( map( int, input().split())) for _ in range(K)]
    LR.sort()
    dp = [0]*(N+1)
    dp[1] = 1
    S = [0]*K
    for i in range(2,N+1):
        for j, (l, r) in enumerate(LR):
            if l <= i:
                S[j] += dp[i-l]
            if r < i:
                S[j] -= dp[i-r-1]
            S[j] %= Q
        dp[i] += sum(S)
        dp[i] %= Q
    # print(dp)
    print(dp[N])
        
if __name__ == '__main__':
    main()


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

using namespace std;

int main()
{
	int n,ma,mb;
	int a[40];
	int b[40];
	int c[40];
	int dp[41][401][401];
	int amax=0;
	int bmax=0;
	int ans = 10000;
	bool flag = false;
	for(int i=0;i<41;i++)
	{
		for(int j=0;j<401;j++)
		{
			for(int k=0;k<401;k++)
			{
				dp[i][j][k]=10000;
			}
		}
	}
	cin>>n>>ma>>mb;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	
	//ここからDP
	//何も使わない調合
	for(int i=0;i<n+1;i++)
	{
		dp[i][0][0]=0;
	}
	for(int i=1;i<n+1;i++)
	{
		for(int j=0;j<amax+1;j++)
		{
			for(int k=0;k<bmax+1;k++)
			{
				dp[i][j][k]=min(dp[i][j][k],dp[i-1][j][k]);//薬を加えない場合
				dp[i][j+a[i-1]][k+b[i-1]] = min(dp[i-1][j+a[i-1]][k+b[i-1]],dp[i-1][j][k]+c[i-1]); //薬を加える場合
			}
		}
		amax+=a[i-1];
		bmax+=b[i-1];
	}
	//ここまでDP
	for(int i=0;i<amax+1;i++)
	{
		for(int j=0;j<bmax+1;j++)
		{
			cerr<<dp[n][i][j]<<" ";
		}
		cerr << endl;
	}
	//答えを求める
	for(int i=1;i<(400/max(ma,mb))+1;i++)
	{
		if(dp[n][ma*i][mb*i]<ans)
		{
			flag=true;
			ans=dp[n][ma*i][mb*i];
		}
	}
	if(flag==false)
	{
		cout<<-1<<endl;
	}else{
		cout<<ans<<endl;
	}
	return 0;
}

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

int main() {
  int A, B;
  int ans;
  cin >> A >> B;

  if (B%A==0)
  {
      ans = A+B;
  }
  else
  {
      ans = B-A;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 200000

int main() {
	long long x, y, z;
	int s, ans;
	scanf("%lld", &x);
	y = x / 1000000000;
	z = x % 1000000000;
	if (z == 0) {
		y--;
		z += 1000000000;
	}

	printf("1 0 0 1000000000 %lld %lld\n", y + 1, z);


	return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var ans = "";
        switch (s[s.Length - 1])
        {
            case '0':
                ans = "pon";
                break;
            case '1':
                ans = "pon";
                break;
            case '2':
                ans = "hon";
                break;
            case '3':
                ans = "bon";
                break;
            case '4':
                ans = "hon";
                break;
            case '5':
                ans = "hon";
                break;
            case '6':
                ans = "pon";
                break;
            case '7':
                ans = "hon";
                break;
            case '8':
                ans = "pon";
                break;
            case '9':
                ans = "hon";
                break;
        }

        // 出力
        Console.WriteLine(ans);
    }
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;
const ll inf = 1e18;
const int maxn = 711;


int n, m;
vector<int> g[maxn], ginv[maxn];
int adj[maxn][maxn];

int color[maxn];

int nodes[2];

bool dfs(int at) {
    nodes[color[at]]++;
    for (int to: ginv[at]) {
	if (color[to] == -1) {
	    color[to]=color[at]^1;
	    if (!dfs(to)) return false;
	} else if (color[to] == color[at]) {
	    return false;
	}
    }
    return true;
}


vector<pair<int,int>> sack;

bool bipartite() {
    memset(color,-1,sizeof(color));

    for (int i=1; i<=n; i++) {
	if (color[i] == -1) {
	    nodes[0]=nodes[1]=0;
	    color[i]=1;
	    if (!dfs(i)) {
		return false;
	    }
	    sack.push_back({nodes[0],nodes[1]});
	}
    }
    return true;

}


ll nc2(ll x) {
    return x*(x-1)/2;
}

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

    cin>>n>>m;
    for (int i=0; i<m; i++) {
	int u,v; cin>>u>>v;
	g[u].push_back(v);
	g[v].push_back(u);
	adj[u][v]=adj[v][u]=1;
    }

    for (int i=1; i<=n; i++) {
	for (int j=i+1; j<=n; j++) {
	    if (!adj[i][j]) {
		ginv[i].push_back(j);
		ginv[j].push_back(i);
	    }
	}
    }


    // G inverse needs to be bipartite
    if (!bipartite()) {
	out(-1);
    }

    vector<int> dp(n+10, false);
    dp[0] = true;

    for (auto p: sack) {
	vector<int> ndp(n+10, false);
	
	int x = p.first;
	int y = p.second;
	
	for (int i=n; i>=0; i--) {
	    if (dp[i]) {
		if (i+x<=n) {
		    ndp[i+x] = true;
		}
		if (i+y<=n) {
		    ndp[i+y] = true;
		}
	    }
	}
	
	swap(dp, ndp);
	
    }


    ll res = inf;
    for (ll i=0; i<=n; i++) {
	if (dp[i]) {
	    ll x = i;
	    ll y = n - i;
	    res = min(res, nc2(x) + nc2(y));
	}
    }

    cout<<res<<endl;
    
    return 0;
}


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

int main(){
  int n, d, x, a;
  int chocolate = 0;
  cin >> n >> d >> x;
  
  for ( int i = 0; i < n; i++ ){
    cin >> a;
    for ( int j = 0; a * j + 1 <= d; j++ ){
      chocolate++;
    }
  }
  
  cout << chocolate + x << endl;
}

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

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

int main()
{
  IO;
  string s, t; cin >> s >> t;
  string ans = "UNRESTORABLE";
  for (int i = 0; i < (int)s.size() - (int)t.size() + 1; ++i) {
	int sz = t.size();
	string compare = s.substr(i, sz);
	bool check = true;
	for (int j = 0; j < sz; ++j)
		if (compare[j] != '?')
			if (compare[j] != t[j])
			{
				check = false;
				break;
			}
	compare = s;
	for (auto & elem : compare)
		if (elem == '?')
			elem = 'a';

	if (check) {
	for (int j = i; j < i + sz; ++j)
		compare[j] = t[j - i];
	if (ans == "UNRESTORABLE" || compare < ans)
		ans = compare;
	}
  }
cout << ans << endl;  

  return 0;
}

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

int main(){

    int N,Q;
    cin>>N;
    vector<int> S(N);
    for(int i=0;i<N;i++){
        cin>>S.at(i);
        }
    cin>>Q;
    int cnt=0;
    for(int i=0;i<Q;i++){
        int t;
        cin>>t;
        int left=0,right=N;
        while(left<right){
            int mid=(left+right)/2;
            if(t==S.at(mid)){
                cnt++;
                break;
            }
            else if(t<S.at(mid)){
                right=mid;
            }
            else if(t>S.at(mid)){
                left=mid+1;
            }
        }
    }
    cout<<cnt<<endl;
}



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


int eval(int x, int y) {
  int i, j, k, cnt =0;
  for(int i = 1 ; i <= x; i++) {
  for(int j = i+1 ; j <= x; j++) {
  for(int k = j+1 ; k <= x; k++) {
    if (i + j + k == y) {
cnt++;
    }
 }
  }}
  return  cnt;
}

int main() {

 int x, y;
 while(cin >> x >> y, x + y != 0 ) {
  cout << eval(x, y) << endl;
 }

}

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

int main(){
    int H,W;

    while(1){
        cin >> H >> W ;
        
        if(H==0 && W==0)break;
        
    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            cout << "#" ;
       }
        cout << endl;
    }
        cout << endl;
    }
    return 0;
    
}

Measured memory_bytes: 3096
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<int>> grid(h, vector<int>(w, inf));
    queue<pair<int, int>> que;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            char sq;
            cin >> sq;
            if (sq == '#') {
                que.push({i, j});
                grid[i][j] = 0;
            }
        }
    }

    pair<int, int> d[] = {
        {1, 0},
        {-1, 0},
        {0, 1},
        {0, -1},
    };
    int ans = 0;
    while (!que.empty()) {
        auto from = que.front();
        que.pop();

        for (const auto &e : d) {
            int toy = from.first + e.first;
            int tox = from.second + e.second;

            if (0 <= toy && toy < h && 0 <= tox && tox < w && grid[toy][tox] == inf) {
                grid[toy][tox] = grid[from.first][from.second] + 1;
                ans = max(ans, grid[toy][tox]);
                que.push({toy, tox});
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12432
#include<iostream>
 using namespace std ;
 int main()
{
 int A,B,C;
 cin>>A;
 cin>>B;
 cin>>C;
 if ((A+B)>=C)
 {
 cout << "Yes"<< endl;
 }
 else {
 cout <<"No" << endl;
 }
 
}

Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>

using namespace std;



long long comb2(long long n) {
    return n * (n - 1) / 2;
}


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

    vector<long long> a(n);
    for (long long a_i = 0; a_i < n; a_i++) {
        cin >> a[a_i];
    }

    vector<long long> v(n + 1, 0);
    for (long long a_i = 0; a_i < n; a_i++) {
        v[a[a_i]]++;
    }

    long long temp = 0;
    for(long long v_i = 1; v_i <= n; v_i++) {
        temp += comb2(v[v_i]);
    }

    for (long long k = 0; k < n; k++) {
        long long ans = temp;
        if (v[a[k]] >= 2) {
            ans = temp - (v[a[k]] - 1);
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 5760
package main

import (
	"fmt"
	"strings"
)

func main() {
	var str string
	fmt.Scan(&str)

	slice := strings.Split(str, "")

	//fmt.Printf("%s\n", slice)

	ans := []string{}
	for i, x := range slice {
		if x != "B" {
			ans = append(ans, x)
		} else if i != 0 && x == "B" {
			length := len(ans)
			if length != 0 {
				ans = ans[:length-1]
			}
		}
	}
	r := strings.Join(ans, "")
	fmt.Println(r)
}


Measured memory_bytes: 1840
#include<iostream>
using namespace std;
static const int MAX=36;
struct card
{char suit,value;};
void BubbleSort(card C[],int N);
void SectionSort(card C[],int N);
bool isstable(card C1[],card C2[],int N);
int main()
{
	card C1[MAX],C2[MAX];
	int N,i;
	cin>>N;
	for(i=0;i<N;i++)
	{
		cin>>C1[i].suit>>C1[i].value;
		C2[i]=C1[i];
	}
	BubbleSort(C1,N);
	cout<<"Stable\n";
	SectionSort(C2,N);
	if(isstable(C1,C2,N))
		cout<<"Stable\n";
	else
		cout<<"Not stable\n";
	return 0;
}
void BubbleSort(card C[],int N)
{
	int i,j;
	card temp;
	for(i=0;i<=N-1;i++)
		for(j=N-1;j>=i+1;j--)
			if(C[j-1].value>C[j].value)
			{
				temp=C[j-1];
				C[j-1]=C[j];
				C[j]=temp;
			}
	for(i=0;i<N;i++)
		if(i<N-1)
			cout<<C[i].suit<<C[i].value<<' ';
		else
			cout<<C[i].suit<<C[i].value;
	cout<<endl;
}
void SectionSort(card C[],int N)
{
	int i,j,index;
	card temp;
	for(i=0;i<N;i++)
	{
		index=i;
		for(j=i;j<N;j++)
			if(C[j].value<C[index].value)
				index=j;
		temp=C[index];
		C[index]=C[i];
		C[i]=temp;
	}
	for(i=0;i<N;i++)
		if(i<N-1)
			cout<<C[i].suit<<C[i].value<<' ';
		else
			cout<<C[i].suit<<C[i].value;
	cout<<endl;
}
bool isstable(card C1[],card C2[],int N)
{
	int i;
	for(i=0;i<N;i++)
		if(C1[i].suit!=C2[i].suit)
			return false;
	return true;
}


Measured memory_bytes: 3112
#include<iostream>
using namespace std;
int main() {
	long long N, X, patty = 0;
	cin >> N >> X;
	for (long long i = (long long)(1 << (N >> 1) + 1) * (1 << (N >> 1) + (N & 1));i;i >>= 1, -- X) {
      	if (X + 1 >= i) {
			patty |= i >> 1;
			X -= i - 2;
		}
	}
	cout << patty;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int str[26]={0},i=0;
	char word[1205];
 	while(scanf("%c",&word[i++])!=EOF);
 	for(int j=0;j<i;j++)
 	{
	 	if(word[j]>='A'&&word[j]<='Z')
		 	word[j] += 32;
	 	if(word[j]>='a'&&word[j]<='z')
	 		str[word[j]-'a']++;	
 	}
 	for(i=0;i<26;i++)
 		printf("%c : %d\n",'a'+i,str[i]);
	return 0;
}


Measured memory_bytes: 2104
import sys, math
from itertools import permutations, combinations, accumulate
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N = int(input())
G = [list(map(int, input().split())) for _ in range(N)]
c = [0]*N # 0:not found, 1:found, 2:finished
res = [[0]*2 for _ in range(N)]

time = 1
def dfs(index):
#    print('index:', index)
    global time
    if c[index]==0:
        c[index]=1
        res[index][0] = time # found
        time += 1
    elif c[index]==1:
        return
    elif c[index]==2:
        return

    u, k, *v = G[index]
    for node in v:
        dfs(node-1) # 1-index -> 0-index

    c[index] = 2
    res[index][1] = time # finished
    time += 1
    return

for i in range(N):
    dfs(i)
res = [[val1]+val2 for val1, val2 in zip(list(range(1, N+1)), res)]
for val in res:
    print(*val)



Measured memory_bytes: 6220
#include <iostream>
#define NMAX 100
#define KMAX 100000

using namespace std;

int n, k, v[NMAX+10], dp[KMAX+10];

int main()
{
    cin >> n >> k;
    for(int i=1; i<=n; i++) cin >> v[i];
    dp[0] = 2;
    for(int i=1; i<=k; i++)
        {   dp[i] = 2;
            for(int j=1; j<=n; j++)
                {   if(v[j] > i) continue;
                    if(dp[i-v[j]] == 2) dp[i] = 1;
                }
        }
    if(dp[k] == 1) cout << "First" << '\n';
    else cout << "Second" << '\n';
    return 0;
}


Measured memory_bytes: 640
from itertools import groupby

n = int(input())
aaa = list(map(int, input().split()))
bbb = list(map(int, input().split()))

idx_a = {}
cnt_a = {}
i = 0
for a, itr in groupby(aaa):
    cnt = len(list(itr))
    i += cnt
    idx_a[a] = i
    cnt_a[a] = cnt

idx_b = {}
cnt_b = {}
i = 0
for b, itr in groupby(bbb):
    cnt = len(list(itr))
    idx_b[b] = i
    cnt_b[b] = cnt
    i += cnt

slide = 0
for a in idx_a:
    if a not in idx_b:
        continue
    if cnt_a[a] + cnt_b[a] > n:
        print('No')
        exit()
    slide = max(slide, idx_a[a] - idx_b[a])

print('Yes')
if slide > 0:
    bbb = bbb[-slide:] + bbb[:-slide]
print(*bbb)


Measured memory_bytes: 92188
#include <bits/stdc++.h>
using namespace std;
#define popcnt(a) __builtin_popcount(a)

#define error(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it)
{
} 
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
} 
typedef long long ll;
const int N = 3e5+1 , M = 5e5+1, OO = 0x3f3f3f3f,MOD = 1e9+7;
ll fstpow(ll a,ll p,ll mod=MOD)
{
  ll res=1;
  while(p)
  {
    if(p&1) res=(res%mod*a%mod)%mod;
    a=(a%mod*a%mod)%mod;
    p>>=1;
  }
  return res;
}
ll modinv(ll a,ll p=MOD)
{
  return fstpow(a,p-2);
}
ll ncr(ll n,ll k,ll mod=MOD)
{
  ll x = 1,y=1;
  for(ll i = n; i > n-k ; --i) x = (x%mod * i%mod)%mod;
  for(ll i = k; i ; --i) y = (y%mod * i%mod)%mod;

  return (x%mod*modinv(y)%mod)%mod;
}
int main()
{
  ll n,a,b;
  scanf("%lld%lld%lld",&n,&a,&b);
  ll ans = (fstpow(2,n)%MOD-(ncr(n,a)+ncr(n,b)+1)%MOD+MOD)%MOD;
  printf("%lld\n",ans);
  #ifdef _LOCAL_DEFINE  
  cerr << (double)clock() * 1.0 / CLOCKS_PER_SEC << endl;
  #endif
  return 0; 
}

Measured memory_bytes: 256
N=int(input())
L = [list(map(int, input().split())) for i in range(N)]
dp=[[0 for j in range(3)] for i in range(N)]
ans=0
for i in range(N):
  for P in range(3):
    for PY in range(3):
      if P==PY:
        continue
      elif i==0:
        dp[i][P]=L[i][P]
        ans=max(ans,dp[i][P])
      else:
        dp[i][P]=max(dp[i][P],dp[i-1][PY]+L[i][P])
        ans=max(ans,dp[i][P])
'''
for i in range(3):
  ans=max(ans,dp[N-1][i])
'''
print(ans)
  

Measured memory_bytes: 47636
import math
while True :
    n=int(input())
    if n==0:
        break
    s=list(map(int,input().split()))
    m=sum(s)/len(s)
    a=0
    for i in range(n) :
        a+=(s[i]-m)**2
    a/=n
    a=math.sqrt(a)
    print(a)


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

#define ll long long
#define pb push_back
#define vi vector<int>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);

int main() {
    fastio;

    int a, b, c;
    cin >> a >> b >> c;
    int x = 100*a + 10*b + c;
    if (x % 4) {
        cout << "NO\n";
    } else {
        cout << "YES\n";
    }
    return 0;
}


Measured memory_bytes: 256
/**
 *    author:  math2do
 *    created: 27.08.2020 16:18:50
**/

#include <bits/stdc++.h>

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(const char &ch) {
  return "'" + string(1, ch) + "'";
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  reverse(res.begin(), res.end());
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "{" + to_string(p.first) + ", " + to_string(p.second) + "}";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "{" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + "}";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "{" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "}";
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector <int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  } 
  sort(arr.begin(), arr.end());
  int upto = *max_element(arr.begin(), arr.end());
  vector <int> cnt(upto + 1, 0);
  for (int val : arr) {
    cnt[val]++;    
  } 
  //debug(arr);
  arr.resize(unique(arr.begin(), arr.end()) - arr.begin());
  //debug(arr);
  //debug(upto);
  vector <bool> seen(upto + 1, false);
  for (int val : arr) {
    for (int i = 2 * val; i <= upto; i += val) {
      seen[i] = true;
    } 
  }
  int ans = 0;
  for (int val : arr) {
    if (!seen[val] && cnt[val] == 1) {
      ans += 1;
    } 
  } 
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8216
import sys
def main():
    input = sys.stdin.readline
    N,K = map(int, input().split())
    
    ans = 0
    for b in range(K+1, N+1):
        div, mod = divmod(N, b)
        one = b - K
        ans += div * one
        ans += max(0, mod - K + (1 if K!=0 else 0))
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38896
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, N;
    cin >> H >> N;
    vector<int> A(N);
    ll sum = 0;
    rep(i,N) {
        cin >> A[i];
        sum+=A[i];
    }
    if(H<=sum) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 640
let k=[0;1;2;3];;
let h()=Scanf.scanf"%d %d %d %d "(fun a b c d->[a;b;c;d]);;
let rec f()=
  let a,b=h(),h()in
  let m,n=List.fold_left2(fun(m,n)s i->List.fold_left2(fun(p,q)x j->if x=s&&i=j then(p+1,q)else if x<>s then(p,q)else(p,q+1))(m,n)a k)(0,0)b k in
  f(Printf.printf "%d %d\n"m n);;
try f()with _->()

Measured memory_bytes: 2224
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static String I = "IMPOSSIBLE";
	public static String B = "Bad";
	public static String G = "Good";
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int n = ni();
		int[] arrn = new int[n];

		for (int i = 0; i < n - 1; i++) {
			arrn[ni() - 1]++;
		}

		for (int i : arrn) {
			out(i);
		}
	}

	/*
	 * 以下メソッド集
	 */
	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static int max(int a, int b) {
		return Math.max(a, b);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static int min(int a, int b) {
		return Math.min(a, b);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

struct block {
    int x, s, t;

    bool operator<(const block& other) const {
        return x < other.x;
    }
};

void doit(vector<int>& d, vector<int>& res, vector<int>& next, int mn, int mx, int x) {
    auto st = lower_bound(d.begin(), d.end(), mn);
    auto ed = lower_bound(d.begin(), d.end(), mx);
    
    int i = st-d.begin();
    int j = ed-d.begin();

    while(i < j) {
        if(res[i] == -1) res[i] = x;
        int nx = next[i];
        next[i] = j;
        i = nx;
    }
}

int32_t main() {

    int n, q; cin >> n >> q;

    vector<block> b(n);
    for(int i = 0; i < n; ++i) cin >> b[i].s >> b[i].t >> b[i].x;
    sort(b.begin(), b.end());

    vector<int> d(q);
    for(int i = 0; i < q; ++i) cin >> d[i];
    vector<int> res(q, -1);

    vector<int> next(q);
    for(int i = 0; i < q; ++i) {
        next[i] = i+1;
    }
    
    for(block bl : b) {
        int mn = bl.s-bl.x, mx = bl.t-bl.x;
        doit(d, res, next, mn, mx, bl.x);
    }

    for(int ans : res) {
        cout << ans << endl;
    }
    
    return 0;
}


Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
  ull dp[100] = {0};

  dp[0] = 2;
  dp[1] = 1;

  for (int i = 2; i <= 86; ++i) {
    dp[i] = dp[i-1] + dp[i-2];
  }

  int i;
  cin >> i;

  cout << dp[i] << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
class MainClass
{
	static void Main(string[] args)
	{
      string S = Console.ReadLine();
      bool isYes = true;
      while (S.IndexOf("s") > -1)
      {
        if (S.Length == 0)
        {
          Console.WriteLine("YES");
          return;
        }
        if (S.IndexOf("ser") > -1)
        {
          int Slen = S.Length;
          S = S.Replace("eraser", "");
          //Console.WriteLine(S);
          if (Slen == S.Length)
          {
            Console.WriteLine("NO");
            return;
          }
        }
        else
        {
          int Slen = S.Length;
          S = S.Replace("erase", "");
          //Console.WriteLine(S);
          if (Slen == S.Length)
          {
            Console.WriteLine("NO");
            return;
          }
        }
      }
      while (true)
      {
        if (S.Length == 0)
        {
          Console.WriteLine("YES");
          return;
        }
        if (S.IndexOf("er") > -1)
        {
          int Slen = S.Length;
          S = S.Replace("dreamer", "");
          //Console.WriteLine(S);
          if (Slen == S.Length)
          {
            Console.WriteLine("NO");
            return;
          }
        }
        else
        {
          int Slen = S.Length;
          S = S.Replace("dream", "");
          //Console.WriteLine(S);
          if (Slen == S.Length)
          {
            Console.WriteLine("NO");
            return;
          }
        }
      }
	}
}


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

int main() {
    int N,cnt;
    cin >> N;
    int maxnum=1,maxcnt=0;
    for (int i=N;i>0;i--) {
        cnt = 0;
        int num = i;
        while (true) {
            if (num%2) break;
            num /= 2;
            cnt++;
        }
        if (cnt > maxcnt) {
            maxcnt = cnt;
            maxnum = i;
        }
    }
    cout << maxnum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
typedef long long ll;


//nをp進数に変換
ll convert(ll n, ll p){ll y=0, i=0, z;
    while(n > 0){z = n%p;y += z*pow(10, i);n = n/p;i++;}
    return y;}

//d^k個の候補を準備。require convert
vector<string> zenkouho(int d,int k){
	int card = pow(d,k);
	vector<string> out;
	rep(i,card){
		int a = convert(i,d);
		int l = to_string(a).size();
		string s = to_string(a);
		rep(j,k-l){
			s = '0' + s;
		}
		out.push_back(s);
	}
	return out;
}

int main(){
	int n;
	cin >> n;
	int l = to_string(n).size();
	ll ans = 0;
	reps(i,3,l+1){
		vector<string> kouho = zenkouho(3,i);
		//各kouhoに対して
		ll num = kouho.size();
		rep(kouhoi,num){
			string ckouho = kouho[kouhoi];
			int num3=0;
			int num5=0;
			int num7=0;
			rep(j,i){
				if(ckouho[j]=='0'){
					ckouho[j]='3';
					num3 ++;
				}
				if(ckouho[j]=='1'){
					ckouho[j]='5';
					num5 ++;
				}
				if(ckouho[j]=='2'){
					ckouho[j]='7';
					num7 ++;
				}			
			}
			if(stoll(ckouho)<=n && num3 >= 1 && num5 >= 1 && num7 >=1){ans++;}
		}
	}
	cout << ans;
}

Measured memory_bytes: 1292
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;
    
    if(n%2==1){
        cout<<"No"<<endl;
    }else{
        vector<char> hoge1(n/2);
        vector<char> hoge2(n/2);
        for(int i=0;i<n;i++){
            if(i<=n/2-1) hoge1.at(i)=s.at(i);
            else hoge2.at(i-n/2)=s.at(i);
        }
        
        if(hoge1==hoge2) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n;
    int ans=0;
    int a[20];
    int b[20];
    int c[20];
    int i,x;
    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++){
        scanf("%d",&b[i]);
    }
    for(i=1;i<n;i++){
        scanf("%d",&c[i]);
    }
    for(i=0;i<n;i++){
        if(a[i]-1==a[i-1]){
            ans+=c[a[i]-1];
        }
        x=a[i];
        ans+=b[(a[i]-1)];
    }
    printf("%d",ans);
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <iomanip>

int main(void) {
	int N = 0;
	int K = 0;
	double totalP = 0.0;

	std::cin >> N;
	std::cin >> K;

	double* p = NULL;
	p = new double[N];

	double saikoroP = 0.0;
	saikoroP = 1.0 / N;

	double coinP = 0.0;
	coinP = 1.0 / 2.0;

	int doCoinNum = 0;
	int tmp = 0;
	for (int ii = 0; ii < N; ii++) {
		tmp = ii + 1;
		doCoinNum = 0;
		while (tmp < K) {
			tmp = tmp * 2;
			doCoinNum++;
		}

		if (doCoinNum == 0) {
			p[ii] = saikoroP;
		}
		else {
			p[ii] = saikoroP * std::pow(coinP, doCoinNum);
		}
	}

	for (int ii = 0; ii < N; ii++) {
		totalP = totalP + p[ii];
	}

	std::cout << std::setprecision(10) << totalP;

	return 0;

}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	unsigned long long int H;//hit point of monsters
	int i;
	unsigned long long int times, monsters;
	char buf[128], *ch;
	int *each_digit;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, "\n");
	i = 0;
	H = (unsigned long long int)atoll(ch);

	times = 0;
	monsters = 1;
	for(; H >= 1; H /= 2) {
		times += monsters;
		monsters *= 2;
	}
	printf("%llu\n", times);


	return 0;
}


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

ll gcd(ll a, ll b) { return (b == 0)? a : gcd(b,a%b);}

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

    ll tot = 0;
    for (int a=1; a<=k; a++) {
        for (int b=1; b<=k; b++) {
            for (int c=1; c<=k; c++) {
                tot += gcd(a, gcd(b, c));
            }
        }
    }
    cout << tot << endl;
    return 0;
}


Measured memory_bytes: 3636
/// Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;

const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf

#define sf scanf

#define ALL(x) x.begin(),x.end()
#define pb push_back

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define for0(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=n-1;i>=0;i--)
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}

int main()

{
    IOS;
    //freopen("input.txt", "r", stdin);
     //freopen("output.txt", "w", stdout);
     ll x;
     while(cin>>x){
        int ans=x/500;
        x-=(ans*500);
        ans*=1000;
        ans+=(x/5)*5;
        cout<<ans<<endl;
     }

     return 0;

}
///Alhamdulillah


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

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

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	int n=sz(s);
	/*
	vector<ll> dp(n+4), dz(n+4);
	rep(i,n) rep2(j,1,n+1-i){
		//dbg(i,j,stoll(s.substr(i,j)));
		dp[i+j] += dp[i] + stoll(s.substr(i,j)) * (1LL<<max(0,i-1));
	}
	for(auto x :dp) printf("%lld, ",x); puts("");
	cout << dp[n] <<"\n";
	*/
	ll ans =0;
	rep(i,n) rep2(j,1,n+1-i){
		ll w = stoll(s.substr(i,j));
		ans +=  w * (1LL<<max(0,i-1)) * (1LL<<max(0,n-j-i-1));
		//dbg(i,j,w,(1LL<<max(0,i-1)),(1LL<<max(0,n-j-i-1)));
	}
	cout << ans <<"\n";
	return 0;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c;
	d=a;
	a=b;
	b=d;
	d=a;
	a=c;
	c=d;
	cout<<a<<" "<<b<<" "<<c;
	return 0;
}

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

typedef pair<int, int> P;
typedef pair<P, int> PP;

int main() {
    int N, M;
    cin >> N >> M;
    vector<PP> city(M);
    for (int i = 0; i < M; i++) {
        int p, y;
        cin >> p >> y;
        city[i] = PP(P(p, y), i);
    }
    sort(city.begin(), city.end());

    vector<P> res(M);
    int i = 0, prev = 0, cnt = 0;
    while (i < M) {
        if (prev != city[i].first.first) {
            prev = city[i].first.first;
            cnt = 0;
        } else {
            cnt++;
        }

        res[city[i].second] = P(city[i].first.first, cnt + 1);
        i++;
    }

    for (int i = 0; i < M; i++) {
        printf("%.6d%.6d", res[i].first, res[i].second);
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE
void solve(void)
{
  int N;
  cin>>N;
  vector<int> DP(N+1,0);
  int M;
  cin>>M;
  for (int i = 0; i < M; i++)
  {
    int A;
    cin>>A;
    DP[A] = -1;
  }
  DP[0] += 1;
  DP[1] += 1;
  for (int i = 2; i <= N; i++)
  {
    if(DP[i] == -1)
    {
      DP[i] = 0;
      continue;
    }
    else
    {
      DP[i] = DP[i-1] + DP[i-2]; 
    }
    DP[i] %= MOD;

  }
  // DEBUG(DP);
  
  
  cout<<DP[N]<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
	int n, m, p;
	while (cin >> n >> m >> p) {
		if (n == 0 && m == 0 && p == 0) {
			break;
		}
		int t[110] = {0};
		int sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> t[i];
			sum += t[i];
		}
		sum *= (100-p);
		if (t[m-1] == 0) {
			cout << 0 << endl;
		} else {
			cout << sum/t[m-1] << endl;
		}
	}
	return 0;
}

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

string S, T, U; int N, A, B;

string ToString(int V) {
	string I = "";
	for (int i = N - 1; i >= 0; i--) {
		if ((V / (1 << i)) % 2 == 1) I += "1";
		else I += "0";
	}
	return I;
}

int ToInt(string V) {
	int ret = 0;
	for (int i = 0; i < N; i++) ret += (1 << (N - 1 - i))*(V[i] - '0');
	return ret;
}

int main() {
	cin >> N >> A >> B;
	S = ToString(A);
	T = ToString(B);
	int cnt = 0;
	for (int i = 0; i < N; i++) { if (S[i] != T[i]) { U += "1"; cnt++; } else U += "0"; }
	if (cnt % 2 == 0) {
		cout << "NO" << endl;
		return 0;
	}

	// ここからが本質
	string cx; for (int i = 0; i < N; i++) cx += "0";

	vector<string>ans; int bit[17] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	for (int i = 0; i < N; i++) {
		// まずどのビットを固定するかを決める
		int pos = 0;
		for (int j = 0; j < N; j++) { if (U[j] != cx[j]) pos = j; }
		bit[pos] = 1;

		vector<int>G; for (int j = 0; j < N; j++) { if (bit[j] == 0) G.push_back(j); }

		for (int j = 1; j <= (1 << (N - 1 - i)); j++) {
			ans.push_back(cx);
			int cp = j, cntv = 0; while (cp % 2 == 0) { cntv++; cp /= 2; }
			
			if (cntv == G.size()) break;
			if (cx[G[cntv]] == '0') cx[G[cntv]] = '1';
			else cx[G[cntv]] = '0';
		}

		if (cx[pos] == '0') cx[pos] = '1';
		else cx[pos] = '0';
	}
	ans.push_back(ToString(A ^ B));

	cout << "YES" << endl;
	for (int i = 0; i < (1 << N); i++) {
		if (i) cout << " ";
		int I = ToInt(ans[i]) ^ A;
		cout << I;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 10228
#include <cstdio>
#include <iostream>
#define travel(x, y, i) for (int i = fir[x], y = e[i].to; i; i = e[i].nxt, y = e[i].to)
using namespace std;

const int N = 2e5 + 50;

struct edge {
  int nxt, to;
} e[N << 1];
int fir[N], cnt = 0;
int n, Max[N], high[N], sz[N], f[N], up[N];
char s[N];

inline void addedge(int x, int y) {
  e[++ cnt] = (edge) { fir[x], y }; fir[x] = cnt;
}

inline void Dfs(int x, int fa) {
  f[x] = fa;
  sz[x] = s[x] == '1';
  travel(x, y, i)
    if (y != fa) {
      Dfs(y, x);
      Max[x] = max(Max[x], Max[y] + 1);
      sz[x] += sz[y];
    }
}

inline void Dfshigh(int x, int fa, int lo) {
  int mx = ++ lo, sb = 0;
  travel(x, y, i)
    if (y != fa) {
      if (mx < Max[y] + 1) {
        sb = mx; mx = Max[y] + 1;
      }
      else sb = max(sb, Max[y] + 1);
    }
  high[x] = min(mx - 1, sb + 1);
  travel(x, y, i)
    if (y != fa) Dfshigh(y, x, max(lo, Max[y] + 1 != mx ? mx : sb));
  up[x] = lo;
}

int main() {
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; i ++) {
    scanf("%d%d", &x, &y);
    addedge(x, y); addedge(y, x);
  }
  scanf("%s", s + 1);
  Dfs(1, 0);
  Dfshigh(1, 0, -1);
  long long ans = 1;
  for (int i = 1, low; i <= n; i ++) {
    low = 1e9;
    travel(i, v, j)
      if (v == f[i]) {
        if (sz[1] - sz[i]) low = min(low, up[i]);
      }
      else if (sz[v]) low = min(low, Max[v] + 1);
    if (s[i] == '1') low = 0;
    ans += max(0, high[i] - low + 1);
  }
  printf("%lld\n", ans);
  return 0;
}


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

class Test
{
    static void Main()
    {
        string ss;
        while ((ss = Console.ReadLine()) != "0")
        {
            int sum = 0;
            for (int i = 0; i < ss.Length; i++)
            {
                sum += int.Parse(ss[i].ToString());
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 15860
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

S = input()
T = input()

if S == T[:-1]:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

const ll MOD = 2019;
signed main() {
  ll l, r; cin >> l >> r;
  if (r-l>MOD) {
    cout << 0 << endl;
    exit(0);
  }
  l = l % MOD; r = r % MOD;
  if (r <= l) r += MOD;
  ll ans = MOD;
  for(ll i = l; i<r; i++) {
    for(ll j = i+1; j<=r; j++) {
      ans = min(ans, (i*j)%MOD);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {

    static int res(String ss, String t) {
        int cnt = 0;
        for(int i=0;i<ss.length();i++) {
            if(ss.charAt(i) != t.charAt(i)) {
                cnt++;
            }
        }
        return cnt;
    }


    static void solve() {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = scan.nextInt();
        }
        BigInteger sum = BigInteger.valueOf(0);
        BigInteger sum2 = BigInteger.valueOf(0);
        for (int i = 1; i < n; i++) {
            sum2 = sum2.add(BigInteger.valueOf(arr[i]));
        }
        for (int i = 0; i < n-1; i++) {
            BigInteger mult = BigInteger.valueOf(arr[i]).multiply(sum2);
            sum = sum.add(mult).mod(BigInteger.valueOf(1000000000 + 7));
            sum2 = sum2.subtract(BigInteger.valueOf(arr[i+1]));
//            for (int j = i+1; j < n; j++) {
//                BigInteger res  = BigInteger.valueOf(arr[i]).multiply(BigInteger.valueOf(arr[j]));//.mod(BigInteger.valueOf(1000000000 + 7));
//                sum = sum.add(res).mod(BigInteger.valueOf(1000000000 + 7));
//            }
        }
        System.out.println(sum);

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int zero1, int one1, int two1, int zero2, int one2, int two2) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }


    public static void main(String[] args) {

        solve();
    }


    static class LoggerNode {
        String message;
        int ts;
    }


    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
}

Measured memory_bytes: 50420