akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S,False(1,-1);
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

template<typename A,size_t N,typename T>
void Fill(A(&array)[N],const T &val){
    fill((T*)array,(T*)(array+N),val);
}

ll gcd(ll a,ll b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}


int solve( int x ){
    if( x == 0 )return 1;
    if( x < 0 )return 0;

    rep(i,6){
        return solve( x - 100 - i );
    }
}

int dp[ 100000 ];
int main(){
    string s;
    cin >> s;

    int res = 0;
    const int len = s.size();

    int sum = 0;
    rep(i, len){
        if( s[i] == '0' )continue;
        sum += s[i] - '0';
        res = max( res , sum - 1 + 9 * ( len - i - 1 ) );
    }
  res = max( res , sum );
    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
  par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
  vector<int> gt;
  aa(int n){
  gt= vector<int>(n, 1);
  }
  void c(V<int> d,int b){
  if(d[b]==0){
    gt[d[b]-1]++;
    gt[gt.sz-1]++;
  }
  else{
    gt[d[b]-1]++;
    c(d,d[d[b]]-1);
  }
}
void cok(int a){
  cout<<gt[a-1]<<endl;
  fo(i,a-1)
  cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){


*/
signed main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=0; i<=25; i++){
    for(int j=0; j<13; j++){
      if(4*i+7*j==n)
        ans++;
    }
  }
  if(ans==0)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;

}

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

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

std::string field[20];
int dx[4] = {0,-1,0,1};	//右、上、左、下
int dy[4] = {1,0,-1,0};
int h,w;
int cnt;
void rec(int y,int x){
	field[y][x] = '#';
	cnt++;
	int xi, yi;
	rep(i,4){
		xi = x, yi = y;
		xi += dx[i];
		yi += dy[i];

		if(xi < 0 || xi >= w)continue;
		if(yi < 0 || yi >= h)continue;
		if(field[yi][xi] != '.')continue;
		rec(yi,xi);
	}
}

int main(){

	while(std::cin >> w >> h, (h||w)){

		cnt = 0;

		rep(i,h){
			std::cin >> field[i];
		}
		rep(i,h){
			rep(j,w){
				if(field[i][j] == '@'){
					rec(i,j);
				}
			}
		}
		std::cout << cnt << std::endl;
	}
	return 0;
}

Measured memory_bytes: 0
#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>;

int main() {
	int	N;
	cin >> N;
	int	M;
	cin >> M;
	int C;
	C = 0;
	rep(j, M)
	{
		int	a;
		cin >> a;
		C += (1 << a);
	}
	rep(i, 1 << N)
	{
		if (C != (C & i))
			continue;
		cout << i << ':';
		rep(j, N)
		{
			if (i & (1 << j))	
				cout << ' ' << j;
		}
		cout << endl;
	}
}



Measured memory_bytes: 3092
#! python3
# greatest_common_divisor.py

def greatest_common_divisor(x, y):
    r = None

    if x >= y:
        r = x%y
        if r == 0: return y
    else:
        r = y%x
        if r == 0: return x

    return greatest_common_divisor(y, r)

x, y = [int(n) for n in input().split(' ')]
print(greatest_common_divisor(x, y))


Measured memory_bytes: 5604
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - Divide the Problems
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

/* global variables */

int as[MAX_N];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) scanf("%d", as + i);
  sort(as, as + n);

  printf("%d\n", as[n / 2] - as[n / 2 - 1]);
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 100000000
#define MAX_N 150005
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;

int main(){
    int N,M;
    int a[1012];
    cin>>N>>M;
    rep(i,0,M)cin>>a[i];
    cout<<N-M-1<<endl; 
    
    return 0;
}

