akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long int lli;
typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<pll> vop;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define REP(i,a,b) for( long long i=a;i<b;i++)
#define REPR(i,a,b) for(long long i=a;i>=b;i--)
#define adb(a) for(auto ii:a) cout << ii << " "; cout << endl
#define adp(a) for(auto ii:a) cout << ii.F << " " << ii.S << endl;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define endl "\n"
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define PI 3.14159265358979323846
const ll MAXN = 100007;
const ll p = 1000000007;
#define N 200003
#define INF INTMAX_MAX

struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1> {}(p.first);
        auto hash2 = hash<T2> {}(p.second);
        return hash1 ^ hash2;
    }
};

struct LessSecond
{
    template<typename T, typename U>
    bool operator()(const std::pair<T, U> &x, const std::pair<T, U> &y) const
    {
        return x.second < y.second;
    }
};

// ll dx[] = {1, -1, 0, 0};
// ll dy[] = {0, 0, 1, -1};
ll power(ll a, ll b, ll m) { ll ans = 1; a = a % m; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; }

ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); }

ll modInverse(ll a, ll m) { ll g = __gcd(a, m); return power(a, m - 2, m); }

bool cmp(const pll &a, const pll &b)
{
    if (a.F != b.F) {
        return a.F > b.F;
    }
    else
        return a.S < b.S;
}

// bool check(ll i, ll j)
// {
//     if (i >= 0 && i < n && j >= 0 && j < m && a[i][j] != '#')
//         return true;
//     return false;
// }

