akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
typedef  long long     ll ;
typedef  unsigned long long ull;
const double EPS= (1e-9);
using namespace std;
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(int num, int idx) {return num ^ (1<<idx);}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=0;
int a[4];
int main(){
    GO();
    cin>>a[0]>>a[1]>>a[2];
    swap(a[0],a[1]);
    swap(a[0],a[2]);
    cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<"\n";
}




































































































































































































































Measured memory_bytes: 256
def counting_sort(A, B, k):
    C = [0 for _ in xrange(int(k+1))]
    for i in xrange(n):
        C[A[i]] += 1
    
    for i in xrange(k):
        C[i] = C[i] + C[i-1]
    
    for i in xrange(n-1, -1, -1):
        B[C[A[i]]-1] = A[i]
        C[A[i]] -= 1


n = int(raw_input())
A = map(int, raw_input().split())
B = [0 for _ in xrange(n)]

counting_sort(A, B, 10000)

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

Measured memory_bytes: 202536
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

 
struct Dinic {
  struct edge {
    int to, cap, rever;
    edge(int to, int cap, int rever):to(to), cap(cap), rever(rever){}
  };
  vector< vector<edge> > graph;
  vector<int> level, iter;
  Dinic(int V):graph(V), level(V), iter(V){}
  void add_edge(int from, int to, int cap) {
    graph[from].emplace_back(to, cap, graph[to].size());
    graph[to].emplace_back(from, 0, graph[from].size()-1);
  }
  void bfs(int s) {
    fill(all(level), -1);
    queue<int> que;
    level[s] = 0;
    que.push(0);
    while(que.size()) {
      int v = que.front(); que.pop();
      for(edge& e : graph[v]) {
        if(e.cap > 0 && level[e.to] < 0) {
          level[e.to] = level[v] + 1;
          que.push(e.to);
        }
      }
    }
  }
  int dfs(int v, int t, int f) {
    if(v == t) return f;
    for(int& i = iter[v]; i < graph[v].size(); i++) {
      edge& e = graph[v][i];
      if(e.cap > 0 && level[v] < level[e.to]) {
        int d = dfs(e.to, t, min(e.cap, f));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rever].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  int max_flow(int s, int t) {
    int flow = 0;
    while(true) {
      bfs(s);
      if(level[t] < 0) return flow;
      fill(all(iter), 0);
      int f; while((f = dfs(s, t, inf)) > 0) flow += f;
    }
  }
}; 

int main(){
    ll h,w;cin >> h >> w;
    vector<string> g(h);rep(i,h)cin >> g[i];
    ll s,t;
    //ll cnt=0,cnt2=0;
    rep(i,h)rep(j,w){
        if(g[i][j]=='T')t=i*w+j;
        if(g[i][j]=='S')s=i*w+j;
        //if(g[i][j]=='o')cnt++;
    }
    if(t/w==s/w||t%w==s%w)cout << -1 <<endl,exit(0);
    Dinic dn(2+h+w);
    ll start=0,goal=1+h+w;
    dn.add_edge(start,s/w+1,inf);
    dn.add_edge(start,h+s%w+1,inf);
    dn.add_edge(t/w+1,goal,inf);
    dn.add_edge(h+t%w+1,goal,inf);
    rep(i,h){
        rep(j,w){
            if(g[i][j]=='o'){
                dn.add_edge(i+1,h+j+1,1);
                dn.add_edge(1+h+j,i+1,1);
            }
        }
    }
    cout << dn.max_flow(start,goal) <<endl;
}


Measured memory_bytes: 4216
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll k,x;
    cin >> k >> x;
    if(k*500>=x) cout << "Yes";
    else cout << "No";
    cout << "\n";
    return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <stdio.h>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); //cinの高速化

  int N;
  IN(N);
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N);
  REP(i, N) IN(A[i]);
  REP(i, N) IN(B[i]);
  REP(i, N-1) IN(C[i]);
  
  int cnt=0;
  REP(i,N){
    cnt += B[A[i]-1];
    if(i!=0 && A[i] == A[i-1]+1) cnt += C[A[i-1]-1];
  }
  OUT(cnt);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
  int N, count = 0;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A.at(i);
  for(int i = 0; i < N; i++){
    for(int j = N-1; j > i; j--){
      if(A.at(j) < A.at(j-1)){
        int temp = A.at(j);
        A.at(j) = A.at(j-1);
        A.at(j-1) = temp;
        count++;
      }
    }
  }
  for(int i = 0; i < N; i++){
    cout << A.at(i);
    if(i != N-1) cout << " ";
  }
  cout << endl;
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<pi,null_type,less<pi>,rb_tree_tag,tree_order_statistics_node_update> indexed_set_pair;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int M = (int)1e3+5;
const int Q = 102;
const int logN = 19;

const double pie = acos(-1);

void solve() {
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  REP(i,0,n-1) {
    cin>>a[i];
    if(i>=k) {
      if(a[i]>a[i-k]) cout<<"Yes";
      else cout<<"No";
      cout<<"\n";
    }
  }
}
int main() {
    //freopen("./sort/b2.in","r",stdin);
    //freopen("output.txt","w",stdout);

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

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        //cout<<"\n";
    }
}


