akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
//ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  ll n; cin>>n;
  vi a(n),b(n);
  rep(i,n) cin>>a[i]>>b[i];
  ll x,y;
  sort(all(a));
  if(n%2) x=a[(n-1)/2];
  else x=a[n/2-1]+a[n/2];
  sort(all(b));
  if(n%2) y=b[(n-1)/2];
  else y=b[n/2-1]+b[n/2];
  out(y-x+1);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 6368
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);


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

  int n;
  cin >> n;

  using P = pair<int, int>;

  set<P> red;
  set<P> blue;
  rep(i, n) {
    int a, b; cin >> a >> b;
    red.insert({a, b});
  }
  rep(i, n) {
    int a, b; cin >> a >> b;
    blue.insert({a, b});
  }

  int ans = 0;
  for (auto& b : blue) {
    P t;
    int y_max = -INF;
    for (auto& r : red) {
      if (r.first >= b.first) break;
      if (r.second < b.second && chmax(y_max, r.second)) t = r;
    }
    if (y_max == -INF) continue;
    ans++;
    red.erase({t});
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int NOT_FOUND=-1;
int linearSearch(int key,int A[],int n){
	int left=0;
	int right=n;
	while(left<right){
		int mid=(left+right)/2;
		if(A[mid]==key){
			return mid;
		}
		else if(key<A[mid]){
			right=mid;
		}
		else{
			left=mid+1;
		}
	}
	return NOT_FOUND;
}
int main(){

	int n,s;
	cin>>n;
	int a[n+1];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	cin>>s;
	int b[s];
	for(int i=0;i<s;i++){
		cin>>b[i];
	}
	
	int count=0;
	for(int i=0;i<s;i++){
		if(linearSearch(b[i],a,n)!=NOT_FOUND)count++;
	}
	cout<<count<<endl;
	
return 0;
}

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

#define st              first
#define nd              second
#define pb              push_back
#define lwb             lower_bound
#define upb             upper_bound
#define Size(a)         int((a).size())
#define reset(s, n)     memset(s, n, sizeof(s))
#define bit(n, i)       (((n) >> (i)) & 1)
#define cntbit(n)       __builtin_popcountll(n)
#define all(a)          (a).begin(), (a).end()
#define unique(a)       (a).resize(unique(all(a)) - (a).begin())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))

typedef long double ld;
typedef long long ll;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-7;
inline ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline int inv(int a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
inline void onbit(ll &a, int i){a |= 1LL << i;}
inline void offbit(ll &a, int i){onbit(a, i), a -= (1LL << i);}

const int N = 3e5 + 5;

ll n, m, k;
ll a[N];

void solve(){
  string s;
  cin >> s;
  if(s.back() == 's'){
    s += "es";
  } else{
    s += "s";
  }
  cout << s;
  
}

main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0); 
  cout.tie(0);
  cout << fixed << setprecision(10);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  int query = 1;
  // cin >> query;
  int start = 1000 * clock() / CLOCKS_PER_SEC;
  while(query--) solve();
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC  - start << "ms\n";
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep2(i,x,n) for(int i=x;i<n;++i)

using Graph = vector<vector<int>>;
Graph g;
vector<bool> seen;

void dfs(int v)
{
    seen[v] = true;
    for(auto nv:g[v])
    {
        if(seen[nv]) continue;
        dfs(nv);
    }
}

int main()
{   
    int n,m;
    cin >> n >> m;

    g.resize(n);
    seen.assign(n,false);

    rep(i,m)
    {
        int x, y, z;
        cin >> x >> y >> z;
        g[x-1].push_back(y-1);
        g[y-1].push_back(x-1);
    }

    int cnt = 0;
    rep(i,n)
    {
        if(seen[i]) continue;
        cnt++;
        dfs(i);
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 8832
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;


signed main()
{
	int N, M;
	cin >> N >> M;

	if (N == 1 && M == 1)
	{
		cout << 1 << endl;
	}
	else if (N <= 2 && M <= 2)
	{
		cout << 0 << endl;
	}
	else if(N == 1)
	{
		cout << M - 2 << endl;
	}
	else if (M == 1)
	{
		cout << N - 2 << endl;
	}
	else
	{
		int a = (N - 2) * (M - 2);
		cout << a << endl;
	}
}







Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
int main() {
	char s[100] ,s1[100],s2[100] ;
	scanf("%s %s %s",s,s1,s2);
	char c,c2,c3; 
	 c=s[0];
	 c2=s1[0];
	 c3=s2[0];
 printf("%c%c%c", c,c2,c3);
 	

	return 0; 
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>
#include <bitset>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

bitset<13000> bs[81][81], bu;

int main(){
	int H, W;
	cin >> H >> W;
	int A[81][81], B[81][81];
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++){
			cin >> A[i][j];
		}
	}
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++){
			cin >> B[i][j];
		}
	}
	bu = 1;
	bs[0][1] = bu << 6500;
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++){
			bs[i][j] = bs[i - 1][j] | bs[i][j - 1];
			int S = abs(A[i][j] - B[i][j]);
			bs[i][j] = (bs[i][j] << S) | (bs[i][j] >> S);
		}
	}
	long long int ans = INF;
	for(int i = 0; i < 13000; i++){
		if((bs[H][W] & (bu << i)) != 0){
			ans = min(ans, abs(i - 6500LL));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 10624
#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 treeMinimum(Node x){
  while(x->left!=NIL) x=x->left;
  return x;
 
}
 
Node treeMaximum(Node x){
  while(x->right!=NIL) x=x->right;
  return x;
 
}
 
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);
 
}
 