int main()
{


    fastIO;
    int test = 1;
    //cin >> test;
    while (test--)
    {
        ll n;
        cin >> n;
        ll a[n];
        REP(i, 0, n) cin >> a[i];
        ll x = a[0];
        ll ans = 0;
        REP(i, 1, n)
        {
            ans += max(0ll, x - a[i]);
            x = max(a[i], x);
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 5172
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    m = II()
    print(48-m)
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    a = II()
    ans = inf
    b = 0
    for k in range(1, 10 ** 5):
        b += a
        ans = min(ans, sum(list(map(int, list(str(b))))))
    print(ans)
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 39408
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    int64_t x;
    cin >> x;
    int64_t cnt = (x / 11) * 2;
    if (x % 11 == 0)
    {
        cout << cnt << endl;
    }
    else if (x % 11 <= 6)
    {
        cout << cnt + 1 << endl;
    }
    else
    {
        cout << cnt + 2 << endl;
    }
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, asin, atan, sqrt, tan, cos, pi
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353


n = I()
A = LI()
D = Counter(A)
min_a = min(A)
max_a = min_a * 2 if D[min_a] == 1 else min_a * 2 - 1
if D[min_a] > 2:
    print("Impossible")
    exit()
flg = 0
for i in range(min_a + 1, max_a + 1):
    if D[i] < 2:
        print("Impossible")
        exit()
    D[i] -= 2

for k in D.keys():
    if k > max_a:
        print("Impossible")
        exit()

print("Possible")



















Measured memory_bytes: 81460
#include <iostream>
using namespace std;
const char a[]={'A','B','C','D','E','F','G','H',\
'I','J','K','L','M','N','O','P','Q','R','S',\
'T','U','V','W','X','Y','Z','A','B','C','D',\
'E','F','G','H','I','J','K','L','M','N','O',\
'P','Q','R','S','T','U','V','W','X','Y'};
int p(char c)
{
	int f;
	for(int i=0;;++i)
	{
		if(a[i]==c)
		{
			f=i;
			break;
		} 
	}
	return f;
}
int main()
{
    int n;
    cin>>n;
    n=n%26;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
    	s[i]=a[p(s[i])+n];
	}
	cout<<s;
    return 0;
}

Measured memory_bytes: 256
#N = int(input())
#S = input()
S = list(input())

#N,K=map(int,input().split())
#S=list(map(int,input().split()))


ans='Yes'

for i,s in enumerate(S):
    
    if i%2==0: #guusuu mojiretu
        if s=='L':
            ans='No'
    else:
        if s=='R':
            ans='No'





print(str(ans))

Measured memory_bytes: 38384
//#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <math.h>
#define OO INT_MAX
#define mp(x,y) make_pair(x,y)
#define x first
#define y second
#define ll unsigned long long int
#define pp pair<int,int>
#define heap priority_queue<pp, vector<pp>, greater<pp>>
using namespace std;

int ans;
string  s;
string s1;
void check(string str, int i) {
	if (i == s.size()) {
		if (str == "ABC")
			ans++;
		return;
	}
	s1 = str;
	check(s1,i+1);
	s1 = str + s[i];
	check(s1, i + 1);
}

int main()
{
//	freopen("test.txt", "r", stdin);
	ll a, t, k;
	cin >> t >> a >> k;
	swap(a, t);
	if (k >= a) {
		k -= a;
		a = 0;
		if (k > t) {
			t = 0;
		}
		else {
			t -= k;
		}
	}
	else {
		a -= k;
	}
	cout << a << " " << t;
}




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

int main() {
  int h, n, a, b;
  cin >> h >> n;
  vector<int> dp(h + 1, 100000001);
  dp[0] = 0;
  for(int i = 0; i < n; i++) {
    cin >> a >> b;
    for(int j = 0; j < h; j++)
      dp[min(h, j + a)] = min(dp[min(h, j + a)], dp[j] + b);
  }
  cout << dp[h] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		boolean result = false;

		if (a + b == c) {
			result = true;
		}
		else if (b + c == a) {
			result = true;
		}
		else if (c + a == b) {
			result = true;
		}

		if (result) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 9044
#include<stdio.h>
int main()
{
    long long int a,b,c=0,o,e,d=1,i,t,j,n,y,k,m,l,r=0;
    scanf("%lld%lld",&n,&k);
    long long int x[n];
    for(i=0;i<n;i++){x[i]=0;}
    for(i=0;i<k;i++)
    {
        scanf("%lld",&a);
        for(j=1;j<=a;j++)
        {
            scanf("%lld",&b);
            x[b-1]++;
        }
    }
    for(i=0;i<n;i++)
    {
        if(x[i]==0){c++;}
    }
    printf("%lld\n",c);


}


Measured memory_bytes: 1688
# -*- coding: utf-8 -*-
import sys
import math
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template

# BEGIN CUT HERE
import collections
class Devisor(int):
    def __init__(self, n: int):
        self.val = n

    def isprime(self):
        if self.val <= 1:
            return 0
        for i in range(2, int(math.sqrt(self.val)) + 1):
            if self.val % i == 0:
                return 0
        return 1

    def factorize(self):
        res = collections.defaultdict(int)
        n = self.val
        i = 2
        while i * i <= n:
            while n % i == 0:
                n //= i
                res[i] += 1
            i += 1
        if n != 1:
            res[n] += 1
        return res

    def divisor(self):
        n = self.val
        ret = list()
        for i in range(1, int(math.sqrt(n)) + 1):
            if n % i == 0:
                ret.append(i)
                ret.append(n // i) if i * i != n else None
        return ret

# END CUT HERE

def main():
    N = ii()
    d = Devisor(N).divisor()
    m = 10**18
    for x in d:
        if x + N // x < m:
            m = x + N // x
    print(m - 2)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 39536
n,m = map(int, input().split())
H = list(map(int, input().split()))
d = {i:[] for i in range(1, n+1)}

for _ in range(m):
  a,b = map(int, input().split())
  d[a].append(b)
  d[b].append(a)
  
count = 0  
  
for k,v in d.items():
  if not v:
    count += 1
  else:
    flg = True
    for v_i in v:
      if H[k-1]<=H[v_i-1]:
        flg = False
        break
    if flg:
      count += 1
    
print(count)

Measured memory_bytes: 37912
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeSearch(Node u, int k){
  if((u==NIL)||(k==u->key)){
    return u;
  }
  if(k<u->key){
    return treeSearch(u->left,k);
  }else{
    return treeSearch(u->right,k);
  }
  
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if((z->key)<(x->key)){
      x = x->left;
    }else{
      x = x->right;
    }
  }

  z->parent=y;

  if(y==NIL){
    root=z;
  }else if((z->key) < (y->key)){
    y->left=z;
  }else{
    y->right=z;
  }
}

void inorder(Node u){
  if(u==NIL){
    return;
  }
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
  
}
void preorder(Node u){
  if(u==NIL){
    return;
  }
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else{
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 20520
#include<iostream>
#include<cctype>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cctype>
#include<cstring>
#include<utility>
#include<cmath>
const int inf=0x7fffffff;
typedef long long int ll;
using namespace std;
#define L 0
#define R 1
int B[10+5];
vector <int > T[2];
bool flag;
void solve(int i){
	if(flag)return;
	if(i==10){flag=1;return;}
	for(int C=0;C<2;C++){
//	cout<<i<<flag<<endl;
//	cout<<T[C].back()<<endl;
//	cout<<B[i]<<endl;
	if(T[C].back()<B[i]){
		T[C].push_back(B[i]);
		solve(i+1);
		T[C].pop_back();
//		for(int x:T[C]){
//			cout<<x<<' ';
//		}
//		cout<<endl;
	}
	}
}
int main()
{
	int n;
	scanf("%d",&n);
	while(n--){
		for(int i=0;i<=9;i++){
			scanf("%d",B+i);
		}
		flag=0;
		T[R].push_back(0);
		T[L].push_back(0);
		solve(0);
		puts(flag?"YES":"NO");
	}
	return 0;
}
//aoj0033.cc
//generated automatically at Thu Sep  8 18:32:18 2016
//by xsthunder

Measured memory_bytes: 1188
import re
s = input()
t = input()

s = s.replace("?", ".")[::-1]
t = t[::-1]

for i in range(len(s) - len(t) + 1):
  if re.match(s[i:i+len(t)], t):
    s = s[:i].replace(".","a") + t + s[i+len(t):].replace(".","a")
    print(s[::-1])
    break
else:
  print("UNRESTORABLE")

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <sstream>
#include <cmath>
using namespace std;
const int inf =0x3f3f3f3f;
typedef long long LL;
const int MAXN=100010;
int a[MAXN];
int main()
{
    LL n, x;
    while(~scanf("%lld %lld", &n, &x))
    {
        LL sum=0;
        for(int i=1;i<=n;++i)
            scanf("%d", &a[i]);
        for(int i=1;i<=n-1;++i)
        {
            if(a[i]+a[i+1]>=x)
            {
                LL t=a[i]+a[i+1]-x;
                sum+=t;
                if(t>=a[i+1])
                    a[i+1]=0;
                else
                    a[i+1]-=t;
            }
        }
        printf("%lld\n", sum);
    }
    return 0;
}


Measured memory_bytes: 640
#include<iostream>

using namespace::std;
#define int long long int
#define MOD 1000000007

int ar[105],dp[105][200005];

main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
		cin>>ar[i];
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<=k;j++)
			dp[i+1][j]=(((dp[i+1][j]+dp[i][j])%MOD)+MOD)%MOD,dp[i+1][j+ar[i]+1]=(((dp[i+1][j+ar[i]+1]-dp[i][j])%MOD)+MOD)%MOD;
		for(int j=1;j<=k;j++)
			dp[i+1][j]=(((dp[i+1][j]+dp[i+1][j-1])%MOD)+MOD)%MOD;
	}
	cout<<dp[n][k]<<'\n';
}


Measured memory_bytes: 158464
#include<bits/stdc++.h>
#include<string>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
//#define mod 1000000007
#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)


int main(){

    fast
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	ll x,y;
    	cin>>x>>y;
    	if(y%2==1)
    	{
    		cout<<"No";
    		return 0;
		}
		y=y/2;
		if(x>y)
		{
			cout<<"No";
			return 0;
		}
		if(y>2*x)
		{
			cout<<"No";
			return 0;
		}
		cout<<"Yes";
		
    	
    	

}
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

template <class Container>
std::vector<int> zalgo(const Container& dat) {
    int n = dat.size();

    std::vector<int> ret(n);
    ret[0] = n;

    int i = 1, len = 0;
    while (i < n) {
        while (i + len < n && dat[len] == dat[i + len]) {
            ++len;
        }
        ret[i] = len;

        if (len == 0) {
            ++i;
            continue;
        }

        int nlen = 1;
        while (i + nlen < n && nlen + ret[nlen] < len) {
            ret[i + nlen] = ret[nlen];
            ++nlen;
        }

        i += nlen;
        len -= nlen;
    }

    return ret;
}

int run(const std::string& s) {
    int n = s.length();
    auto zs = zalgo(s);

    int l;
    for (l = 1; l < n; ++l) {
        bool judge = true;
        for (int i = l; i < n; i += l) {
            if (zs[i] < l) judge = false;
        }
        if (judge) break;
    }
    return l;
}

void solve() {
    std::string s;
    std::cin >> s;

    int n = s.length();
    int l = run(s);

    if (l == n) {
        std::cout << 1 << std::endl
                  << 1 << std::endl;
    } else if (l == 1) {
        std::cout << n << std::endl
                  << 1 << std::endl;
    } else {
        std::vector<bool> fore(n + 1, true);
        auto zs = zalgo(s);
        for (l = 1; l < n; ++l) {
            for (int i = l; i < n; i += l) {
                if (zs[i] < l) break;
                fore[i + l] = false;
            }
        }

        std::vector<bool> back(n + 1, true);
        std::reverse(s.begin(), s.end());
        zs = zalgo(s);
        for (l = 1; l < n; ++l) {
            for (int i = l; i < n; i += l) {
                if (zs[i] < l) break;
                back[i + l] = false;
            }
        }

        int ans = 0;
        for (int i = 1; i < n; ++i) {
            if (fore[i] && back[n - i]) ++ans;
        }

        std::cout << 2 << std::endl
                  << ans << std::endl;
    }
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}


Measured memory_bytes: 4728
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define LL       long long
#define DS       pair<LL, LL>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    LL n, k;
    cin >> n >> k;
    LL ans = log10(n) / log10(k) + 1;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String one = sc.next();
		String two = sc.next();
		
		StringBuffer buf = new StringBuffer();
	
		buf.append(two);
		buf.append(one);
		String ans = buf.toString();
		
		System.out.println(ans);
	}

}