Measured memory_bytes: 3044
function Main(input) {
  var array = input.trim().split("\n");
  array = array.map(val => parseInt(val, 10));
  var amount = 0;
  var longestWaitTime = 0;

  for (var i = 0; i < array.length; i++) {
    var ceil = Math.ceil(array[i] / 10) * 10;
    amount += ceil;
    longestWaitTime =
      ceil - array[i] > longestWaitTime ? ceil - array[i] : longestWaitTime;
  }
  console.log(amount - longestWaitTime);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11468
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MON 1000000007
#define INF (1<<29)
typedef long long Int;
typedef pair<Int, Int> P;

#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))
vector<Int> children[108000];
Int parent[108000];
Int s[108000];
Int u, v, w, n, k, c, q;
Int group[108000];
Int index[108000];
Int order;
void dfs_size(Int x){
  s[x] = 1;
  for(auto c:children[x]){
    dfs_size(c);
    s[x] += s[c];
  }
}

void dfs_hl(Int x, Int boss = -1){
  if(boss != -1)group[x] = boss;
  else{
    group[x] = x;
    index[x] = 0;
  }
  if(children[x].empty())return;
  for(Int i = 1;i < children[x].size();i++){
    if(s[children[x][i]] > s[children[x][0]])
      swap(children[x][i], children[x][0]);
  }
  index[children[x][0]] = index[x] + 1;
  for(Int i = 0;i < children[x].size();i++){
    dfs_hl(children[x][i], i==0?group[x]:-1);
  }  
}


Int pos[108000];
Int p = 1;
void euler_tour(Int x){
  pos[x] = p++;
  for(auto c:children[x])euler_tour(c);
}

vector<Int> bit1(108000,0);
vector<Int> bit2(108000,0);
void add(vector<Int> &bit, Int x, Int val){
  x++;
  while(x < bit.size()){
    bit[x] += val;
    x += x & -x;
  }
}

Int sum(vector<Int> &bit, Int x){
  x++;
  Int res = 0;
  while(x){
    res += bit[x];
    x -= x & -x;
  }
  return res;
}

void add_val(Int l, Int r, Int val){
  //(x-l+1)*val
  add(bit1, l, (-l+1)*val);
  add(bit2, l, val);
  //-(x-l+1)*val+(r-l+1)*val
  add(bit1, r, r*val);
  add(bit2, r, -val);
}

Int get_sum(Int x){
  return sum(bit1, x) + sum(bit2, x) * x;
}

int main(){
  cin >> n;
  for(Int i = 0;i < n;i++){
    cin >> k;
    for(Int j = 0;j < k;j++){
      cin >> c;
      children[i].push_back(c);
      parent[c] = i;
    }
  }
  parent[0] = -1;
  dfs_size(0);
  dfs_hl(0);
  euler_tour(0);
  cin >> q;

  while(q--){
    cin >> order;
    if(order == 0){
      cin >> v >> w;
      while(v != -1){
	Int boss = group[v];
	add_val(pos[boss], pos[v], w);
	v = parent[boss];
      }
    }
    if(order == 1){
      cin >> u;
      Int res = 0;
      while(u != -1){
	Int boss = group[u];
	res += get_sum(pos[u]) - get_sum(pos[boss] - 1);
	u = parent[boss];
      }
      res -= get_sum(1) - get_sum(0);
      cout << res << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 18600
#include <stdio.h>
#include <map>
#include <algorithm>
#include <vector>
#include <queue>

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

int abs(int x){
  return x > 0 ? x : -x;
}

int length(char c[]){
  int cnt=0;
  for(cnt=0;c[cnt]!='\0';cnt++){
  }
  return cnt;
}


int x,y,z;

int main(){
  scanf("%d %d %d", &x,&y,&z);
  x-=z;
  printf("%d\n",x/(y+z));
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define INF 1e18
#define int int64_t
vector<int>v;

int pos(int i,int x){
   
   int l = -1;int r = v.size();
   int mid;
   while(l+1<r)
   {
        mid = (l+r)/2;
        if(v[i]*v[mid]<x)
          l = mid;
        else
          r =mid;
   }
   return r;

}
int neg(int i,int x)
{
   int l = -1;int r = v.size();
   int mid;
   while(l+1<r)
   {
        mid = (l+r)/2;
        if(v[i]*v[mid]<x)
          r = mid;
        else
          l = mid;
   }
   return v.size()-r;

}
int calculate(int x) 
{
      int val = 0; int sum =0;
      for(int  i =0;i<v.size();i++)
      {
          if(v[i]<0)
             val = neg(i,x);
          else
             val = pos(i,x);

          if(v[i]*v[i]<x)
            val--;

          sum+= val;
      }
      sum = sum/2;
     // cout<<x<<" "<<sum<<endl;
      return sum;

}
signed main(void)
{
  int n,k,a;
   cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>a;
    v.push_back(a);
  }
  
  sort(v.begin(),v.end());
   
  int l = -INF; int r = INF;  
  int mid;
       while(l+1<r)
       {  
            mid = (l+r)/2;
            //cout<<mid<<" ";
            if(calculate(mid)<k)
              l = mid;
            else
              r = mid;
       }
    
    cout<<l<<endl;

}


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

const int N = 2020;

inline char get(void) {
	static char buf[100000], *S = buf, *T = buf;
	if (S == T) {
		T = (S = buf) + fread(buf, 1, 100000, stdin);
		if (S == T) return EOF;
	}
	return *S++;
}
inline void read(int &x) {
	static char c; x = 0;
	for (c = get(); c < '0' || c > '9'; c = get());
	for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
}
inline void read(char *ch) {
	static char c; int len = 0;
	for (c = get(); c < '0' || c > '1'; c = get());
	for (; c == '0' || c == '1'; c = get()) ch[len++] = c;
}

int n, m, q, x1, x2, y11, y2, E, V;
char ch[N][N];
int num[N][N], edg[N][N];
int pr1[N][N], pr2[N][N];

inline int Edge(int x, int y) {
	return (ch[x][y] == '1' && ch[x][y - 1] == '1') + (ch[x][y] == '1' && ch[x - 1][y] == '1');
}

int main(void) {
	read(n); read(m); read(q);
	for (int i = 1; i <= n; i++) read(ch[i] + 1);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			num[i][j] = num[i - 1][j] + num[i][j - 1] - num[i - 1][j - 1] + (ch[i][j] == '1');
	for (int i = 2; i <= n; i++)
		for (int j = 1; j <= m; j++)
			pr1[i][j] = pr1[i][j - 1] + (ch[i][j] == '1' && ch[i - 1][j] == '1');
	for (int i = 1; i <= n; i++)
		for (int j = 2; j <= m; j++)
			pr2[i][j] = pr2[i - 1][j] + (ch[i][j] == '1' && ch[i][j - 1] == '1');
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			edg[i][j] = edg[i - 1][j] + edg[i][j - 1] - edg[i - 1][j - 1] + Edge(i, j);
	while (q--) {
		read(x1); read(y11); read(x2); read(y2);
		E = edg[x2][y2] - edg[x2][y11 - 1] - edg[x1 - 1][y2] + edg[x1 - 1][y11 - 1];
		E -= pr1[x1][y2] - pr1[x1][y11 - 1] + pr2[x2][y11] - pr2[x1 - 1][y11];
		V = num[x2][y2] - num[x2][y11 - 1] - num[x1 - 1][y2] + num[x1 - 1][y11 - 1];
		printf("%d\n", V - E);
	}
	return 0;
}

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

int main()
{
    string S;

    cin >> S;
    if(S == "Sunny") {
        cout << "Cloudy" << endl;
    } else if(S == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = []
nega = 0
for i in A:
    if i < 0:
        B.append(-i)
        nega+=1
    else:
        B.append(i)
if nega % 2 == 1:
    print(sum(B)-2*min(B))
else:
    print(sum(B))

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

namespace AtTest.ForBlue.ABC_085
{
    class D
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int h = int.Parse(input[1]);
            int[] katana = new int[n];
            int[] throwPow= new int[n];
            for (int i = 0; i < n; i++)
            {
                input = Console.ReadLine().Split(' ');
                katana[i] = int.Parse(input[0]);
                throwPow[i] = int.Parse(input[1]);
            }
            Array.Sort(katana);
            Array.Sort(throwPow);

            int throwGreatIndex = 0;
            for (; throwGreatIndex < throwPow.Length; throwGreatIndex++)
            {
                if (throwPow[throwGreatIndex] > katana[n - 1])
                {
                    break;
                }
            }

            int cnt = 0;
            for(int i = n - 1; i >= throwGreatIndex; i--)
            {
                h -= throwPow[i];
                cnt++;
                if (h <= 0)
                {
                    Console.WriteLine(cnt);
                    return;
                }
            }

            int pow = katana[n - 1];
            cnt += h / pow;
            if (h % pow > 0)
            {
                cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 15712
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		ArrayList<Integer> primes = new ArrayList<Integer>();
		primes.add(2);
		for (int i = 3; i < 100000; i += 2) {
			for (int j = 0; j < primes.size(); ++j) {
				long p = primes.get(j);
				if (p * p > i) {
					primes.add(i);
					break;
				}
				if (i % p == 0) break;
			}
		}
		while (true) {
			int M = sc.nextInt();
			if (M == 0) break;
			int A = sc.nextInt();
			int B = sc.nextInt();
			long mp = 0;
			long mq = 0;
			for (int i = 0; i < primes.size(); ++i) {
				long q = primes.get(i);
				if (q * 2 > M) break;
				int pos = Collections.binarySearch(primes, (int) Math.min((M / q), q));
				if (pos < 0) pos = -pos - 2;
				if (pos >= 0) {
					long p = primes.get(pos);
					if (p * q <= mp * mq) continue;
					if (p * B < q * A) continue;
					mp = p;
					mq = q;
				}
			}
			System.out.println(mp + " " + mq);
		}
	}
}

Measured memory_bytes: 31304
def main():
    N = int(input())
    A  = list(map(int,(input().split())))
    con = 1
    m = 10**18
    
    for a in A:
        if(a==0):
            print(0)
            return

    for a in A:
        con*=a
        if con > m :
            print(-1)
            return
    print(con)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21648
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
using namespace std;
int main(void){
	char a[200000];
	int b[100000];
	int n;
	int m;
	int x;
	int y;
	int z;
	long long c;
	int s;
	int k;

		scanf("%s", a);
		n = strlen(a);
		x = 0;
		if (a[0] == a[n - 1])x++;
		if (n % 2 == 0)x++;
		x = x % 2;
		if (x == 0)printf("First\n");
		else printf("Second\n");

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define vi   vector<int>
#define vvi  vector<vi >
#define vvvi vector<vvi >
#define pii  pair<int,int>
#define INF  (int)1e9
#define MOD  (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n,d;
	cin>>n>>d;
	
	int e=(n%(2*d+1))?1:0;
	
	cout<<n/(2*d+1)+e<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
   FAST/**/
   
   ll n,m,k;
   cin>>n>>m>>k;
   
   string s[n];
   
   for(ll i=0;i<n;i++)
        cin>>s[i];
   
   ll hand[n];
   memset(hand,0,sizeof(hand));
   
   //ll cnt = k;
   ll mark[n][m];
   memset(mark,0,sizeof(mark));
   ll curr = 1;
   
   for(ll i=0;i<n;i++)
   {
       
        ll cnt1 = 0;
           for(ll j=0;j<m;j++)
           {
               if(s[i][j] == '#')
                    cnt1++;
           }
           
           if(cnt1 == 0)
               continue;
       
       hand[i] = 1;
       
       ll lim = -1;
       for(ll j=0;j<m;j++)
       {
           if(s[i][j] == '#')
           {
               lim = j;
               break;
           }
       }
       
       for(ll j=0;j<m;j++)
       {
           if(j<=lim)
           {
               mark[i][j] = curr;
               continue;
           }
           
           if(s[i][j] == '#')
           {
               curr++;
               mark[i][j] = curr;
               //cnt--;
           }
           
           else mark[i][j] = curr;
       }
       
       curr++;
   }
   
   set<ll> st;
   for(ll i=0;i<n;i++)
        if(hand[i])
            st.insert(i);
   
   while(st.size()>0)
   {
       ll curr = *st.begin();
       st.erase(st.begin());
       
       if(curr-1>=0 && hand[curr-1] == 0)
       {
           for(ll j=0;j<m;j++)
                mark[curr-1][j] = mark[curr][j];
           hand[curr-1] = 1;
           st.insert(curr-1);
       }
       
       if(curr+1<n && hand[curr+1] == 0)
       {
           for(ll j=0;j<m;j++)
                mark[curr+1][j] = mark[curr][j];
           hand[curr+1] = 1;
           st.insert(curr+1);
       }
   }
   
   for(ll i=0;i<n;i++)
   {
       for(ll j=0;j<m;j++)
            cout<<mark[i][j]<<" ";
       cout<<"\n";        
           
   }
   
   return 0;
}  
   

Measured memory_bytes: 1664
import java.util.*;

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

        String str = sc.next();

        if(str.charAt(0)==str.charAt(1) && str.charAt(2)==str.charAt(3) && str.charAt(1)!=str.charAt(2)){
            System.out.println("Yes");
        }
        else if(str.charAt(0)==str.charAt(2) && str.charAt(1)==str.charAt(3) && str.charAt(2)!=str.charAt(1)){
            System.out.println("Yes");
        }
        else if(str.charAt(0)==str.charAt(3) && str.charAt(1)==str.charAt(2) && str.charAt(3)!=str.charAt(1)){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
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;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll H; cin >> H;
  ll ans = 1, cnt = 1;
  for(ll i=H; i>1; i/=2) {
    cnt *= 2;
    ans += cnt;
  }
  cout << ans;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
		public static void main(String[] args){
			
			double r = scan.nextDouble();
			//int r = Integer.parseInt(args[0]);
			double s = r*r*Math.PI;
			double l = 2*r*Math.PI;
			
			BigDecimal src_s = BigDecimal.valueOf(s);
			BigDecimal src_l = BigDecimal.valueOf(l);
			src_s  = src_s.setScale(6, BigDecimal.ROUND_DOWN);
			src_l = src_l.setScale(6,BigDecimal.ROUND_DOWN);

			System.out.println(src_s+" "+src_l);
		}
}



Measured memory_bytes: 28248
#高速化実験
class Combi():
    def __init__(self, N, mod):
        self.power = [1 for _ in range(N+1)]
        self.rev = [1 for _ in range(N+1)]
        self.mod = mod
        for i in range(2, N+1):
            self.power[i] = (self.power[i-1]*i) % self.mod
        self.rev[N] = pow(self.power[N], self.mod-2, self.mod)
        for j in range(N, 0, -1):
            self.rev[j-1] = (self.rev[j]*j) % self.mod

    def com(self, K, R):
        if K < R:
            return 0
        else:
            return ((self.power[K])*(self.rev[K-R])*(self.rev[R])) % self.mod

    def pom(self, K, R):
        if K < R:
            return 0
        else:
            return (self.power[K])*(self.rev[K-R]) % self.mod


def main():
    N, M = map(int, input().split())
    mod = 10**9+7
    c = Combi(5*10**5, mod)
    ans = c.pom(M, N)**2 % mod
    for k in range(1, N+1):
        s = (-1)**((k-1) % 2)
        t = c.com(N, k)
        u = c.pom(M-k, N-k)**2
        v = c.pom(M, k)
        ans -= s*t*u*v
        ans = ans % mod
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 146604
import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
from functools import cmp_to_key
def resolve():
    n = int(input())
    positive, negative = [], []
    for _ in range(n):
        balance = min_balance = 0
        for c in input():
            if c == '(':
                balance += 1
            else:
                balance -= 1
            min_balance = min(min_balance, balance)
        if balance > 0:
            positive.append((min_balance, balance))
        else:
            negative.append((min_balance, balance))


    now = 0
    # positive は min_balance の大きい方から足せば良い
    positive.sort(reverse = 1)
    for min_balance, balance in positive:
        if now + min_balance < 0:
            print("No")
            return
        now += balance

    # negative は sort を工夫
    def cmp(s1, s2):
        m1, b1 = s1
        m2, b2 = s2
        return -1 if min(m1, b1 + m2) > min(m2, b2 + m1) else 1

    negative.sort(key = cmp_to_key(cmp))
    for min_balance, balance in negative:
        if now + min_balance < 0:
            print("No")
            return
        now += balance

    print("Yes" if now == 0 else "No")
resolve()

Measured memory_bytes: 177124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char S[] = {'a','i','u','e','o'};
  char c;
  int x=0;
  cin >> c;
  for(int i = 0; i < 5; i++){
    if(c == S[i]){
      x++;
    }
  }
  if(x == 0){
    cout << "consonant" << endl;
  }
  else{
    cout << "vowel" << endl;
  }
}


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

int main() {
	int n, money;
	std::cin >> n >> money;

	// 普通に全探索だと計算量がO(n^3)でTLEなので、計算量を落とす
	// z = n - x - y
	for (int x = 0; x <= n; x++) {
		for (int y = 0; x + y <= n; y++) {
			// 負の数にはならない
			int z = n - (x + y);
			if (10000 * x + 5000 * y + 1000 * z == money) {
				std::cout << x << " " << y << " " << z << std::endl;
				return 0;
			}
		}
	}

	std::cout << -1 << " " << -1 << " " << -1 << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int N;
  cin >> N;
  vector<int> p(N);
  for(auto &i : p) cin >> i;
  cout << accumulate(p.begin(), p.end(), 0) - *max_element(p.begin(), p.end()) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
using System;

namespace Submit
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] c = Console.ReadLine().Split();
            int a = int.Parse(c[0]);
            int b = int.Parse(c[1]);
            Console.Write(a * b + " ");
            Console.WriteLine(2 * (a + b));
        }
    }
}


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x;
	cin >> x;
	if (x>=400&&x<=599) cout << 8;
	if (x>=600&&x<=799) cout << 7;
	if (x>=800&&x<=999) cout << 6;
	if (x>=1000&&x<=1199) cout << 5;
	if (x>=1200&&x<=1399) cout << 4;
	if (x>=1400&&x<=1599) cout << 3;
	if (x>=1600&&x<=1799) cout << 2;
	if (x>=1800&&x<=1999) cout << 1;
	cout << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)

typedef vector<ll> vec;
typedef vector<vec> mat;

ll MOD = 1000000007ll;

mat mul(mat &A,mat &B)
{
	mat C(A.size(),vec(B[0].size()));
	for(int i=0;i<A.size();i++)
	{
		for(int k=0;k<B.size();k++)
		{
			for(int j=0;j<B[0].size();j++)
			{
				C[i][j]=(C[i][j]+A[i][k]*B[k][j])%MOD;
			}
		}
	}
	return C;
}
mat pow(mat A, ll n)
{
	mat B(A.size(),vec(A.size()));
	for(int i=0;i<A.size();i++)
	{
		B[i][i]=1ll;
	}
	while(n>0)
	{
		if(n&1)B = mul(B,A);
		A = mul(A,A);
		n >>= 1;
	}
	return B;
}
ll fib(ll x)
{
	mat A(2,vec(2));
	A[0][0]=1;A[0][1]=1;A[1][0]=1;A[1][1]=0;
	A = pow(A,x);
	return A[1][0];
}
ll solve(ll x,ll y)
{
	if(y==1ll)return fib(x);
	if(x%2ll==1ll)return (fib(2ll*y)*fib(x+2ll-2ll*y))%MOD;
	if(x%4ll==2ll)
	{
		ll m = x/4ll;
		if(y<=(x+2ll)/4ll)return (fib(2ll*y)*fib(x+2ll-2ll*y))%MOD;
		else
		{
			y -= (x+2ll)/4ll;
			ll id = 2ll*m+3ll-2ll*y;
			ll id2 = x+2ll-id;
			return (fib(id)*fib(id2))%MOD;
		}
	}
	else
	{
		ll m = x/4ll;
		if(y<=m)return (fib(2ll*y)*fib(x+2ll-2ll*y))%MOD;
		else
		{
			y-=m;
			ll id = 2ll*m+3ll-2ll*y;
			ll id2 = x+2ll-id;
			return (fib(id)*fib(id2))%MOD;
		}
	}
}
int main()
{
	ll K;
	scanf("%lld",&K);
	ll l = 0ll,r = 1000000002ll;
	while(r-l>1)
	{
		ll mid = (l+r)/2ll;
		if(mid*(mid+1)<K)l = mid;
		else r = mid;
	}
	ll X = (l+1ll)*2ll;
	ll Y = K-l*(l+1ll);
	if(Y>l+1ll)
	{
		X++;
		Y-=(l+1ll);
	}
	printf("%lld\n",solve(X,Y));
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <vector>

using namespace std;

int main(){
    long long INF = 1LL << 60;
    int N;
    cin >> N;
    vector<int> h(N);
    vector<int> dp(N);
    for(int i  = 0;i < N;i++){
        cin >> h[i];
        dp[i] = INF;
    }
    dp[0] = 0;
    for(int i = 1;i < N;i++){
        if(i < 2){
            dp[i] = dp[i-1] + abs(h[i] - h[i -1]);
        }else{
            dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]),dp[i-2] + abs(h[i] - h[i-2]));
        }
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x=scan.nextInt();
		int t=scan.nextInt();
		if((x-t)>0) System.out.println(x-t);
		else System.out.println("0");
	}

}