Measured memory_bytes: 3972
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

#define EPS (1e-7)


MY_NAMESPACE(testbed)
int main()
{
	const int modval = 998244353;

	int n, s;
	cin >> n >> s;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	vector<vector<ll>> dp(n + 1, vector<ll>(s + 1));
	dp[0][0] = 1;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j <= s; j++)
		{
			dp[i + 1][j] = dp[i][j] * 2 % modval;
			if (j - a[i] >= 0)
			{
				dp[i + 1][j] += dp[i][j - a[i]];
			}
			dp[i + 1][j] %= modval;
		}
	}
	cout << dp[n][s] << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 73744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n, k; cin >> n >> k;
    string s; cin >> s;
    vector<int> tmp;
    int cnt = 0;

    char rec = '1';
    rep(i, n) {
        if (i == 0) {
            if (s[i] == '1') {
                cnt++;
            }
            else {
                tmp.push_back(cnt);
                cnt++;
                rec = '0';
            }
            continue;
        }

        if (s[i] == rec) {
            cnt++;
        }
        else {
            tmp.push_back(cnt);
            cnt = 1;
            if (rec == '0') rec = '1';
            else rec = '0';
        }
    }
    tmp.push_back(cnt);

    int m = sz(tmp); //ブロック数
    int blo = m/2;
    
    // rep(i, m) {
    //     cout << tmp[i] << endl;
    // }

    if (blo <= k) {
        cout << n << endl;
        return 0;
    }

    vector<int> ruiseki(m+1);
    rep(i, m) {
        ruiseki[i+1] = ruiseki[i] + tmp[i];
    }

    int ans = 0;
    for(int i=0; i<m; i+=2) {
        if (i+2*k+1 <= m) {
            ans = max(ans, ruiseki[i+2*k+1]-ruiseki[i]);
        }
        else {
            ans = max(ans, ruiseki[m]-ruiseki[i]);
        }
    }

    cout << ans << endl;
    // rep(i, m) {
    //     cout << tmp[i] << endl;
    // }

}

Measured memory_bytes: 1272
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>

int main() {
	int p, q, r;
	cin >> p >> q >> r;
	int ans = p + q + r;
	int m = max(p, max(q, r));
	cout << ans - m;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 137, task c, 2020/08/29
//ms,
/*
*/

int main(void){
  int N;
  vector<string> s;
  int64_t rec=1;
  int64_t ans=0;

  cin >>N;
  for(int i=0;i<N;i++){
    string tmp;
    cin >>tmp;
    s.push_back(tmp);
    sort(s[i].begin(), s[i].end());
    //cout <<s[i] <<endl;
  }

  sort(s.begin(), s.end());

  for(int i=0;i<N-1;i++){
    if(s[i]==s[i+1]) rec++;
    else{
      ans +=  rec*(rec-1)/2;
      rec=1;
    }
  }
  ans += rec*(rec-1)/2;

  cout <<ans;
  return 0;
}
/*
*/


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

#define show(x) cerr << #x << " = " << x << endl ;
#define input_from_file freopen("input.txt","r",stdin)
#define output_to_file freopen("output.txt" , "w",stdout)
#define output_to_error freopen("error.txt" , "w" ,stderr)
#define fastio ios_base::sync_with_stdio(0)
#define endl '\n'


int main()
{
    #ifdef LOCAL
        input_from_file;
        output_to_file;
        output_to_error;
    #endif
    fastio;cin.tie(0);cout.tie(0);
    char c ; 
    cin >> c ; 
    cout << (char)(c + 1) ;


    return 0;
}


Measured memory_bytes: 256
import copy

N, M = map(int, input().split())
A = [int(x) for x in input().split()]
cost = [0,2,5,5,4,5,6,3,7,6]

dp = [[0 for _ in range(10)] for i in range(N+10)]

A = sorted(A, reverse=True)

for num in A:
    c = cost[num]
    if dp[c][0] == 0:
        dp[c][0] = 1
        dp[c][num] = 1

for i in range(1, N+1):
    for num in A:
        c = cost[num]
        prev = copy.deepcopy(dp[i])
        if prev[0] != 0:
            if dp[i + c][0] > dp[i][0] + 1:
                continue
            elif dp[i + c][0] == dp[i][0] + 1:
                nxt = prev
                nxt[num] += 1
                nxt[0] += 1
                for number in range(9, 0, -1):
                    if dp[i + c][number] < nxt[number]:
                        dp[i + c] = copy.deepcopy(nxt)
                        break
                    if dp[i + c][number] > nxt[number]:
                        break
            else:
                nxt = prev
                nxt[num] += 1
                nxt[0] += 1
                dp[i + c] = copy.deepcopy(nxt)

# print(dp[N])
ans = ""
for number in range(9, 0, -1):
    for _ in range(dp[N][number]):
        ans = ans + str(number)

print(ans)


Measured memory_bytes: 6128
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

f = factorization(n)

if f == [[1, 1]]:
    print(0)
    exit()

ans = 0
for sosu in f:
    p, n_ = sosu

    cur = 1
    for _ in range(n_):
        if cur <= n_:
            ans += 1
            n_ -= cur
            cur += 1

print(ans)


Measured memory_bytes: 66712
from collections import defaultdict
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]
w1 = wv[0][0]
ws = []
ijkl = [0,0,0,0]
for i in range(N):
    w = wv[i][0]
    ijkl[w-w1] += 1