Measured memory_bytes: 35660
s=input()
k=int(input())
ans=""
for i in s[:-1]:
    if i=="a":
        ans+=i
        continue
    if k>=123-ord(i):
        k-=123-ord(i)
        ans+="a"
    else:
        ans+=i
i=s[-1]
ans+=chr((ord(i)+k-97)%26+97)
print(ans)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn =1e5+5;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	a-=b;
	if(c>=a)
    {
        cout<<c-a<<'\n';
    }
    else
        cout<<0<<'\n';





}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`

	3 3 0
	100 -100 0
	0 100 100
	100 100 100
	-100 100 100

	`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */

	n, m, c := nextInt(), nextInt(), nextInt()
	b := nextInts(m)

	ans := 0

	for i := 0; i < n; i++ {
		a := nextInts(m)
		w := 0
		for j := 0; j < m; j++ {
			w += a[j] * b[j]
		}
		if w+c > 0 {
			ans++
		}
	}

	fmt.Fprintln(out, ans)
}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


Measured memory_bytes: 640
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		char[] s  = sc.nextLine().toCharArray();
		int ans = 0;
		int rain = 0;
		
		for(char c : s) {
			if(c == 'R') {
				rain++;
				if(ans < rain) {
					ans = rain;
				}
			}else {
				rain = 0;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
	
}




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

using namespace std;

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

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

	int n;
	cin >> n;

	vector<int> p(n+1);
	rep(i, n) cin >> p[i+1];

	vector<pii> v(n);
	rep(i, n) v[i] = (pii){p[i+1], i+1};
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());

	multiset<int> ms;
	ms.insert(0);
	ms.insert(0);
	ms.insert(n+1);
	ms.insert(n+1);

	ll ans = 0;
	rep(i, n){
		int num = v[i].first;
		int id = v[i].second;

		auto itr = ms.lower_bound(id);
		ll y = *itr;

		itr++;
		ll z = *itr;

		itr--;
		itr--;
		ll x = *itr;

		itr--;
		ll w = *itr;

		ans += (x - w) * (y - id) * num;
		ans += (id - x) * (z - y) * num;

		// cout << w << " " << x << " " << id << " " << y << " " << z << endl;
		// cout << "add:" << (x - w) * (y - id) * num << endl;
		// cout << "add:" << (id - x) * (z - y) * num << endl;
		ms.insert(id);
	}

	cout << ans << endl;
}


