akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
    int ref[10];
    int x;
    for(int i=1;i<10;i++)
    {
        x=2019*i;
        ref[x%10]=(x/10);
    }
    int arr[2019],brr[2019];
    for(int & j : arr)
        j=0;
    char s[200001];
    scanf("%s",s);
    int n=strlen(s);
    int count=0;
    for(int i=0;i<n;i++)
    {
        x=(int)s[i]-48;
        count+=arr[ref[x]];
        for(int j=0;j<2019;j++) {
            brr[j] = arr[j];
            arr[j]=0;
        }
        for(int j=0;j<2019;j++)
            arr[(j*10+x)%2019]+=brr[j];
        arr[x]++;
    }
    printf("%d",count);
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s,t; cin>>s>>t;
	int ans=1001;
	for(int i=0;i+t.size()<=s.size();++i){
		int tans=0;
		for(int j=0;j<t.size();++j){
			if(s.at(i+j)==t.at(j))continue;
			else ++tans;
		}
		ans=min(ans,tans);
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 3624
#include <iostream>

typedef unsigned long long ll;

ll calc()
{
  ll N, x;
  ll a[100000];
  ll i, tmp;
  ll count = 0;

  std::cin >> N >> x;

  for (i = 0; i < N; i++) {
    std::cin >> a[i];
  }

  if (N == 2) {
    if (a[0] + a[1] < x)
      return 0;
    
    count = a[0] + a[1] - x;
    return count;
  }

  for (i = 1; i < N - 1; i++) {
    while (a[i-1] + a[i] > x) {
      tmp = a[i-1] + a[i] - x;
      count += tmp;
      if (a[i] < tmp) {
        a[i] = 0;
        a[i-1] = x;
      } else {
        a[i] -= tmp;
      }
    }

    while (a[i] + a[i+1] > x) {
      tmp = a[i] + a[i+1] - x;
      count += tmp;
      if (a[i+1] < tmp) {
        a[i+1] = 0;
        a[i] = x;
      } else {
        a[i+1] -= tmp;
      }
    }
  }

  return count;
}

int main(void)
{
  std::cout << calc() << std::endl;

  return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);

    int N,T;
    cin >> N >> T;
    int ans = INT_MAX;
    for(int i=0; i<N; i++){
        int c,t;
        cin >> c >> t;
        if(t <= T) ans = min(ans, c);
    }
    if(ans == INT_MAX) cout << "TLE" << endl;
    else cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

const int LENGTH = 2e5+1;

int main()
{
	int i, sIndex, tIndex;
	char s[LENGTH], t[LENGTH], sChar[26] ={ 0 }, tChar[26] ={ 0 };
	std::scanf("%s", s);	std::scanf("%s", t);

	for (i = 0; s[i]; i++) {
		sIndex = s[i]-'a', tIndex = t[i]-'a';

		if (s[i] != t[i]) {
			if (!sChar[sIndex])
				sChar[sIndex] = t[i];
			else if (sChar[sIndex] != t[i]) {
				std::printf("No\n");
				return 0;
			}

			if (!tChar[tIndex])
				tChar[tIndex] = s[i];
			else if (tChar[tIndex] != s[i]) {
				std::printf("No\n");
				return 0;
			}
		}
		else if (sChar[sIndex] || tChar[tIndex]) {
			std::printf("No\n");
			return 0;
		}
	}

	std::printf("Yes\n");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;

int main() {
  ll n, a, b, c, bc;
  cin >> n >> a >> b;
  c = n % (a+b);
  // bc = a / (a+b);
  bc = a * (n/(a+b));
  if(c >= a) {
    bc+=a;
  } else {
    bc+=c;
  }
  cout <<  bc << endl ;
  return 0;
}

Measured memory_bytes: 256
/*** akshaykumar99 ***/
 
#include<bits/stdc++.h> 
using namespace std;
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long N = 2e5+1;
 
typedef long long ll;
typedef long double ld;

void test_case()
{
	ll h, w, m;
    cin >> h >> w >> m;
    map<pair<ll,ll>,ll> maps;
   	for(ll i = 1; i <= m; i++)
   	{
        ll x,y;
        cin >> x >> y;
        maps[{x,y}] = 1;
    }
    vector<ll>row(h+1,0),col(w+1,0);
    for(auto s : maps)
    {
        row[s.first.first]++;
        col[s.first.second]++;
    }
    vector<ll>x,y;
    ll ans = 0;
    for(auto s : maps)
    {
        x.push_back(s.first.first);
        y.push_back(s.first.second);
    }
    ll a = x.size();
    ll b = y.size();
    ll ind_x,ind_y;
    ll ma_x = 0,ma_y = 0;
    for(ll i = 1; i <= h; i++)
    {
        if(row[i] > ma_x)
        {
            ma_x = row[i];
            ind_x = i;
        }
    }
    for(ll i = 1; i <= w; i++)
        ans = max(ans,col[i] + ma_x - maps[{ind_x,i}]);
    
   	for(ll i = 1; i <= w; i++)
   	{
        if(col[i] > ma_y)
        {
            ma_y = col[i];
            ind_y = i;
        }
    }
    for(ll i = 1; i <= h; i++)
        ans = max(ans,row[i] + ma_y - maps[{i,ind_y}]);
    cout << ans << "\n";
}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL); 
    ll tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}