Node treeSuccessor(Node x){
  Node y;
  if(x->right!=NIL) return treeMinimum(x->right);
   
  y=x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
    return y;
 
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
 
  if(z->left==NIL || z->right == NIL) y=z;
  else y=treeSuccessor(z);
 
  if(y->left!=NIL) x=y->left;
  else x=y->right;
 
  if(x!=NIL) x->parent = y->parent;
 
  if(y->parent==NIL) root=x;
  else if(y==y->parent->left) y->parent->left = x;
  else y->parent->right = x;
 
  if(y!=z) z->key=y->key;
 
}
 
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 if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}



Measured memory_bytes: 20456
N, X, M = map(int,input().split())
ans = X
lst = [X]
check = [0] * M
check[X] += 1
A = X
flag = False
for i in range(N-1):
    A = A**2 % M
    if check[A] == 0:
        check[A] += 1
        lst.append(A)
        ans += A
    else:
        flag = True
        init = lst.index(A)
        last = i+1
        break
if flag:
    new_list = lst[init:]
    l = len(new_list)
    s = sum(new_list)
    num = N - last
    ans += s * (num//l)
    for i in range(num%l):
        ans += new_list[i]

print(ans)

Measured memory_bytes: 12196
a,b,c=raw_input().split()

common_diviser=[]
stage=[]
count=0
i=0
start=int(a)

for i in range(int(c)):
    i+=1
    if(int(c)%i==0):
        common_diviser.append(i)


area=int(b)-int(a)+1
for i in range(area):
    stage.append(start)
    start+=1

for i in range(area):
    if(stage[i] in common_diviser):
        i+=1
        count+=1

print(count)


Measured memory_bytes: 5300
// C - H and V
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int h,w,k; cin>>h>>w>>k;
	vector<string> C(h);
	rep(i, h) cin>>C[i];
	int ans = 0;
	rep(bit, 1<<(h+w)){
		int c = 0;
		rep(i,h)
			if(bit>>(w+i) & 1)
				rep(j,w) if(bit>>j & 1 && C[i][j] == '#') c++;
		if(c == k) ans++;
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 3564
// Aizu Vol-1 0130: Train
// 2017.8.3

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

char *gets(char *);
char buf[1100], *p;
char ans[100], *a, *t;

int main()
{
	int i, n;

	gets(buf);
	n = atoi(buf);
	for (i = 0; i < n; i++) {
		gets(p = buf);
		memset(ans, 0, sizeof(ans));
		t = a = ans + 50;
		while (*p) {
			if (isspace(*p)) p++;
			if (!*p) break;
			if (isalpha(*p)) {
				if (!*a) *a = *p;
				else if (*a != *p) while (1);
			}
			else if (*p == '<') {
				if (*++p != '-') while (1);
				a--;
				if (a < t) t = a;
			}
			else if (*p == '-') {
				if (*++p != '>') while (1);
				a++;
			}
			p++;
		}
		puts(t);
	}
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define vc vector<int>
#define um unordered_map<int,int>
#define ll long long 
#define rep(i,a,b) for(__typeof(a) i=a; i<b; i++)
#define si(a) a.size()
#define all(a) a.begin(),a.end()
#define ss(a) a.second
#define ff(a) a.first
#define M 1000000
#define pb push_back
#define repit(i,a) for(auto i=a.begin(); i!=a.end(); i++)
#define take(arr,n) for(int i=0;i<n;i++)cin>>arr[i]
#define out(arr,n) for(int i=0;i<n;i++)cout<<arr[i]<<' '
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define reprev(i,b,a) for(__typeof(b) i=b; i>=a; i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define doublearray vector<vector<int>>
#define mod 998244353 
using namespace std;
ll max(ll a, ll b){ return a>b?a:b; }
ll min(ll a, ll b){ return a<b?a:b; }
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}
int binaryS(ll x, ll sb[], int m){
    int l = 0, r=m;
    int mid = (l+r)/2;
    while(l<r){
        mid = (l+r)/2;
        if(sb[mid]<x) l= mid+1;
        else if(sb[mid]>x) r = mid-1;
        else return mid;
    }
    return l;
}
int main(){
    fastio;
    int n; cin>>n;
    int arr[n]; take(arr,n);
    int maxi = -1;ll su = 0;
    rep(i,0,n){
        su += (ll)max(0,maxi-arr[i]);
        maxi = max(maxi,arr[i]);
    }
    cout<<su<<endl;
    return 0;
}





Measured memory_bytes: 4432
def main():
    N, D, A = (int(i) for i in input().split())
    c = [[int(i) for i in input().split()] for j in range(N)]
    c.sort()

    from collections import deque
    q = deque([])
    ans = 0
    tot = 0
    for i in range(N):
        x = c[i][0]
        h = c[i][1]
        while q and q[0][0] < x:
            tot -= q[0][1]
            q.popleft()
        h -= tot
        if h > 0:
            num = (h+A-1)//A
            ans += num
            damage = num*A
            tot += damage
            q.append((x+2*D, damage))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 82264
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
  	cin>>s>>t;
  	int n=s.size();
  int count=0;
  for(int i=0;i<n;i++)
  {
    if(s[i]!=t[i]) count++;}
  cout<<count;
}

Measured memory_bytes: 3912
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimze("02")
using namespace std;
using ll = long long;
const ll maxn=3e5+5;
ll n,a[maxn];
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>n;
	cout<<n+n*n+n*n*n;
}


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

using namespace std;
const int MAXN=1e5+10;
int n,m,dat[MAXN],o1,o2,st;

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++) scanf("%d",&dat[i]);
	for(int i=1;i<=m;i++)
		if(dat[i]&1)
			if(!o1) o1=i;
			else if(!o2) o2=i;
			else return puts("Impossible"),0;
	
	if(o1) swap(dat[1],dat[o1]);
	if(o2) swap(dat[m],dat[o2]);
	for(int i=1;i<=m;i++) printf("%d ",dat[i]);
	
	if(m==1) m++;
	dat[1]--;dat[m]++;st=dat[1]?1:2;
	printf("\n%d\n",m-st+1);
	for(int i=st;i<=m;i++) printf("%d ",dat[i]);
	return 0;
}