Measured memory_bytes: 6144
#include "bits/stdc++.h"
using namespace std;

const int N=1e5+20;

int n,k,a[N];

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);

	sort(a,a+n);
	printf("%d",accumulate(a,a+k,0));
}

Measured memory_bytes: 3832
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n, m;
    scanf("%ld%ld", &n, &m);

    vector<long> x(n);
    vector<long> y(m);
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &x[i]);
    }
    for(i=0; i<m; i++) {
        scanf("%ld", &y[i]);
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

#if 0
    ll sumx=0;
    long j;
    for(i=0; i<n-1; i++) {
        for(j=i+1; j<n; j++) {
            sumx += (x[j]-x[i]);
            sumx %= MOD;
        }
    }

    ll sumy=0;
    for(i=0; i<m-1; i++) {
        for(j=i+1; j<m; j++) {
            sumy += (y[j]-y[i]);
            sumy %= MOD;
        }
    }

#else
    ll sumx=0;
    for(i=0; i<n; i++) {
        sumx = (sumx + (i-(n-1-i))*(ll)x[i]);
        if(sumx>0) sumx = sumx %MOD;
        else       sumx = (MOD - (-sumx) %MOD)%MOD;
    }

    ll sumy=0;
    for(i=0; i<m; i++) {
        sumy = (sumy + (i-(m-1-i))*(ll)y[i]);
        if(sumy>0) sumy = sumy %MOD;
        else       sumy = (MOD - (-sumy) %MOD)%MOD;
    }
#endif

    printf("%lld\n", sumx*sumy%MOD);

    return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

#define int long long

#if defined(__GNUC__)
#define __int32 __int32_t
#endif // __GNUC__

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); (i)++)
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) sort(ALL(x))
#define RSORT(x, T) sort(ALL(x), greater<(T)>())
#define REVERCE(x) reverce(ALL(x))

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

	int n, m;

	cin >> n >> m;

	vector<int> box(n, 100000000);

	struct key {
		itn plice;
		itn kindValue;
		itn kind;
	};

	vector<key> keys(m);
	int kind_part;

	for (int i = 0; i < keys.size(); i++) {
		cin >> keys[i].plice >> keys[i].kindValue;
		for (int j = 0; j < keys[i].kindValue; j++) {
			cin >> kind_part;
			keys[i].kind |= 1 << (kind_part - 1);
		}
	}

	vector<vector<itn>> dp(m + 1);

	REP(i, dp.size()) {
		dp[i].resize(pow(2, n), pow(2, 30));
	}

	dp[0][0] = 0;

	REP2(i, 1, dp.size()) {
		REP(j, dp[i].size())dp[i][j] = dp[i - 1][j];
		REP(j, dp[i].size()) {
			dp[i][j | keys[i - 1].kind] = min(dp[i - 1][j] + keys[i - 1].plice, dp[i][j | keys[i - 1].kind]);
		}
	}

	if (dp[m][pow(2, n) - 1] == pow(2, 30)) {
		cout << -1;
	}
	else {
		cout << dp[m][pow(2, n) - 1];
	}

	return 0;
}

