akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1 << 21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
    int N, W;
    cin >> N >> W;
    vector<pair<ll, ll>> wv(N);
    // i番目までの品物で、重さの総和がw以下での価値の総和の最大
    // dp[i][j] := i番目までの品物、重さがj以下のものの価値
    ll dp[105][100500];
    rep(i, N+4)rep(j, W+4) dp[i][j] = 0;

    rep(i, N){
        ll w, v;
        cin >> w >> v;
        wv[i] = make_pair(w, v);
    }
    rep(i, N)rep(j, W+1){
        pair<ll, ll> tmp = wv[i];
        if (j-tmp.first>=0) chmax(dp[i+1][j], dp[i][j-tmp.first] + tmp.second);
        
        chmax(dp[i+1][j], dp[i][j]);
    }

    cout << dp[N][W] << endl;

    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  int x;
  if ((a+b)%2 == 0){
    x = (a+b)/2;
  }
  if ((a+b)%2 == 1){
    x = ((a+b)/2)+1;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int main(){
    int N, M; cin >> N >> M; ll H[202020] = {};
    rep(i, N){
        cin >> H[i];
    }
    bool dame[202020] = {};
    rep(i, M){
        int a, b; cin >> a >> b; a--; b--;
        if(H[a]<=H[b]) dame[a] = true;
        if(H[b]<=H[a]) dame[b] = true;
    }
    int ans = 0;
    rep(i, N){
        if(!dame[i]){
            ans++; //cout << i+1 << endl;
        }
    }
    cout << ans << endl;
}
    

Measured memory_bytes: 5368
def main():
    n = int(input())
    numbers = [int(input()) for i in range(n)]
    count = shellSort(numbers, n)

    print(count)
    [print(i) for i in numbers]

def shellSort(numbers, n):
    count = 0
    m = 1
    g = []
    while m <= n :
        g.append(m)
        m = 3 * m + 1
    g.reverse()
    for h in g:
        count += insertionSort(numbers, n, h)

    print(len(g))
    print(' '.join(map(str, g)))

    return count

def insertionSort(numbers, n, h):
    count = 0
    for i in range(h, n, 1):
        v = numbers[i]
        j = i - h
        while (j >= 0) & (numbers[j] > v):
            numbers[j + h] = numbers[j]
            j -= h
            count += 1

        numbers[j + h] = v

    return count

if __name__ == '__main__':
    main()



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

string str;
unordered_map<char, int> cnt;

int main( void ) {
    
    cin >> str;
    for( char ch : str )
        cnt[ch] ++;
    
    bool ok = true;
    for( char ch = 'a'; ch <= 'z'; ch ++ )
        ok &= ( cnt[ch] % 2 == 0 );
    
    cout << ( ok ? "Yes" : "No" ) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll> p(n),c(n);
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> c[i];
    rep(i, n) p[i]--;
    ll ans = -1e18;
    rep(si, n){    //初期値をn通り回す。
        int x = si;
        vector<int> s;
        ll tot = 0;
        while(1){
            x = p[x];
            s.push_back(c[x]);
            tot += c[x];  //1周期の収支
            if(x == si) break;
        }
        int l = s.size();
        ll t = 0;
        rep(i, l){      //周期のどこで切るか全探索
            t += s[i];  //現在のスコア
            if(i+1 > k) break;
            ll now = t;
            if(tot > 0){
                ll e = (k-(i+1))/l;  //あと何周期か
                now += tot*e;
            } 
            ans = max(ans, now);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3708
#main
arr = Array.new
while n = gets
   arr << n.to_f
end

arr.each do |v|
   t = v / 9.8
   y = 4.9 * (t ** 2)
   puts (y / 5).ceil + 1
#   puts y % 5 == 0 ? n - 1 : n
end

Measured memory_bytes: 6124
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	A, B, C = map(int, input().split(" "))
	
	ans = 0
	todo = 0
	base = max(A,B,C)
	
	if base > A:
		tmp = (base - A) // 2
		ans += tmp
		if (base - A) % 2 == 1:
			todo += 1
	if base > B:
		tmp = (base - B) // 2
		ans += tmp
		if (base - B) % 2 == 1:
			todo += 1
	if base > C:
		tmp = (base - C) // 2
		ans += tmp
		if (base - C) % 2 == 1:
			todo += 1
			
	if todo == 2:
		ans += 1
	if todo == 1:
		ans += 2
		
	print(ans)
			
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 13228
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define FOR(i,n) for(int i=1;i<=n;i++)
int main()
{
 ios::sync_with_stdio(false);
char str[4];
cin>>str;
if(strlen(str)==2)
{
	cout<<str<<endl;
}
else
{
	for(int i=2;i>=0;i--)
	{
		cout<<str[i];
	}
	cout<<endl;
}

 return 0;
}


Measured memory_bytes: 256
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

#define YES_ cout<<"Yes"<<endl;
#define NO_ cout<<"No"<<endl;


int main(){
 

    int a,b;
    cin>>a>>b;
    if((a*b)%2==0){
        cout<<"Even"<<endl;
    }
    else{
        cout<<"Odd"<<endl;
    }




}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int uii;
typedef pair<int,int> pii;
typedef unsigned long long uLL; 
typedef vector<int> vii; 
//__int128
int a, b, c;

int main(int argc, char const *argv[])
{
	cin >> a >> b >> c;
	if(a == b && b == c){
		puts("Yes");
	} else {
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
### constant

PNLTY = 20

### subroutines

def cmp_t(a, b)
  ($rights[a] != $rights[b]) ?
    $rights[b] <=> $rights[a] : $times[a] <=> $times[b]
end

def cmp_t_s(a, b)
  ct = cmp_t(a, b)
  (ct != 0) ? ct : b <=> a
end

### main

loop do
  m, tn, pn, rn = gets.split.map(&:to_i)
  break if (m | tn | pn | rn) == 0

  $rights = tn.times.map{0}
  $times = tn.times.map{0}
  ngs = tn.times.map{pn.times.map{0}}
  
  rn.times do
    mi, ti, pi, ji = gets.split.map(&:to_i)
    ti -= 1
    pi -= 1

    if ji == 0
      $rights[ti] += 1
      $times[ti] += ngs[ti][pi] * PNLTY + mi
    else
      ngs[ti][pi] += 1
    end
  end
  #p [$rights, $times]

  ts = (0...tn).sort{|a, b| cmp_t_s(a, b)}

  print (ts[0] + 1)
  for i in (1...tn)
    print (cmp_t(ts[i - 1], ts[i]) != 0 ? ',' : '=')
    print (ts[i] + 1)
  end
  puts
end

Measured memory_bytes: 6156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define FASTIO() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N = 200005, M = 1000000007, BIG = 0x3f3f3f3f;

ll n;

void Process() {
  ll q = n / 500;
  ll r = n % 500;
  cout << q * 1000 + (r / 5) * 5 << "\n";
}

int main() {
  FASTIO();

  while (cin >> n) {
    Process();

    if (cin.eof())
      break;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <functional>
#include <assert.h>
using namespace std;
int main(int argc, char *argv[])
{
  auto parse = [](const string &exp) {
    int i = 0;
    function<int()> pp = [&exp, &i, &pp]() {
      char c = exp[i++];
      switch(c) {
      case '0': { return 0x0000; }
      case '1': { return 0xffff; }
      case 'a': { return 0xaaaa; }  // 1010 1010 1010 1010
      case 'b': { return 0xcccc; }  // 1100 1100 1100 1100
      case 'c': { return 0xf0f0; }  // 1111 0000 1111 0000
      case 'd': { return 0xff00; }  // 1111 1111 0000 0000
      case '-': { return (~pp())&0xffff; }
      case '(': { 
        int a = pp();
        c = exp[i++];
        switch(c) {
        case '^': { int b = a ^ pp(); /* ')' */ i++; return b; }
        case '*': { int b = a & pp(); /* ')' */ i++; return b; }
        }
        assert(false);
      }
      }
    };
    return pp(); 
  };
  /* building answers from the shortest ones
     1: 0,1,a,b,c,d
     2: -a,-b-c-d
     3: x
     4: x
     5: (_*_), (_^_)   # 1+1+3
     6: (_*__), (_^__), -(_*_), -(_^_)
     7: -(_*__), -(_^__)
     8: (__*__), (__^__)
     9: (_*_____), (_^_____)
     ... 
  */
  vector<string> ans(1<<16, "");  // redundant. only the length is necessary.
  vector<vector<int>> sss;
  sss.push_back({});
  vector<int> ss1;
  for(string s : { "0", "1", "a", "b", "c", "d" }) {
    int t = parse(s);
    ss1.push_back(t);
    ans[t] = s;
  }
  sss.push_back(move(ss1));
  const string str_neg = "-";
  const string str_xor = "^";
  const string str_and = "*";
  for(int i = 2; i <= 16; i++) {
    //cout << "building " << i << endl;
    vector<int> is;
    // negation
    for(int s : sss[i-1]) {
      int p = (~s) & 0xffff;
      if(ans[p] == "") {
        string str = "-" + ans[s];
        ans[p] = move(str);
        is.push_back(p);
        //cout << "pushed " << ans[p] << endl;
      }
    }
    // combination
    for(int j = 1; j < i - 3; j++) {
      int k = i - j - 3; // i.e., i = k + j + 3
      for(int s : sss[j]) {
        for(int t : sss[k]) {
          {
            int p = s ^ t;
            if(ans[p] == "") {
              string str = "(" + ans[s] + "^" + ans[t] + ")";
              ans[p] = move(str);
              is.push_back(p);
              //cout << "pushed " << ans[p] << endl;
            }
          }
          {
            int p = s & t;
            if(ans[p] == "") {
              string str = "(" + ans[s] + "*" + ans[t] + ")";
              ans[p] = move(str);
              is.push_back(p);
              //cout << "pushed " << ans[p] << endl;
            }
          }
        }
      }
    }
    sss.push_back(is);
  }
  for(;;) {
    string str;
    cin >> str;
    if(str == ".") break;
    //cout << "read: " << setfill('0') << setw(4) <<  hex << parse(str) << endl;
    cout << ans[parse(str)].length() << endl;
  }
  return 0;
}

Measured memory_bytes: 3152
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	char correct[16] = {'C','O','D','E','F','E','S','T','I','V','A','L','2','0','1','6'};
	char input_char;
	int count = 0;
	for (int i = 0; i < 16; i++){
		cin >> input_char;
		if (input_char != correct[i]) count++;
	}
	printf("%d\n",count);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

#define pb push_back

const int LLINF = 1LL << 60;

signed main()
{
  int N, K;
  int A[25];
  int minv = LLINF;

  cin >> N >> K;
  Rep(i, N) cin >> A[i];
  
  Rep(i, 1 << N) {
    int cnt = 0, sum = 0, maxv = 0;

    Rep(j, N) {
      if((1 << j) & i) cnt++;
    }
    if(cnt != K) continue;

    Rep(j, N) {
      if((1 << j) & i) {
	sum += max(0LL, maxv + 1 - A[j]);
	maxv = max(maxv + 1, A[j]);
      } else {
	maxv = max(maxv, A[j]);
      }
    }

    minv = min(sum, minv);
  }

  cout << minv << endl;
      
  
  return 0;
}


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

int main() {
    int64_t a, b, n;
    cin >> a >> b >> n;
    
    if(n < b) {
        cout << (a*n)/b << endl;
    } else {
        cout << (a*(b-1))/b << endl;
    }

    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;

signed main(){
	cin>>N;
	int ans=0;
	for(int i=1;i<=N;i++){
		if(i%3!=0&&i%5!=0){
			ans+=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define alint(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int prime[300010];
bool is_prime[300010];

void sieve(int n){
	int p=0;
	for(int i=0;i<=n;i++) is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=n;i++){
		if(is_prime[i]){
			prime[p++]=i;
			for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
		}
	}
}

int main(){
	sieve(300000);
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		int ans=0;
		rep(i,n+1,2*n+1){
			if(is_prime[i]) ans++;
		}
		o(ans);
	}
}

Measured memory_bytes: 1552
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
#include <numeric>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    int N;
    vector<int> ret(4, 0);
    cin >> N;
    string temp;
    rep(i, N){
        cin >> temp;
        if(temp=="AC") ret[0]++;
        else if(temp=="WA") ret[1]++;
        else if(temp=="TLE") ret[2]++;
        else if(temp=="RE") ret[3]++;
    }

    cout << "AC x " << ret[0] << endl;
    cout << "WA x " << ret[1] << endl;
    cout << "TLE x " << ret[2] << endl;
    cout << "RE x " << ret[3] << endl;

    return 0;
}

Measured memory_bytes: 3656
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

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

        int n = s.nextInt();

        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }

        Arrays.sort(arr);

        int midLow = (n / 2) - 1;


        int low = arr[midLow] + 1;
        int high = arr[midLow + 1];

        System.out.println(high - low + 1);
    }
}


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

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

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

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

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

//main code

int main(int argc, char const* argv[])
{
    LL n,k;
    cin >> n >> k;
    LL ans = pow(n/k,3);
    if (k % 2 == 1) {
        cout << ans << endl;
    }
    else {
        // ans = pow(n/(k/2),3);
        ans += pow((n/(k/2)) - n/k,3);
        cout << ans << endl;
    }
    return 0;
}


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


int main(){
    int x;
    cin >> x;
    int ans = 0;
    ans += x/500*1000;
    x %= 500;
    ans += x/5*5;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <map>
#include <cstring>
using namespace std;

int gem[21][21];
map<char,int> dx = {{'N', 0}, {'E', 1}, {'W', -1}, {'S', 0}};
map<char,int> dy = {{'N', 1}, {'E', 0}, {'W', 0}, {'S', -1}};

int main() {
    int N, M, x, y, l;
    char d;
    while (cin >> N, N) {
        memset(gem, 0, sizeof gem);
        for (int i=0; i<N; ++i) {
            cin >> x >> y;
            gem[y][x] = 1;
        }
        cin >> M;
        int nx = 10, ny = 10;
        int cnt = 0;
        for (int i=0; i<M; ++i) {
            cin >> d >> l;
            for (int j=0; j<l; ++j) {
                nx += dx[d];
                ny += dy[d];
                cnt += gem[ny][nx];
                gem[ny][nx] = 0;
            }
        }
        cout << (cnt == N ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 1188
from collections import defaultdict

n, m = map(int, input().split())
disputes = defaultdict(int)
for i in range(m):
    a, b = map(int, input().split())
    disputes[b] = max(disputes[b], a)
ans = 0
most_right_bridge = 0
for b in sorted(disputes.keys()):
    if most_right_bridge <= disputes[b]:
        ans += 1
        most_right_bridge = b
print(ans)


Measured memory_bytes: 11108
m=10**9+7

n=int(input())
a=list(map(int,input().split()))
ans=0

for i in range(60):
    x=0
    y=0
    for j in range(n):
        if (a[j]>>i)%2==1:
            x+=1
        else:
            y+=1
    ans+=(2**i) * (x*y)
print(ans%m)

Measured memory_bytes: 122808
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n, m;
    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        int a;
        cin >> a;
        n -= a;
    }

    cout << max(n, -1) << endl;

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;

template <typename T>
bool chmax(T& a, const T& b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}

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


int main() {
	int N, R;
	cin >> N >> R;
	if (N < 10) {
		cout << R + 100 * (10 - N) << endl;
	}
	else cout << R << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
const ll MOD=100000007;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return v[(size / 2) - 1] ;
}
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;}

struct unionfind{
    vector<ll> d;
    unionfind(ll x):d(x,-1){}
    ll root(ll x) {return d[x]<0?x:d[x]=root(d[x]);}
    ll size(ll x) {return -d[root(x)];};
    bool unite(ll x,ll y) {x=root(x),y=root(y); if(x!=y){if(d[x]>d[y])swap(x,y);d[x]+=d[y];d[y]=x;}return x!=y;}
    bool find(ll x,ll y) {return root(x)==root(y);}
};

int main(){
  ll n,m;
  cin>>n>>m;
  vector<ll> k(m);
  vector<vector<ll>> s(m,vector<ll>(n));
  ll ans=0;
  rep(i,0,m){
      cin>>k[i];
      rep(j,0,k[i]) cin>>s[i][j];
  }
  vector<ll> p(m);
  rep(i,0,m) cin>>p[i];
  rep( i,0,1<<n){
      bool f=1;
      rep( j,0,m){
          ll cnt=0;
          rep(t,0,k[ j ]) if(i&(1<<(s[ j ][t]-1))) cnt++;
          if(cnt%2!=p[ j ]) f=0;
      }
      if(f) ans++;
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
ll fact[(ll)1e6] = {1};
ll anabi(ll a, ll b){return b ? (b & 1 ? a : 1) * anabi(a * a % MOD, b / 2) % MOD : 1;}
ll comb(ll n, ll k){return (!n || n <= k ? 1 : fact[n] * anabi(fact[k] * fact[n - k] % MOD, MOD - 2) % MOD);}
int main(){
	for(ll i = 1; i < (ll)1e6; i++) fact[i] = fact[i - 1] * i % MOD;
	ll h, w, a, b; cin >> h >> w >> a >> b;
	ll po = h - a - 1, yo = b;
	ll ans = 0;
	for(ll i = yo; i < w; i++) ans = (ans + comb(po + i, po) * comb(h + w - 2 - (po + i) - 1, w - i - 1) % MOD) % MOD;;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8064
n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

li = make_divisors(n)
min_dig = 100

for i in range(len(li)):
    a = li[i]
    di_a = len(str(a))
    b = int(n/a)
    di_b = len(str(b))
    digit = max(di_a, di_b)
    if digit <= min_dig:
        min_dig = digit

print(min_dig)




Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
ll mod = 1000000007;
P p[200005];

ll i, b, c, k, j, n, m,ss, z = 0,t, pa[305][305] = {}, l;
ll a,q;
vector<vector<ll>> v(305);
string s;
char ca[10000];


int main() {
	cin >>a;
	for (i = 1; i < 10; i++) {
		if ((a % i) != 0)continue;
		else {
			if ((a / i) < 10) {
				cout << "Yes";
				return 0;
			}
		}

	}


	cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------



int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int X;
  cin >> X;
  if(X >= 30){
    cout << "Yes\n";
  }else{
    cout << "No\n";
  }

  return 0;
}

Measured memory_bytes: 3648
H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()

lr, rr = 1, H
lc, rc = 1, W
# print(lr, rr, lc, rc)

for i in range(N-1, -1, -1):
    if T[i] == 'L':
        rc = min(rc+1, W)
    elif T[i] == 'R':
        lc = max(lc-1, 1)
    elif T[i] == 'U':
        rr = min(rr+1, H)
    else:
        lr = max(lr-1, 1)

    # print(lr, rr, lc, rc)

    if S[i] == 'L':
        lc += 1
    elif S[i] == 'R':
        rc -= 1
    elif S[i] == 'U':
        lr += 1
    else:
        rr -= 1

    # print(lr, rr, lc, rc)

    if lc > rc or lr > rr:
        print('NO')
        exit()

if not lr <= sr <= rr or not lc <= sc <= rc:
    print('NO')
else:
    print('YES')


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

// Tip : ceil ( a/b ) = 1 + floor( (a-1)/b ) !

void solve ( int test_case )
{
    int n ;
    cin >> n ;

    string s ;
    cin >> s ;

    string sub = "ABC" ;

    int cnt = 0 ;
    for ( int i=0 ; i < n - 2 ; i ++ )
    {
        string temp = s.substr ( i , 3 ) ;
        if ( temp == sub )
            cnt ++ ;
    }

    cout << cnt ; line
}

int main()
{
    int t = 1;
    // cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      char[][] c = new char[2][3];
      String s1 = sc.next();
      String s2 = sc.next();
      c[0] = s1.toCharArray();
      c[1] = s2.toCharArray();
      if( c[0][0]==c[1][2]&&c[0][1]==c[1][1]&&c[0][2]==c[1][0] ){
      	System.out.println("YES");
      }else{
      	System.out.println("NO");
      }
    }
}

Measured memory_bytes: 21844
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; 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;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


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


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  string n;
  cin>>n;
  if(n[0]==n[2]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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


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

/* vector<int> A(N); 
    vector<pair<int, int> > tasks; ＃ソートした場合、１つ目でソート
　tie(b, a) = p.at(i); #pairを分割
    tasks.emplace_back(b, a)  ＃配列tasksの最後に(b,a)を追加
　xの二乗:  pow(x, 2.0) 
    小さい順: sort(v.begin(), v.end());
    大きい順: reverse(v.begin(), v.end());
    int: -2,147,483,648 ～ 2,147,483,647
    ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807
    // int型の2次元配列(3×4要素の)の宣言
    vector<vector<int>> data(3, vector<int>(4));
*/
 
int main() {
  
  int A, B, C, count=0, ans=0;
  string D, E;
  cin >> D;
  
  if(D=="hi"||D=="hihi"||D=="hihihi"||D=="hihihihi"||D=="hihihihihi"){
  	cout << "Yes" << endl;
  }
  else{
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int N, X;
    int remain;
    
    scanf("%d %d\n", &N, &X);
    
    int array[N];
    int i;
    remain = X;
    int min = 1000;
    int num;
    
    for (i = 0; i < N; i++){
        scanf("%d", &array[i]);
        remain -= array[i];
        if (array[i] < min){
            min = array[i];
        }
    }
    
    num = N + (remain / min);
    
    printf("%d\n", num);
    
    return 0;
}

Measured memory_bytes: 128
/**
 *    author:  khangtq1
 *    created: 22.06.2020 13:10:57 +07
**/

#include <bits/stdc++.h>

using namespace std;

const int INF = (int) 1e9 + 7;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);		
	int n;
	cin >> n;
	vector<int> h(n);
	for(int i = 0; i < n; i++) {
		cin >> h[i];
	}
	vector<int> dp(n, INF);
	dp[0] = 0;
	for(int i = 0; i < n; i++) {
		for(int step : {i + 1, i + 2}) {
			if(step < n) {
				dp[step] = min(dp[step], dp[i] + abs(h[i] - h[step]));
			}
		}
	}
	cout << dp[n - 1];
	return 0;
}


Measured memory_bytes: 3976
#include<cstdio>
#include<cmath>
#include<malloc.h>
#include<stdlib.h>
#include<cstring>
#include<algorithm>
int main()
{
	char x[25];
	while(~scanf("%s",x))
	{
		if(strlen(x)!=19)
		continue;
		else
		for(int i=0;i<19;i++)
		{
			if(x[i]==',')
			x[i]=' ';
			printf("%c",x[i]);
		}
		puts("\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s,t;
    cin>>s>>t;
    
    sort(all(s));
    sort(all(t));
    reverse(all(t));
    
    if(s<t){
        cout1("Yes")
    }else{
        cout1("No")
    }
}

Measured memory_bytes: 256
x, y = map(int, input().split())
a = [4, 6, 9, 11]
b = [1, 3, 5, 7, 8, 10, 12]
if x==y or (x in a and y in a) or (x in b and y in b):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main() {
	int m=0,f=0,r=0,v[100]={0},x[100]={0},z[100]={0},n[100]={0};

    for(int y = 1 ; y <= 100 ; y++ ){
        cin>>m>>f>>r;
        v[y]=m+f;
		x[y]=m;
		z[y]=f;
		n[y]=r;
    if(m==-1&&f==-1&&r==-1){
        break;
    }
    }
	for(int y = 1 ; y <= 100 ; y++ ){
        if(v[y]<0){
            break;
        }else if(v[y]>=80){
            cout<<"A"<<endl;
        }else if(v[y]>=65&&v[y]<80&&x[y]!=-1&&z[y]!=-1){
            cout<<"B"<<endl;
        }else if(v[y]>=50&&v[y]<65&&x[y]!=-1&&z[y]!=-1){
            cout<<"C"<<endl;
        }else if(v[y]>=30&&v[y]<50&&n[y]>=50&&x[y]!=-1&&z[y]!=-1){
            cout<<"C"<<endl;
        }else if(v[y]>=30&&v[y]<50&&n[y]<50&&x[y]!=-1&&z[y]!=-1){
            cout<<"D"<<endl;
        }else{
            cout<<"F"<<endl;
        }
    }
    
   return 0;
}


Measured memory_bytes: 3112
def resolve():
	n = int(input())
	c = list(map(int, input().split()))
	c = sorted(c, reverse=True)
	a, b = 0, 0
	for i in range(n):
		if i % 2 == 0:
			a += c[i]
		else:
			b += c[i]
	print(a-b)
resolve()

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

const int nIMPOS = -1;
struct StDist
{
  int m_nDist;
  int m_nDmy;

  StDist(int nDist) : m_nDist(nDist), m_nDmy(0)
  { }
};

void fnInput(vector<vector<int>>& rvvnAdjcy, vector<StDist>& rvoDist)
{
  int nxSiz;
  cin >> nxSiz;

  rvvnAdjcy.resize(nxSiz + 1, vector<int>(nxSiz + 1, 0));
  for (int i = 0; i < nxSiz; ++i)
  {
    int nx, nySiz;
    cin >> nx >> nySiz;
    for (int j = 0; j < nySiz; ++j)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
  StDist oDist(nIMPOS);
  rvoDist.resize(nxSiz + 1, oDist);
}

void fnBreadthFirstSearch(const vector<vector<int>>& cnrvvnAdjcy, 
                          queue<int>& rqnBFSrch, vector<StDist>& rvoDist)
{
  while (rqnBFSrch.size())
  {
    int nx = rqnBFSrch.front(); rqnBFSrch.pop();

    for (int ny = 1; ny < cnrvvnAdjcy[nx].size(); ++ny)
    {
      if (!cnrvvnAdjcy[nx][ny])          continue;
      if (rvoDist[ny].m_nDist != nIMPOS) continue; 

      int nDist = rvoDist[nx].m_nDist + 1;
      rvoDist[ny].m_nDist = nDist;
      rqnBFSrch.push(ny);
    }
  }
}

void fnResult(const vector<StDist>& cnrvoDist)
{
  for (int i = 1; i < cnrvoDist.size(); ++i)
    cout << i <<  " " << cnrvoDist[i].m_nDist << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;
  queue<int>  qnBFSrch;
  vector<StDist> voDist;

  fnInput(vvnAdjcy, voDist);

  voDist[1].m_nDist = 0;
  qnBFSrch.push(1);
  fnBreadthFirstSearch(vvnAdjcy, qnBFSrch, voDist);
  fnResult(voDist);

  return 0;
}

Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  int N; cin>>N;
  set<int> S;
  rep(i,0,N){
    int A; cin>>A;
    S.insert(A);
  }
  string ans="NO";
  if(S.size()==N)
    ans="YES";
  cout<<ans<<endl;
  }



Measured memory_bytes: 9600
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<string,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l,ans;
string s,t;
ll d[200010],dp[500][500];

int main(){
  cin >> s;
  rep(i,0,s.sz)if(s[i] == 'p')m++;
  print((s.sz/2)-m);
  return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
 
        double a = scan.nextDouble();
        double b = scan.nextDouble();
        double angle = scan.nextDouble();

        double rad = angle * (Math.PI / 180);
        double x = (a - (b * Math.cos(rad)));
        double h = b * Math.sin(rad);
        double c = Math.sqrt((h * h) + (x * x));
        double S = (a * h) /2;
        double L = a + b + c;

        System.out.println(S);
        System.out.println(L);
        System.out.println(h);
    }
}



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

long nCr(int n, int r) {//コピペ
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main() {
	map<int,ll> A1,A2;//<整数,出現回数>,<整数,場合の数>
	
	int n;
	cin>>n;
	vector<int>K(n);
	rep(i,n){
		int a;//変数設定上大文字と小文字は区別される
		cin>>a;
		K[i]=a;
		if(A1.count(a))A1[a]++;
		else A1[a]=1;
	}
	
	
	for(auto p:A1){
		A2[p.first]=nCr(p.second,2);
	}
	
	ll sum=0;
	for(auto p:A2){
		sum+=p.second;
	}
	
	for(int i=0;i<n;i++){
		ll j,sub;//仮の変数
		j=A1[K[i]]-1;
		sub=nCr(j+1,2)-nCr(j,2);
		cout<<sum-sub<<endl;
	}
	
	
}

//一部WA　

Measured memory_bytes: 18176
def func(r, x, d):
    return r * x - d

def main():
    r, d, x0 = map(int, input().split())

    lst = list()
    lst.append(x0)
    for i in range(0, 10):
        lst.append(func(r, lst[i], d))
    
    for it in lst:
        if (it == x0):
            continue
        print(it)
    
main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
using ll = long long;
using namespace std;

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    if(a * n < b){
        cout << a * n << endl;
    }else{
        cout << b << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    string s;
    cin >> s >> s;
    cout << 'A' << s[0] << 'C';
    return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    LL n;cin >> n;
    vector<LL> a(n);
    inc(i, 0, n) cin >> a[i];
    vector<LL> sum(n, 0);
    inc(i, 0, n){
        auto aa = a[i];
        if(i - aa >= 0){
            sum[i-aa]++;
        }
        // if(i + aa < n){
        //     sum[i+aa]++;
        // }
    }

    LL ans = 0;

    inc(i, 0, n){
        auto aa = a[i];
        if(i + aa < n){
            ans += sum[i + aa];
        }
    }

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


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

int main(){
  string str;
  cin>>str;
  bool C=false;
  for(char ch:str){
    if(ch=='C')C=true;
    if(C&&ch=='F'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 764
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Comparator;
import java.util.Collections;
 
class Main {
	public static void main(String[] args) {
 
	    Scanner sc = new Scanner(System.in);
	    double N = sc.nextDouble();
	    double M = sc.nextDouble();
	    ArrayList<Double> A = new ArrayList<>();
	    double total = 0;
	    double vote = 0;
	    
	    for (int i = 0; i < N; i++) {
	      vote = sc.nextDouble();
	      total += vote;
	      A.add(vote);
	    }
	    
	    Collections.sort(A, Comparator.reverseOrder());
	    
	    for (int j = 0; j < M; j++) {
	      if (!(A.get(j)/total >= 1/(4*M))) {
	        System.out.println("No");
	        return;
	      }
	    }
	    System.out.println("Yes");
 
	  }
}

Measured memory_bytes: 24404
#include<stdio.h>
#include<iostream>
#include<vector>
#include <fstream>
#include<math.h>
#include <numeric>
#include<algorithm>
#include <stdlib.h>
# include <map>

using namespace std;

int main(){
    int n,tmp2;
    int tmp= 0;
  	int ans = 0;
    cin >> n;
    for(int i = 0;i< n;i++){
        cin >> tmp2;
        ans += tmp2;
        if(tmp < tmp2){
            tmp = tmp2;

        }
    }
    cout << ans -tmp/2;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,d,e,f,g,h,tc,tl;

    while(cin>>a>>b)
    {
        if(a>=13)
        {
            cout<<b<<endl;
        }
        else if(a>=6&&a<=12)
        {
            cout<<b/2.<<endl;
        }
        else
        {
            cout<<"0"<<endl;
        }
    }



    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n < 1000) cout << "ABC";
    else cout << "ABD";
}


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let n = buf.trim().parse::<i64>().unwrap();
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let a = buf.trim().parse::<i64>().unwrap();

    if n % 500 <= a {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352