akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{	
    ll x, a = 0, b = 0;
    bool ok = false;
    cin >> x;

    FOR(i, -120, 120){
        FOR(j, -120, 120){
            if(i*i*i*i*i - j*j*j*j*j == x){
                a = i;
                b = j;
                ok = true;
                break;
            }
        }
        if(ok) break;
    }
    cout << a << " " << b << endl;
}


Measured memory_bytes: 3500
n = input()
f = len

if f(n) > 1:
    first = int(n[-1])
else:
    first = int(n)
        
if first in [2,4,5,7,9]:
    print('hon')
elif first in [0,1,6,8]:
    print('pon')
elif first in [3]:
    print('bon')

Measured memory_bytes: 61908
import java.io.*;
import java.util.HashSet;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] input = br.readLine().split(" ");
        int n = Integer.parseInt(input[0]);
        int k = Integer.parseInt(input[1]);
        int[] w = new int[n];
        int max = 0;
        int sum = 0;

        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(br.readLine());
            if (max < w[i]) {
                max = w[i];
            }
            sum += w[i];
        }

        int load;
        int capacity = Math.max(max, sum / k);
        int i, j;
        while (true) {
            load = 0;
            j = 0;

            for (i = 0; i < k; i++) {
                load = 0;
                while (load <= capacity) {
                    load += w[j];
                    j++;
                    if (j == w.length && load <= capacity) {
                        System.out.println(capacity);
                        return;
                    }
                }
                j--;
            }
            capacity++;
        }
    }
}

Measured memory_bytes: 35240
#include <iostream>
#include <string.h>
using namespace std;

int main(){
	char s[10001];
	cin.getline(s,10000);
	int c = strlen(s);
	for(int i=0;i<c;i++)
		if('a' <= s[i] && s[i] <= 'z')
			s[i] += 'A' - 'a';
	cout << s << "\n";
	return 0;
}

Measured memory_bytes: 1132
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ctime>
using namespace std;
const long long INF = 100000000000000000;

/* マンハッタン距離の典型らしい */
void solve()
{
    int N; cin >> N;
    vector<long long > z(N),w(N);
    for (int i = 0; i < N; ++i){
        int x,y; cin >> x >> y;
        z[i] = x+y;
        w[i] = x-y;
    }

    long long z_min=INF,z_max=-INF,w_min=INF,w_max=-INF;
    for (int i = 0; i < N; ++i){
        if(z[i]<z_min) z_min = z[i];
        if(z[i]>z_max) z_max = z[i];
        if(w[i]<w_min) w_min = w[i];
        if(w[i]>w_max) w_max = w[i];
    }
    cout << max(z_max-z_min,w_max-w_min) << endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    // int ti = clock();
    // input();
    solve();
    // printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 6408
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readarr(a, n) int a[(n) + 1] = {}; fori(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori(i, 1, n) {fori(j, 1, m) cin >> a[i][j];}
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define sort1(v) sort(v.begin(), v.end()) 
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;

const long long inf2 = (long long)1e18;
const long long mod = (long long)(1e9+7);
const long long inf1 =(long long)(1e6+1);
 
signed main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int h, n;
    cin >> h >> n;
    int a[n+1], b[n+1];
    fori(i, 1, n) cin >> a[i] >> b[i];
    vi cost (h+1, inf2);
    fori(i, 1, h)
    {
        fori(j, 1, n)
        {
            if(i-a[j] <= 0) cost[i] = min(cost[i], b[j]);
            else cost[i] = min(cost[i], b[j] + cost[i-a[j]]);
        }
    }

    cout << cost[h];
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> R(N + 1, 0);
  vector<int> G(N + 1, 0);
  vector<int> B(N + 1, 0);
  for (int i = N - 1; i >= 0; --i) {
    R[i] = R[i + 1] + ((S[i] == 'R') ? 1 : 0);
    G[i] = G[i + 1] + ((S[i] == 'G') ? 1 : 0);
    B[i] = B[i + 1] + ((S[i] == 'B') ? 1 : 0);
  }

  int64_t answer = 0;
  for (int i = 0; i < N - 2; ++i) {
    for (int j = i + 1; j < N - 1; ++j) {
      if (S[i] == S[j]) continue;
      char need;
      if (S[i] == 'R') {
        need = (S[j] == 'G') ? 'B' : 'G';
      } else if (S[i] == 'G') {
        need = (S[j] == 'R') ? 'B' : 'R';
      } else if (S[i] == 'B') {
        need = (S[j] == 'R') ? 'G' : 'R';
      }

      if (need == 'R') {
        answer += R[j + 1];
      } else if (need == 'G') {
        answer += G[j + 1];
      } else {
        answer += B[j + 1];
      }
      int k = (j - i) + j;
      if (k < N && S[k] == need) answer--;
    }
  }
  cout << answer << endl;
  return 0;
}


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

int main() {
	int n,k;

	//入力
	cin >> n >> k;
	vector<ll> a(n);
	rep(i,n) {
		cin >> a[i];
	}

	//答え
	int ans = 1 + ceil((double)(n-k) / (k-1));

	//答え
	std::cout << ans << endl;
}


Measured memory_bytes: 3988
#include<bits/stdc++.h>
            using namespace std;
             
            #define int long long
            #define ll long long
            #define pb emplace_back
            #define mp make_pair
            #define f(i,a,n) for(int i=a ; i<n ; i++)
            #define F first
            #define S second
            #define E "\n"
            #define fast ios:: sync_with_stdio(false),cin.tie(0);
            
           int32_t main()
              {
                    int n;
                    cin >> n ;
                    int a[n+1]={0};
                    f(i,0,n)
                    {
                          int temp;
                          cin >> temp;
                          a[temp]=i+1;
                    }
                    f(i,1,n+1) cout<<a[i]<<" ";
            }

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


int main(){
  string s;
  cin >> s;
  int n,j,i,ans,k;
  bool ha=true;
  n=s.size();
  j=n-1;
  ans=0;
  i=0;
  int med=n/2;
  while(i<=j){
    if(s[i]=='x' && s[j]!='x'){
      ans++;
      i++;
    }else if(s[j]=='x' && s[i]!='x'){
      ans++;
      j--;
    }else if(s[i]!=s[j] && s[i]!='x' && s[j]!='x'){
      ha=false;
      i=j;
    }else if(s[i]==s[j]){
      i++;
      j--;
    }
  }
  if(ha==true){
    cout << ans << endl;
  }else{
    ans=-1;
    cout << ans << endl;
  }
  return 0;

}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int count;
    int win=0;
    int n;
    scanf("%d",&n);
    for(count=111;count<=1000;count=count+111){
        if(count>=n){printf("%d\n",count);break;}
    }
    return 0;
}

