akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstring>
#include <unordered_set>
#include <chrono>
#include <cassert>

//#pragma GCC optimize("Ofast,unroll-loops,fast-math,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt")
//#pragma GCC target("avx,avx2")

using namespace std;

//#define int long long
#define pii pair<int, int>
#define mp make_pair
const int SZ = 5e5 + 4;
const int inf = 2e9;
int hashpow = 41;
int mod = 1e9 + 7;

int x;

inline void read() {
    cin >> x;
}

inline void solve() {
    cout << 10 - x / 200 << "\n";
}

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

//    int t;
//    cin >> t;
//    for (int i = 0; i < t; ++i) {
        read();
        solve();
//    }

    return 0;
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Modular
    {
        private const int M = 1000003;
        private long value;

        public Modular(long value) { this.value = value; }
        public static implicit operator Modular(long a) { return new Modular((a % M + M) % M); }
        public static Modular operator +(Modular a, Modular b) { return a.value + b.value; }
        public static Modular operator -(Modular a, Modular b) { return a.value - b.value; }
        public static Modular operator *(Modular a, Modular b) { return a.value * b.value; }
        public static Modular Pow(Modular a, int n)
        {
            switch (n)
            {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                var p = Pow(a, n / 2);
                return p * p * Pow(a, n % 2);
            }
        }
        public static Modular operator /(Modular a, Modular b) { return a * Pow(b, M - 2); }
        private static readonly List<int> facs = new List<int> { 1 };
        public static Modular Fac(int n)
        {
            for (int i = facs.Count; i <= n; ++i) { facs.Add((int)(Math.BigMul(facs.Last(), i) % M)); }
            return facs[n];
        }
        public static Modular Ncr(int n, int r)
        {
            return (n < r) ? 0
                 : (n == r) ? 1
                            : Fac(n) / Fac(r) / Fac(n - r);
        }
        public static explicit operator int(Modular a) { return (int)a.value; }
    }

    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static Modular Pi(int x, int n)
        {
            return (x > 0 && n < 1000002) ? Modular.Fac(x + n) / Modular.Fac(x - 1) : 0;
        }

        static int Solve(int x, int d, int n)
        {
            if (d == 0)
            {
                return (int)Modular.Pow(x, n);
            }
            else
            {
                var X = new Modular(x) / d;
                return (int)(Modular.Pow(d, n) * Pi((int)X, n - 1));
            }
        }

        static void Main(string[] args)
        {
            int Q = ReadInt();
            for (int i = 0; i < Q; ++i)
            {
                int[] V = ReadInts();
                Console.WriteLine(Solve(V[0], V[1], V[2]));
            }
        }
    }
}


Measured memory_bytes: 30752
#include <bits/stdc++.h>
#define ll unsigned long long

using namespace std;

int main() {
    ll N,K;
    cin >>N>>K;
    vector<ll> yotei(N+1,0);
    for(ll i=0;i<K;i++) {
        ll a,b;
        cin >>a>>b;
        yotei[a] = b;
    }
    vector<vector<ll>> dp(N+1,vector<ll>(7,0));
    if(yotei[1]==0){
        dp[1][1] = 1;
        dp[1][2] = 1;
        dp[1][3] = 1;
    }else if(yotei[1]==1){
        dp[1][1] = 1;
    }else if(yotei[1]==2){
        dp[1][2] = 1;
    }else if(yotei[1]==3){
        dp[1][3] = 1;
    }
    for(ll i=1;i<N;i++) {
        for(ll j=1;j<=6;j++) {
            if(dp[i][j] >= 10000)dp[i][j]%=10000;
        }
        if(yotei[i+1]==0) {
            dp[i+1][1] = dp[i][2] + dp[i][3] + dp[i][5] + dp[i][6];
            dp[i+1][2] = dp[i][1] + dp[i][3] + dp[i][4] + dp[i][6];
            dp[i+1][3] = dp[i][1] + dp[i][2] + dp[i][4] + dp[i][5];
            dp[i+1][4] = dp[i][1];
            dp[i+1][5] = dp[i][2];
            dp[i+1][6] = dp[i][3];
        }else if(yotei[i+1]==1) {
            dp[i+1][1] = dp[i][2] + dp[i][3] + dp[i][5] + dp[i][6];
            dp[i+1][2] = 0;
            dp[i+1][3] = 0;
            dp[i+1][4] = dp[i][1];
            dp[i+1][5] = 0;
            dp[i+1][6] = 0;
        }else if(yotei[i+1]==2) {
            dp[i+1][1] = 0;
            dp[i+1][2] = dp[i][1] + dp[i][3] + dp[i][4] + dp[i][6];
            dp[i+1][3] = 0;
            dp[i+1][4] = 0;
            dp[i+1][5] = dp[i][2];
            dp[i+1][6] = 0;
        }else if(yotei[i+1]==3) {
            dp[i+1][1] = 0;
            dp[i+1][2] = 0;
            dp[i+1][3] = dp[i][1] + dp[i][2] + dp[i][4] + dp[i][5];
            dp[i+1][4] = 0;
            dp[i+1][5] = 0;
            dp[i+1][6] = dp[i][3];
        }
    }
    ll sum = 0;
    for(ll i=1;i<=6;i++) {
        sum+=(dp[N][i]);
    }
    cout << ((sum % 10000)+10000)%10000 << endl;
}



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

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

    vector<int> l, r;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        l.push_back(b);
        r.push_back(a);
    }

    l.push_back(0);
    r.push_back(0);
    N++;

    sort(begin(l), end(l));
    sort(begin(r), end(r));
    reverse(begin(r), end(r));

    long long result = 0;
    for (int i = 0; i < N && l[i] < r[i]; i++) {
        result += 2 * (r[i] - l[i]);
    }
    cout << result << endl;
}