Measured memory_bytes: 256
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Asum = [0]*(N+1)
Bsum = [0]*(M+1)
Asum[0] = 0
Bsum[0] = 0
for i in range(N):
    Asum[i+1] = Asum[i]+A[i]
for i in range(M):
    Bsum[i+1] = Bsum[i]+B[i]
    
bestbooks = 0
upup = M+1
for i in range(N+1):
    lasttime = K - Asum[i]
    if lasttime < 0:
        break
    for j in reversed(range(0,upup)):
        #print(i,j,upup,lasttime,bestbooks)
        if Bsum[j] <= lasttime and i+j>bestbooks:
            bestbooks = i+j
           
        if Bsum[j] <= lasttime:
            upup = j+1
            break
            
print(bestbooks)

Measured memory_bytes: 117968
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    scanf("%d", &n);
    string s, t;
    cin >> s >> t;
    int ans = n + n;
    for (int i = 1; i <= n; ++i)
    {
        bool ok = true;
        for (int k = 0; k < i; ++k)
        {
            if (s[n - i + k] != t[k])
            {
                ok = false;
                break;
            }
        }
        if (ok)
        {
            ans = (min)(ans, n + n - i);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3676
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S[] = sc.next().split("");
    
    int n = (int)Math.pow(2, S.length - 1);
    
    long total = 0;
    for (int i = 0; i < n; i++) {
      String s = S[0];
      
      for (int j = 0; j < S.length - 1; j++) {
        if ((1&i>>j) == 1) {
          total += Long.parseLong(s);
          s = S[j + 1];
        } else {
          s += S[j + 1];
        }
      }
      total += Long.parseLong(s);
    }
    System.out.println(total);
  }
}