Measured memory_bytes: 16384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char S[100],TD[100],T[102];
	cin>>S>>TD;
	int len=strlen(S);
	for(int i=1;i<=len;i++) T[i]=TD[i-1];
	for(int i=0;i<len;i++)
	{
		T[0]=T[len];
		for(int j=len;j>0;j--) T[j]=T[j-1];
		for(int j=1;j<=len;j++) TD[j-1]=T[j];
		int shenniu=strcmp(S,TD);
		if(shenniu==0){cout<<"Yes"<<endl;return 0;};
	};
	cout<<"No"<<endl;return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int kumi;

int saiki(int n,int s,int k){
	if(s==0 && n==0){
		++kumi;
		return 0;
	}
	
	int i;
	for(i=k+1;i<10;i++){
		saiki(n-1,s-i,i);
	}
	return 0;
}
		

main(){
	int n,s,i;
	
	while(0<=scanf("%d%d",&n,&s)){
		if(n==0 && s==0)break;
		kumi=0;
		for(i=0;i<10;i++){
			saiki(n-1,s-i,i);
		}
		printf("%d\n",kumi);
	}
	return 0;
}

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

using namespace std;

const int INF = 1 << 30;
const std::vector<int> dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1};

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H, W;
  cin >> H >> W;
  int sy, sx, gy, gx;
  cin >> sy >> sx >> gy >> gx;
  sy--, sx--, gy--, gx--;
  vector<string> S(H);
  for (auto &e : S) {
    cin >> e;
  }
  priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>,
                 greater<pair<int, pair<int, int>>>>
      que;
  que.push(make_pair(0, make_pair(sy, sx)));
  vector G(H, vector(W, INF));
  while (!que.empty()) {
    auto q = que.top();
    que.pop();
    int c = q.first, y = q.second.first, x = q.second.second;
    for (int i = 0; i < 4; i++) {
      int ny = y + dy[i], nx = x + dx[i];
      if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
      if (S[ny][nx] == '#') continue;
      if (chmin(G[ny][nx], c)) {
        que.push(make_pair(G[ny][nx], make_pair(ny, nx)));
      }
    }
    for (int i = -2; i < 3; i++) {
      for (int j = -2; j < 3; j++) {
        int ny = y + i, nx = x + j;
        if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
        if (S[ny][nx] == '#') continue;
        if (chmin(G[ny][nx], c + 1)) {
          que.push(make_pair(G[ny][nx], make_pair(ny, nx)));
        }
      }
    }
  }
  if (G[gy][gx] == INF) {
    cout << -1 << '\n';
  } else {
    cout << G[gy][gx] << '\n';
  }
  return 0;
}


Measured memory_bytes: 8492
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		int judge = 0;

		for(int i=0; i<B; i++) {
			if((i*A)%B != C) {
				judge += 0;
			}else {
				judge += 1;
			}
		}

		if(judge == 0) {
			System.out.println("NO");
		}else {
			System.out.println("YES");
		}


	}

}


Measured memory_bytes: 21716
/*
	################
	# Avi Kasliwal #
	# Noob Coder:( #
	################
*/

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;

#define int long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)


#define deb(x) cout << "#x " << x << "\n"


#define newline cout << "\n"
#define yes cout << "Yes" << "\n"
#define no cout << "No" << "\n"
#define Yes cout << "YES" << "\n"
#define No cout << "NO" << "\n"


#define fixDeci(num, places) std::cout << std::fixed << std::setprecision(places) << num << '\n'
#define setBits(x) __builtin_popcount(x)
#define zerobits(x) __builtint_ctzll(x)
#define MOD 1000000007