for i in range(ijkl[0]+1):
    for j in range(ijkl[1]+1):
        for k in range(ijkl[2]+1):
            for l in range(ijkl[3]+1):
                w = i*w1+j*(w1+1)+k*(w1+2)+l*(w1+3)
                if w <= W:
                    ws.append(w)
ws = list(set(ws))
ws.sort()
dp = [defaultdict(lambda:-float('inf')) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in ws:
        w,v = wv[i]
        dp[i+1][j] = max(dp[i][j],dp[i][j-w]+v)
print(max(dp[N].values()))

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

string S;
int cnt_0, cnt_1;

int main(){
  cin >> S;
  rep(i, S.size()){
    if (S[i]=='0') cnt_0++;
    else cnt_1++;
  }
  cout << 2 * min(cnt_0, cnt_1) << endl;
}


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

struct Node{
  int key;
 struct Node *r,*l,*p;
};

struct Node *root,*NIL;

void insert(int);
void inorder(struct Node *);
void preorder(struct Node *);
struct Node * find(struct Node *,int);
struct Node * treeMinmum(struct Node *);
struct Node * treeSuccessor(struct Node *);
void treeDelete(struct Node *);

int main(){
  int n,i,x;
  char com[100];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='f'){
      scanf("%d",&x);
      struct Node *t=find(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(find(root,x));
    }
  }
  
  return 0;
}

void insert(int k){
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z; 

  z=malloc(sizeof(struct Node));
  z->key=k;
  z->l=NIL;
  z->r=NIL;

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

  z->p=y;
  if(y==NIL){
    root=z;
  }
  else{
    if( z->key<y->key){
      y->l=z;
    }
    else{
      y->r=z;
    }
  }
}

void inorder(struct Node *u){
  if(u==NIL) return;
  inorder(u->l);
  printf(" %d",u->key);
  inorder(u->r);
}

void preorder(struct Node *u){
 if(u==NIL) return;
 printf(" %d",u->key);
 preorder(u->l);
 preorder(u->r);
}

struct Node * find(struct Node *u,int k){
  while(u!=NIL && k!=u->key){
    if(k < u->key) u=u->l;
    else u=u->r;
  }
  return u;
}

struct Node * treeMinmum(struct Node *x){
  while(x->l!=NIL) x=x->l;
  return x;
}

struct Node * treeSuccessor(struct Node *x){
  if(x->r!=NIL) return treeMinmum(x->r);
  struct Node *y;
  y=x->p;
  while(y!=NIL && x==y->r){
    x=y;
    y=y->p;
  }
  return y;
}

void treeDelete(struct Node *z){
  struct Node *y,*x;
  if(z->l==NIL || z->r==NIL) y=z;
  else y =treeSuccessor(z);

  if(y->l!=NIL){
    x=y->l;
  }
  else {
    x=y->r;
  }

 if(x!=NIL){
   x->p=y->p;
 }

if(y->p==NIL){
  root=x;
 }
 else {
   if(y==y->p->l){
     y->p->l=x;
   }
   else {
     y->p->r=x;
   }
 }

if(y!=z){
  z->key=y->key;
 }

 free(y);
}



Measured memory_bytes: 20460
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1,mod=1e18;
const int inf=(1ull<<31)-1;
string a,b;

int main()
{
	//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(15);
	cin>>a>>b;
	cout<<b<<a;
	return 0;
}

Measured memory_bytes: 256
xs,ys,xt,yt = map(int,input().split())
N = int(input())
XYR = [list(map(int,input().split())) for _ in [0]*N]
XYR.append([xs,ys,0])
XYR.append([xt,yt,0])

E = [{} for _ in [0]*(N+2)]
for i in range(N+2):
    for j in range(N+2):
        if j==i : continue
        dx = XYR[i][0]-XYR[j][0]
        dy = XYR[i][1]-XYR[j][1]
        r2 = XYR[i][2]+XYR[j][2]
        E[i][j] = max(0,(dx**2+dy**2)**0.5 - r2)

import heapq
def Dijkstra(N,E,start):
    d = [-1]*N
    q = [(0,start)]
    while q:
        ci,i = heapq.heappop(q)
        if d[i]!= -1:continue
        d[i] = ci
        for j,cj in E[i].items():
            if d[j]!=-1:continue
            heapq.heappush(q,(ci+cj,j))
    return d

print(Dijkstra(N+2,E,N)[-1])