Measured memory_bytes: 21972
import sys
input = sys.stdin.readline

from collections import deque
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]

for i in range(M):
    x, y = map(int, input().split())
    G[x].append(y)
    G[y].append(x)

USED = [-1] * (N+1)
USED[0] = 0
USED[1] = 0

Q = deque()
Q.append(1)

while Q:
    x = Q.pop()
    for t in G[x]:
        if USED[t] == -1:
            Q.appendleft(t)
            USED[t] = x

if -1 in USED:
    print("No")
else:
    print("Yes")
    print(*USED[2:])


Measured memory_bytes: 35204
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
p = 0
for i in range(n):
    x = 0
    a = list(map(int,input().split()))
    for j in range(m):
        x += a[j] * b[j]
    if x > (-c):
        p += 1

print(p)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n,m,q;
    cin>>n>>m>>q;
    int a[n+1][n+1],l,r;
    for (int i=1;i<=n;i++) {
        for (int j=0;j<=n;j++) {
            a[i][j] = 0;
        }
    }
    while (m--) {
        cin>>l>>r;
        a[l][r-l]++;
    }
    for (int i=1;i<=n;i++) {
        for (int j=1;j<=n;j++) {
            a[i][j] += a[i][j-1];
        }
    }
    while (q--) {
        cin>>l>>r;
        int ans = 0;
        for (;l<=r;l++) {
            ans += a[l][r-l];
        }
        cout<<ans<<"\n";
    }
}


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

#define int long long
#define pii pair<int, int>
#define pb push_back

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        ans += (s[i] != t[i]);
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3796
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 200000;

ll a[N],sa[N];