#define rep(i, s, e) for (i = s; i < e; i++)
#define repr(i, s, e) for (i = s; i >= e; i--)

// GCD Function
int GCD(int a, int b) {
	if (b == 0) {
		return a;
	} else {
		return GCD(b, a % b);
	}
}

// LCM Function
int LCM(int a, int b) {
	int gcd = GCD(a, b);
	return (max(a, b) / gcd)*(min(a, b));
}

/*int p[100000001];
void Sieve() {
	p[0] = p[1] = 0;
	p[2] = 1;
	for (int i = 4; i < 100000000; i += 2) {
		p[i] = 0;
	}
	for (int i = 3; i * i < 100000000; i++) {
		if (p[i] == 1) {
			for (int j = i*i; j < 100000000; j += i) {
				p[j] = 0;
			}
		}
	}
}*/

int32_t main () {
	IOS; int i, j;

	/*######## Code Here ##########*/
	/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
	
	int t; t = 1;
	while (t--) {
		int n, k; cin >> n >> k;
		int a[n];
		rep (i, 0, n) {
			cin >> a[i];
		}
		int dp[n];
		rep (i, 0, n) {
			dp[i] = INT_MAX;
		}
		dp[0] = 0;
		rep (i, 1, n) {
			for (int j = i - 1; j >= i - k; j--) {
				if (j < 0) {
					break;
				}
				dp[i] = min(dp[i], dp[j] + abs(a[j] - a[i]));
			}
		}
		cout << dp[n - 1] << "\n";
	}

	return 0;
}