Measured memory_bytes: 157448
#include<bits/stdc++.h>
#define LL long long
#define PB push_back
#define POP pop_back()
#define PII pair<int,int>
#define FI first
#define SE second
#define ULL unsigned long long
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;
const int maxn=1<<17;
const int N=1e5+10,M=N<<2;
int n,m;
int vis[N];
int a[30][30];
bool check(int x1,int x2,int x3,int x4,int x5,int x6){
    if(vis[a[x1][x2]]&&vis[a[x3][x4]]&&vis[a[x5][x6]])return 1;
    return 0;
}
int main()
{
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            scanf("%d",&a[i][j]);
        }
    }
    cin>>n;
    while(n--){
        scanf("%d",&m);
        vis[m]=1;
    }
    if(check(1,1,1,2,1,3)){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check(2,1,2,2,2,3)){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check(3,1,3,2,3,3)){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check(1,1,2,1,3,1)){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check(1,2,2,2,3,2)){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check(1,3,2,3,3,3)){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check(1,1,2,2,3,3)){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(check(3,1,2,2,1,3)){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No";
    return 0;
}
/*
4 4
0000
0110
0110
0011
*/


Measured memory_bytes: 256
//
// Created by user on 3/9/2020.
//
#include <bits/stdc++.h>
//#define endl '\n'
using namespace std;

int main() {
    ios_base :: sync_with_stdio(0); cin.tie(0);
    int a, b;
    cin >> a >> b;

    for (int i = 1; i <= 10000; ++i) {
        cerr << i << " " << (int)(i * 0.08) << " " << (int)(i * 0.1) << '\n';
        if ( (int)(i * 0.08) == a and (int)(i * 0.1) == b) {
            cout << i;
            return 0;
        }
    }
    cout << -1;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

unsigned long long solve(unsigned long long a, unsigned long long b) {
    if(a==b) {
        return a;
    }

    unsigned long long k, l, x, y;
    unsigned long long ans = 0uLL;

    // ad-hoc for i=0
    k = ((a|4uLL)-1uLL);
    x = ((k-a+1uLL)&1uLL? 1:0);

    l = b&(~(3uLL));
    y = ((b-l+1uLL)&1uLL? 1:0);
    if (x^y) ans += 1uLL;

    for(unsigned long long i = 1uLL;b>=(1uLL<<i);++i) {
        if (a&(1uLL<<i)) {
            k = (a|((1uLL<<(i+1uLL))-1uLL));
            x = ((k-a+1uLL)&1? 1:0);
        } else {
            x = 0;
        }

        if (b&(1uLL<<i)) {
            l = b& (~((1uLL<<(i+1uLL))-1uLL));
            y = ((b-l+1uLL)&1? 1:0);
        } else {
            y = 0;
        }
        if (x^y) ans += (1uLL<<i);
    }
    return ans;
}

unsigned long long solve2(unsigned long long a, unsigned long long b) {
    for(unsigned long long i=a+1;i<=b;++i) {
        a ^= i;
    }
    return a;
}

unsigned long long fzero(unsigned long long a) {
    if(a&1uLL) {
        a = 1uLL&((a+1uLL)/2uLL)? 1uLL: 0uLL;
    } else {
        a = fzero(a-1uLL) ^ a;
    }
    return a;
}

unsigned long long solve3(unsigned long long a, unsigned long long b) {
    return fzero(a-1uLL)^fzero(b);
}

int main(int argc, char const *argv[])
{
    unsigned long long a, b;
    cin >> a >> b;
    cout << solve3(a, b) << endl;
    return 0;
}


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

int main() {
	char a, b;
	cin >> a >> b;

	if (a == 'H') {
		if (b == 'H') {
			cout << 'H' << endl;
		}
		else cout << 'D' << endl;
	}
	else {
		if (b == 'H') {
			cout << 'D' << endl;
		}
		else cout << 'H' << endl;
	}
}

Measured memory_bytes: 256
// Author: Harshdeep Sharma , IIT  Indore
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
// #define MOD  998244353
#define ll long long
const double PI = atan(1.0) * 4;
// const ll INF = (int)1e9 ;
const int di[4] = { -1, 0, 1, 0} ;
const int dj[4] = {0, -1, 0, 1} ;
const ll INF = (ll)2e18 + 50;
const int maximum  = numeric_limits<int>::max();
const int minimum  = numeric_limits<int>::min();
// const int N = 1e5 + 5 ;
const int mod = 1e9 + 7 ;
// const int N = 3e5 + 5 ;

ll power(ll a , ll e) {
	ll res = 1LL ;
	while (e > 0) {
		if (e % 2 == 1) res = res * a;
		a =  a * a  ;
		e /= 2 ;
	}
	return res ;
}






int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t ;
	// cin >> t ;
	t = 1 ;
	while (t--) {
		// int n;
		int n ;
		cin >> n ;
		vector<ll> a(n) ;
		for (int i = 0 ; i < n ; i++) {
			cin >> a[i] ;
		}
		ll ans = 0 ;
		for (int i = 0 ; i < n - 1 ; i++) {
			if (a[i + 1] < a[i] ) {
				ans += (a[i] - a[i + 1]) ;
				a[i + 1] = a[i] ;
			}
		}
		cout << ans << "\n";


	}



	return 0 ;
}





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

using ll = long long;

const int INF = 1000000000;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; ++i) cin >> H[i];
    bool ok = true;
    H[0]--;
    for (int i = 1; i < N - 1; ++i) {
        if (H[i - 1] < H[i]) --H[i];
        if (H[i] > H[i + 1]) {
            ok = false;
            break;
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
}


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

int main()
{
	int n;
	while(cin >> n){
		if(!n)
			break;
		int tosi[7];
		for(int i=0;i<7;i++){
			tosi[i] = 0;
		}
		int a;
		for(int i=0;i<n;i++){
			cin >> a;
			if(a<10)
				tosi[0]++;
			else if(a<20)
				tosi[1]++;
			else if(a<30)
				tosi[2]++;
			else if(a<40)
				tosi[3]++;
			else if(a<50)
				tosi[4]++;
			else if(a<60)
				tosi[5]++;
			else
				tosi[6]++;
		}
		for(int i=0;i<7;i++){
			cout << tosi[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll N, M, V, P;
  cin >> N >> M >> V >> P;
  vector<ll> A(N);
  REP(i, N) { cin >> A[i]; }
  sort(ALL(A));
  ll ng = -1, ok = N - P;

  while (ng + 1 < ok) {
    ll mid = (ok + ng) / 2;
    if (A[N - P] - A[mid] > M) {
      ng = mid;
      continue;
    }
    ll b = A[mid] + M;  //ボーダーライン
    ll margin = 0;
    REP(i, N) {
      if (i <= mid || i >= N - P + 1) {
        margin += M;
      } else {
        margin += min(b - A[i], M);
      }
    }
    if (margin >= M * V) {
      ok = mid;
    } else {
      ng = mid;
    }
  }
  cout << N - ok << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
typedef long long ll;
// cd test ; rm -R ./*; cd ..
const ll MOD = 1000000007;

int main(void) {
  ll n, k;
  cin >> n >> k;
  ll a[n];
  rep (i, n) cin >> a[i];

  vector<ll> t(n, 0), t_l(n, 0);

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[i] > a[j]) t[i]++;
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (a[i] > a[j]) t_l[i]++;
    }
  }

  ll ans = 0;
  rep (i, n) {
    ans += t[i];
  }
  ans = (ll) ans * k % MOD;
  ll k_sum = (ll) k * (k - 1) / 2 % MOD;

  rep (i, n) {
    ans += (ll) k_sum * (t[i] + t_l[i]);
  }
  cout << ans % MOD << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int N[100], n, i;

    scanf("%d", &n);
    for(i = 0; i < n; ++i)
    {
        scanf("%d", &N[i]);    
    }

    for(i = n-1; i >= 0; --i)
    {
        printf("%d", N[i]);
        if(i != 0) printf(" ");
    }
    printf("\n");

 return 0;
}


Measured memory_bytes: 2032
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	          int i;

	      	  cin.tie(0);  ios_base::sync_with_stdio(false);

	      	  int N;
	      	  cin >> N;

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

	      	  sort(a.begin(),a.end());
	      	  if(N==2){
	      		  cout << a[1] << ' ' << a[0] << endl;
	      		  return 0;
	      	  }

	      	  int x=a[N-1];

	      	  if(x%2==1){
	      		  if(binary_search(a.begin(),a.end(),(x+1)/2)){
	      			  cout << x << ' ' << (x+1)/2 << endl;
	      			  return 0;
	      		  }

	      		  int b=upper_bound(a.begin(),a.end(),(x+1)/2)-a.begin();
	      		  int c;
	      		  if(abs((x+1)/2-a[b])<abs((x+1)/2-a[b-1])) c=a[b];
	      		  else c=a[b-1];

	      		  cout << x << ' ' << c << endl;

	      	  }else{

	      		  if(binary_search(a.begin(),a.end(),x/2)){
	      			  cout << x << ' ' << x/2 << endl;
	      			  return 0;
	      		  }

	      		  int b=upper_bound(a.begin(),a.end(),x/2)-a.begin();
	      		  int c;
	      		  if(abs(x/2-a[b])<abs(x/2-a[b-1])) c=a[b];
	      		  else c=a[b-1];

	      		  cout << x << ' ' << c << endl;

	      	  }

	          return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    
    int n=sc.nextInt();
    
    int ans=1;
    for(int i=0;i<n;i++){
      if(n>=ans*2){
        ans*=2;
      }else{
        System.out.println(ans);
        break;
      }
    }
    

    sc.close();
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<int> d(120);

  for(int i = 0 ; i < N ; ++i){
    cin >> d.at(i);
  }

  int counter = 0;

  for(int i = 0 ; i < N ; ++i){
    for(int j = 0 ; j < N ; ++j){
      if(d.at(i) == d.at(j) && i != j) d.at(j) = 0;
    }
  }

  for(int i = 0 ; i < N ; ++i){
    if(d.at(i) != 0) ++counter;
  }
  
  cout << counter << endl;
}


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

using namespace std;

const int N = 50;

void mult(int m1[N][N], int m2[N][N], int n, int m){
  int res[N][N];
  fill(res[0], res[N], 0);
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      for(int k=0;k<n;k++) res[i][j] = (res[i][j] + m1[i][k] * m2[k][j]) % m;
    }
  }
  for(int i=0;i<n;i++) for(int j=0;j<n;j++) m1[i][j] = res[i][j];
}