int main() {
	int n;cin>>n;
	rep(i,n) cin>>a[i];
	sa[0]=a[0];
	rep(i,n-1) sa[i+1]=sa[i]+a[i+1];
	int l=0,m=1,r=2;
	ll ans=INFL;
	for(m=1;m<=n-2;m++){
		while(l<m-1&&abs(sa[m]-2*sa[l])>abs(sa[m]-2*sa[l+1])) l++;
		while(r<n-2&&abs(sa[n-1]-2*sa[r]+sa[m])>abs(sa[n-1]-2*sa[r+1]+sa[m])) r++;
		ll ssa[4];
		ssa[0]=sa[l];
		ssa[1]=sa[m]-sa[l];
		ssa[2]=sa[r]-sa[m];
		ssa[3]=sa[n-1]-sa[r];
		sort(ssa,ssa+4);
		ans=min(ans,abs(ssa[0]-ssa[3]));
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3328
N, M = map(int, input().split())
H = list(map(int,input().split()))
X = [0 for i in range(N)]
for i in range(M):
  A, B = map(int,input().split())
  if H[A-1] > H[B-1]:
    X[B-1] += 1
  elif H[A-1] < H[B-1]:
    X[A-1] += 1
  else:
    X[A-1] += 1
    X[B-1] += 1

print(X.count(0))

Measured memory_bytes: 20036
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long int

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  ll X,Y;cin>>X>>Y;
  int c=0;
  ll flag=X;
  while(flag<=Y){
    c++;
    flag*=2;
  }
  P(c);
  return 0;
}


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

int main(){
    long long int q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    q *= 8;
    h *= 4;
    s *= 2;
    cout << (n / 2) * min({q, h, s, d}) + (n % 2) * (min({q, h, s}) / 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    ll N, K, X, Y, ans = 0;
    cin >> N >> K >> X >> Y;
    rep1(i, N){
        if(i <= K)ans += X;
        else ans += Y;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <vector>

int main(){
    int num, temp, ans=2147483647;
    std::vector<int> a;

    // 入力
    std::cin >> num;

    for(int i=0; i<num; i++){
        std::cin >> temp;
        a.push_back(temp);
    }

    for(int i=1; i<100; i++){
        int sum = 0;
        for(int j=0; j<num; j++){
            sum += (a[j]-i)*(a[j]-i);
            // std::cout << sum << std::endl;
            // std::cout << j << ", " << a[j] << ", " << i << std::endl;
        }
        //std::cout << sum << std::endl;
        if(sum < ans) ans = sum;
    }
    
    std::cout << ans << std::endl;

    return 0;
}

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

using namespace std;

long double P = acos(-1.0);
const int MAXN = 110;

int n;
long double x[MAXN], y[MAXN], ans;

long double solve() {
	long double r = rand();
	long double xn, yn;
	long double xa = 0, ya = 0;
	r /= RAND_MAX;
	r *= P * 2;
	for (int i = 0; i < n; i++) {
		xn = cos(r) * x[i] - sin(r) * y[i];
		yn = sin(r) * x[i] + cos(r) * y[i];
		if (xn >= 0) {
			xa += xn;
			ya += yn;
		}
	}
	return sqrt(xa * xa + ya * ya);
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
	for (int i = 0; i < 10000; i++) ans = max(ans, solve());
	cout << setprecision(13) << ans;
}


Measured memory_bytes: 512
import scala.io.StdIn

object Main extends App {
  
  var continue = true
  while(continue){
    val Array(a, op, b) = StdIn.readLine().split(' ')
    val result = op match{
      case "+" => a.toInt + b.toInt
      case "-" => a.toInt - b.toInt
      case "*" => a.toInt * b.toInt
      case "/" => a.toInt / b.toInt
      case _ => {
        continue = false
        0
      } 
    }
    if(continue){
      println(f"$result")
    }
  }

}


Measured memory_bytes: 43808
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  int A = 0, B = 0;
  for (int i = 0; i < b; i++) {
    A = A * 10 + a;
  }
  for (int i = 0; i < a; i++) {
    B = B * 10 + b;
  }
  if (a <= b) {
    cout << A << endl;
  }
  else {
    cout << B << endl;
  }
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=123;
int dp[5][S+5][20000+5];
int ara[5][S+5];
int n;

int Solve(int i,int j,int cnt)
{
    if(i==1 && j==n-1)return cnt+ara[i][j];
    if(dp[i][j][cnt]!=-1)return dp[i][j][cnt];
    
    int mx=0;
    if(i+1<=1)mx=Solve(i+1,j,cnt+ara[i][j]);
    if(j+1<=n)mx=max(mx,Solve(i,j+1,cnt+ara[i][j]));

    return dp[i][j][cnt]=mx;
}

int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    while(sf("%d",&n)==1)
    {
        for(int i=0;i<2;i++)
        {
            for(int j=0;j<n;j++)sf("%d",&ara[i][j]);
        }

        memset(dp,-1,sizeof dp);
        pf("%d\n",Solve(0,0,0));
    }
    return 0;
}
 









 




























Measured memory_bytes: 50304
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)

int main(){
    
    // 1. 入力情報.
    int N, a, o = 0;
    scanf("%d", &N);
    rep(i, N){
        scanf("%d", &a);
        if(a & 1) o++; // 奇数.
    }
    
    // 2. 黒板に数が 1つだけ残るようにできるか.
    bool ans = o & 1;
    
    // 3. 出力.
    printf("%s\n", ans ? "NO" : "YES");
    return 0;
    
}

Measured memory_bytes: 3632
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

string cnv(int[] ymd)
{
    immutable y=ymd[0], m=ymd[1], d=ymd[2];
    immutable S = ["meiji","taisho","showa","heisei"];
    foreach_reverse(i,t;[[1868,9,8],[1912,7,30],[1926,12,25],[1989,1,8]])
    {
        if(y>t[0] || (y==t[0] && (m>t[1] || (m==t[1] && d>=t[2]))))
            return S[i]~" "~[y-t[0]+1,m,d].map!(to!string).join(" ");
    }
    return "pre-meiji";
}

void main()
{
    stdin.byLine().map!(s=>cnv(s.split().map!(to!int).array())).join("\n").writeln();
}

Measured memory_bytes: 1080
n = int(input())
p = input().split(' ')

cnt = 0
for i in range(n):
    tmp = list(map(int, p[i:i+3]))
    if len(tmp) == 3:
        if (tmp[0] < tmp[1] and tmp[1] < tmp[2]) or (tmp[1] < tmp[0] and tmp[2] < tmp[1]):
            cnt += 1
print(cnt)

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = int(1e9) + 7;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> t(n+1);
  reps(i, 1, n) cin >> t[i];

  int m;
  cin >> m;
  rep(i, m) {
    int p, x;
    cin >> p >> x;

    int sum = 0;
    reps(j, 1, n) {
      if (j == p) sum += x;
      else sum += t[j];
    }

    cout << sum << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		if(N == M) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
	
}

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

const int MAXN = 200005;

int a[MAXN], n;
long long sum[MAXN];

int main()
{
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		sum[i] = sum[i-1]+a[i];
	}
	long long ans = 1e18;
	auto check = [](int i, int j, int k) {
		return abs((sum[j]-sum[i-1])-(sum[k]-sum[j]));
	};
	auto calc = [](int i, int j, int k) {
		long long mx = max(max(max(sum[i], sum[j]-sum[i]), sum[k]-sum[j]), sum[n]-sum[k]);
		long long mn = min(min(min(sum[i], sum[j]-sum[i]), sum[k]-sum[j]), sum[n]-sum[k]);
		return mx-mn;
	};
	for (int i = 2; i < n-1; i++) {
		int a = 1, d = i-1, b, c;
		while (d-a >= 3) {
			b = a+(d-a)/3, c = a+(d-a)/3*2;
			if (check(1, b, i) < check(1, c, i)) d = c;
			else a = b;
		}
		int x = i+1, w = n-1, y, z;
		while (w-x >= 3) {
			y = x+(w-x)/3, z = x+(w-x)/3*2;
			if (check(i+1, y, n) < check(i+1, z, n)) w = z;
			else x = y;
		}
		for (int j = a; j <= d; j++)
			for (int k = x; k <= w; k++)
				ans = min(ans, calc(j, i, k));
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
  int h, w;
  cin >> h >> w;
  string s[h];
  rep(i,h) cin >> s[i];
  int ans = 0;
  rep(i,h) {
    rep(j,w) {
      if(s[i][j] == '#') continue;
      int sx = i, sy = j;
      rep(k,h) {
        rep(l,w) {
          if(s[k][l] == '#') continue;
          int gx = k, gy = l;
          queue<P> que;
          vector<vector<int>> d(h,vector<int>(w,INF));
          d[sx][sy] = 0;
          que.push(P(sx,sy));
          while(!que.empty()) {
            P p = que.front(); que.pop();
            if(p.first == gx && p.second == gy) break;
            rep(m,4) {
              int nx = p.first + dx[m], ny = p.second + dy[m];
              if(nx >= 0 && nx < h && ny >= 0 && ny < w && s[nx][ny] != '#' && d[nx][ny] == INF) {
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] + 1;
              }
            }
          }
          ans = max(ans,d[gx][gy]);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll p[5001], p1[5001], result = INF, n;
  cin >> n;
  rep(i, n) cin >> p[i];
  rep(i, 4) {
    rep(j, n) p1[j] = p[j];
    ll tmp = i;
    p1[0] -= i;
    rep(j, n - 1) {
      if(p1[j] <= 0) continue;
      tmp += p1[j] * 2;
      p1[j + 1] -= p1[j];
    }
    if(p1[n - 1] > 0) tmp += p1[n - 1];
    result = min(result, tmp);
  }
  cout << result << endl;
	return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code
int main(int argc, char const* argv[])
{
	LL h,w,n;
	cin >> h >> w >> n;
	VL a(n), b(n);
	auto out_h = [&](LL _h){return _h < 1 or _h > h-2;};
	auto out_w = [&](LL _w){return _w < 1 or _w > w-2;};
	VL ans(10,0);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	map<pair<LL,LL>, LL> mp;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				mp[{a[i] - j, b[i] - k}]++;
			}
		}
	}
	LL count = 0;
	for (auto&& var : mp) {
		if (out_h(var.first.first) or out_w(var.first.second)) continue;
		ans[var.second]++;
		count++;
	}
	ans[0] = (h-2)*(w-2) - count;
	for (auto&& a : ans) {
		cout << a << endl;
	}
	return 0;
}



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

typedef unsigned long long int ulli;

int main() {
	ulli n, ans = 0;
	cin >> n;
	map<int, int> m;
	for (ulli i = 1; i <= n; i++) {
		int temp;
		cin >> temp;
		ans += m[i-temp];
		m[i+temp]++;
	}
	cout << ans;
}

Measured memory_bytes: 20624
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main(void) {
 int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++) {
    cin >> a[i]; 
  }
  
  for(int i = 0; i < N; i++) {
   if(a[i] != 0) {
    break; 
   }
   if(i == N - 1) {
    cout << "Yes" << endl; return 0; 
   }
  }
  
  map<int, int> cnt;
  for(int i = 0; i < N; i++) {
    cnt[a[i]] += 1;
  }
  if(cnt.size() != 3 && cnt.size() != 2) {
   cout << "No" << endl; return 0; 
  }

  if(cnt.size() == 3) {
    static int bb = 0;
    auto begin = cnt.begin(), end = cnt.end();
    for( auto iter = begin; iter != end; iter++) {
      bb = bb ^ iter->first;
      static int cc = iter->second;

      if(cc != iter->second && cnt.size() == 3) {
       cout << "No" << endl; return 0; 
      }
    }
    if(bb == 0) {
      cout << "Yes" << endl; return 0;
    }
    cout << "No" << endl; return 0;
  }
  else if(cnt.size() == 2) {
    auto begin = cnt.begin(), end = cnt.end();
    int dd, ee = 0;
    for( auto iter = begin; iter != end; iter++) {
      if(iter->first != 0) {
        dd = iter->second;
      }
      else if(iter->first == 0){
        ee = iter->second;
      }
    }
    if( dd == ee * 2 ) {
      cout << "Yes" << endl; return 0;
    }
    cout << "No" << endl; return 0;
  }
  
  
 return 0; 
}

Measured memory_bytes: 4224
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
map<long long,long long> m1;
void check(long long a){
    for(long long i=2;i*i<=a;i++){
    
        while(a%i == 0){
            m1[i]++;
            
           
            
            a/=i;
            
        }
        if(a==1){
            break;
        }
    }
    if(a==1){
        return;
    }
    m1[a]++;
}
int main() {
    long long n;
    cin>>n;
    for(long long i=1;i<=n;i++){
        check(i);
    }
    long long ans =1;
    for(auto x:m1){
        //cout<<x.first<<" "<<x.second+1<<endl;
        ans*=(x.second+1);
        ans%=MOD;
    }
    cout<<ans<<endl;
}

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

// 入出力
void print() { std::cout << '\n'; }
template <class T>void print(const T &x) {std::cout << x <<'\n';}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}

int main(){
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    std::set<long long> d;
    for(int i = 0 ; i < N ; i++){
        ll tmp;
        cin >> tmp;
        d.insert(tmp);
    }
    cout << d.size() << '\n';
    // print(d.size());
    return 0;
}


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

public class ABC157_C {
	private static void Main(string[] args) {
		var input = ReadIntsAsArray();
		var n = input[0];
		var m = input[1];

		var number = new Number(n);
		for (int i = 0; i < m; i++) {
			input = ReadIntsAsArray();
			number.Guess(input[0], input[1]);
		}

		var answer = number.GetAnswer();
		Console.WriteLine(answer);
	}

	private static int[] ReadIntsAsArray() => Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();
}

public class Digit {
	private int number;
	private int initialNumber;
	private bool isGuessed;
	private bool canGuess;

	public int Number {
		get { return this.number; }
	}

	public bool CanGuess {
		get { return this.canGuess; }
	}

	public Digit(int number) {
		this.number = this.initialNumber = number;
		this.isGuessed = false;
		this.canGuess = true;
	}

	public void Guess(int number) {
		if ((isGuessed) && (this.number != number)) {
			this.canGuess = false;

		} else if (number < this.initialNumber) {
			this.canGuess = false;

		} else {
			this.number = number;
			this.isGuessed = true;
		}
	}
}

public class Number {
	private List<Digit> digits = new List<Digit>();

	public Number(int digit) {
		if (digit == 1) {
			this.digits.Add(new Digit(0));

		} else {
			this.digits.Add(new Digit(1));

			for (int i = 0; i < (digit - 1); i++) {
				this.digits.Add(new Digit(0));
			}
		}
	}

	public void Guess(int s, int c) {
		this.digits[s-1].Guess(c);
	}

	public string GetAnswer() {
		StringBuilder sb = new StringBuilder("");

		foreach (var digit in digits) {
			if (!digit.CanGuess) return "-1";
			else sb.Append(digit.Number);
		}

		return sb.ToString();
	}
}

Measured memory_bytes: 13396
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int N;
string S;
void input() {
    cin >> N;
    cin >> S;
}
int solve() {
    input();
    int b_num = 0, w_num = 0;
    int b = 0;
    for(int i = 0; i < N; i++) {
        if(S.at(i) == '.') w_num++;
        else b_num++;
    }
    int ans = min(w_num, b_num);
    for(int i = 0; i < N; i++) {
        if(S.at(i) == '.') w_num--;
        else b++;
        ans = min(ans, b + w_num);
    }
    return ans;
}
int main() {
    cout << solve() << endl;
}

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

int main(){
	int i,x,sum,slen;
	char input[1024],num[2];
	while(1){
		sum=0;
		fgets(input,sizeof input,stdin);
		slen=strlen(input);
		//printf("slen=%d\n",slen);
		for(i=0;i<slen-1;i++){
			num[0]=input[i];
			//printf("%c\n",num[0]);
			sum+=atoi(num);
		}
		if(sum==0){
			break;
		}
		printf("%d\n",sum);
		
	}
	return 0;
}

Measured memory_bytes: 528
import sys
input = sys.stdin.readline
from itertools import accumulate


def read():
    
    N, C, K = map(int, input().strip().split())
    T = []
    for i in range(N):
        t = int(input().strip())
        T.append(t)
    return N, C, K, T


def solve(N, C, K, T):
    T.sort()
    i = 0
    ans = 0
    while i < N:
        tk = T[i] + K
        j0 = i
        for j in range(j0, min(j0+C, N)):
            if T[j] <= tk:
                i += 1
            else:
                break
        ans += 1
    return ans


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


Measured memory_bytes: 13384
import java.util.*;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.print(a / b + " ");
		System.out.print(a % b + " ");
		System.out.println(String.format("%.5f",(double)a / b));
	}
}