/*Timus : 294930IX */

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll n,a,ans=0;cin>>n;
  map<ll,int> m;
  rep(i,n){
    cin>>a;
    m[a]++;
  }
  reps(x,m){
    if(x.se%2){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define gcd __gcd 
#define digits(n) (int)(log10(n) + 1)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vl;
typedef vector <pll> vll;
typedef vector <pii> vii;

const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;

template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

/********** TEMPLATE ENDS HERE ***********/

const int DIM = 1e5 + 7;

int op[DIM];

main()
{
	IOS
	
	int n;
	cin >> n;
	
	for(int i = 1; i <= n; i++) 
	{
		op[i] = op[i - 1] + 1;
		for(int j = 6; j <= i; j *= 6) 
		{
			op[i] = min(op[i - j] + 1, op[i]);
		}
		
		for(int j = 9; j <= i; j *= 9) 
		{
			op[i] = min(op[i - j] + 1, op[i]);
		}
	}
 
	cout << op[n];
}

Measured memory_bytes: 640
import collections
N = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a)
a = a.most_common()
ans = 0
for i in range(len(a)):
  if a[i][0] <= a[i][1]:
    ans += a[i][1] - a[i][0]
  else:
    ans += a[i][1]
    
print(ans)

Measured memory_bytes: 21232
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=2e5;
const int INF=1e9;
int main(){
	int N;cin>>N;
	float A[N];
	rep(i,0,N) cin>>A[i];
	sort(A,A+N);
	float temp=A[0];
	rep(i,1,N) temp=(temp+A[i])/2;
	cout<<setprecision(14)<<temp<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

class TEST{
	static void Main(){
		
		while(true){
			var n=int.Parse(Console.ReadLine());
			if(n==0)break;
			Dictionary<int,ulong> SaleResult=new Dictionary<int,ulong>();
			for(int i=0;i<n;i++){
				String[] s=Console.ReadLine().Split(' ');
				int shain = int.Parse(s[0]);
				ulong sales =(ulong.Parse(s[1]))*(ulong.Parse(s[2]));
				if(SaleResult.ContainsKey(shain)==false){
					SaleResult.Add(shain,0);
				}
				SaleResult[shain]+=sales;
			}
			int chk=0;
			foreach(int shain in SaleResult.Keys){
				if(SaleResult[shain]>=1000000){
					Console.WriteLine("{0}",shain);
					chk++;
				}
			}
			if(chk==0)Console.WriteLine("NA");		
		}
	}
}

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

using namespace std;

int n;
static const int MAX_N = 200000;
int R[MAX_N];

int main(){
  cin >> n;
  for(int i = 0; i < n; i++)
    cin >> R[i];
  int maxv = -2000000000;
  int minv = R[0];
  for(int i = 1; i < n; i++){
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }
  cout << maxv << endl;
}

Measured memory_bytes: 1940
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
using namespace std;
int main () { 
	int x;
	cin >> x;
		if(x >= 15){
			x = (x*800) - 200*(x / 15);
				cout << x << endl;
		}else{
			x = x*800;
				cout << x << endl;
		}
} 			


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	string a;
	int s;
	cin>>a;
	s=a.length()-2;
	cout<<a[0]<<s<<a[a.length()-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#ifdef on_linux
	#include <sys/resource.h>
#endif

#ifdef dobby_is_a_free_elf
	#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
	#define trace(...) 0;
#endif

using namespace std;
using namespace __gnu_pbds;


#define all(x)                  (x).begin(), (x).end()
#define between(i,x,y)          ((i) >= (x) && (i) <= (y))
#define DECIMAL(n)              cout << fixed << setprecision(n)
#define fi                      first
#define lbd                     lower_bound
#define mem0(x)                 memset(x, 0, sizeof (x))
#define mem1(x)                 memset(x, -1, sizeof (x))
#define mp                      make_pair
#define pb                      push_back
#define pf                      push_front
#define ppb                     pop_back
#define ppf                     pop_front
#define sc                      second
#define sqr(a)                  ((a) * (a))
#define sz(x)                   (int)((x).size())
#define ubd                     upper_bound

#define int                     long long

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template <typename T>
using ordered_set = tree<T, null_type,
      less<T>,
      rb_tree_tag,
      tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0
// order_of_key(k) returns count of elements strictly smaller than k


const long double PI = 3.14159265358979323846264338;
const double eps = 1e-10;
#ifdef int
	const long long INF = 1e18;
#else
	const long long INF = 1e9;
#endif
const int32_t fftmod = 998244353;
const int32_t MOD = 1000000007;
const int32_t N = 1e5 + 10;
const int32_t NN = 1e6 + 10;

inline void add(int &a, int b) {
	a %= MOD;
	b %= MOD;
	a += b;
	if (a >= MOD) { a -= MOD; }
}

inline void sub(int &a, int b) {
	a %= MOD;
	b %= MOD;
	a -= b;
	if (a < 0) { a += MOD; }
}

inline int mul(int a, int b) {
	a %= MOD;
	b %= MOD;
	return (int) ((long long) a * b % MOD);
}

inline int power(int a, long long b) {
	int res = 1;
	while (b > 0) {
		if (b & 1) {
			res = mul(res, a);
		}
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}

inline int inv(int a) {
	a %= MOD;
	if (a < 0) { a += MOD; }
	int b = MOD, u = 0, v = 1;
	while (a) {
		int t = b / a;
		b -= t * a; swap(a, b);
		u -= t * v; swap(u, v);
	}
	assert(b == 1);
	if (u < 0) { u += MOD; }
	return u;
}

inline void elf_magic(int testcase)
{
	int n;
	cin >> n;
	if (n == 1) {
		cout << 0;
	} else {
		cout << ((power(10, n) - mul(2, power(9, n)) + MOD) % MOD + power(8, n)) % MOD;
	}

	return;
}

int32_t main()
{
	#ifdef on_linux
	rlimit cpu_time {.rlim_cur = 2, .rlim_max = RLIM_INFINITY};
	setrlimit(RLIMIT_CPU, &cpu_time);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int TESTS = 1;
	//cin >> TESTS;
	for (int i = 1; i <= TESTS; ++i) {
		// cout << "Case #" << i << ": ";
		elf_magic(i);
		if (i != TESTS)	{ cout << '\n'; }
	}
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct TEMP_OMAZINAI_ { TEMP_OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } TEMP__omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void TEMP_INPUT_IMPL_() {};
template <class T, class... Args> void TEMP_INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; TEMP_INPUT_IMPL_(args...); }
void TEMP_OUTPUT_IMPL_() {};
template <class T, class... Args> void TEMP_OUTPUT_IMPL_(T dest, Args... args) { cout << dest << (sizeof...(Args) ? " " : ""); TEMP_OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; TEMP_INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define rsort_v(v) std::sort(v.rbegin(), v.rend())
#define unique_v(v) v.erase(std::unique(v.begin(), v.end()), v.end()) //必ずソート後に実行
#define out(...) (TEMP_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))
 
// ^^^ Template ^^^ //

ll atu[60], p[60];
ll burger(ll level, ll X){
	if(!level) return 0<X;
	if(X<=1+atu[level-1]) return burger(level-1, X-1);
	else return p[level-1] + 1 + burger(level-1, X-2-atu[level-1]);
}

int main() {
	in(ll, N, X);
	p[0] = atu[0] = 1;
	loop(i, 55) atu[i+1] = 2*atu[i] + 3;
	loop(i, 55) p  [i+1] = 2*  p[i] + 1;
	out(burger(N, X));
}



Measured memory_bytes: 256
n,k = map(int,input().split())
h = []
for i in range(n):
    temp = int(input())
    h.append(temp)
h.sort()
i = 0
min = h[k-1]-h[0]
while i+k <= n:
    if min > (h[k+i-1]-h[i]):
        min = h[k+i-1]-h[i]
    i += 1
print(min)

Measured memory_bytes: 7384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define rrep1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }

int n;
ll x[110];

int main() {
    cin >> n;
    rep(i, n) cin >> x[i];

    ll ans = LLINF;
    for (ll p = 0; p <= 100; p++) {
        ll sum = 0;
        rep(i, n) sum += (x[i] - p) * (x[i] - p);
        chmin(ans, sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstring>
#include <vector>
#include <iostream>
using namespace std;
int h, w, cap[200][200];
bool used[200];

int dfs(int s, int t, int f) {
    used[s] = true;
    for (int u = 0; u < h + w; u++) {
        int c = cap[s][u];
        if (used[u] || c == 0) continue;
        if (u == t) {
            f = min(f, c);
            cap[s][u] -= f;
            cap[u][s] += f;
            return f;
        }
        int f1 = dfs(u, t, min(f, c));
        if (f1 > 0) { cap[s][u] -= f1; cap[u][s] += f1; return f1; }
    }
    return 0;
}

int maxflow(int s, int t) {
    int ans = 0;
    for (;;) {
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, 1<<30);
        if (f > 0) ans += f;
        else break;
    }
    return ans;
}

int main() {
    cin >> h >> w;
    string a[h]; for (int i = 0; i < h; i++) cin >> a[i];
    int sx, sy, tx, ty;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++) {
            if (a[i][j] == 'S') { sx = i; sy = j; }
            if (a[i][j] == 'T') { tx = i; ty = j; }
            if (a[i][j] == 'o') cap[i][h+j] = cap[h+j][i] = 1;
        }
    if (sx == tx || sy == ty) { cout << -1 << endl; return 0; }

    cap[sx][sy+h] = cap[sy+h][sx] = cap[tx][ty+h] = cap[ty+h][tx] = 1<<30; 
    cout << maxflow(sx, tx) << endl;
}


Measured memory_bytes: 384
import java.util.*;
import java.io.*;
import java.lang.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();

        int[] arr = {a,b,c};
        Arrays.sort(arr);

        for (int i = 0; i<k; i++){
            arr[2] = arr[2] * 2;
        }
        System.out.println(arr[0]+arr[1]+arr[2]);
    }
}

Measured memory_bytes: 35560
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    val n = sc.nextInt()
    val w = sc.nextInt()

    val dp = Array(n + 1) { LongArray(w + 1) }
    val weights = IntArray(n)
    val values = IntArray(n)


    for (i in 0 until n) {
        weights[i] = sc.nextInt()
        values[i] = sc.nextInt()
    }

    for (i in 0 until n) {
        for (j in 1..w) {
            dp[i + 1][j] =
                if (j - weights[i] >= 0) Math.max(dp[i][j], dp[i][j - weights[i]] + values[i])
                else dp[i][j]
        }
    }

    println(dp[n][w])
}

Measured memory_bytes: 147492
# import math
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
from itertools import permutations
# import numpy as np


# k,x = map(int, input().split())

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
m = [i + 1 for i in range(n)]
c = 0

for i in permutations(m):
    c += 1
    # print(i)
    if list(i) == p:
        a = c
    if list(i) == q:
        b = c

print(abs(a - b))


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

int main() {
    int N;  cin >> N;
    set<string> s;
    for (int i = 0; i < N; ++i) {
        string t;  cin >> t;
        s.insert(t);
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 19184
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
#include <sstream>
using namespace std;
const constexpr int INF = 1e9;
#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
struct Less{
   bool operator()(const pair<string, int>&a, const pair<string, int>&b){
        if(a.first==b.first){
            return a.second < b.second;
        }
       return a.first < b.first;
    }
};

ll extGCD(ll a, ll b, ll& x, ll& y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}
ll GCD(ll a, ll b){
    if(a<b) swap(a, b);
    if(b==0) return a;
    return GCD(b, a%b);
}
int par[100010], rr[100010];
void init(){
    for(int i=0; i<100010; ++i){
        par[i]=i;
        rr[i]=0;
    }
}
int root(int x){
    return par[x] == x ? x:par[x] = root(par[x]);
}
bool same(int x, int y){
    return root(x)==root(y);
}
void unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x==y) return ;
    
    if(rr[x]<rr[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(rr[x]==rr[y]) rr[x]++;
    }
}

ll pow_mod(ll x, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res*x%MOD;
        }
        x = x*x%MOD;
        n>>=1;
    }
    return res;
}
int main() {
    int N; cin >> N;
    map<string, int> mp;
    REP(i, N){
        string s; cin >> s;
        mp[s]++;
    }
    int cnt=0;
    for(auto itr=mp.begin(); itr!=mp.end(); ++itr){
        if((*itr).second%2!=0) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 12544