Measured memory_bytes: 1276
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::cmp::min;

#[allow(unused_macros)]
macro_rules! get {
    ($i:ident) => {
        $i = String::new();
        io::stdin().read_line(&mut $i).ok();
    };
}

#[allow(unused_macros)]
macro_rules! to_vec {
    ($s:ident, $t:ty) => {
        $s.split_whitespace().map(|i| i.parse().ok().unwrap()).collect::<Vec<$t>>()
    }
}

#[allow(unused_macros)]
macro_rules! parse {
    ($s:ident, $t:ty) => {
        $s.trim().parse::<$t>().ok().unwrap()
    }
}

#[allow(unused_macros)]
macro_rules! max {
    ($v:ident) => {
        $v.iter().max().unwrap()
    };
}

#[allow(unused_macros)]
macro_rules! min {
    ($v:ident) => {
        $v.iter().max().unwrap()
    };
}

#[allow(unused_macros)]
macro_rules! sort {
    ($v:ident) => {
        $v.as_mut_slice().sort()
    };
}

#[allow(unused_variables)]
#[allow(unused_mut)]
fn main() {
    let mut s: String;
    get!(s);
    let n = parse!(s, usize);
    get!(s);
    let mut a = to_vec!(s, i32);
    let mut c = 0;
    for i in 0..n {
        let mut minj = i;
        for j in i..n {
            if a[j] < a[minj] {
                minj = j;
            }
        }
        a.swap(i, minj);
        if i != minj {
            c += 1;
        }
    }

    for i in 0..n {
        print!("{}", a[i]);
        if i != (n - 1) {
            print!(" ");
        } else {
            println!();
        }
    }

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


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

int main() {
  string S, T;
  cin >> S >> T;
  int a[26] ={0}, b[26] = {0};
  
  for (int i = 0; i < S.size(); i++) {
    a[S[i] - 'a']++;
  }
  for (int i = 0; i < T.size(); i++) {
    b[T[i] - 'a']++;
  }
  
  sort(a, a+26);
  sort(b, b+26);
  
  bool ans = true;
  
  for (int i = 0; i <26; i++) {
    if (a[i] != b[i]) {
      ans = false;
      break;
    }
  }
  
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 904
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define vp vector<P>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define INFTY 1e9
const int mod = 1000000007;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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 (a>b) {
        a = b;
        return true;
    }
    return false;
}

//cout << fixed << setprecision(10) << y << endl;
struct edge {int to, cost;};
vector< vector<edge> > es;

int gcd(int a, int b) {
    int r = a % b;
    if (r == 0) return b;
    return gcd(b, r);
}

ll lcm(ll a, ll b) {
    return a/gcd(a, b)*b;
}
const ll max_n = 10000010;
int is_prime[max_n];
Pl cms[max_n];
void sieve() {
    REP(i, max_n) {
        is_prime[i] = 1;
        cms[i] = Pl(1, i);
    }
    is_prime[0] = is_prime[1] = 0;
    cms[0] = Pl(0, 0);
    FOR(i, 2, sqrt(max_n)+1) {
        if (is_prime[i]) {
            for (int j = 2*i; j < max_n; j += i) {
                is_prime[j] = 0;
                ll cnt = 1;
                ll m = cms[j].second;
                while (m % i == 0) {
                    m /= i;
                    cnt += 1;
                }
                cms[j].first *= cnt;
                cms[j].second = m;
            }
        }
    }
}

int main() {
    ll n;
    cin >> n;
    sieve();
    ll res = 0;
    REP(i, n) {
        if (is_prime[i+1]) {
            res += (i+1)*2;
        } else {
            if (is_prime[cms[i+1].second]) res += (i+1)*(cms[i+1].first)*2;
            else res += (i+1)*(cms[i+1].first);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 198940
S = input()
K = int(input())
s = []
ss = []
for i in range(len(S)):
    s.append(S[i:])
s.sort()
for i in range(len(s)-1):
    if s[i] != s[i+1][:len(s[i])]:
        ss.append(s[i])
ss.append(s[-1])
i = 0
while len(ss[i]) < K:
    K -= len(ss[i])
    i += 1
print(ss[i][:K])


Measured memory_bytes: 89180
N=int(input())
S=[]
L=[]
C=[]

for i in range(N):
    S.append(str(input()))

S.sort()
L.append(S[0])
C.append(1)
cur=0

for i in range(1,N):
    if S[i]!=S[i-1]:
        L.append(S[i])
        C.append(1)
        cur+=1
    else:
        C[cur]+=1
count_max=max(C)
for i in range(len(L)):
    if C[i]==count_max:
        print(L[i])

Measured memory_bytes: 95960
#include<stdio.h>
#include<stdlib.h>
#define true 0
#define false 1

int solve(int, int);
int n;
int A[20];

int main(){
  int i;
  int q;
  int m[200];
  int sol;

  scanf("%d", &n);
  if(20 < n)
    exit(0);
  
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
    if(A[i] < 1 || 2000 < A[i])
      exit(1);
  }

  scanf("%d", &q);
  if(200 < q)
    exit(2);
  
  for(i = 0; i < q; i++){
    scanf("%d", &m[i]);
    if(m[i] < 1 || 2000 < m[i])
      exit(3);
  }

  for(i = 0; i < q; i++){
    sol = solve(0, m[i]);
    if(sol == true)
      printf("yes\n");
    else if(sol == false)
      printf("no\n");
  }

  return 0;
}

int solve(int i, int m){
  int res;

  if(m == 0)
    return true;
  if(n <= i)
    return false;

  res = solve(i+1, m);
  if(res == true)
    return res;
  res = solve(i+1, m-A[i]);
  return res;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
int main(){
    int h,w,k;
    int p=0;
    std::cin >> h>>w>>k;
    vvector(c,char,h,w,'0');
    vvector(a,int,h,w,0);
    reprep(i,j,h,w)std::cin >> c[i][j];
    rep(i,h){
        
        if(c[i][0]=='#'){
            p++;
            a[i][0]=p;
        }
        rep(j,w-1){
            if(c[i][j+1]=='#'){
                p++;
                a[i][j+1]=p;
            }
            else a[i][j+1]=a[i][j];
        }
        irep(j,w-1)if(a[i][j]==0)a[i][j]=a[i][j+1];
    }

    rep(j,w){
        rep(i,h-1){
            if(a[i+1][j]==0)a[i+1][j]=a[i][j];
        }
        irep(i,h-1)if(a[i][j]==0)a[i][j]=a[i+1][j];
    }
    rep(i,h){
        rep(j,w)std::cout << a[i][j] <<" ";
        std::cout  << std::endl; 
    }
}

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

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K = INT()
print(A[K-1])


Measured memory_bytes: 3444
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia;
		int[][] a=new int[s[1]][];
		long[] ans=new long[s[1]];
		for(int i = 0;i<s[1];i++) {a[i]=sc.Ia;}
		ans[s[1]-1]=(long)s[0]*(s[0]-1)/2;
		Uf uf=new Uf(s[0]);
		for(int i = s[1]-1;i>=1;i--) {
			if(!uf.Same(a[i][0]-1,a[i][1]-1)){
				ans[i-1]=ans[i]-uf.Total(a[i][0]-1)*uf.Total(a[i][1]-1);
				uf.Union(a[i][0]-1,a[i][1]-1);
			}
			else{ans[i-1]=ans[i];}
		}
		Console.WriteLine(String.Join("\n",ans));
	}
}
public class Uf{
	private int[] arr,hi;
	public int all;
	public Uf(int n){
		arr=new int[n];
		hi=new int[n];
		all=n;
		for(int i=0;i<n;i++){arr[i]=-1;}
	}
	public void Union(int a,int b){
		a=Root(a);
		b=Root(b);
		if(a!=b){
			if(hi[a]<hi[b]){
				int v=b;
				b=a;
				a=v;
			}
			arr[a]+=arr[b];
			hi[a]=Math.Max(hi[a],hi[b]+1);
			arr[b]=a;
			all--;
		}
	}
	public bool Same(int a,int b){return Root(a)==Root(b);}
	public long Total(int a){return -arr[Root(a)];}
	public int Root(int a){return arr[a]<0?a:arr[a]=Root(arr[a]);}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 31940
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

int main(){
    int a[3]; cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    cout << ((a[0]+a[1])%2 ? (2*a[2]-a[1]-a[0]+3)/2 : (2*a[2]-a[1]-a[0])/2) << "\n";
    //和と3最大値の偶奇 で 最大値or最大値+1
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

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

int main(){
    ll n; 
    ll cnt = 0;
    ll base = 5;
    cin >> n;
    if(n % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    n /= 2;
    while(base <= n){
        cnt += (n / base);
        base *= 5;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3624
from collections import defaultdict
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


class UnionFind:
    """
    sizeによる実装
    """

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.size = [1 for _ in range(N)]

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

    def union(self, x, y):
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return
        if self.size[px] < self.size[py]:
            self.parent[px] = py
            self.size[py] += self.size[px]
        else:
            self.parent[py] = px
            self.size[px] += self.size[py]

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

    def connectedNum(self, x):
        return self.size[self.find(x)]


N, M = map(int, input().split())
Un = UnionFind(N)  # 会話できる人をつなげる
D = defaultdict(lambda: [])
for i in range(N):
    _, *L = map(lambda x: int(x)-1, input().split())
    for l in L:
        D[l].append(i)
for i in range(M):
    if len(D[i]) > 1:
        t = D[i]
        for d in t[1:]:
            Un.union(t[0], d)
if Un.size[Un.find(0)] == N:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 87260
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


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

    vector<pair<double,double>> xy(n);
    for(int i = 0; i < n; i++){
        cin >> xy[i].first >> xy[i].second;
    }

    const double pi =  3.141592653589793;
    double ans = 0.0;
    for(double i = 0.0; i < 2*pi; i += 2*pi/1000){
        double sumx = 0, sumy = 0;
        double x = cos(i);
        double y = sin(i);
        for(int j = 0; j < n; j++){
            double cos_theta = (x*xy[j].first + y*xy[j].second)/sqrt(xy[j].first*xy[j].first+xy[j].second*xy[j].second);
            if(0 <= cos_theta && cos_theta <= 1){
                sumx += xy[j].first;
                sumy += xy[j].second;
            }
        }
        ans = max(ans, sumx*sumx + sumy*sumy);
    }

    printf("%.12f\n",sqrt(ans));


    return 0;

}


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

int main() {
  int hmm;
  cin >> hmm;
  vector<int> mochi(hmm);
  for (int i = 0; i < hmm; i++) {
    cin >> mochi.at(i);
  }
  sort(mochi.begin(), mochi.end());
  int height = 1;
  for (int j = 0; j < hmm - 1; j++) {
    if (mochi.at(j) < mochi.at(j + 1)) {
      height++;
    }
  }
  cout << height << endl;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
typedef long long ll;
const int MOD = 1e9 + 7;

int pow_mod(ll x, ll n, int M) {
	ll ans = 1;
	for (; n; n>>=1) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
	}
	return ans;
}

ll C[2001][2001], c[2001][2001], dp[2001][2001];

int main() {
	rep(x, 2001) {
		C[x][0] = 1;
		for (int y = 1; y <= x; y++)
			C[x][y] = (C[x - 1][y - 1] + C[x - 1][y]) % MOD;
	}
	rep(x, 2001) rep(y, 2001) c[x][y] = (C[x][y] + (y ? c[x][y - 1] : 0)) % MOD;
	rep(x, 2001) rep(y, 2001) if (y) dp[x][y] = c[y - 1][x];
	rep(x, 2001) rep(y, 2001) if (x) dp[x][y] = (dp[x][y] + dp[x - 1][y]) % MOD; else dp[x][y] = 1;
	int A, B; cin >> A >> B;
	ll ans = 0;
	rep(x, A + 1) for (int y = 0; x + y <= A && y <= B - 1; y++) {
		ll z = C[B - 1][y];
		int a = A - x - y, b = y;
		z = z * dp[a][b] % MOD;
		ans = (ans + z) % MOD;
	}
	cout << ans << endl;
}


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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    i64 N;
    cin >> N;

    vector<i64> a(N);
    rep(i,0,N) cin >> a[i];

    vector<long double> pow4(40);
    pow4[0]=1;
    rep(i,1,pow4.size()) pow4[i]=pow4[i-1]*4;

    i64 size=100;
    vector<vector<i64>> memo1(N,vector<i64>(size));
    vector<vector<bool>> done1(N,vector<bool>(size));
    function<i64(i64,i64)> rec1=[&](i64 i,i64 x){
        assert(x<size);
        if(done1[i][x]) return memo1[i][x];
        done1[i][x]=true;
        if(i==N-1) return memo1[i][x]=0;
        if(x>15) return memo1[i][x]=rec1(i,15)+(N-i-1)*(x-15);
        i64 y=0;
        while(a[i]*pow4[x]>a[i+1]*pow4[y]+eps) ++y;
        return memo1[i][x]=rec1(i+1,y)+y;
    };

    vector<vector<i64>> memo2(N,vector<i64>(size));
    vector<vector<bool>> done2(N,vector<bool>(size));
    function<i64(i64,i64)> rec2=[&](i64 i,i64 x){
        assert(x<size);
        if(done2[i][x]) return memo2[i][x];
        done2[i][x]=true;
        if(i==0) return memo2[i][x]=0;
        if(x>15) return memo2[i][x]=rec2(i,15)+i*(x-15);
        i64 y=0;
        while(a[i]*pow4[x]>a[i-1]*pow4[y]+eps) ++y;
        return memo2[i][x]=rec2(i-1,y)+y;
    };

    i64 ans=min(rec1(0,0)*2,rec2(N-1,0)*2+N);
    rep(i,1,N) {
        ans = min(ans, rec1(i, 0) * 2 + rec2(i - 1, 0) * 2 + i);
    }

    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 395648
function main(input) {
  input=input.trim()
  var arr=Array.from(input)
  var ans=0;
  for(var i=0; i<arr.length; i++){
    if(arr[i]=="o"){
      ans++
    }
  }
  console.log(700+ans*100);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <cassert>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

#define st first
#define nd second

const int MAXN = 1e6 + 5, inf = 1e9;
const ll INF = 1e18;
const ld PI = 3.1415926535897932384626433832795;

int cnt[MAXN];
ll dp[MAXN], tab[MAXN];
bool vis[MAXN], used[MAXN];

vector<int> G[MAXN];
vector<ll> V;
set<ll> S;
map<ll, int> M;
stack<ll> St;
queue<ll> Q;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

    //////////////////////////////////////////
    //////////////////////////////////////////

    int n, k;
    cin >> n >> k;
    if ((n + 1) / 2 >= k) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}


Measured memory_bytes: 24832
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
using namespace std;
const int INF = 1e9;
typedef long long lint;
const lint LINF = 1e18;
const lint MOD = 1e9 + 7;
// const lint MOD = 998244353;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}
 
int main(){
	int n,k; cin>>n>>k;
	vector<int> v(n), d(n-k+1);
	rep(i,n) cin >> v[i];
	rep(i,n-k+1){
		d[i] = min(abs(v[i]) + abs(v[i+k-1] - v[i]), abs(v[i+k-1]) + abs(v[i+k-1] - v[i]));
	}
	cout << *min_element(all(d)) << endl;

}


Measured memory_bytes: 768
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
const int INF = (1 << 30);

//毎回変える定数
#define N_MAX 200


//変数
int N,ans;
vector<vector<int>> csf;

//サブ関数
//入力
void input() {
	cin >> N;
	int tmp;
	N--;
	REP(i, N) {
		vector<int> tmpv;
		REP(j, 3) {
			cin >> tmp;
			tmpv.push_back(tmp);
		}
		csf.push_back(tmpv);
	}
}


//計算
void calc() {
	int times;
	REP(k, N+1) {
		ans = 0;
		FOR(i,k,N){
			if (ans <= csf[i][1]) {
				ans = csf[i][1];
			}
			else {
				times = ceil((double)(ans - csf[i][1]) / csf[i][2]);
				ans = csf[i][1] + csf[i][2] * times;
			}
			ans += csf[i][0];
		}
		DEBUGING(ans);
	}
}


//出力
void output() {

}

//デバッグ
void debug() {
	REP(i, 100) {
		int N;
		cin >> N;
	}
}


//メイン関数
int main() {

	input();
	calc();
	output();
	debug();
	

	return 0;
}


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

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

    long long ans = 1LL << 60;
    for (int P = 0; P < 105; ++P) {
        long long sum = 0;
        for (int i = 0; i < N; ++i) {
            sum += (X[i] - P) * (X[i] - P);
        }
        if (ans >= sum) ans = sum;
    }

    cout << ans << endl;
}


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

typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

#define INF (int)(1e9)

#define rep(i,n) for(int i=0; i<(n); ++i)
#define REP(i,start,end) for(int i=(start);i<=(end);++i)
#define all(n) begin(n),end(n)

#define DEBUG

int main()
{
	//ios::sync_with_stdio(false); cin.tie(0);
	string n;
	cin >> n;

	if(n[0] == n[1] && n[1] == n[2]) cout << "Yes\n";
	else if(n[2] == n[3] && n[1] == n[2]) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, M = list(map(int, sys.stdin.readline().split()))
A = [int(sys.stdin.readline()) for _ in range(M)]

MOD = 10 ** 9 + 7
A = np.array(A)


# https://atcoder.jp/contests/abc066/submissions/5721975
def mod_invs(max, mod):
    """
    逆元のリスト 0 から max まで
    https://atcoder.jp/contests/abc127/submissions/5630531
    ここから。あんまり良くわかってない
    :param max:
    :param mod:
    :return:
    """
    invs = [1] * (max + 1)
    for x in range(2, max + 1):
        invs[x] = (-(mod // x) * invs[mod % x]) % mod
    return invs


def get_factorials(max, mod=None):
    """
    階乗 0!, 1!, 2!, ..., max!
    :param int max:
    :param int mod:
    :return:
    """
    ret = [1]
    n = 1
    if mod:
        for i in range(1, max + 1):
            n *= i
            n %= mod
            ret.append(n)
    else:
        for i in range(1, max + 1):
            n *= i
            ret.append(n)
    return ret


def can_go():
    # 上までいける？
    return len(A) < 2 or min(np.diff(A)) > 1


factorials = get_factorials(N, MOD)


def mod_inv(a, mod):
    """
    a の逆元
    :param int a:
    :param int mod:
    :return:
    """
    return pow(a, mod - 2, mod)


def ncr(n, r, mod=None):
    """
    scipy.misc.comb または scipy.special.comb と同じ
    組み合わせの数 nCr
    :param int n:
    :param int r:
    :param int mod: 3 以上の素数であること
    :rtype: int
    """
    if n < r:
        return 0

    # 何度も呼ぶ場合は最大の n 以下の階乗を事前に計算しておくといい
    return (
            factorials[n]
            * mod_inv(factorials[r], mod)
            * mod_inv(factorials[n - r], mod)
            % mod
    )


if not can_go():
    print(0)
    exit()


def count(n):
    ans = 0
    for r in range(n):
        if r > n - r:
            break
        ans += ncr(n - r, r, MOD)
    return max(1, ans)


step = 0
ans = 1
for a in A:
    ans = ans * count(a - step - 1) % MOD
    step = a + 1
ans *= count(N - step)
print(ans % MOD)


Measured memory_bytes: 21668
import java.util.Scanner;

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

    while(true) {
      int n = in.nextInt();
      int x = in.nextInt();

      if (n == 0 && x == 0) break;

      int count = 0;
      for (int i = 1; i < (double)x / 3; i++) {
        for (int j = i + 1; j < (double)(x - i) / 2; j++) {
          if (x - (i + j) > n) {
            continue;
          }
          else {
            count += (x - i - 2 * j + 1) / 2;
            break;
          }
        }
      }
      System.out.println(count);
    }
  }
}

Measured memory_bytes: 26432
import sys
input = sys.stdin.readline
 
n,m = map(int,input().split())
 
#Union Find
par = [] #親
rank = [] #木の深さ
 
#初期化
for i in range(n):
    #par[i]:i rank[i]:0
    par.append(i)
    rank.append(0)
 
#木の根を求める
def find(x,par):
    if par[x] == x:
        return x
    else:
        return find(par[x],par)
 
#xとyの属する集合の併合
def unite(x,y,par,rank):
    x = find(x,par)
    y = find(y,par)
    
    if x != y:
        #xとyの属している集合が異なる時
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x]==rank[y]:
                rank[x] += 1
 
#xとyが同じ集合に属するかの判定
def same(x,y,par):
    return find(x,par) == find(y,par)
 
for i in range(m):
    X,Y,Z = map(int,input().split())
    unite(X-1,Y-1,par,rank)
 
tank = []
for i in range(n):
    p = find(i,par)
    tank.append(p)
print(len(set(tank)))

Measured memory_bytes: 17988
#include <bits/stdc++.h>
using namespace std;
int a, b;
int v[20][20];
bool taken[20][20];
vector<pair<int, int> > adj[110];
bool taken2[101][101];
int main()
{
	scanf("%d%d", &a, &b);
	for (int i = 1; i <= a; i++)
	{
		for (int j = 1; j <= b; j++)
		{
			scanf("%d", &v[i][j]);
		}
	}
	for (int i = 0; i <= 100; i++)
	{
		for (int j = 0; j <= 100; j++)
		{
			for (int k = 0; k <= 100; k++)
			{
				if (taken2[i][j]) break;
				if (i + j + k > 100) break;
				bool works = true;
				bool canhelp = false;
				for (int x = 1; x <= a && works; x++)
				{
					for (int y = 1; y <= b; y++)
					{
						if (i * x + j * y + k < v[x][y])
						{
							works = false;
							break;
						}
						else if (i * x + j * y + k == v[x][y] && !taken[x][y]) canhelp = true;
					}
				}

				if (!works) continue;
				if (!canhelp) continue;
				for (int x = 1; x <= a; x++)
				{
					for (int y = 1; y <= b; y++)
					{
						if (i * x + j * y + k == v[x][y])
						{
							taken[x][y] = true;
						}
					}
				}
				taken2[i][j] = true;
				adj[i].emplace_back(j, k);
			}
		}
	}
	for (int i = 1; i <= a; i++)
	{
		for (int j = 1; j <= b; j++)
		{
			if (!taken[i][j])
			{
				printf("Impossible\n");
				return 0;
			}
		}
	}
	int constant = 10*10;
	// 1 = sink
	// 2 - 101 = that many xs
	// 102 - 201 = that many ys
	// 202 (2*constant + 2) sink
	printf("Possible\n");
	vector<pair<pair<int, int> , char> > out;
	vector<pair<pair<int, int> , int> > out2;
	printf("%d ", 2*constant+2);
	for (int i = 1; i <= constant; i++)
	{
		out.emplace_back(make_pair(i, i+1), 'X');
	//	printf("%d %d X\n", i, i+1);
		out.emplace_back(make_pair(i+constant+1, i+constant+2), 'Y');
	//	printf("%d %d Y\n", i+constant+1, i + constant+2);
	}
	for (int i = 0; i <= constant; i++)
	{
		for (auto a : adj[i])
		{
			int y = a.first;
			y = constant-y;
			// 0 if 100
			y += constant+2;
			int wei = a.second;
			out2.emplace_back(make_pair(i+1, y), wei);
		}
	}
	printf("%lu\n", out.size() + out2.size());
	for (auto a : out) printf("%d %d %c\n", a.first.first, a.first.second, a.second);
	for (auto a : out2) printf("%d %d %d\n", a.first.first, a.first.second, a.second);
	printf("%d %d\n", 1, 2*constant+2);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define ll            long long

#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void sb()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int main()
{
	//sb();
    ll n;
    cin>>n;
    vector<ll> a;
    vector<ll> dp(n,0);
    for(int i=0;i<n;i++){
        ll num;
        cin>>num;
        a.pb(num);
    }
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(int i=2;i<n;i++){
        dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1];



return 0;
}



Measured memory_bytes: 2168
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int X;
    cin >> X;
  	if(X==2){
    	cout << X <<endl;
      	return 0;
    }
    for (int i = X; i <= 100100; i++)
    {
        for (int j = 2; j < i; j++)
        {
            if (i % j == 0)
            {
              break;
            }else if(i%j!=0&&j==i-1){
            	cout << i <<endl;
              	return 0;
            }
        }
    }
    return 0;
}

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, m, c;
	cin >> n >> m >> c;
	vector<int>b(m);

	int s;
	int ans = 0;
	for (int i = 0; i < m; i++)cin >> b[i];
	for(int i=0;i<n;i++)
	{
		s = 0;
		for(int j=0;j<m;j++)
		{
			int p;
			cin >> p;
			s += p*b[j];
		}
		if (s + c > 0)ans++;
	}
	cout << ans;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)
	switch {
	case a < b:
		fmt.Println("a < b")
	case a > b:
		fmt.Println("a > b")
	case a == b:
		fmt.Println("a == b")
	}
	return
}



Measured memory_bytes: 1088
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <random>
#include <tuple>

using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
const ll MOD = 1e9 + 7;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

//最大公約数
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll x, ll y){return x / gcd(x, y) * y;};


bool J(vector<ll> q){
  ll N = q.size();
  rep(i, N-1){
    if(q[i] > q[i+1]) return 0;
  }
  return 1;
}

int main(void){
  ll N;
  cin >> N;
  vector<ll> p(N);
  rep(i, N) cin >> p[i];


  rep(i, N)rep(j, N){
    vector<ll> q = p;
    swap(q[i], q[j]);
    if(J(q)){
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;


}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int A,B;
    cin >> A >> B;
    int S =0;
    for (int i = 1; i < N+1; i++){
        int p = i;
        int sum = 0;
        while(p >= 1){
        sum += p%10;
         p = p/10;
        }
        if ((A <= sum) && (sum <=B)){
            S += i;
        }
    }
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
T = input()
mm = 0
for i in range(len(S)-len(T)+1):
    a = S[i:i+len(T)]
    mm_now = sum([x == y for x,y in [*zip(a,T)]])
    mm = max(mm_now, mm)
print(len(T) - mm)


Measured memory_bytes: 8964
[n,k]=list(map(int,input().split()))
dlist=[]
alists=[]
for i in range(k):
    dlist.append(int(input()))
    alists.append(list(map(int,input().split())))

okashi=[0]*n
for i in range(k):
    for j in alists[i]:
        if okashi[j-1]==0:
            okashi[j-1]=1

ans=0
for i in range(n):
    if okashi[i]==0:
        ans+=1

print(ans)

Measured memory_bytes: 9208
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,M,P;
  cin >> N >> M >> P;
  while(N != 0){
    vector<int> A(N);
    int sum = 0;
    for(int i=0; i<N; i++){
      cin >> A[i];
      sum += A[i];
    }
    sum *= 100;
    sum -= sum*P/100;
    if(A[M-1] == 0){
      cout << 0 << endl;
    }else{
      cout << sum/A[M-1] << endl;
    }
    cin >> N >> M >> P;
  }
  return 0;
}



Measured memory_bytes: 3040
import scala.io.StdIn


object Main extends App {

  val Array(a, b, c)  = StdIn.readLine().split(" ").map(_.toInt)

  def solve(A: Int, B: Int, C: Int): String = {
    if (a < c & b > c) {
      "Yes"
    } else if (a > c & b < c) {
      "Yes"
    } else {
      "No"
    }
  }

  println(solve(a, b, c))
}
  




Measured memory_bytes: 25516
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

typedef long long ll;
int main(){
	int N, M; cin >> N >> M;
	vector<ll> k(M), p(M);
	vector<vector<ll> > s(M);

	for(int i = 0; i < M; ++i){
		cin >> k[i];
		for(int j = 0; j < k[i]; ++j){
			int si; cin >> si;
			s[i].push_back(si);
		}
	}
	for(int i = 0; i < M; ++i) cin >> p[i];


	int allcnt = 0;
	for(int i = 0; i < pow(2, N); ++i){
		int flag = 1;
		for(int j = 0; j < M; ++j){
			int cnt = 0;
			for(int l = 0; l < s[j].size(); ++l){
				if((i & (1<<(s[j][l]-1))) == (1<<(s[j][l]-1))) cnt++;
			}
			if(cnt % 2 != p[j]) { flag = 0; break; }
		}
		if(flag) allcnt ++;
	}

	cout << allcnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n,s;
lli q;
vll a;

lli sum = 0;
lli ans;

int main(){
    cin >> n >> q;
    a = vll(n);
    ans = n+1;
    for(lli i = 0;i < n;i++) cin >> a[i];
    for(lli i = 0;i < q;i++){
        cin >> s;
        ans = 0;
        sum = 0;
        for(lli i = 0,j = 0;i < n;){
            sum += a[i++];
            while(j < n && sum > s) sum -= a[j++];
            ans += i-j;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3496
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()

class SegmentTree(object):
    def __init__(self, A, dot, unit):
        n = 1 << (len(A) - 1).bit_length()
        tree = [unit] * (2 * n)
        for i, v in enumerate(A):
            tree[i + n] = v
        for i in range(n - 1, 0, -1):
            tree[i] = dot(tree[i << 1], tree[i << 1 | 1])
        self._n = n
        self._tree = tree
        self._dot = dot
        self._unit = unit

    def __getitem__(self, i):
        return self._tree[i + self._n]

    def update(self, i, v):
        i += self._n
        self._tree[i] = v
        while i != 1:
            i >>= 1
            self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])

    def add(self, i, v):
        self.update(i, self[i] + v)

    def sum(self, l, r):
        l += self._n
        r += self._n
        l_val = r_val = self._unit
        while l < r:
            if l & 1:
                l_val = self._dot(l_val, self._tree[l])
                l += 1
            if r & 1:
                r -= 1
                r_val = self._dot(self._tree[r], r_val)
            l >>= 1
            r >>= 1
        return self._dot(l_val, r_val)

def resolve():
    n, m = map(int, input().split())
    E = [[] for _ in range(n)]
    for _ in range(m):
        u, v, w = map(int, input().split())
        u -= 1; v -= 1
        E[u].append((v, w))

    tree = SegmentTree([INF] * n, min, INF)
    tree.update(0, 0)
    for v in range(n):
        for nv, w in E[v]:
            tree.update(nv, min(tree[nv], tree.sum(v, nv) + w))

    ans = tree[n - 1]
    if ans == INF:
        ans = -1
    print(ans)
resolve()

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct edge {
  int to, cost;
  edge(){}
  edge(int to, int cost):to(to), cost(cost){}
};

int N, M, R, Q;
vector< vector<edge> > graph;
vector<int> mincost[11];

void dijkstra(int r) {
  mincost[r].resize(N+1, inf);
  priority_queue< pint, vector<pint>, greater<pint> > que;
  reps(i, 1, N+1) if(i%R == r) {
    mincost[r][i] = 0;
    que.emplace(0, i);
  }
  while(que.size()) {
    pint p = que.top(); que.pop();
    int v = p.second;
    if(mincost[r][v] < p.first) continue;
    for(edge& e : graph[v]) {
      if(e.cost + mincost[r][v] < mincost[r][e.to]) {
	mincost[r][e.to] = e.cost + mincost[r][v];
	que.emplace(mincost[r][e.to], e.to);
      }
    }
  }
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> N >> M >> R >> Q;
  graph.resize(N+1);
  rep(i, M) {
    int a, b, c;
    cin >> a >> b >> c; //--a, --b;
    graph[b].emplace_back(a, c);
  }
  rep(i, R) dijkstra(i);
  int ans = 0;
  rep(i, Q) {
    int x, y, z;
    cin >> x >> y >> z; //--x, --y;
    int tmp = 0;
    rep(j, R) chmax(tmp, z-mincost[j][x]-mincost[j][y]);
    ans += tmp;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 16704
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
	int N,d[110];
	cin >> N;
	for(int i=0;i<N;i++) cin >> d[i];
	
	sort(d, d+N, greater<int>());
	
	int ans = 1;
	for(int i=0;i<N-1;i++){
		if(d[i]>d[i+1]){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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


int main(){
    int h, w;
    while(1){
        cin >> h >> w;
        if(h == 0){
            break;
        }
        char a[h][w] = {};
        
        int i, j;
        for(i = 0; i < h; i++){
            for(j = 0; j < w; j++){
                a[i][j] = '#';
            }
        }
        
        for(i = 0; i < h; i++){
            for(j = 0; j < w; j++){
                cout << a[i][j];
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3108
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<iomanip>
using namespace std;
 
int main(){
	int r;
 
	cin>>r;
 
	cout<<fixed<<setprecision(20)<<r*2*M_PI<<endl;
 
	return 0;
}

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

int main() {
    // 素数テーブル
    const int MAX = 1e5 + 100;
    vector<bool> is_prime(MAX, true);
    is_prime[0] = false;
    is_prime[1] = false;
    for (int i = 2; i < MAX; i++) {
        if (is_prime[i] == true) {
            for (int j = 2; i * j < MAX; j++) {
                is_prime[i * j] = false;
            }
        }
    }
    // 累積和
    vector<int> num(MAX);
    for (int i = 2; i < MAX; i++) {
        num[i] = num[i - 1];
        if (is_prime[i] == true and is_prime[(i + 1)/2] == true) {
            num[i]++;
        }
    }

    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int l, r;
        cin >> l >> r;
        cout << num[r] - num[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val S = sc.next

    (S.count { _ == '+' } - S.count { _ == '-' }).toString
  }
}


Measured memory_bytes: 25776