Measured memory_bytes: 26808
import java.util.Scanner;

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

		int n = sc.nextInt();
		
		long[] ts = new long[n];
		for (int i = 0; i < n; i++) {
			ts[i] = sc.nextLong();
		}
		
		long tmp = ts[0];
		long ans = tmp;
		for (int i = 1; i < n; i++) {
			tmp = gcd(ans, ts[i]);
			ans = ans * (ts[i] / tmp);
		}
		
		System.out.println(ans);
	}
	
	private long gcd(long a, long b) {
		if (b == 0) return a;
		
		if (a < b) {
			long tmp = b;
			b = a;
			a = tmp;
		}
		
		return gcd(b, (a % b));
	}
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    int n;
    cin >> n;
    if(n>63){
        cout << 64 << endl;
    }else if(n>31){
        cout << 32 << endl;
    }else if(n>15){
        cout << 16 << endl;
    }else if(n>7){
        cout << 8 << endl;
    }else if(n>3){
        cout << 4 << endl;
    }else if(n>1){
        cout << 2 << endl;
    }else{
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
int main() {
  string s;
  cin >> s;
  string v = "";
  for (int i = 0; i < 3; i++)
    v += s[i];
  cout << v << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <numeric>

using namespace std;

typedef long long ll;

int main(void){
    ll n;
    cin >> n;
    vector<ll> c(n - 1),s(n - 1),f(n - 1);
    vector<ll> ans(n - 1);
    for(ll i = 0;i < n - 1; i++){
        ans[i] = 0;
        cin >> c[i] >> s[i] >> f[i];
    }
    for(ll i = 0;i < n - 1; i++){
        for(ll j = i;j < n - 1;j++){
            if(ans[i] < s[j]){
                ans[i] = s[j];
            }else if(ans[i] % f[j] == 0){

            } else {
                ans[i] += f[j] - ans[i] % f[j];
            }
            ans[i] += c[j];
        }
    }
    for(ll i = 0;i < n - 1; i++){
        cout << ans[i] << endl;
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

#define _deb(x) cout<<x;
void _print() {cerr << "]\n";} template <typename T, typename... V>void _print(T t, V... v) {_deb(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
template <class T, class U> void print_m(const map<T,U> &m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}
template<class T, class U>void debp(const pair<T, U> &pr, bool end_line=1){cout<<"{"<<pr.first<<" "<<pr.second<<"}"; cout<<(end_line ? "\n" : ", ");}
template <class T> void print_vp(const T &vp, int sep_line=0){if(vp.empty()){cout<<"Empty"<<endl; return;}if(!sep_line) cout<<"{ ";for(auto x: vp) debp(x,sep_line);if(!sep_line) cout<<"}\n";cout<<endl;}
template <typename T>void print(const T &v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<sz(v); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<endl;}
template <typename T>void print_vv(const T &vv){if(sz(vv)==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<sz(*vv.begin()); j++)cout<<setw(w)<<j<<" ";cout<<endl;int i = 0;for(auto &v: vv){cout<<i++<<" {";for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<"},\n";}cout<<endl;}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s; cin>>s;
    if(s.back()=='s') cout<<s+"es"<<"\n";
    else cout<<s+"s"<<"\n";
    return 0;
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<string.h>
#define MAX 100

int main(void){
    int n;
    int t_point = 0, h_point = 0;
    char tarou[MAX], hanako[MAX];
    
    scanf("%d", &n);
    for(; n > 0; n--){
        scanf("%s %s", tarou, hanako);
        if(strcmp(tarou, hanako) > 0){
            t_point += 3;
        }else if(strcmp(tarou, hanako) == 0){
            t_point += 1;
            h_point += 1;
        }else if(strcmp(tarou, hanako) < 0){
            h_point += 3;
        }
    }
    printf("%d %d\n", t_point, h_point);
    
    return 0;
}


Measured memory_bytes: 2700
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie();
int main()
{
	//IOS;
	string s;
	while(cin>>s)
	{
		int ans=0;
		for(int i=s.length()-1;i>0;i--)
		{
			//cout<<s[i]-'0'<<" "<<ans<<"\n";
			if(s[i]>'5') ans+=10-(s[i]-'0'),s[i-1]++;
			else if(s[i]=='5')
			{
				if(s[i-1]>='5') s[i-1]++,ans+=5;
				else ans+=s[i]-'0';
			}
			else ans+=s[i]-'0';
		}
		if(s[0]>'5') ans+=10-(s[0]-'0')+1;
		else ans+=s[0]-'0';
		cout<<ans<<"\n";
	}
}

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

using namespace std;

main(){
	int x,y,z;
	cin >> x >> y >> z;
	if(x==1&&y==0&&z==0){
		printf("Close\n");
	}else if(x==0&&y==1&&z==0){
		printf("Close\n");
	}else if(x==1&&y==1&&z==0){
		printf("Open\n");
	}else if(x==0&&y==0&&z==1){
		printf("Open\n");
	}else{
	printf("Close\n");}
}



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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int main() {
    string s;
    cin >> s;
    s[0] = s[0] + 1;
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef _DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9 + 7;
const ll LINF = 1LL << 60;
template<class T, class U> inline bool chmax(T &a, const U &b) { if(a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if(a > b) { a = b; return true; } return false; }

int n, m, c[20], dp[50100];

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  cin >> n >> m;
  rep(i,m) cin >> c[i];
  rep(i,50100) dp[i] = INF;
  dp[0] = 0;
  rep(i,m) {
    rep(j,n+1) {
      if(j+c[i] <= n) chmin(dp[j+c[i]], dp[j]+1);
    }
  }
  cout << dp[n] << '\n';
  return 0;
}


Measured memory_bytes: 3412
from itertools import permutations
import sys
input = sys.stdin.readline

def main():
    N, M, RR = map(int, input().split())
    R = list(map(int, input().split()))
    INF = float("inf")
    T = [[INF] * N for _ in range(N)]
    for _ in range(M):
        a, b, c = tuple(map(int, input().split()))
        T[a-1][b-1] = c
        T[b-1][a-1] = c
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if T[i][j] > T[i][k]+T[k][j]:
                    T[i][j] = T[i][k]+T[k][j]
    ans = INF
    for rs in permutations(R):
        cost = 0
        for i in range(RR-1):
            cost += T[rs[i]-1][rs[i+1]-1]
        ans = min(ans, cost)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 4796
#include<stdio.h>

 

int main(void)
{
  int a[3][3],n,i,j,k;

 

  //ビンゴカードの入力
  for(i=0;i<3;i++)
    for(j=0;j<3;j++)
      scanf("%d",&a[i][j]);

 

  //bの入力
  scanf("%d",&n);
  int b[n];
  for(k=0;k<n;k++)
    scanf("%d",&b[k]);

 

  //ビンゴカードに穴をあける
  for(i=0;i<3;i++)
    for(j=0;j<3;j++)
      for(k=0;k<n;k++)
        if(a[i][j]==b[k])
          a[i][j] = 0;

 

  //ビンゴが達成されているか確認
  for(i=0;i<3;i++){
    if(a[i][0]+a[i][1]+a[i][2]==0){
      printf("Yes\n");
      return 0;
    }
    else if(a[0][i]+a[1][i]+a[2][i]==0){
      printf("Yes\n");
      return 0;
    }
  }
  if(a[0][0]+a[1][1]+a[2][2]==0){
     printf("Yes\n");
     return 0;
  }
  else if(a[0][2]+a[1][1]+a[2][0]==0){
     printf("Yes\n");
     return 0;
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;
using ll = long long;


int main(){
    ll b1,a,b,c=0,d=0,e,m,n,k,o=0,p,l,q,x1,y1,z,max1=0,s=0,ans,r,i1=-1,x,w,h,y,j1;
    string t,u;
    
    cin>>n;
    ll a1[n];
    for(ll i=0;i<n;i++){
        cin>>a>>b;   
        a1[i]=a+b*10000000000;
    }
    sort(a1,a1+n);
    for(ll i=0;i<n;i++){  
        o+=a1[i]%10000000000;
        if(o>a1[i]/10000000000){
            c++;
            break;
        }
    }
    if(c==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}




Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int K,T;cin>>K>>T;
  vector<int> a(T);
  for(int i=0;i<T;i++)cin>>a.at(i);
  sort(a.begin(),a.end());
  int ans=a.at(T-1)*2-K-1;
  ans=max(0,ans);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cctype>

#define div 1000000000+7

typedef long long ll;

using namespace std;


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

    if(a.size() > b.size()){
        printf("GREATER");
        return 0;
    }else if(a.size() < b.size()){
        printf("LESS");
        return 0;
    }else {
        for (int i = 0; i < a.size(); i++) {
            if (a[i] < b[i]) {
                printf("LESS");
                return 0;
            } else if (a[i] > b[i]) {
                printf("GREATER");
                return 0;
            }
        }
    }
    printf("EQUAL");
    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++)
 
int main() {
  	int a, b;	cin >> a >> b;
  	if(a - 2*b > 0) cout << a - 2*b << endl;
  	else cout << 0 << endl;
}


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

using namespace std;

int Q;
char s[1010];

int re(int a , int &p , int q){
	if(s[a] == '?') return a;
	if('0' <= s[a] && s[a] <= '9'){
		int x = s[a] - '0';
		if((x + 1) * 10 - 1 <= p){
			return a;
		}
		if(x + 1 >= q){
			p = q - 1;
			return a;
		}
		if(x > 0) ++a;
		if('0' <= s[a] && s[a] <= '9'){
			x = x * 10 + s[a] - '0';
		}
		if(x > p) p = x;
		if(x >= q) p = q - 1;
		return a;
	}
	bool b = (s[a] == '^');
	int x = p;
	a += 2;
	if(s[a] < '0' || '9' < s[a]){
		int h = re(a , x , q);
		if(!b && x <= p){
			return h;
		}
		if(b && x + 1 >= q){
			p = q - 1;
			return h;
		}
		a += 2;
		for(h = 1 ; h > 0 ; ++a){
			if(s[a] == '(') ++h;
			if(s[a] == ')') --h;
		}
	} else {
		x = s[a] - '0';
		if(!b && (x + 1) * 10 - 1 <= p){
			return a;
		}
		if(b && x + 1 >= q){
			p = q - 1;
			return a;
		}
		if('0' <= s[a + 1] && s[a + 1] <= '9'){
			x = x * 10 + s[a + 1] - '0';
		}
		if(x > 0) ++a;
		if(!b && x <= p){
			return a;
		}
		if(b && x + 1 >= q){
			p = q - 1;
			return a;
		}
	}
	if(b){
		p = max(p , x);
	} else {
		q = min(q , x + 1);
	}
	if(p + 1 >= q) return a;
	while(s[a] != ',' && s[a] != '?') ++a;
	return re(a + 1 , p , q);
}

int main(){
	scanf("%d" , &Q);
	for(int i = 0 ; i < Q ; ++i){
		scanf(" %s" , s);
		int x = 0;
		int z = re(0 , x , 100) + 1;
		printf("%d %d\n" , x , z);
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N;
pair<pair<string, int>, int> p[110];

int main() {
    cin >> N;
    string name;
    int score;
    rep(i, N) {
        cin >> name >> score;
        p[i] = make_pair(make_pair(name, -score), i+1);
    }
    sort(p, p+N);
    rep(i, N) cout << p[i].second << endl;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> city(N);

  for (int i = 0; i < M; i++)
  {
    for (int j = 0; j < 2; j++)
    {
      int x;
      cin >> x;
      city.at(x - 1)++;
    }
  }

  for (auto a: city)
  {
    cout << a << endl;
  }
  
}



Measured memory_bytes: 256
// https://atcoder.jp/contests/abc169/tasks/abc169_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll A, B;
  cin >> A >> B;
  ll res = A * B;
  cout << res << "\n";
}


Measured memory_bytes: 3588
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main{
    public static void main(String args[]){
	try{
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str;
	    String strary[] = new String[2];
	    int w = Integer.parseInt(br.readLine());
	    int n = Integer.parseInt(br.readLine());
	    int ary[] = new int[w];
	    for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    }
	    int a,b,tmp;
	    for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    }
	    for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    }
	}
	catch(Exception e){
	    System.out.println("error");
	    System.exit(0);
	}
    }
}

Measured memory_bytes: 16920
#include <stdio.h>
#include <math.h>

int main(void){
	int prime[100000] = {0};
	int n;
	int primeTop = 2;
	int i;
	
	prime[0] = prime[1] = 1;
	while(primeTop <= sqrt(100000)){
		for(i = 1; i < 100000; i++){
			if(i * primeTop < 100000){
				prime[i * primeTop] = 1;
			}
		}
		prime[primeTop] = 2;
		
		for(i = 2; i < 100000; i++){
			if(prime[i] == 0){
				primeTop = i;
				break;
			}
		}
	}
	for(i = 2; i < 100000; i++){
		if(prime[i] == 0){
			prime[i] = 2;
		}
	}
	
	while(scanf("%d", &n) != EOF){
		for(i = n-1; i > 0; i--){
			if(prime[i] == 2){
				printf("%d ", i);
				break;
			}
		}
		for(i = n+1; i < 100000; i++){
			if(prime[i] == 2){
				printf("%d\n", i);
				break;
			}
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 996
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
using namespace std;

#define read(x) scanf("%d",&x)
#define readl(x) scanf("%lld",&x)
#define ll long long 
#define ull unsigned long long

int n,m,k,a,b;

int main()
{
	read(k),read(n),read(m);
	int a=n-n/k*k;
	if(a==0) cout<<"OK"<<endl;
	else if(n+k-a<=m) cout<<"OK"<<endl;
	else cout<<"NG"<<endl;
	return 0;
} 

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


int main() {
	
	int n;
	cin >> n;
	FOR(i, 1, 10) {
		FOR(j, 1, 10) {
			if (i*j == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
	
}


Measured memory_bytes: 256