void mod_pow(int mat[N][N], int p, int n, int m){
  int res[N][N];
  fill(res[0], res[N], 0);
  for(int i=0;i<n;i++) res[i][i] = 1;
  while(p > 0){
    if(p & 1) mult(res, mat, n, m);
    mult(mat, mat, n, m);
    p >>= 1;
  }
  for(int i=0;i<n;i++) for(int j=0;j<n;j++) mat[i][j] = res[i][j];
}

main(){
  int n, m, a, b ,c, t, s[N], mat[N][N];
  while(cin >> n >> m >> a >> b >> c >> t && (n|m|a|b|c|t)){
    for(int i=0;i<n;i++) cin >> s[i];
    fill(mat[0], mat[N], 0);
    for(int i=0;i<n;i++){
      if(i - 1 >= 0) mat[i][i-1] = a;
      mat[i][i] = b;
      if(i + 1 < n) mat[i][i+1] = c;
    }
    mod_pow(mat, t, n, m);
    for(int i=0;i<n;i++){
      int ans = 0;
      for(int j=0;j<n;j++) ans = (ans + mat[i][j] * s[j]) % m;
      if(i) cout << " ";
      cout << ans;
    }
    cout << endl;
  }
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    string s;
    in>>n>>s;
    for(auto&c:s){
        c+=n;
        if(c>'Z') c-=26;
    }
    cout<<s<<endl;
}

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