Measured memory_bytes: 26536
#include <cstdio>

#define REP(a, n) for (int i = (a); i < n; i++)

using namespace std;

int main()
{
  int l, m, n;
  
  while (scanf("%d", &l), l != 0){
    int sum = 0, month = 1;
    bool flag = true;
    REP(0, 12){
      scanf("%d%d", &m, &n);
      sum += m - n;
      if (sum >= l) flag = false;
      if (flag) month++;
    }
  
    if (month <= 12) printf("%d\n", month);
    else printf("NA\n");
  }

  return (0);
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> x(n);
  std::cin >> x;

  int64_t ans = 100000000;

  for (int64_t i = 1; i <= 100; i++) {
    int64_t sum = 0;
    for (const auto v : x) {
      sum += (v - i) * (v - i);
    }
    ans = std::min(ans, sum);
  }

  std::cout << ans << std::endl;
  return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	int a,b;
	cin>>a>>b;
	if(a%3 && b%3 && (a+b)%3){
		cout<<"Impossible"<<endl;
	}
	else
		cout<<"Possible"<<endl;

	return 0;
}


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

using namespace std;

#define ll long long

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

  int n;
  cin >> n;
  int k = 1;
  while (k * n % 360 != 0) k++;
  cout << k << "\n";

  return 0;
}

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