int min(int a,int b){
    int ans;
    if(a>b){return b;}
    else {return a;}
}

int max(int a,int b){
    int ans;
    if(a>b){return a;}
    else {return b;}
}

Measured memory_bytes: 128
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii> 
using vec = vector<T>;

const ll INF = 1e18, MOD = 1e9 + 7;

const int MAX = 1e6;

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);
    
    int n, m;
    cin >> n >> m;
    set<int> s;
    for (int i = 0; i < m; i++) {
        int x;
        cin >> x;
        s.insert(x);
    }
    vll dp({0, 1});
    for (int i = 1; i <= n; i++) {
        ll res;
        if (s.count(i)) {
            res = 0;
        }
        else {
            res = (dp[0] + dp[1]) % MOD;
        }
        dp[0] = dp[1];
        dp[1] = res;
    }
    cout << dp[1] << '\n';
}

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

namespace ITP2_11_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] line = ReadIntAr();
            for (int i = 0 ; i < (1 << line[0]) ; i++)
            {
                if (BitCount(i) == line[1])
                {
                    List<int> s = new List<int>(line[1]);
                    for (int j = 0 ; j < line[0] ; j++)
                    {
                        if ((i >> j & 1) == 1) s.Add(j);
                    }
                    Console.WriteLine("{0}:{1}", i, (s.Count == 0 ? "" : " ") + string.Join(" ", s.Select(x => x.ToString()).ToArray()));
                }
            }
        }

        private static int BitCount(int bits)
        {
            bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);    //  2bitごとに計算
            bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);    //  4bitごとに計算
            bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);    //  8bitごとに計算
            bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);    //  16ビットごとに計算   
            return (bits & 0x0000ffff) + (bits >> 16);       
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



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