def comparison(x,y):
    count1 = 0
    for t in range(0,y):
        if(x - list[t] >= 0):
            count1 = count1 + 1

    #print(count1)
    if(count1 == y):
        return 1
    else:
        return 0


answer = 1

for i in range(1,n):
    answer = answer + comparison(list[i],i)

print(answer)


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


int main(){

int k,s;
cin >> k >> s;
ll ans = 0;
int z;

for (int i = 0; i <= k; i++)
{
    for (int j = 0; j <= k; j++)
    {
      z = s - i - j;
      if(z >= 0 && z <= k)
      {
          ans++;
      }      
        }
        
    }
 printf("%lld\n", ans);
   
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
// #define double long double
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
//#define endl "\n"
#define inf 1e+15
int ans[N];
vector<pii> v[N];
void dfs(int x , int p){
	for(int i=0;i<v[x].size();i++){
		int y=v[x][i].ff , z = v[x][i].ss;
		if(y==p) continue;
		if(z%2==1) ans[y]= 1 - ans[x],dfs(y,x);
		else ans[y]=ans[x] , dfs(y,x);
	}
}
signed main(){
  fast;
  int n,x,y,z;
  cin>>n;
  for(int i=1;i<n;i++){
  	cin>>x>>y>>z;
  	v[x].pb({y,z});
  	v[y].pb({x,z});
  }
  ans[1] = 0;
  dfs(1 , -1);
  for(int i=1;i<=n;i++)
  	cout<<ans[i]<<endl;

}
  


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

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007


int main(){
	NINJA;

	long double r; cin >> r;

	long double ans = (double)2*r*(double)3.14159265358;

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

Measured memory_bytes: 3804
n = int(input())
a = [int(input())-1 for i in range(n)]
used = [0] * n
br = 0
cnt = 0
while True:
    if used[br]:
        print(-1)
        exit()
    if br == 1:
        print(cnt)
        exit()
    used[br] = 1
    br = a[br]
    cnt += 1

Measured memory_bytes: 7852
#include <iostream>
#include <stdio.h>
#include<algorithm>
using namespace std;
int main (void)
{
int n;
int a[1000];
int d=10000;
int e=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
 d=min(d,a[i]);
e=max(e,a[i]);
}
cout<<e-d<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1005;
int n,arr[N][N],idx[N];
int main() 
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
		for(int j=0;j<n-1;j++) 
			scanf("%d",&arr[i][j]);
    queue<pair<int,int>>que;
    int ans=0,cnt=0;
    for(int i=1;i<=n;i++) 
		if(arr[arr[i][0]][0]==i&&i<arr[i][0])
        	que.push({i,arr[i][0]});
    for(;cnt<n*(n-1)/2;ans++) 
	{
        if(que.empty()) 
		{
            puts("-1");
            return 0;
        }
        int s=que.size();
        while(s--) 
		{
            int a=que.front().first,b=que.front().second;
            que.pop();
            idx[a]++;
            if(arr[arr[a][idx[a]]][idx[arr[a][idx[a]]]]==a)
                que.push({a,arr[a][idx[a]]});
            idx[b]++;
            if(arr[arr[b][idx[b]]][idx[arr[b][idx[b]]]]==b)
                que.push({b, arr[b][idx[b]]});
            cnt++;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template <std::uint_fast64_t Modulus> class modint {
    using u64 = std::uint_fast64_t;

  public:
    u64 a;
    constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr modint operator+(const modint rhs) const noexcept {
        return modint(*this) += rhs;
    }
    constexpr modint operator-(const modint rhs) const noexcept {
        return modint(*this) -= rhs;
    }
    constexpr modint operator*(const modint rhs) const noexcept {
        return modint(*this) *= rhs;
    }
    constexpr modint operator/(const modint rhs) const noexcept {
        return modint(*this) /= rhs;
    }
    constexpr modint operator^(const u64 rhs) const noexcept {
        return modint(*this) ^= rhs;
    }
    constexpr modint &operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    constexpr modint &operator-=(const modint rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr modint &operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr modint &operator/=(modint rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
    constexpr modint &operator^=(u64 exp) {
        modint rhs = modint(*this);
        a = 1;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
};
using mint = modint<MOD>;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vll c(1000010), a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        int t = a[i];
        for (int j = 2; j * j <= a[i]; j++) {
            int cnt = 0;
            while (t % j == 0) {
                t /= j;
                cnt++;
            }
            chmax(c[j], (ll)cnt);
        }
        if (t > 1) {
            chmax(c[t], 1LL);
        }
    }
    mint res = 0;
    mint s = 1;
    for (int i = 2; i <= 1000000; i++) {
        s *= mint(i) ^ c[i];
    }
    for (int i = 0; i < n; i++) {
        res += s / a[i];
    }
    cout << res.a << endl;
}


Measured memory_bytes: 8192
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    if ('A' <= n && n <= 'Z')
    {
        cout << "1\n";
    }
    else if ('a' <= n && n <= 'z')
    {
        cout << "2\n";
    }
    else
    {
        cout << "0\n";
    }
}


Measured memory_bytes: 3096
#include<stdio.h>
int n,m,h[100000],f[100000]={},a,b,i,r=0;
int main(){
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)scanf("%d",&h[i]);
    for(i=0;i<m;i++){
        scanf("%d%d",&a,&b);
        if(h[a-1]>=h[b-1])f[b-1]--;
        if(h[b-1]>=h[a-1])f[a-1]--;
    }
    for(i=0;i<n;i++)if(f[i]==0)r++;
    printf("%d",r);
    return 0;
}

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

int main(){
  int N;
  cin>>N;
  int vec[110];
  for(int i=0;i<N;i++){
    cin >> vec[i];
  }
  sort(vec, vec+N, greater<int>());
  int alice=0, bob=0;
  for(int i=0;i<N;i+=2){
    alice+=vec[i];
  }
  for(int i=1;i<N;i+=2){
    bob+=vec[i];
  }
  int sum =alice-bob;
  cout << sum << endl;
}

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

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		vector<string> s(n);
		vector<int> len(n+1,0);
		for(int i=0; i<n; i++){
			cin >> s[i];
			len[i]=s[i].length();
		}
		
		for(int i=1; i<n; i++){
			int p=0;
			while(s[i][p]<'a' || 'z'<s[i][p]) p++;
			p--;
			s[i][p] = '+';
			for(int j=i+1; j<n+1; j++){
				if(len[j]>p && s[j][p]=='.'){
					if(s[j][p+1]=='.'){
						s[j][p]='|';
					}else{
						s[j][p]='+';
					}
				}else{
					j--;
					while(s[j][p]=='|'){
						s[j][p]=' ';
						j--;
					}
					break;
				}
			}
		}
		
		for(int i=0; i<n; i++){
			cout << s[i] << endl;
		}
	}
	return 0;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    string s;cin >> s;
    for(int i = 0;i < n;i++)
    {
        if(i == k-1)
        {
            cout << (char)tolower(s[i]);
        }
        else
        {
            cout << s[i] ;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
        int[] list = new int[3];
        for(int i = 0; i < 3; i++) {
          list[i] = sc.nextInt();
        }
        Arrays.sort(list);
      
        int k = sc.nextInt();
      
        for(int i = 0; i < k; i++) {
          list[2] *= 2;
        }
        int ans = 0;
        for(int i = 0; i < list.length; i++) {
          ans += list[i];
        }
    
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int main()
{
  unsigned long long H,W;
  cin >> H >> W;

  if(H%2 == 1 && W%2 == 1 && H != 1 && W != 1){
    cout << (H * W + 1) / 2 << endl;
  }else if(H ==1 || W == 1){
    cout << 1 << endl;
  }else{
    cout << (H * W) / 2 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll c=0,l=0;
    rep(0,i,n)if(s[i]=='W')++c;
    rep(0,i,c)if(s[n-1-i]=='W')++l;
    cout<<c-l;
}

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

int main(void)
{
    //cout << "hello world!" << endl;
    int a = 0;
    int b = 0;
    int x = 0;

    cin >> x >> a >> b;

    if (abs(x - a) <= abs (x - b))
    {
        cout << "A" << endl;
    }
    else {
        cout << "B" <<endl;
    }

    return 0;
}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long

const long long MOD = 1000000007;

int main(){
  int h,n;
  cin >> h >> n;
  vector<int> a(n),b(n);
  vector<vector<int>> dp(n+1,vector<int>(h+1,1e8+1));
  rep(i,n) cin >> a.at(i) >> b.at(i);

  rep(i,n){
      rep(j,h+1){
        if(j<=a.at(i)) dp.at(i+1).at(j)=min(dp.at(i).at(j),b.at(i));
        else dp.at(i+1).at(j) = min(dp.at(i).at(j),dp.at(i+1).at(j-a.at(i))+b.at(i));
      }
  }
  cout << dp.at(n).at(h)<<endl;
}


Measured memory_bytes: 39424
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;

const lint mod = 1e9 + 7;

int main(){
    int MAX = 100010;
    bool prime[MAX];
    rep(i, MAX) prime[i] = true;
    prime[0] = prime[1] = false;
    For(i, 2, MAX)if(prime[i]){
        for(int j=i*2; j<MAX; j+=i) prime[j] = false;
    }
    int p[MAX];
    rep(i, MAX) p[i] = 0;
    For(i, 3, MAX)if(prime[i] && prime[(i+1)/2]) ++p[i];
    rep(i, MAX-1) p[i+1] += p[i];
    
    int q;
    scanf("%d", &q);
    while(q--){
        int l, r;
        scanf("%d%d", &l, &r);
        printf("%d\n", p[r] - p[l-1]);
    }
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>

int main(void)
{
    std::string Sa, Sb, Sc;
    std::cin >> Sa >> Sb >> Sc;
    
    std::string::iterator ia = Sa.begin(), ib = Sb.begin(), ic = Sc.begin();

    char field = 'a';
    
    bool flag = true;
    while(flag)
    {
        switch(field)
        {
        case 'a':
            if(ia == Sa.end()) { flag = false; break; }
            field = *ia;
            ++ia;
            break;
        case 'b':
            if(ib == Sb.end()) { flag = false; break; }
            field = *ib;
            ++ib;
            break;
        case 'c':
            if(ic == Sc.end()) { flag = false; break; }
            field = *ic;
            ++ic;
            break;
        }
    }

    std::cout << static_cast<char>(field + ('A' - 'a')) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <queue>

using namespace std;

int main()
{
	int a , b , c , d;
	scanf("%1d%1d%1d%1d",&a , &b , &c , &d);
	for(int i = 1 ; i <= 2 ; i++){
		for(int j = 1 ; j <= 2 ; j++){
			for(int k = 1 ; k <= 2 ; k++){
				int sum = 0;
				if(i == 1) sum = a + b;
				else sum = a - b;
				if(j == 1) sum += c;
				else sum -= c;
				if(k == 1) sum += d;
				else sum -= d;
				if(sum == 7){
					printf("%d",a);
					if(i == 1) printf("+");
					else printf("-");
					printf("%d",b);
					if(j == 1) printf("+");
					else printf("-");
					printf("%d",c);
					if(k == 1) printf("+");
					else printf("-");
					printf("%d=7\n",d);
					return 0;
				}
			}
		}
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  cin >> N >> A >> B;
  if(N*A > B){
    cout << B << endl;
  }
  else if(N*A < B){
    cout << N*A << endl;
  }
  else{
    cout << B << endl;
  }
}

Measured memory_bytes: 256
n, *a = map(int, open(0).read().split())
a = [0] + a
for i in range(n): a[i+1] += a[i]
a.sort()

b = []
prev = cnt = 0
for i in range(n+1):
        if prev==a[i]: cnt+=1
        else:
                b.append(cnt)
                cnt = 1
        prev = a[i]
b.append(cnt)

ans = 0
for i in b: ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 25108
#include <iostream>
#include <vector>
#include <climits>

/*
std::vector<int> generate_coin_set(int n) {
    std::vector<int> coin_set;
    // while()
}
*/

int main()
{
    int N;
    while(std::cin >> N) {
        // std::vector<int> coin {1, 6, 9, 36, 81, 216, 729}; // generate_coin_set(N); // or just prebuild the set ?
        int coin[] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};
        int set_len = sizeof(coin) / sizeof(int);
        int dp[N+1];
        dp[0] = 0;
        for(int i = 1; i <= N; i++) {
            dp[i] = INT_MAX;
        }

        for(int i = 1; i <= N; i++) {
            int min_coin = INT_MAX;
            for(int j = 0; j < set_len && coin[j] <= i; j++) {
                if(dp[i - coin[j]] + 1 < min_coin) {
                    min_coin = dp[i - coin[j]] + 1;
                }
            }
            dp[i] = min_coin;
        }

        std::cout << dp[N] << std::endl;
    }


    return 0;
}

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

using namespace std;

int se20[] = {2,3,4,5,6,8,9,10,12,14,16,18,20,21,22,24,25,26,27,28};

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	if (N >= 20){
		for (int i = 1; i <= N%20; ++i){
			cout << i*30 << ' ';
		}
		for (int i = 0; i < N/20; ++i){
			for (int j = 0; j < 20; ++j){
				cout << se20[j] + i*30 << ' ';
			}
		}
		cout << '\n';
	}
	else{
		if (N == 3){
			cout << 2 << ' ' << 5 << ' ' << 63 << '\n';
		}
		else{
			for (int i = 0; i < N/4; ++i){
				cout << 2 + i*18 << ' ' << 3 + i*(18) << ' ' << 4 + i*18 << ' ' << 9 + i*18 << ' ';
			}
			for (int i = 1; i <= N%4; ++i){
				cout << 6*i << ' ';
			}
			cout << '\n';
		}
	}
	cout << flush;
	//for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}}
}



/*
2	
3	
4	
5	
6
8
9
10
12
14
16
18
20
21
22
24
25
26
27
28
30




*/

Measured memory_bytes: 384