int main() {
    int N;
    cin >> N;
    //--
    vector< queue<int> > vq (N+1, queue<int>() );
    for(int i = 1; i <= N; i++) {
        int tmp, nn = N-1;
        while(nn--) {
            cin >> tmp;
            vq[i].push(tmp);
        }
    }
    // -- draw borders
    // cout << "border";
    vq[0].push(-1);
    for(int i = 1; i <= N; i++) {
        vq[i].push(0);
    }
    // cout << "border end\n";
    // --
    int days = 0;
    int matches = N*(N-1)/2;
    int empty_day = 0;

    vector<int> today (N+1, 0);

    while( matches ) {
        empty_day = 1;
        days++;
        //
        for(int i = 1; i <= N; i++) {
            int against = vq[i].front();
            // cout << "matching players: " << i << " vs " << against << endl;
            // cout << "check opponent: " << against << " vs " << vq[against].front() << endl;
            if( (vq[against].front() == i) && (today[i] != days) && (today[against] != days) ) {
                empty_day = 0;
                matches--;

                vq[i].pop();
                vq[against].pop();

                today[i]        = days;
                today[against]  = days;
            }
        }
        //
        if(empty_day) {
            cout << -1;
            return 0;
        }
    }
    cout << days;
    return 0;
}

Measured memory_bytes: 6784