Measured memory_bytes: 68856
A, B, AB, A_NUM, B_NUM = map(int, input().split())


if AB * 2 > A + B:
    print(A * A_NUM + B * B_NUM)
    exit()

ans = 0
nikoichi = min([A_NUM, B_NUM])
ans += AB * nikoichi * 2

if A_NUM > B_NUM:
    if A > AB * 2:
        ans += (A_NUM-B_NUM) * AB * 2
    else:
        ans += (A_NUM-B_NUM) * A
elif A_NUM < B_NUM:
    if B > AB * 2:
        ans += (B_NUM-A_NUM) * AB * 2
    else:
        ans += (B_NUM-A_NUM) * B

print(ans)


Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 100010
vector<int> g[N];
int dp[N], dp2[N];
int n;
bool used[N];

int rec(int u){
	used[u] = true;
	int cnt = 0, b = 0;
	vector<int> d;
	for(auto &&v: g[u]){
		if(used[v]) continue;
		cnt++;
		rec(v);
		if(dp2[v]) b = 1;
		dp[u] += dp[v];
	}
	if(cnt==0){
		dp[u] = 1;
		dp2[u] = 1;
	} else if(cnt==1){
		if(b) dp2[u] = 1;
	} else {
		if(b) dp[u]--;
	}
}

int main(){
	cin>>n;
	rep(i, n-1){
		int x, y;
		cin>>x>>y;
		g[x].pb(y);
		g[y].pb(x);
	}
	rep(i, n){
		if(g[i].size()>2){
			rec(i);
			//cerr<<i<<endl;
			cout<<dp[i]<<endl;
			return 0;
		}
	}
	cout<<1<<endl;
	return 0;
	int r = 0;
	rep(i, n){
		if(g[i].size()==1) r++;
		else {
			int s = 0;
			for(auto j: g[i]) if(g[j].size()==1) s = 1;
			r -= s;
		}
	}
	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long int ll;
typedef unsigned long long int ull;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  string s,t;
  cin >>a>>b>>c;
  if(a*b<c)c=a*b;
  cout <<c;
}

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

#define F first
#define S second

int dx[] = { 0 , 0, 1, -1, -1, -1, 1, 1};
int dy[] = { 1, -1 , 0, 0, 1, -1, 1, -1};
const double EPS= 1e-8 ;
const double PI  = acos(-1.0);
#define inf INT_MAX
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }





int main()
 {
 int n ; 
 cin>>n; 
 int a[n][3]  ;
 for (int i=  0  ; i< n ;i++) 
 for ( int j=0 ; j<3 ; j++) {
	 cin>>a[i][j] ; 
 }
 
 vector < vector < int > > dp (n , vector < int > (3 , 0 ) ) ;
 dp [0][0] = a[0][0]  ; 
 dp[0][1]= a[0][1] ; 
 dp[0][2] = a[0][2];  
 for ( int i  = 1 ; i< n;++i )
 for ( int j = 0  ; j< 3 ; j++) 
 {
	 for (int k  = 0 ; k < 3 ; k++)
	 {
		 if (k!= j)
		 {
			 dp[i][j] = max ( dp[i][j] , dp[i-1][k]+a[i][j]) ; 
		 }
	 }
 }
 
 int ans = max ( { dp[n-1][0], dp[n-1][1], dp [n-1 ][2]}) ; 
 cout << ans << endl; 
 
  



 return 0 ;
}






 
 
 
 
 
 

 


Measured memory_bytes: 6912
import java.util.Scanner;

/*
 * ??\?????????
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
 */
public class Main{

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int totalTime = 0;
        int n = scanner.nextInt();
        int q = scanner.nextInt();
        
        int[] A = new int[n];
        Queue queue = new Queue(n);
        