int main(){
  long long N,H;
  cin>>N>>H;
  long long a[N];
  long long b[N];
  for (int i=0;i<N;i++){
    cin>>a[i]>>b[i];
  }
  sort(a,a+N);
  sort(b,b+N);
  long long maxa=a[N-1];
  long long td=0;
  long long cnt=0;
  for(int i=N-1;i>-1;i--){
    if(b[i]>maxa){
      td=td+b[i];
      cnt++;
      if(td>=H){
        cout<<cnt<<endl;
        return 0;
      }
    }
  }
  if((H-td)%maxa==0){
    cout<<cnt+(H-td)/maxa<<endl;
    return 0;
  }
  else cout<<cnt+(H-td)/maxa+1<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

vector<int> edge[100010];
vector<int> n_edge[100010];
int color[100010];
int Max = 0;

void allocate(int a, int prev, int prev_color){
    int count = 0;
    for(int i=0; i<edge[a].size(); i++){
        if(edge[a][i] != prev){
            count++;
            if(count == prev_color) count++;
            color[n_edge[a][i]] = count;
            allocate(edge[a][i], a, count);
        }
    }
    if(count > Max) Max = count;
}
int main(void){
    int N;
    cin >> N;
    int a, b;
    for(int i=0; i<N-1; i++){
        cin >> a >> b;
        edge[a].push_back(b);
        edge[b].push_back(a);
        n_edge[a].push_back(i);
        n_edge[b].push_back(i);
    }
    allocate(1, 0, N);
    cout << Max << endl;
    for(int i = 0; i < N-1; i++){
        cout << color[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 13440
/*         Waha tufaan bhi haar jate hain...
        ...Jaha Kastiyan zid pe hoti hain
*/
#include <bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define fl(i,a,n) for(int i=a; i<n; i++)
#define rfl(i,a,n) for(int i=a; i>=n; i--)
#define ll long long 
#define pb push_back
#define all(v) v.begin(),v.end()
#define in(arr,n) fl(i,0,n)  cin>>arr[i];
#define out(arr,n) fl(i,0,n) cout<<arr[i]<<" ";	    cout<<endl;
#define test()  int tt;  cin>>tt;  while(tt--) 

int main()  {
    fast;
    string s;   cin>>s;
    if(s[2]==s[3] && s[4]==s[5])    cout<<"Yes";
    else    cout<<"No";
}

Measured memory_bytes: 256
using System;
using System.Linq;

class B
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var h = Read();
		var m = h[1];
		var a = Read();

		var s = a.Sum();
		Console.WriteLine(a.Count(x => 4 * m * x >= s) >= m ? "Yes" : "No");
	}
}


Measured memory_bytes: 28308
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

int main() {
	ll N;
	cin >> N;
	vector<int> L(N);
	rep(i, N) cin >> L[i];
	sort(L.begin(), L.end());

	vector<ll> dp; // dp[i]: L[i+2] までの棒を使用する．

	// dp[i+1] = (i+1番目を必ず使用) + dp[i];
	if(L[0]+L[1]>L[2]) dp.push_back(1);
	else dp.push_back(0);

	for(int i=1; i<N-2; i++) {
		int cnt = 0;
		for(int j = i-1+2; j>0; j--) {
			for(int k = j-1; k>=0; k--) {
				if(L[j]+L[k]>L[i+2]) cnt++;
				// cout << "cnt " << cnt << ' ' << L[i+2] << ' '<< L[j] << ' '<< L[k] << endl;
			}
		}

		dp.push_back(dp[i-1] + cnt);
		// cout << "dp[i]: " << dp[i] << endl;
	}

	cout << dp[N-3] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX_N 100

int iabs(int a){
	if(a < 0){
		return -a;
	}
	return a;
}

void swap(char *a,char *b){
	char tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}



int main(void){
	int n, a[MAX_N], b[MAX_N], i, sub;
	char message[101];
	while(1){
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		scanf("%s",message);

		for(i = 0;i < n;i++){
			scanf("%d%d",&a[i],&b[i]);
			a[i]--;b[i]--;

		}
		for(i = n - 1;i >= 0;i--){
			sub = iabs(a[i] - b[i]);
			message[a[i]] = (message[a[i]] - 'a' + 26 + sub) % 26 + 'a';
			message[b[i]] = (message[b[i]] - 'a' + 26 + sub) % 26 + 'a';
			swap(&message[a[i]],&message[b[i]]);
		}

		printf("%s\n",message);


	}
	return 0;
}

Measured memory_bytes: 1012
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC119A
{
    static class MainClass
    {

        static string[] s;
        static int[] n;

        public static void Main(string[] args)
        {

            s = Console.ReadLine().Split().ToArray();
            DateTime d = DateTime.Parse(s[0]);

            if (d <= DateTime.Parse("2019/04/30"))
            {
                Console.WriteLine("Heisei");
            }
            else
            {
                Console.WriteLine("TBD");
            }
            return;
        }
    }
}


Measured memory_bytes: 13780
x,y,A,B,C = map(int,input().split())

a = list(map(int,input().split()))

b = list(map(int,input().split()))

c = list(map(int,input().split()))

a = sorted(a)[::-1]
b = sorted(b)[::-1]
c = sorted(c)[::-1]

a = a[:x]
b = b[:y]
ans = a+b
ans = sorted(ans)
# ans = ans[::-1]
index = 0
# print(ans)
# print(c)
for i in range(0,C):
    if(c[i] > ans[index]):
        ans[index] = c[i]
        index = index + 1
    else:
        break

    if(index == x+y):
        break
# print(ans)
print(sum(ans))



Measured memory_bytes: 110956
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  int i;
  for(i=0;i<n;i++){
    cin >> s[i];
  }
  vector<long> a(5);
  for(i=0;i<n;i++){
    if(s[i][0] == 'M'){
      a[0]++;
    }else if(s[i][0] == 'A'){
      a[1]++;
    }else if(s[i][0] == 'R'){
      a[2]++;
    }else if(s[i][0] == 'C'){
      a[3]++;
    }else if(s[i][0] == 'H'){
      a[4]++;
    }
  }
  int j,k;
  long ans=0;
  for(i=0;i<5;i++){
    for(j=i+1;j<5;j++){
      for(k = j+1;k<5;k++){
        ans +=a[i] * a[j] * a[k];
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6144
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    def COMinit(n,MOD):
        fac,finv,inv=[0]*max(2,n+1),[0]*max(2,n+1),[0]*max(2,n+1)
        fac[0]=fac[1]=1
        finv[0]=finv[1]=1
        inv[1]=1
        for i in range(2,(n+1)):
            fac[i]=fac[i-1]*i%MOD
            inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
            finv[i]=finv[i-1]*inv[i]%MOD
        return fac,finv,inv
    
    def COM(n, k, MOD):
        if n<k or n<0 or k<0:
            return 0
        fac,finv,inv=COMinit(n,MOD)
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD
    
    for i in range(K):
        print(COM(K-1,i,MOD)*COM(N-K+1,i+1,MOD)%MOD)

if __name__ == '__main__':
    main()


Measured memory_bytes: 45672
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
points=0
renzoku=[1 for i in range(k)]
for i in range(n):
	if i<k:
		if t[i]=='r':
			points+=p
		if t[i]=='s':
			points+=r
		if t[i]=='p':
			points+=s
	else:
		if t[i]==t[i-k]:
			renzoku[i%k]+=1
			if renzoku[i%k]%2==1:
				if t[i]=='r':
					points+=p
				if t[i]=='s':
					points+=r
				if t[i]=='p':
					points+=s
		else:
			renzoku[i%k]=1
			if t[i]=='r':
				points+=p
			if t[i]=='s':
				points+=r
			if t[i]=='p':
				points+=s
print(points)

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

int main() {
  
    int N,A;
    cin>> N ;
    cin>> A ;
    
    if( A*1 >= N){
        
        cout<<"Yes"<< endl;
    }
    
    else if(N%500 == 0){
         cout<<"Yes"<<endl;
        }
    else if( N-((N/500)*500)<=A )
               {
          cout<< "Yes"<<endl;
        }
    else {
             cout << "No"<<endl;
         }
                
}
             


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

int main(){
int x; cin >> x;
int lim=(int)sqrt(x);
if(x==2) cout << 2 << endl;
else{
    int ch=0;
    if(x%2==0) x++;
    for(int i=x; i>0; i=i+2){
        for(int j=3; j<=lim; j=j+2){
            if(i%j==0){
                ch++;
                break;
            }
        }
    if(!ch){ 
    cout << i << endl;
    break;
    }
    ch=0;
    }
}
return 0;
}


Measured memory_bytes: 256
from math import sqrt
def div(n):
    s = set()
    for i in range(1, int(sqrt(n))+2):
        if n%i == 0:
            s.add(i)
            s.add(n//i)
    return s

def solve(x, n):
    while n % x == 0:
        n //= x
    if n % x == 1:
        return True
    return False

def main():
    n = int(input())
    t = div(n) | div(n-1)
    ans = 0
    for v in t:
        if v != 1 and solve(v, n):
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3952
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for(int i = (int)n - 1; j <= i; --i)

constexpr ll MOD = 0x3b9aca07;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	string s; cin >> s;

	int n = (int)s.size();
	vector<bool> ex(26);
	for(char c : s) ex[c - 'a'] = true;

	if (n < 26) {
		rep(i, 0, 26) {
			if (!ex[i]) {
				cout << s + char('a' + i) << endl;
				return 0;
			}
		}
	} else {
		rrep(i, 0, n - 1) {
			ex[s[i + 1] - 'a'] = false;
			rep(j, 0, 26) {
				if (!ex[j]) {
					char c = char(j + 'a');
					if (c > s[i]) {
						cout << s.substr(0, i) + c << endl;
						return 0;
					}
				}
			}
			ex[s[i] - 'a'] = false;

		}
		cout << -1 << endl;
	}

	return 0;
}


Measured memory_bytes: 3616
#include<cstdio>
#include<stack>
using namespace std;

int main(){
  int x;
  stack<int> q;
  while(scanf("%d", &x) != EOF){
    if(x == 0){
      printf("%d\n", q.top());
      q.pop();
    }
    else{
      q.push(x);
    }
  }
  return 0;
}

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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

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

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

int N, L;
ll A[100000];
int main(){
    ios::sync_with_stdio(false);
    cin >> N >> L;
    REP(i,N) {
        cin >> A[i];
    }
    int flag = 1;
    int knot = -1;
    REP(i,N-1) {
        if (A[i]+A[i+1] >= L) {
            flag = 0;
            knot = i;
            break;
        }
    }
    
    if (flag) {
        cout << "Impossible" << endl;
        return 0;
    }
    
    cout << "Possible" << endl;
    
    REP(i, knot) {
        cout << i+1 << endl;
    }
    
    for(int i = N-2; i > knot; i--) {
        cout << i+1 << endl;
    }
    
    cout << knot+1 << endl;
    
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

template<class T, class Compare = greater<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = less<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;
const llong MOD = (llong)(1e9) + 7;

llong n;
llong t[100005];
llong a[100005];

llong ti[100005];
llong ai[100005];

llong ans = 1;

int main() {

    cin >> n;
    for (llong i = 0; i < n; i++) cin >> t[i];
    for (llong i = 0; i < n; i++) cin >> a[i];

    for (llong i = 1; i < n; i++) {
        if (t[i] > t[i - 1]) ti[i] = t[i];
    }
    for (llong i = n - 2; i >= 0; i--) {
        if (a[i] > a[i + 1]) ai[i] = a[i];
    }
    for (llong i = 0; i < n; i++) {
        if (a[i] < ti[i]) ans = 0;
        if (t[i] < ai[i]) ans = 0;
    }

    if (a[0] != t[n - 1]) ans = 0;

    for (llong i = 1; i < n - 1; i++) {
        if (t[i] == t[i - 1] && a[i] == a[i + 1]) {
            ans *= min(t[i], a[i]);
            ans %= MOD;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2944
n, m = map(int, input().split())
a = []
 
for i in range(n):
    a.append(list(map(int, input().split())))
 
b = []
for i in range(m):
    b.append(int(input()))
 
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)


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

//defines
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define int long long
#define mod 1000000007
#define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--)
#define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
int power(int a , int b)
{
    int res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % mod ;
        }
        b/=2 ;
        a = (a*a) % mod ;
    }
    return res ;
}

//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int32_t main()
{
    fast;
    string s ; cin >> s ; 
    int ans = 0 ; 
    for(auto c : s) ans += (c == '1') ; 
    cout << ans << endl ; 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define watch(x) cout << #x << " is " << x << endl;
#define print(a, l, r)          \
	for (int i = l; i < r; i++) \
		cout << a[i] << (i == (r - 1) ? endl : " ");
const long long M = 1000000007;
int main()
{

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

	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	int ans = 0;
	for (int i = n - 1; i >= 0; i--)
	{
		int l = 0, r = i - 1;
		while (l < r)
		{
			if ((a[l] + a[r]) > a[i])
			{
				ans += r - l;
				r--;
			}
			else
				l++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main() {
	int node_num, adj[100][100];

	std::cin >> node_num;

	for (int i = 0; i < node_num; i++)
		for (int j = 0; j < node_num; j++)
			adj[i][j] = 0;

	for (int i = 0; i < node_num; i++) {
		int node, num;
		std::cin >> node >> num;
		for (int j = 0; j < num; j++) {
			int n;
			std::cin >> n;
			adj[node - 1][n - 1] = 1;
		}
	}

	for (int i = 0; i < node_num; i++) {
		for (int j = 0; j < node_num; j++) {
			std::cout << adj[i][j] << (j != node_num - 1 ? " ":"");
		}
		std::cout << std::endl;
	}
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint a(N+2);
    for(int i=1;i<=N;i++) cin>>a[i];
    a[0]=a[N+1]=0;

    int sum=0;
    for(int i=0;i<=N;i++) sum+=abs(a[i+1]-a[i]);

    for(int i=1;i<=N;i++){
        int cost=sum-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]);
        cout<<cost<<endl;
    }

}


Measured memory_bytes: 2048
import functools


def pretty_print(arr: [int]):
    return functools.reduce(lambda a, b: f'{a} {b}', arr)


def custom_sort(arr: [int]):
    print(pretty_print(arr))
    for i in range(1, len(arr)):
        val = arr[i]
        # print(f'val is {val}')
        j = i - 1
        # print(j >= 0, arr[j] > val)
        while j >= 0 and arr[j] > val:
            # print(f'\tj is {j}')
            arr[j + 1] = arr[j]
            j -= 1
        arr[j + 1] = val
        print(pretty_print(arr))
    return arr


length = input()
array: [int] = list(map(lambda n: int(n), input().split(' ')))
# print(type(array[0]))

custom_sort(array)


Measured memory_bytes: 6296
/*
 *  Lang    : C++
 *  Author  : little_angel
 */
#include <bits/stdc++.h>

using namespace std;
#define int long long

int n, a[16][16], dp[1ull << 17u], val[1ull << 17u];

// mask  = number of rabbits already paired

void rec(int pos, vector<int> &rem, int p_score, int mask, int group) {
    if (pos == rem.size()) dp[mask] = max(dp[mask], p_score + val[group]);
    else {
        rec(pos + 1, rem, p_score, mask, group);
        rec(pos + 1, rem, p_score, mask ^ (1ull << rem[pos]), group ^ (1ull << rem[pos]));
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

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

    clock_t s = clock();

    for (int mask = 0; mask < (1ull << n); ++mask) {
        for (int i = 0; i < n; ++i) {
            if ((1ull << i) & mask) {
                for (int j = i + 1; j < n; ++j) {
                    if ((1ull << j) & mask) {
                        val[mask] += a[i][j];
                    }
                }
            }
        }
    }

    for (int mask = 0; mask < (1ull << n); ++mask) {
        vector<int> rem;
        for (int i = 0; i < n; ++i) if (!(mask & (1ull << i)))rem.emplace_back(i);
        rec(0, rem, dp[mask], mask, 0);
    }
    cout << dp[(1ull << n) - 1] << endl;

    cerr << (double) (clock() - s) / CLOCKS_PER_SEC << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const ll INF=1e9+7;
const ll N = 100002;
ll ans=1,n,a[N];
ll sa[N];
int main(){
	cin>>n;
	FOR(i,0,n){
		sa[i]=2;
	}
	sa[0]=1;
	FOR(i,0,n){
		cin>>a[i];
		sa[a[i]]--;
	}
	ll k=1;
	if(n%2==1)k=0;
	bool ok=true;
	for(ll i=k;i<n;i+=2){
		if(sa[i]!=0){
			ok=false;
			break;
		}
	}
	if(ok){
		FOR(i,0,n/2){
			ans*=2;
			ans%=INF;
		}
		cout<<ans<<endl;
	}else{
		cout<<0<<endl;
	}

	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head=1, tail, n;

void enqueue(P x){
  Q[tail]=x;
  if(tail+1==LEN){
    tail=0;
  }
  else{
    tail++;
  }
}

P dequeue(){
  P a=Q[head];
  if (head+1>= LEN) {
    head=0;
  }
  else{
    head++;
  }
  return a;
}


int main(){
  int elaps = 0;
  int count=0;
  int i,q;
  
  scanf("%d %d", &n, &q);
  
  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  
  tail=n+1;
  
  for(i=1;i<=count+n;i++){
    if(Q[head].t<=q){
      printf("%s",Q[head].name);
      elaps=elaps+Q[head].t;
      printf(" %d\n",elaps);
      dequeue();
    }
    else {
      count++;
      elaps=elaps+q;
      Q[head].t=Q[head].t-q;
      enqueue(Q[head]);
      dequeue();
    }
  } 
  return 0;
}

Measured memory_bytes: 10756
/**
 *    Author  : Ador
 *    Created : 24.07.2020
**/
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cctype>
typedef long long int ll ;
typedef unsigned long long int ull ;
using namespace std ;
int main(void)
{
    ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
        //freopen("input.txt", "r", stdin) ;
        //freopen("output.txt", "w", stdout) ;
    ll n , i , sum = 0 ; cin >> n ;
    for(i = 1 ; i <= n ; ++i)
    {
        ll x = (n / i) ;
        sum += i * ((x * (x + 1)) / 2) ;
    }
    cout << sum << "\n" ;
    return 0 ;
}


Measured memory_bytes: 3640
from heapq import heappop, heappush

N, M = map(int, input().split())
INF = 10**10

edges = [[] for _ in range(N * 3)]

for _ in range(M):
    fr, to = map(int, input().split())
    fr -= 1
    to -= 1
    edges[fr].append(to + N)
    edges[fr + N].append(to + 2 * N)
    edges[fr + 2 * N].append(to)

S, T = map(int, input().split())
S -= 1
T -= 1

minDist = [INF] * (3 * N)
que = [(0, S)]

while que:
    dist, now = heappop(que)

    if minDist[now] <= dist:
        continue
    minDist[now] = dist

    dist += 1

    for to in edges[now]:
        if minDist[to] > dist:
            heappush(que, (dist, to))

ans = minDist[T]

if ans == INF:
    print(-1)
else:
    print(ans // 3)

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  int odd = 0;
  for(int i=0;i<N;i++){
    cin >> a[i];
    odd += a[i] & 1;
  }
  if(odd%2){
    cout << "NO" ;
  }else{
    cout << "YES";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int x;
char c;
inline int read()
{
	x=0; c=getchar();
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return x;
}
int main()
{
	long n = read(), ans = n;
	for (int i = 1; i < n; ++i)
	{
        int u = read(), v = read();
		if (u > v) ans += i * (n - i + 1) - v * (n - u + 1);
        else ans += i * (n - i + 1) - u * (n - v + 1);
	}
	printf("%ld", ans);
  
    return 0;
}


Measured memory_bytes: 3764
#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>
using namespace std;
#define INF 2000001145
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};

int ans=0;
int k,n;
string s;

signed main(){
	
	cin>>n>>s;
	rep(i,n){
		if(i>n-3)continue;
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')ans++;
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007LL;
const int MOD2 = 13;
const int MAX_N = 100005;

int n;
string s;
int _pow10[MAX_N];
ll dp[MAX_N][MOD2];

int main()
{
	ios::sync_with_stdio(false);
	cin >> s;
	n = (int)s.length();
	reverse(s.begin(), s.end());

	_pow10[0] = 1;
	for (int i = 1; i < n; i++)
		_pow10[i] = (_pow10[i - 1] * 10LL) % MOD2;

	dp[0][0] = 1;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < MOD2; j++)
		{
			if (s[i] == '?')
			{
				for (int k = 0; k < 10; k++)
				{
					int newRem = (j + _pow10[i] * k) % MOD2;
					dp[i + 1][newRem] += dp[i][j];
					if (dp[i + 1][newRem] >= MOD)
						dp[i + 1][newRem] -= MOD;
				}
			}
			else
			{
				int newRem = (j + _pow10[i] * (s[i] - '0')) % MOD2;
				dp[i + 1][newRem] += dp[i][j];
				if (dp[i + 1][newRem] >= MOD)
					dp[i + 1][newRem] -= MOD;
			}
		}
	cout << dp[n][5] << endl;
}

Measured memory_bytes: 11088
#include<bits/stdc++.h>
#define sc scanf
typedef long long ll;
using namespace std;
int flag[3];
int main()
{
	string s[3];
	for(int i=0;i<3;i++)
	{
		cin>>s[i];
		//s[i]+=(i+'A');
	}
	int cnt=0;
	while(1)
	{
		if(s[cnt].size()==0)
		{
			cout<<char(cnt+'A')<<"\n";
			break; 
		}
		int tmp=s[cnt][0];
		s[cnt].erase(0,1);
		cnt=tmp-'a';	
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;
  long long a[100005];
  cin >> n;
  int i;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  int ki=0;
  for(i=0;i<n;i++){
    if(a[i]%2!=0){
      ki++;
    }
  }
  if(ki%2!=0){
    cout << "NO";
    return(0);
  }
  cout << "YES";
  return(0);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int x, long long int y){
 long long int tmp;
 long long int r;
 if(x > y){
    tmp = x;
    x = y;
    y = tmp;
  }
  r = y % x;
  while(r!=0){
    y = x;
    x = r;
    r = y % x;
  }
  return x;
}
int main(){
    int n,x;
    cin >> n >> x;
    int a;
    int b[n];
    for(int i=0;i<n;i++){
        cin >> a;
        b[i]=abs(a-x);
    }

    if(n>1){
    int ans=gcd(b[0],b[1]);
    for(int i=2;i<n;i++)ans=gcd(ans,b[i]);
    cout << ans << endl;
    }
    else cout << b[0] << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll arr[200005][3],n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    }
    for(int i=1;i<n;i++)
    {
        arr[i][0]+=max(arr[i-1][1],arr[i-1][2]);
        arr[i][1]+=max(arr[i-1][2],arr[i-1][0]);
        arr[i][2]+=max(arr[i-1][0],arr[i-1][1]);
    }
    cout<<max({arr[n-1][0],arr[n-1][1],arr[n-1][2]})<<'\n';
    return 0;
}

Measured memory_bytes: 5784
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

ab.sort()
ans = 0
for i in range(n):
    if m >= ab[i][1] :
        ans += ab[i][0]*ab[i][1]
        m = m -ab[i][1]
    elif 0 < m < ab[i][1] :
        ans += m*ab[i][0]
        break
print(ans)


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

int main(){
    int n; cin >> n;
    bool flag = true;

    string words[100];
    cin >> words[0];
    for(int i = 1; i < n; i++){
        cin >> words[i];
        if(words[i].front() != words[i-1].back())
            flag = false; 
    }
    for(int low = 0; low < n-1; low++){
        for(int high = low + 1; high < n; high++){
            if(words[low] == words[high]){
                flag = false; break;
            }
        }
    }
    cout << (flag ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int Main(){
    int N;
    float ans=0.0;
    cin >> N;
    for(int i=0;i<N;i++){
        float x;
        string u;
        cin >> x >> u;
        if(u == "JPY"){
            ans += x;
        }else{
            ans += x*380000.0;
        }
    }
    cout << ans << endl;
}
int main(){ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s,t;
int q,a,b,c,d;
int tcd[2][100005];
int main(){
   iostream::sync_with_stdio(0);
   cin >> s >> t;
   s = '0' + s;
   t = '0' + t;
   cin >> q;
   for(int i=1;i<s.size();i++)
      tcd[0][i] = (tcd[0][i-1] + (s[i] == 'A' ? 1 : 2)) % 3;
   for(int i=1;i<t.size();i++)
      tcd[1][i] = (tcd[1][i-1] + (t[i] == 'A' ? 1 : 2)) % 3;
   while(q--){
      cin >> a >> b >> c >> d;
      int v1 = (tcd[0][b] - tcd[0][a-1] + 3)  % 3;
      int v2 = (tcd[1][d] - tcd[1][c-1] + 3)  % 3;
      if (v1 == v2) cout << "YES\n";
      else cout << "NO\n";
   }
}


Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
int main() {
	ll h;
	cin>>h;
	ll now=1;
	ll ans=0;
	while(h!=0){
		ans+=now;
		h/=2;
		now*=2;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3600
/**
*    Username : adhoc_king
*    Name : adhoc_king
*    Institute : IIT Bombay
*/

#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
// #include <deque>
// #include <queue>
// #include <array>
// #include <ctime>
// #include <list>
// #include <map>
// #include <set>
// #include <cassert>
// #include <complex>
// #include <sstream>
// #include <forward_list>
// #include <unordered_set>
// #include <unordered_map>

using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define scani(n) scanf("%d",&n);
#define EPS 1e-9
#define FOR(i,n) for(int i=0; i<n; i++)
#define X first
#define Y second
#define arrinput for(int i=0; i<n; i++) cin>>arr[i];
#define arrsum for(int i=0; i<n; i++) sum+=arr[i];
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,n) for(int i=n-1; i>=0; i--)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MOD = 1e9+7;
const int n_ = 1e5+1000;
const long double PI = acos(-1.0);

ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

bool vowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') return true;
    else return false;
}

// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
class UnionFind {                                              // OOP style
private:
    vi p, rank, setSize;                       // remember: vi is vector<int>
    int numSets;
public:
    UnionFind(int N) {
        setSize.assign(N, 1); numSets = N; rank.assign(N, 0);
        p.assign(N, 0); for (int i = 0; i < N; i++) p[i] = i; }
    int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
    bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
    void unionSet(int i, int j) { 
        if (!isSameSet(i, j)) { numSets--; 
        int x = findSet(i), y = findSet(j);
        // rank is used to keep the tree short
        if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
        else                   { p[x] = y; setSize[y] += setSize[x];
                                 if (rank[x] == rank[y]) rank[y]++; } } }
    int numDisjointSets() { return numSets; }
    int sizeOfSet(int i) { return setSize[findSet(i)]; }
};

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n;
    cin>>n;
    int arr[n];
    for0(i,n) cin>>arr[i];
    int count = 0;
    for0(i,n) if(arr[i] < 0) count++;
    for0(i,n) if(arr[i] < 0) arr[i] *= (-1);
    sort(arr, arr+n);
    int sum = 0;
    for0(i,n) sum += arr[i];
    if(count%2 == 0) cout<<sum;
    else cout<<sum - 2*arr[0];

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

ll gcd(ll x,ll y){return y ? gcd(y,x%y) : x;};
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
int main(){
    int N,M;cin>>N>>M;
    string s,t;
    cin>>s>>t;
    int g=gcd(N,M);
    REP(i,g){
        if(s[i*(N/g)]!=t[i*(M/g)]){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<lcm(N,M)<<endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
//#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N, M;
	cin >> N >> M;
	vector<tuple<int, long long int, int>>v(M);
	vector<int>output_first(M), output_second(M);
	rep(i, M) {
		int P, Y;
		cin >> P >> Y;
		output_first[i] = P;
		v[i] = make_tuple(P, Y, i);
	}
	sort(v.begin(), v.end());
	int num;
	rep(i, M) {
		if (!i) {
			output_second[get<2>(v[i])] = 1;
			num = 1;
		}
		else {
			if (get<0>(v[i - 1]) == get<0>(v[i])) {
				num++;
				output_second[get<2>(v[i])] = num;
			}
			else {
				num = 1;
				output_second[get<2>(v[i])] = num;
			}
		}
	}
	rep(i, M) {
		printf("%06d%06d\n", output_first[i], output_second[i]);
	}
}

Measured memory_bytes: 4608
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  int f[50];
  f[0] = f[1] = 1;
  for (int i = 2; i <= n; ++i) f[i] = f[i - 1] + f[i - 2];
  cout << f[n] << endl;
  return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(v1, v2)     cout << v1 << " " << v2 << endl
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << endl
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << endl

//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  string s, t;
  cin >> s;

  char tmp='0';
  rep(i,n){
    if(tmp!=s[i]){
      t.push_back(s[i]);
      tmp = s[i];
    }
  }

  //prt(t);
  prt(t.size());

}


Measured memory_bytes: 640