        for(int i=1;i<=n;i++){
            Process process = new Process(scanner.next(),scanner.nextInt());
            queue.enqueue(process);
        }
        while(true){
        	Process p= queue.dequeue();
        	if(p==null){
        		break;
        	}
        	int time =p.getProcessTime();
        	int remainingTime = time-q;
        	if(remainingTime <=0){
        		totalTime += time;
        		System.out.println(p.getProcessName()+" "+totalTime);
        	}else{
        		totalTime += q;
        		p.setProcessTime(time-q);
        		queue.enqueue(p);
        	}
        }
    }
}
class Queue{
	int startIndex;
	int endIndex;
	int size;
    String[] queueName;
    int[] queueTime;
    
	Queue(int n){
    	startIndex =0;
    	endIndex = 0;
    	size = n;
        queueName = new String[n];
        queueTime = new int[n];
	}
	void enqueue(Process process){
		//System.out.println("??¨????????\???"+process.getProcessName()+","+process.getProcessTime());

		queueName[endIndex]=process.getProcessName();
		queueTime[endIndex]=process.getProcessTime();
		endIndex++;
		endIndex %= size;
	}
	Process dequeue(){
		//System.out.println("????????\???"+queueName[startIndex]+","+queueTime[startIndex]);
		if(queueName[startIndex].equals("")){
			return null;
		}
		Process process = new Process(queueName[startIndex],queueTime[startIndex]);
		queueName[startIndex]="";
		startIndex++;
		startIndex %= size;
		return process;
	}
}

class Process{
	private String processName;
	private int processTime;
	Process(String processName,int processTime){
		this.processName = processName;
		this.processTime = processTime;
	}
	String getProcessName(){
		return processName;
	}
	void setProcessName(String processName){
		this.processName = processName;
	}
	public int getProcessTime() {
		return processTime;
	}
	public void setProcessTime(int processTime) {
		this.processTime = processTime;
	}
}

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


int gcd(int a, int b) {
    if (a < b) return gcd(b, a);
    int c;
    while (a%b) {
        c = a%b;
        a = b;
        b = c;
    }

    return b;
}

int main() {
    int a, b;
    cin >> a >> b;
    cout << gcd(a, b) << endl;
}


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

ll dp[2][4] = {1, };
const ll mod = 1e9+7;
int main() {
	in(string, s);
	auto show = [&](char c){
		cerr << " ---------- " << endl;
		cerr << "c = " << c << endl;
		loop(i, 4)
			cerr << dp[0][i] << " -> " << dp[1][i] << endl;
		cerr << " ---------- " << endl;
	};
	for(char c : s){
		loop(i, 4)
			dp[1][i] = (c-'?'?1:3)*dp[0][i] % mod;
		switch(c){
		case 'A':
			dp[1][1] += dp[0][0];
			break;
		case 'B':
			dp[1][2] += dp[0][1];
			break;
		case 'C':
			dp[1][3] += dp[0][2];
			break;
		case '?':
			dp[1][1] += dp[0][0];
			dp[1][2] += dp[0][1];
			dp[1][3] += dp[0][2];
			break;
		}
		//show(c);
		loop(i, 4)
			dp[0][i] = dp[1][i] % mod;
	}
	out(dp[0][3]);
}



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

int main() {
  int h,w;
  vector<char> img = vector<char>(w,'#');
  cin >> h >> w;
  
  vector<string> tb = vector<string>(w+2,"#");
  for (int i = 0; i < w+2; i++) {
    cout << tb.at(i);
  }
  cout << endl;
  
  for (int i = 0; i < h; i++) {
    for (int t = 0; t < w; t++) {
      cin >> img.at(t);
    }
    cout << "#";
    for (int t = 0; t < w; t++) {
      cout << img.at(t);
    }
    cout << "#" << endl;
  }
  for (int i = 0; i < w+2; i++) {
    cout << tb.at(i);
  }
  cout << endl;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
constexpr int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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; }

#include "bits/stdc++.h"

struct LazySegmentTree {

	int n;
	std::vector<long long> nodes, lazy;
	LazySegmentTree(std::vector<long long> v) {
		int sz = (int)v.size();
		n = 1; while (n < sz) n *= 2;
		nodes.resize(2 * n - 1);
		lazy.resize(2 * n - 1, 0);

		for (int i = 0; i < sz; i++) nodes[i + n - 1] = v[i];
		for (int i = n - 2; i >= 0; i--) nodes[i] = nodes[i * 2 + 1] + nodes[i * 2 + 2];
	}

	void eval(int k, int l, int r) {
		if (lazy[k] != 0) {
			nodes[k] += lazy[k] * (r - l);
			if (r - l > 1) {
				lazy[2 * k + 1] += lazy[k];
				lazy[2 * k + 2] += lazy[k];
			}
			lazy[k] = 0;
		}
	}
	void add(int a, int b, int x) {
		add(a, b, x, 0, 0, n);
	}
	long long getsum(int a, int b) {
		return getsum(a, b, 0, 0, n);
	}
private:
	void add(int a, int b, int x, int k, int l, int r) {
		eval(k, l, r);
		if (b <= l || r <= a)return;
		if (a <= l && r <= b) {
			lazy[k] += x;
			eval(k, l, r);
		}
		else {
			add(a, b, x, 2 * k + 1, l, (l + r) / 2);
			add(a, b, x, 2 * k + 2, (l + r) / 2, r);
			nodes[k] = nodes[2 * k + 1] + nodes[2 * k + 2];
		}
	}

	long long getsum(int a, int b, int k, int l, int r) {
		if (b <= l || r <= a)return 0;
		eval(k, l, r);
		if (a <= l && r <= b)return nodes[k];
		return getsum(a, b, 2 * k + 1, l, (l + r) / 2) + getsum(a, b, 2 * k + 2, (l + r) / 2, r);
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q;
	cin >> n >> q;
	vl v(n, 0);
	LazySegmentTree st(v);
	REP(i, q) {
		int t;
		cin >> t;
		if (t) {
			int l, r;
			cin >> l >> r;
			l--;
			cout << st.getsum(l, r) << endl;
		}
		else {
			int l, r, x;
			cin >> l >> r >> x;
			l--;
			st.add(l, r, x);
		}
	}


}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
const int maxn = 234567;
int fen[maxn];
void add(int x, int v){
	for(; x < maxn; x += x & - x) fen[x] += v;
}
int sum(int x){
	int ans = 0;
	for(; x; x -= x & - x) ans += fen[x];
       	return ans;
}
int main(){
	int n, k; cin >> n >> k;
	vector<long long> a(n + 1, 0);
	for(int i = 1; i <= n; i++){
		cin >> a[i]; a[i] -= k;
		a[i] += a[i - 1];
	}
	vector<long long> b = a;
	sort(b.begin(), b.end());
	b.erase(unique(b.begin(), b.end()), b.end());
	long long ans = 0;
	for(int i = 0; i <= n; i++){
		int pt = lower_bound(b.begin(), b.end(), a[i] + 1) - b.begin();
		ans += sum(pt);
		pt = lower_bound(b.begin(), b.end(), a[i]) - b.begin();
		add(pt + 1, 1);
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  vector<int> isp(100004, 1);
  for(int i = 2; i < 100004; i++)
    if(isp[i])
      for(int j = i * 2; j < 100004; j += i)
        isp[j] = 0;
  int n;
  cin >> n;
  for(int i = n; i < 100004; i++) {
    if(isp[i]) {
      printf("%d\n", i);
      return 0;
    }
  }
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(){
    int a,b,k;
    cin>>a>>b>>k;
    int i = 1, j=b-a+1;
    while(a<=b){
        if (i<=k || j<=k) {
            cout << a <<endl;
        }
        a++;
        i++;
        j--;
    }
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

int main(){
    string s;
    cin >> s;
    ll temp = 0;
    rep(i,0,s.size()){
        temp += s[i] - '0';
    }
    if(temp % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 3720
#include <stdio.h>
#define MOD 1000000007
int main(void){
	int n,m,i;
	scanf("%d %d", &n,&m);
	long long escada[n+1];
	for(i=0;i<=n;i++)escada[i]=1;
	int quebr[m];
	for(i=0;i<m;i++)scanf("%d",&quebr[i]);
    for(i=0;i<m;i++)escada[quebr[i]]=0;
	for(i=2;i<=n;i++){
		if(escada[i]!=0){
			escada[i]=(escada[i-2]+escada[i-1])%MOD;
		}
	}
	printf("%lld\n",escada[n]);
	return 0;
}
	


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

int main(){
  int X,Y;
  cin >> X >> Y;
  if (X == 2 || Y == 2){
    cout << "No" << endl;
  }
  else if ((X == 4 || X == 6|| X == 9|| X == 11) && (Y == 4 || Y == 6|| Y == 9|| Y == 11)){
    cout << "Yes" << endl;
  }
  else if ((X == 4 || X == 6|| X == 9|| X == 11) || (Y == 4 || Y == 6|| Y == 9|| Y == 11)){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

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

int main(){
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> scores(N, 0);
  for(int ii=0; ii<Q; ii++){
    int winner;
    cin >> winner;
    scores[winner-1]++;
  }
  for(auto& score : scores){
    cout << (K-(Q-score)>0 ? "Yes" : "No") << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
h,w = map(int,raw_input().split())
d = [map(int,raw_input().split()) for i in range(10)]

for k in range(10):
	for i in range(10):
		for j in range(10):
			d[i][j] = min(d[i][j], d[i][k] + d[k][j])

arr = [map(int,raw_input().split()) for i in range(h)]

print sum(sum(d[a][1] if a>=0 else 0 for a in aa) for aa in arr)

Measured memory_bytes: 2948
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

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

  ll n, a, b;
  string s;
  cin >> n >> a >> b >> s;

  ll det = 0;
  ll abr = 1;
  rep(i, n) {
    if (s[i] == 'c')
      puts("No");
    else if (s[i] == 'a') {
      if (det < a + b) {
        puts("Yes");
        det++;
      } else
        puts("No");
    } else {
      if (det < a + b && abr <= b) {
        puts("Yes");
        det++;
        abr++;
      } else
        puts("No");
    }
  }

  return 0;
}


Measured memory_bytes: 848
#include <stdio.h>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char *argv[])
{
    int n,k;
    scanf("%d %d", &n, &k);
    double p = 0;
    for (int i=1; i<=min(k-1,n);i++) {
        int a = ceil(log2(double(k)/double(i)));
        p += pow(0.5, a);
    }
    for (int i=k;i<=n;i++) {
        p += 1;
    }
    printf("%.16f", p / n);
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String new_s = s+s;
		String p = sc.next();
		
		if(new_s.contains(p)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
	}
}


Measured memory_bytes: 26328
N = int(input())
inputs = [int(i) for i in input().split()]

ans = [0 for _ in range(N)]
for i in range(N-1, -1, -1):
    if sum(ans[i::i+1]) % 2 != inputs[i]:
        ans[i] = 1

print(ans.count(1))
result = ''
for i in range(N):
    if ans[i] == 1:
        result += str(i+1) + ' '
print(result)

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

int main() {
	int num;
	int N;

	int sum{ 0 }, max{ 0 };
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &num);
		sum += num;
		if (num > max)max = num;
	}

	cout << sum - max / 2 << endl;

}


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

int main() {
  int X, Y, Z, K;
  scanf("%d %d %d %d", &X, &Y, &Z, &K);
  vector<long int> A;
  vector<long int> B;
  vector<long int> C;
  long int tmp;
  long int t;
  for (int i = 0; i < X; ++i) {
    scanf("%ld", &tmp);
    A.push_back(tmp);
  }
  for (int i = 0; i < Y; ++i) {
    scanf("%ld", &tmp);
    B.push_back(tmp);
  }
  for (int i = 0; i < Z; ++i) {
    scanf("%ld", &tmp);
    C.push_back(tmp);
  }
  sort(A.rbegin(), A.rend());
  sort(B.rbegin(), B.rend());
  sort(C.rbegin(), C.rend());

  vector<long> vec;
  for (int i = 0; i < A.size(); ++i) {
    for (int j = 0; j < B.size(); ++j) {
      for (int k = 0; k < C.size(); ++k) {
        if ((i + 1) * (j + 1) * (k + 1) <= K) {
          vec.push_back(A[i] + B[j] + C[k]);
        } else {
          break;
        }
      }
    }
  }

  sort(vec.rbegin(), vec.rend());
  for (int i = 0; i < K; ++i) { printf("%ld\n", vec[i]); }
  return 0;
}


Measured memory_bytes: 1412
#!/usr/bin/env python3
#!/usr/bin/env pypy3

from math import *

def main():
    import sys
    sys.dont_write_bytecode = True
    sys.setrecursionlimit(10000000)

    input = sys.stdin.readline

    #import numpy as np
    #import scipy as sp

    # Python 3 modules: https://docs.python.org/3/library/

    import os
    import math, itertools, operator
    from math import factorial as fact
    from operator import itemgetter, attrgetter
    from itertools import permutations, combinations
    from functools import reduce, lru_cache
    # Use scipy for stats: https://docs.scipy.org/doc/scipy/reference/stats.html
    # Before Python 3.5.  Import from math after it.
    from fractions import gcd
    from fractions import Fraction as Frac

    inf = float('inf')
    pow = __builtins__.pow

    def lcm(a, b):
        return a * b // gcd(a,b)

    def perm(a, b):
        import scipy.special
        return scipy.special.perm(a, b, exact = True)

    def comb(a, b):
        import scipy.special
        return scipy.special.comb(a, b, exact = True)

    def dfact(n):
        import scipy.special
        return scipy.special.factorial2(n, exact = True)

    def prod(l):
        return reduce(operator.mul, l)

    def input_ints(func = input, sep = None, conv = int):
        return list(map(conv, func().split(sep = sep)))

    if os.environ.get('GOROOT') is None:
        def dprint(*args, **kwargs):
            kwargs['file'] = sys.stderr
            import inspect
            frame = inspect.currentframe().f_back
            print('[' + os.path.basename(frame.f_code.co_filename)
                    + ':' + str(frame.f_lineno) + ']', *args, **kwargs)
    else:
        def dprint(*args, **kwargs):
            pass


    ############################################################################


    N, = list(map(int, input().split()))
    H = list(map(int, input().split()))

    yes = True
    last = H[-1]
    for n in range(N - 2, -1, -1):
        diff = last - H[n]
        dprint(diff)
        if diff < -1:
            yes = False
            break
        last = H[n]
        if diff == -1:
            last -= 1
    print('Yes' if yes else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 16248
using System;
public class program
{
    public static void Main()
    {
        var a = int.Parse(Console.ReadLine());
        var b = 0;
        double answer = 0;

        if(a == 1)
        {
            b = 1;
        }
        else if(a % 2 == 0)
        {
            b = a / 2;
        }
        else if(a % 2 == 1)
        {
            b = a / 2 + 1;
        }
        double count = b;
        double number = a;
        answer = count / number;

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 11092
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

const long long MOD = 1e9 + 7;

template <typename T>
struct Combination {
    vector<T> fac, finv, inv;
    const LL MOD = 1e9 + 7;
    Combination(int size)
        : fac(size + 1), finv(size + 1), inv(size + 1) {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < size + 1; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
    long long com(int n, int k){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
};
int main() {
    int h, w, a, b; cin >> h >> w >> a >> b;

    Combination<long long> com(h + w);

    long long ans = 0;
    for (int i = b; i < w; i++) {
        ans += com.com(h + i - a - 1, i)
            * com.com(w - 1 - i + a - 1, a - 1) % MOD;

    }
    cout << ans % MOD<< endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n, m, s, t;
  cin >> n >> m;
  vector<vl> g(n*3);
  rep(i, m) {
    ll u, v;
    cin >> u >> v;
    u--;
    v--;
    rep(j, 3) {
      g[u+n*j].push_back(v+((j+1)%3)*n);
    }
  }
  cin >> s >> t;
  s--;
  t--;

  constexpr ll inf = 1LL<<60;
  vl dis(3*n, inf);

  queue<ll> que;
  que.push(s);
  dis[s] = 0;

  while (que.size()) {
    ll now = que.front();
    que.pop();
    for (auto&& i : g[now]) {
      if (dis[i] == inf) {
        que.push(i);
        dis[i] = dis[now]+1;
      }
    }
  }

  if (dis[t] == inf) {
    cout << -1 << endl;
  } else {
    assert(dis[t]%3 == 0);
    cout << dis[t]/3 << endl;
  }
}


Measured memory_bytes: 19072
#include<iostream>
using namespace std;
int main(){
	int n,x,max,min,pre;
	while(cin>>n,n){
		cin>>x;
		pre=x;
		max=x;
		min=x;
		for(int i=0;i<n-1;i++){
			cin>>x;
			pre+=x;
			if(max<x)
				max=x;
			if(min>x)
				min=x;
		}
		cout<<(pre-max-min)/(n-2)<<endl;
		
		
		
		
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
int copmare(const void *a,const void *b){
    if(*(int *)a>*(int *)b){
        return 1;
    }else{
        return -1;
    }
}
int MIN(int a,int b){
    if(a<b)return a;
    return b;
}
int main()
{   int a,b,n,m,k,i,j,x,y,p[101],ua=0,ab=0,ob=0;
    scanf("%d%d%d",&n,&a,&b);
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
        if(p[i]<=a){
            ua++;
        }
        if(a<p[i]&&p[i]<=b){
            ab++;
        }
        if(p[i]>b){
            ob++;
        }
    }
    int ans=MIN(ua,MIN(ab,ob));
    printf("%d",ans);

    return 0;
}


Measured memory_bytes: 128
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto A = readln.split.map!(to!long).array;

    long ans = 1L << 60;
    foreach (i; 0..(1<<N)) {
        long h_max = A[0];
        int visible = 1;
        long tmp = 0;
        foreach (j; 1..N) {
            if (h_max < A[j]) {
                h_max = A[j];
                visible += 1;
            }
            else if (i & (1 << j)) {
                tmp += h_max - A[j] + 1;
                h_max = h_max + 1;
                visible += 1;
            }
        }

        if (visible >= K) ans = min(ans, tmp);
    }

    ans.writeln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int sz=2005;
int n,m;
char a[sz][sz];
int r[sz][sz],l[sz][sz],u[sz][sz],d[sz][sz];
int ans;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++) scanf("%s",a[i]);
    for(int i=0;i<n;i++){
        int curr=-1;
        for(int j=0;j<m;j++){
            if(a[i][j]=='#') curr=j;
            else l[i][j]=curr;
        }
        curr=m;
        for(int j=m-1;j>=0;j--){
            if(a[i][j]=='#') curr=j;
            else r[i][j]=curr;
        }
    }
    for(int j=0;j<m;j++){
        int curr=-1;
        for(int i=0;i<n;i++){
            if(a[i][j]=='#') curr=i;
            else u[i][j]=curr;
        }
        curr=n;
        for(int i=n-1;i>=0;i--){
            if(a[i][j]=='#') curr=i;
            else d[i][j]=curr;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(a[i][j]=='#') continue;
            int myl,myr,myu,myd,tmp=1;
            if(j-1>=l[i][j]+1) tmp+=(j-1-(l[i][j]+1)+1);
            if(r[i][j]-1>=j+1) tmp+=(r[i][j]-1-(j+1)+1);
            if(i-1>=u[i][j]+1) tmp+=(i-1-(u[i][j]+1)+1);
            if(d[i][j]-1>=i+1) tmp+=(d[i][j]-1-(i+1)+1);
            ans=max(ans,tmp);
        }
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 66944
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
//#include<chrono>
//#include<time.h>
//#include<windows.h>
using namespace std;
 
//#define int ll
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
//static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
struct edge {int /*from,*/to,cost;};

signed main(){
    int n;
    int t[114];
    int m;
    int p[114],x[114];

    cin >> n;
    int sum = 0;
    REP(i,n) {scanf("%d",&t[i]);sum+=t[i];}
    cin >> m;
    REP(i,m){
        int p,tmp;
        scanf("%d%d",&p,&tmp);
        printf("%d\n",sum+tmp-t[p-1]);
    }


    return 0;
}



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

#define MAX 100000

int n;
long long a[MAX];

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

	long long esum = 0;
	long long osum = 0;
	long long eans = 0;
	long long oans = 0;
	for( int i = 0; i < n; i++ ) {
		esum += a[i];
		osum += a[i];
		if( i % 2 ) {
			if( osum <= 0 ) {
				oans += 1 - osum;
				osum = 1;
			}
			if( esum >= 0 ) {
				eans += 1 + esum;
				esum = -1;
			}
		}
		else {
			if( osum >= 0 ) {
				oans += 1 + osum;
				osum = -1;
			}
			if( esum <= 0 ) {
				eans += 1 - esum;
				esum = 1;
			}
		}
	}

	cout << min( eans, oans ) << endl;

	return 0;
}


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] col = new int[n];
		int[] num = new int[n];
		col[0] = 1;
		Arrays.fill(num, 1);
		for (int i = 0; i < m; i++) {
			int x = sc.nextInt() - 1;
			int y = sc.nextInt() - 1;

			if (col[x] == 1) {
				if (num[x] == 1) {
					col[x] = 0;
				}
				col[y] = 1;
			}
			num[x]--;
			num[y]++;
		}
		for (int i = 1; i < n; i++) {
			col[i] += col[i - 1];
		}
		System.out.println(col[n - 1]);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n,ans=0;
    cin >> n;
    vector<pair<int,int>> a(n);
    map<pair<int,int>,int> m;
    pair<int,int> v;
    for (int i=0;i<n;i++){
        cin >> a.at(i).first >> a.at(i).second;
    }
    sort(a.begin(),a.end());
    for (int i=0;i<n-1;i++){
        for (int j=i+1;j<n;j++){
            v.first=a.at(j).first-a.at(i).first;v.second=a.at(j).second-a.at(i).second;
            m[v]++;
        }
    }
    for(auto itr = m.begin(); itr != m.end(); ++itr){
        ans=max(ans,itr->second);
    } 
    cout << n-ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

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

    if( r < 1200 ) cout << "ABC";
    else if( r < 2800 ) cout << "ARC";
    else cout << "AGC";
    cout << endl;
    return 0;
}



Measured memory_bytes: 384
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    S = input()
    cnt = 0

    for i in range(len(S)):
        if i == 0:
            continue
        if S[i] != S[i - 1]:
            cnt += 1

    print(cnt)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 #include <string> 
 #include <math.h>
 #include <bitset>
 using namespace std;
 
 int main(){
    int A;
    int B;
    int T;

    cin >> A >> B >> T;
    cout << T/A*B << endl;
        
    return 0;
 }



Measured memory_bytes: 256
N,M=map(int,input().strip().split())
H=list(map(int,input().strip().split()))

A=[0 for _ in range(M)]
B=[0 for _ in range(M)]
for m in range(M):
    A[m],B[m]=map(int,input().strip().split())

R=[[] for _ in range(N)]
for i in range(M):
    R[A[i]-1].append(B[i])
    R[B[i]-1].append(A[i])

best=0
for i in range(len(R)):
    biggest=True
    if len(R[i])==0:
        pass
    else:
        for j in range(len(R[i])):
            if H[i]<=H[R[i][j]-1]:
                biggest=False
    if biggest==True:
        best+=1

print(best)

Measured memory_bytes: 30920
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
const int maxn=10009;
long long n,x;
long long gcd(long long a,long long b)
 {
     return b ? gcd(b,a%b) : a;
 }
int main()
{
    while(scanf("%lld%lld",&n,&x)!=EOF)
    {
        long long ans=3*(n-gcd(n,x));
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 128
input()
sm = de = 0
ans = 10 ** 15
for s in (input() + "-0").split('-'):
    a = list(map(int, s.split('+')))
    if sm:
        ans = min(ans, sum(a) + de)
        de += a[0]
    sm += sum(a)
print(sm - 2 * ans)

Measured memory_bytes: 15176
# coding: utf-8
# Your code here!
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
sum_A = sum(A)
flag = 0
A.sort(reverse=True)
for i in range(M):
    if A[i]/sum_A < 1/(4*M):
        flag = 1

if flag:
    print("No")
else:
    print("Yes")

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

using namespace std;

void cldflm()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w" , stdout);
#endif
}

int main()
{

	

	string str1, str2;

	cin >> str1 >> str2;

	int n = str1.length(), count = 0;

	for (int i = 0; i < n; i++)
	{
		if (str1[i] != str2[i])
			count++;
	}


	cout << count;

	return 0;
}



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

int main() {
	long long n,t,t1;
	string output="";
	cin >> n;
	while (n > 0) {
		n--;
		output = (char)('a' + n%26) + output;
		n /= 26;
	}
	cout << output;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  int K, S;
  cin >> K >> S;
  ll ret = 0;
  rep(X,K+1){
    rep(Y,K+1){
      if(S-(X+Y)>=0 && S-(X+Y)<=K){
        ret++;
      }
    }
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main() {
    int n;
    cin >> n;
    int l;
    cin >> l;
    int fl=10000;
    int sum =0;
    for (int i =1; i< n + 1;i++) {
        if (abs(l+i-1) < abs(fl)) {
            fl = l+i-1;
        }
        sum += l+i-1;
    }
    cout << sum - fl << endl;




}


Measured memory_bytes: 256
unittest
{
	assert( [ "2" ].parse.expand.solve == 8 );
	assert( [ "1" ].parse.expand.solve == 1 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	return n ^^ 3;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		sc.close();
		long save = n;
		ArrayList<Long> list = new ArrayList<Long>();
		long ans = Long.MAX_VALUE;
		for (int i = 1; i <= Math.sqrt(n); i++) {
			if (n % i == 0) {
				long tmp = i + (n / i);
				if (tmp < ans) {
					ans = tmp;
				}
			}
		}
		System.out.println(ans - 2);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 23892
#!/usr/bin/env python

N,M=list( int(i) for i in input().split() )
counter=[0]*N

for i in range(0, M):
    a,b=list( int(i) for i in input().split() )
    counter[a-1]+=1
    counter[b-1]+=1

for i in range(0, N):
    print(counter[i])


Measured memory_bytes: 2940
'use strict'
 
function main(s) {
  s = s.replace(/\r?\n/g,'');
  s = s.split(' ');
  
  let N = Number(s[0]); //need takoyaki
  let X = Number(s[1]); //max takoyaki
  let T = Number(s[2]); //time 
  
  let nT = Math.ceil(N / X);
  let kekka = T * nT;
  
  console.log(kekka);
}
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29668
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;

void main()
{
    auto input = readln.chomp.split.to!(long[]);

    long n = input[0];
    long m = input[1];
    long x = input[2];

    auto as = readln.chomp.split.to!(long[]);

    long Z;
    long N;

    foreach (a; as)
    {
        if (a < x)
        {
            Z++;
        }
        else
        {
            N++;
        }
    }
    min(Z,N).writeln();

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int A,B;
    A = s.nextInt();
    B = s.nextInt();
    if(A >= 13)
      System.out.println(B);
    else if(A >= 6 && A <= 12)
      System.out.println(B/2);
    else
      System.out.println(0);
  }
}


Measured memory_bytes: 21076
/**
 *  author:   TakeruOkuyama
 *  created:  2020-04-15 11:17:28
**/
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
const int INF = 999999999;

int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N, INF);
    int min = INF;
    rep(i, N){
        cin >> P[i];
        if(i > 0){
            Q[i] = min;
        }
        if(min > P[i]){
            min = P[i];
        }
    }
    int ans = 0;
    rep(i, N){
        //cout << P[i] << " " << Q[i] << endl;
        if(P[i] <= Q[i]){
            ans++;
        }
    }
    cout << ans << endl;
return 0;}
/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 

Measured memory_bytes: 1792