akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  A *= 100;
  B *= 100;

  int mx_sugar_water = A;
  int mx_sugar = 0;
  for(int a=0; a <= F/A; a++) {
    for(int b=0; b <= F/B; b++) {
      int water = a*A + b*B;
      if (water > F) break;

      int limit = water / 100 * E;
      limit = std::min(limit, F - water);

      for(int c=0; c <= limit/C; c++) {
        for(int d=0; d <= limit/D; d++) {
          int sugar = c*C + d*D;

          if (sugar > limit) break;

          if (water+sugar == 0) continue;

          if (mx_sugar * (sugar+water) < mx_sugar_water * sugar) {
            mx_sugar_water = water + sugar;
            mx_sugar = sugar;
          }
        }
      }
    }
  }

  cout << mx_sugar_water << " " << mx_sugar << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, i, j, k, l, r, t, a[202];
int main(){
  cin>>n;
for(i=0;i<2*n;i++)cin>>a[i];
sort(a,a+2*n);
for(i=0;i<2*n;i+=2)t+=a[i];
cout<<t<<endl;
}

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

//#define DEBUG

using namespace std;

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}


void func_to_create(){
    uint32_t N;
    std::string S;
    cin >> N;
    cin >> S;
    if( S.size() <= N){
        cout << S << endl;
    }else{
        cout << S.substr(0, N);
        cout << "..." << endl;
    }
}
int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    func_to_create();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


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

using namespace std;

using ll = long long;

int main() {
  const int sqrtN = 512;
  int n, q;
  cin >> n >> q;
  int bucket_sz = (n+sqrtN-1)/sqrtN;
  vector<ll> a(n, 0);
  vector<ll> bucketSum(bucket_sz, 0);
  vector<ll> bucketAdd(bucket_sz, 0);
  auto update = [&](int s, int t, int x) {
    for(int i = 0; i < bucket_sz; ++i) {
      int l = i*sqrtN, r = (i+1)*sqrtN;
      if(r <= s || t <= l) continue;
      if(s <= l && r <= t) bucketAdd[i] += x;
      else {
	for(int j = max(s, l); j < min(t, r); ++j) {
	  a[j] += x;
	}
	ll sum = 0;
	for(int j = l; j < r; ++j) sum += a[j];
	bucketSum[i] = sum;
      }
    }
  };
  auto query = [&](int s, int t)->ll{
    ll res = 0;
    for(int i = 0; i < bucket_sz; ++i) {
      int l = i*sqrtN, r = (i+1)*sqrtN;
      if(r <= s || t <= l) continue;
      if(s <= l && r <= t) res += bucketSum[i]+bucketAdd[i]*sqrtN;
      else {
	for(int j = max(s, l); j < min(t, r); ++j) {
	  res += a[j]+bucketAdd[i];
	}
      }
    }
    return res;
  };
  while(q--) {
    ll c, s, t;
    cin >> c >> s >> t;
    if(c == 0) {
      ll x; cin >> x;
      update(s-1, t, x);
    } else {
      cout << query(s-1, t) << endl;
    }
  }

  return 0;
}



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

int main()
{
	int ans = 0, flag = 0;
	char n[4];

	cin >> n;

	for (int i = 0; i < 2; i++){
		flag = 1;
		for (int j = 0; j < 2; j++){
			if (n[j+i] != n[i+j + 1])
				flag = 0;
		}
		if (flag ==1)
			ans = 1;
	}

	if (ans == 1)
		cout << "Yes\n";
	else
		cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(){
    char s[4];

    scanf("%s", s);

    int cnt = 0;
    for(int i = 0; i < strlen(s); ++i){
        if(s[i] == 'R') cnt++;
    }

    if(s[0] == 'R' && s[1] == 'S' && s[2] == 'R') cnt = 1;

    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 1736
from time import time

t0 = time()

from random import randrange

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

N = 26

si = []
t = [max(range(26), key=lambda x: si[x]) for si in s]


while time() - t0 < 1.85:
    # init
    diff = 0

    di = randrange(D)
    qi = randrange(N)
    if t[di] == qi:
        continue

    # delete
    old_type = t[di]

    for next_d in range(di + 1, D):
        if t[next_d] == old_type:
            break
    else:
        next_d = D

    for prev_d in range(di - 1, -1, -1):
        if t[prev_d] == old_type:
            break
    else:
        prev_d = -1

    diff -= s[di][old_type]
    diff -= (next_d - di) * (di - prev_d) * c[old_type]

    # insert
    for next_d in range(di + 1, D):
        if t[next_d] == qi:
            break
    else:
        next_d = D

    for prev_d in range(di - 1, -1, -1):
        if t[prev_d] == qi:
            break
    else:
        prev_d = -1

    diff += s[di][qi]
    diff += (next_d - di) * (di - prev_d) * c[qi]

    # saiyou
    if diff >= 0:
        t[di] = qi

ans = [ti + 1 for ti in t]
print(*ans, sep="\n")

Measured memory_bytes: 84892
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
#include <math.h>
#include <queue>

using namespace std;

//???????????????2?????????????????????1???

int main(){

	int left_length,right_length,ans_length,left[150],left_X[150],right[150],right_X[150],sum_left[150],left_work_X[150],sum_right[150],right_work_X[150],loop;
	bool FirstFLG,ansFound;
	char buf[150];

	while(scanf("%s",buf)!=EOF){

		for(int i = 0; i < 150; i++){
			left[i] = 0;
			left_X[i] = 0;
			right[i] = 0;
			right_X[i] = 0;
		}

		for(left_length = 0;buf[left_length]!='+';left_length++);
		for(right_length = 0;buf[left_length+1+right_length] != '=';right_length++);
		for(ans_length = 0;buf[left_length+1+right_length+1+ans_length]!='\0';ans_length++);

		FirstFLG = false;

		for(int i = 0; i < left_length;i++){
			if(buf[i] >= '0' && buf[i] <= '9'){
				left[left_length-i-1] += (buf[i]-'0');
			}else{
				left_X[left_length-i-1]++;
				if(i == 0 && left_length > 1)FirstFLG = true;
			}
		}

		for(int i = 0; i < right_length;i++){
			if(buf[left_length+1+i] >= '0' && buf[left_length+1+i] <= '9'){
				left[right_length-1-i] += (buf[left_length+1+i]-'0');
			}else{
				left_X[right_length-1-i]++;
				if(i == 0 && right_length > 1)FirstFLG = true;
			}
		}

		for(int i = 0; i < ans_length; i++){
			if(buf[left_length+1+right_length+1+i] >= '0' && buf[left_length+1+right_length+1+i] <= '9'){
				right[ans_length-1-i] += (buf[left_length+1+right_length+1+i] -'0');
			}else{
				right_X[ans_length-1-i]++;
				if(i == 0 && ans_length > 1)FirstFLG = true;
			}
		}


		for(int i = 0; i <=130;i++){
			if(left[i] >= 10){
				left[i+1] += left[i]/10;
				left[i] %= 10;
			}
		}

		if(FirstFLG){
			loop = 1;
		}else{
			loop = 0;
		}

		ansFound = false;
		for(; loop <= 9; loop++){
			for(int i = 0; i < 150; i++){
				sum_left[i] = left_work_X[i] = sum_right[i] = right_work_X[i] = 0;
			}

			for(int i = 0; i <= 130;i++){
				if(left_X[i] > 0){
					left_work_X[i] += loop*left_X[i];

					if(left_work_X[i] >= 10){
						left_work_X[i+1] += left_work_X[i]/10;
						left_work_X[i] %= 10;
					}
				}
			}

			for(int i = 0; i <= 130;i++){
				sum_left[i] += left[i] + left_work_X[i];
				if(sum_left[i] >= 10){
					sum_left[i+1] += sum_left[i]/10;
					sum_left[i] %= 10;
				}
			}

			for(int i = 0; i <= 130; i++){
				if(right_X[i] > 0){
					right_work_X[i] += loop*right_X[i];

					if(right_work_X[i] >= 10){
						right_work_X[i+1] += right_work_X[i]/10;
						right_work_X[i] %= 10;
					}
				}
			}

			for(int i = 0; i <= 130; i++){
				sum_right[i] += right[i] + right_work_X[i];
				if(sum_right[i] >= 10){
					sum_right[i+1] += sum_right[i]/10;
					sum_right[i] %= 10;
				}
			}

			ansFound = true;

			for(int i = 0; i <= 130; i++){
				if(sum_left[i] != sum_right[i]){
					ansFound = false;
					break;
				}
			}

			if(ansFound){
				printf("%d\n",loop);
				break;
			}

		}
		if(!ansFound)printf("NA\n");

	}


    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
  ll H; cin >> H;
  ll W; cin >> W;
  vector<ll> P(H*W*2);
  vector<vector<ll> > X(H, vector<ll>(W));
  vector<vector<ll> > Y(H, vector<ll>(W));
  vector<string> S(H);
  for (ll j=0; j < H; ++j) cin >> S[j];
  ll iter = 0;
  for (ll j=0; j < W; ++j) {
    for (ll k=0; k < H; ++k) {
      if (S[k][j] == '#') {
        iter += 1;
      } else {
        P[iter] += 1;
        Y[k][j] = iter;
      }
    }
    iter += 1;
  }
  iter += 1;
  for (ll j=0; j < H; ++j) {
    for (ll k=0; k < W; ++k) {
      if (S[j][k] == '#') {
        iter += 1;
      } else {
        P[iter] += 1;
        X[j][k] = iter;
      }
    }
    iter += 1;
  }

  ll ans = 0;
  for (ll j=0; j < H; ++j) {
    for (ll k=0; k < W; ++k) {
      ans = max(ans, P[X[j][k]]+P[Y[j][k]]-1);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 129536
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1<<30;
typedef long double ld;
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 dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
vector<set<int> > pls;
map<string,int> ma,num;
int n;
void dfs(string s, char mx){
  if(s.size()==n){
    cout << s << endl;
    return;
  }
  for(char c='a' ; c<=mx+1 ; c++){
    dfs(s+c, max(c, mx));
  }
}
int main(){
  cin >> n;
  dfs("", 'a'-1);
  return 0;
}


Measured memory_bytes: 1536
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DBannedK {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> a(N);
        REP(i, N) cin >> a[i];
        map<int, int> cnt;
        REP(i, N) {
            cnt[a[i]]++;
        }

        int res = 0;
        for (auto kv : cnt) {
            int num = kv.second;
            if (num < 2) continue;
            res += num * (num - 1) / 2;
        }

        REP(i, N) {
            int n = a[i];
            int tmp = res;
            int num = cnt[n];
            tmp -= num * (num - 1) / 2;
            tmp += (num - 1) * (num - 2) / 2;
            cout << tmp << endl;
        }
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DBannedK solver;
    solver.solve(in, out);
    return 0;
}


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

using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define all(vec) vec.begin(),vec.end()
#define ff first
#define ss second
#define inf 4e18
#define MOD 1000000007
#define pb push_back
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for2(low,high,k) for(int j=low;j<high;j+=k)
#define rev(high,low,k) for(int i=high;i>=low;i-=k) 

int main(){
	fast;
	lli k;
	cin>>k;
	string s;
	cin>>s;
	if (s.size()<=k) cout<<s<<endl;
	else{
		for (int i=0;i<s.size();i++){
			if (i<k) cout<<s[i];
			else break;
		}
		cout<<"..."<<endl;
	}
}

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

using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;
const int oo = 1e9;


int n;
const int nx = 1e5+5;
int ac[nx][3];
int dp[3][nx];
int go(int a, int i){
	if(i == n) return 0;
	if(dp[a][i] != -1) return dp[a][i];
	int& ans = dp[a][i];
	
	if(a==0){
		ans=max(ans, go(1, i+1)+ac[i][0]);
		ans=max(ans, go(2, i+1)+ac[i][0]);
	}
	if(a==1){
		ans=max(ans, go(0, i+1)+ac[i][1]);
		ans=max(ans, go(2, i+1)+ac[i][1]);
	}
	if(a==2){
		ans=max(ans, go(0, i+1)+ac[i][2]);
		ans=max(ans, go(1, i+1)+ac[i][2]);
	}
	
	return ans;
}
int main(){
	cin>>n;
	for(int i=0; i<n; i++) cin>>ac[i][0]>>ac[i][1]>>ac[i][2];
	memset(dp, -1, sizeof dp);
	cout<<max(go(0,0),max(go(1,0),go(2,0)))<<"\n";
	return 0;
}

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

ll GCD(ll a, ll b) {
    if(a < b) {
        swap(a, b);
    }
    if(a % b == 0) {
        return b;
    } else {
        return GCD(b, a % b);
    }
}

int main() {
    ll A, B;
    cin >> A >> B;

    ll gcd = GCD(A, B);

    int ans = 1;
    ll max_num = gcd;
    for(ll i = 2; i * i <= max_num; i++) {
        if(gcd % i == 0) {
            while(gcd % i == 0) {
                gcd /= i;
            }
            ans++;
        }
    }
    if(gcd != 1) {
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    ll N, W; cin >> N >> W;
    vector<ll> w0, w1, w2, w3;
    ll sample; cin >> sample;
    ll v; cin >> v;
    w0.push_back(v);

    for(int i=0; i<N-1; i++){
        ll w, v; cin >> w >> v;
        if(w == sample) w0.push_back(v);
        else if(w == sample+1) w1.push_back(v);
        else if(w == sample+2) w2.push_back(v);
        else w3.push_back(v);
    }

    sort(w0.begin(), w0.end(), greater<ll>());
    sort(w1.begin(), w1.end(), greater<ll>());
    sort(w2.begin(), w2.end(), greater<ll>());
    sort(w3.begin(), w3.end(), greater<ll>());

    ll ans = 0;
    for(int i=0; i<=w0.size(); i++){
        for(int j=0; j<=w1.size(); j++){
            for(int k=0; k<=w2.size(); k++){
                for(int l=0; l<=w3.size(); l++){

                    if(i*sample + j*(sample+1) + k*(sample+2) + l*(sample+3) <= W){
                        ll tmp = 0;
                        for(int a=0; a<i; a++) tmp += w0[a];
                        for(int a=0; a<j; a++) tmp += w1[a];
                        for(int a=0; a<k; a++) tmp += w2[a];
                        for(int a=0; a<l; a++) tmp += w3[a];

                        ans = max(ans, tmp);
                    }
                }
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

double a[200010],sum[200010];
 
int main(void){
    ll n,k;
    cin>>n>>k;
    vector<ll>p(n);
    for(ll i=0;i<n;i++){
        cin>>p[i];
    }
    for(ll i=0;i<n;i++){
        a[i] = (double)(p[i]+1)/2;
    }
    sum[0]=0.0;
    for(ll i=0;i<n;i++){
        sum[i+1]=sum[i]+a[i];
    }
    double ans = 0.0;
    for(ll i=0;i<=n-k;i++){
        ans = max(ans,sum[i+k]-sum[i]);
    }
    printf("%.12lf",ans);
    cout<<endl;
	return 0; 
}

Measured memory_bytes: 4992
#include <iostream>
using namespace std;
bool m[10];
int n;
int main()
{
    for (int i = 0; i < 4; i++)
    {
        cin >> n;
        m[n] = true;
    }
    if ((m[1])&&(m[9])&&(m[7])&&(m[4]))
    {
        cout << "YES";
    }
    else cout << "NO";
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <unordered_map>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  int n, m, sum = 0;
  cin >> n >> m;

  if (n >= 2)
  {
    sum += n * (n - 1) / 2;
  }
  if (m >= 2)
  {
    sum += m * (m - 1) / 2;
  }

  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void view(int a[], int n){
	int i;
	for(i=0;i<n-1;i++) printf("%d ",a[i]);
	printf("%d\n",a[n-1]);
}

void insertionSort(int a[], int n){
	int i,j,v;
	view(a,n);
	for(i=1;i<n;i++){
		v = a[i];
		j = i-1;
		while(j>=0 && a[j]>v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		view(a,n);
	}
	
}

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

	scanf("%d\n",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	insertionSort(a,n);

	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<numeric>
#include<cmath>
#include<stdio.h>

using std::cout;
using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;
using std::sin;

#define INF 999999999
#define MOD 1000000007
#define PI 3.141592653589793

using ulli = unsigned long long int;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N;
ulli h[100001];
ulli tbl[100001];

int main(){
	cin.tie(0);
	std::ios::sync_with_stdio(false);
    
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> h[i];
    }
    tbl[0] = 0;
    tbl[1] = abs(h[1]-h[0]);
    for(int i=2; i < N; i++){
        tbl[i] = min(tbl[i-2] + abs(h[i-2]-h[i]), 
            tbl[i-1] + abs(h[i-1]-h[i]));
    }
    cout << tbl[N-1] << '\n';
    return 0;
}


Measured memory_bytes: 1792
s = input()
s_list = ['SUN','MON','TUE','WED','THU','FRI','SAT']
if s == s_list[0]:
  print(7)
elif s == s_list[1]:
  print(6)
elif s == s_list[2]:
  print(5)
elif s == s_list[3]:
  print(4)
elif s == s_list[4]:
  print(3)
elif s == s_list[5]:
  print(2)
else:
  print(1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int(i) = 0; (i) < (n); (i)++)
int gcd2(int a, int b){
  int ans = 1;
  for(int i = a; i > 1; i--){
    if (a % i == 0 && b % i == 0){
        ans = i;
        break;
    }
  }
  return ans;
}
int gcd(int a, int b, int c){
  int ans = 1;
  for(int i = a; i > 1; i--){
    if (a % i == 0 && b % i == 0 && c % i == 0){
        ans = i;
        break;
    }
  }
  return ans;
}

int main(){
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++){
    for (int j = i; j < N; j++){
      for(int k = j; k < N; k++){
        if (i == j && j == k){
          ans += i + 1;
        }else if(i == j){
          ans += 3 * gcd2(i+1, k+1);
        }else if (j == k){
          ans += 3 * gcd2(i+1, j+1);
        }else if (i == k){
          ans += 3 * gcd2(j+1, k+1);
        }else{
          ans += 6 * gcd(i+1, j+1, k+1);
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main()
{
	int n , h , m ,s;
	scanf( "%d" , &n);
	h = n / 3600;
	m = (n - h * 3600) / 60;
	s = n - (h * 3600) - (m * 60);
	printf("%d:%d:%d\n", h , m ,s);
	
	
	return 0;
} 


Measured memory_bytes: 2756
def solve():
    from sys import stdin
    f_i = stdin
    
    D, N = map(int, f_i.readline().split())
    T = tuple(int(f_i.readline()) for i in range(D))
    
    clothes = [tuple(map(int, f_i.readline().split())) for i in range(N)]
    clothes.sort(key=lambda x: x[2])
    
    candidate = []
    for t in T:
        ct = tuple(filter(lambda x: x[0] <= t <= x[1], clothes))
        c_min = ct[0][2]
        c_max = ct[-1][2]
        if c_min == c_max:
            candidate.append((c_min,))
        else:
            candidate.append((c_min, c_max))
    
    dp = [0] * len(candidate[0])
    for c1, c2 in zip(candidate, candidate[1:]):
        dp = [max(rec + abs(ci - cj) for rec, ci in zip(dp, c1)) for cj in c2]
    
    print(max(dp))
    
solve()


Measured memory_bytes: 5620
#include <stdio.h>
#include <stdlib.h>
const int N = 1e6+10;
typedef long long LL;
const LL mod = 1e9+7;
LL a[N];

int main()
{

    a[1]=1;
    for(int i=2;i<N-1;i++) a[i]=a[i-1]*i%mod;
    int x;
    scanf("%d", &x);
    printf("%lld\n",a[x]);
    return 0;
}


Measured memory_bytes: 7936
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

using ll=long long;

int main() {
  int H,W,N; cin >>H >>W >>N;
  int ans=ceil(N/float(max(H,W)));
  cout <<ans <<endl;
  return 0;
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; ++i) {
		cin >> d[i];
	}
	sort(d.begin(), d.end());
	int ans = d[n / 2] - d[n / 2 - 1];
	cout << ans << '\n';	
	
	return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	while (1) {

		vector<long long int>ls(3);
		cin >> ls[0] >> ls[1] >> ls[2];
		sort(ls.begin(), ls.end());
		long long int r = (ls[0] * ls[0] + ls[1] * ls[1]);
		if (!ls[0])break;
		long long int d; cin >> d;
		while (d--) {
			long long int n; cin >> n;
			if (4*n*n>r)cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A(M);
    REP(i, M) cin >> A[i];

    int a = 0, b = 0;
    REP(i, M){
        if (A[i] < X) a++;
        else b++;
    }

    cout << min(a, b) << endl;

    return 0;
}


Measured memory_bytes: 256
import unittest
import fractions


def solution(n, a):
    gcd_left = [0]
    gcd_right = [0]
    for i in range(n):
        gcd_left.append(fractions.gcd(gcd_left[i], a[i]))
        # 順に(0とa[-1]), (a[-1]とa[-2]),...の比較
        # 要は右端から順にgcdを求めている
        gcd_right.append(fractions.gcd(gcd_right[i], a[-(i + 1)]))

    gcd_right = gcd_right[::-1]  # gcd_right[i]がi番目以降のgcdとなるように反転

    ans = []
    for i in range(n):
        ans.append(fractions.gcd(gcd_left[i], gcd_right[i + 1]))


    return max(ans)


class MyTestCase(unittest.TestCase):
    def test1(self):
        self.assertEqual(solution(3, [7, 6, 8]), 2)

    def test2(self):
        self.assertEqual(solution(3, [12, 15, 18]), 6)

    def test3(self):
        self.assertEqual(solution(2, [1000000000, 1000000000]), 1000000000)




if __name__ == '__main__':

    n = int(input())
    a = list(map(int, input().split()))
    print(solution(n, a))

    unittest.main()

Measured memory_bytes: 17556
X,Y,Z,K=gets.chomp.split.map(&:to_i)
a=gets.chomp.split.map(&:to_i)
b=gets.chomp.split.map(&:to_i)
c=gets.chomp.split.map(&:to_i)

ab = []
a.each_with_index do |m, i|
  next if i >= K
  b.each_with_index do |n, j|
    next if j >= K
    ab << m+n
  end
end

ab.sort!.reverse!

abc = []
ab.each_with_index do |m, i|
  next if i >= K
  c.each_with_index do |n, j|
    next if j >= K
    abc << m+n
  end
end

abc.sort!.reverse!

0.upto(K-1) do |i|
  puts abc[i]
end

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define fff ff
#define sss ss.ff
#define ttt ss.ss
#define INF (1 << 30)
#define LLF (1ll << 60)
#define PRIME (1000000007)
#define FASTIO std::ios::sync_with_stdio(false)
#ifdef DEBUG
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define FILE_INPUT                  \
  freopen("input.txt", "r", stdin); \
  freopen("output.txt", "w", stdout)

#define all(x) x.begin(), x.end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ii> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<string> vs;

/*-----------------END TEMPLATE-----------------*/

int main() {
  FASTIO;
  ll m, d;
  cin >> m >> d;
  ll ans = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= d; j++) {
      if (j < 10) continue;

      ll d1 = j % 10;
      ll d2 = (j / 10) % 10;
      if (d1 >= 2 && d2 >= 2 && d1 * d2 == i) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
//using ll=long long;

int main(){
    string n;
    cin >> n;
    string one, ten, hundred;
    if(n[2] == '9') one = '1';
    else one = '9';
    if(n[1] == '9') ten = '1';
    else ten = '9';
    if(n[0] == '9') hundred = '1';
    else hundred = '9';
    string res = hundred + ten + one;
    cout << res << endl;
    
    return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if (a >= 13) cout << b << endl;
    else if (a >= 6) cout << b / 2 << endl;
    else cout << 0 << endl;
}

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

using ll = long long;
using namespace std;
const int MOD = 1e9 + 7;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll n;
	cin >> n;
	vector< vector<int> > v((n + 1), vector<int>(n + 1));
	vector<int> dp(1 << n), bit(1 << n);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >>  v[i][j];
		}
	}
	dp[0] = 1;
	for (int i = 0; i < (1 << n); i++) {
		bit[i] = bit[i / 2] + (i & 1);
		for (int j = 0; j < n; j++) {
			if (i & (1 << j))	dp[i] +=  dp[i ^ (1 << j)] * v[bit[i]][j + 1];
			if (dp[i] >= MOD) dp[i] -= MOD;
		}
	}
	cout << dp[(1 << n) - 1] << '\n';
	return 0;
}


Measured memory_bytes: 19536
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >>N;
    vector<long long>vec(N);
    long long left=0;
    long long right=0;
    for(int i=0;i<N;i++){
        cin>>vec.at(i);
        left+=vec.at(i);
    }
    long long minn=999999999999999999;
    for(int i=N-1;i>=0;i--){
        left-=vec.at(i);
        right+=vec.at(i);
     long long zettai=abs(left-right);
         minn=min(minn,zettai);
    }
    cout <<minn<<endl;
}

Measured memory_bytes: 4824
A,B,C,X = int(input()),int(input()),int(input()),int(input())
ans = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                ans += 1

print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

//????????????????????£??????
//AOJ??????CE??§???????????????


int timer,root,numV,numE,parent[100001],lowest[100001],prenum[100001],ans[100001]={},rootChild=0;
bool visited[100001];
std::vector<std::vector<int> > G(100001);

void dfs(int u,int prev){
    // ????????? u ????¨????????????´????????????
    prenum[u] = timer;
    lowest[u] = timer;
    timer++;

    visited[u] = true;

    rep(i,G[u].size()){
    	int v = G[u][i];
        if(!visited[v]){
        	if(prev==-1)rootChild++;
        	// ????????? u ??????????????? v ????¨????????????´????????????
            parent[v] = u;
            dfs( v, u );
            // ????????? v ?????¢?´¢?????????????????´????????????
            lowest[u] = min( lowest[u], lowest[v] );
        }else if(v != prev){
			// ??¨?????? u --> v ??? Back-edge ?????´????????????
            lowest[u] = min( lowest[u], prenum[v] );
        }
    }
    // ????????? u ?????¢?´¢?????????????????´????????????
}

void depthFirstSearchScheme(void){
	rep(i,numV){
		visited[i] = false;
	}
	root = 0;
	timer = 1;
	// lowest ????¨????
	dfs( root, -1 );
}

int main(void){
	cin>>numV>>numE;
	int s,t;
	rep(i,numE){
		cin>>s>>t;
		G[s].push_back(t);
		G[t].push_back(s);
	}
	depthFirstSearchScheme();
	if(rootChild>=2)ans[root]=1;//root????????\??????
	reg(i,1,numV-1){
		if(prenum[parent[i]]<=lowest[i] && parent[i]!=root)ans[parent[i]]=1;//root????????\??????
	}
	rep(i,numV){
		if(ans[i]==1)cout<<i<<endl;
	}

	return 0;
}

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

using namespace std;

int main(void) {
  int h, w;
  cin >> h >> w;

  vector<string> s(h);
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }

  int dp[110][110];
  fill(dp[0], dp[110], -1);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == 'c') {
        dp[i][j] = 0;
      } else if (j > 0) {
        dp[i][j] = dp[i][j - 1] < 0 ? -1 : dp[i][j - 1] + 1;
      }
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (j) cout << " ";
      cout << dp[i][j];
    }
    cout << endl;
  }

  return 0;
}


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

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

	if (a + b > 23) cout << (a + b) - 24 << endl;
	else cout << a + b << endl;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    if(a*c <= b){
        System.out.println(c);
    }else{
        System.out.println(b / a);
    }




    







}
}

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

int main(){
string O,E;
  cin>>O>>E;
  
  string ans;
  for(int i=0; i<min(O.size(), E.size()); i++){
   ans.push_back(O[i]);
   ans.push_back(E[i]); 
  }
  if(O.size()>E.size()){ans.push_back(O[O.size()-1]);}
  else if(O.size()<E.size()){ans.push_back(E[E.size()-1]);}
  
  cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll MOD = (ll)pow(10, 9) + 7;

int main(){
  ll N;
  cin >> N;
  vl A(N);
  rep(i, N) cin >> A[i];

  ll val;
  vl one(61, 0);
  rep(i, N){
    val = 1;

    rep(j, 61){
      if(val > A[i]) break;
      
      if((A[i] & val) > 0) one[j]++;
      
      val <<= 1;
    }
  }

  val = 1;
  ll ans = 0;

  rep(i, 61){
    ll cz = N - one[i];
    ans += (val % MOD) * (one[i] * cz % MOD) % MOD;
    ans %= MOD;
    val <<= 1;
  }

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


Measured memory_bytes: 2560
sx, sy, tx, ty = map(int,input().split())

xd = tx - sx
yd = ty - sy

route1 = []
route1.append('R'*xd)
route1.append('U'*yd)

route2 = []
route2.append('L'*xd)
route2.append('D'*yd)

route3 = ['D']
route3.append('R' * (xd + 1))
route3.append('U' * (yd + 1))
route3.append('L')

route4 = ['U']
route4.append('L'*(xd+1))
route4.append('D'*(yd+1))
route4.append('R')

ans = ''.join(route1) + ''.join(route2) + ''.join(route3) + ''.join(route4)
print(ans)




Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define YN(a, b, c) ((c)? a : b)
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) (i64)(a / (f64)__gcd(a, b) * b) /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 N;
    string S;
    cin >> N >> S;
    Vec<i32> E(N + 1, 0);
    Vec<i32> W(N + 1, 0);
    for (i32 i = 1; i <= N; i++) {
        if (S[i - 1] == 'E') E[i] += 1;
        else if (S[i - 1] == 'W') W[i] += 1;
        E[i] += E[i - 1];
        W[i] += W[i - 1];
    }
    Vec<i32> ans(N + 1, 0);
    for (i32 i = 1; i <= N; i++) {
        i32 left = 0, right = 0;
        if (i != 1) left = W[i - 1];
        if (i != N) right = E[N] - E[i];
        ans[i] = left + right;
    }
    i32 m = 300001;
    for (i32 i = 1; i <= N; i++) {
        m = min(m, ans[i]);
    }
    cout << m << endl;
}


Measured memory_bytes: 7168
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;

int main(){
    string S; cin >> S;

    vector<ll> dp(13, 0);
    dp[0] = 1;
    int mul = 1;

    for (int i = S.size()-1; i >= 0; i--){
        vector<ll> nextdp(13, 0);
        
        if (S[i] == '?'){
            for (int k = 0; k < 10; k++){
                for (int j = 0; j < 13; j++){
                    nextdp[(k*mul+j)%13] += dp[j];
                    nextdp[(k*mul+j)%13] %= MOD;
                }
            }
        }
        else{
            int k = (int)(S[i] - '0');
            for (int j = 0; j < 13; j++){
                nextdp[(k*mul+j)%13] += dp[j];
                nextdp[(k*mul+j)%13] %= MOD;
            }
        }

        mul *= 10;
        mul %= 13;
        dp = nextdp;
    }


    cout << dp[5] << endl;    
}

Measured memory_bytes: 512
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        mut s: chars,
    }
    s.sort();

    let ans = s.len() == 4 && s[0] == s[1] && s[2] == s[3] && s[0] != s[2];

    println!("{}", if ans {"Yes"} else {"No"});
}


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

using LL = long long;
const int maxn = 33;
LL digit[maxn], dp[maxn][maxn][maxn][maxn];
LL x;

LL dfs(int l, int f, int t, int s, int z, int flag) {
  if(l == 0) {
    if(f >= 1 && t >= 1 && s >= 1) return dp[l][f][t][s] = 1;
    else return dp[l][f][t][s] = 0;
  }
  if(!flag && ~dp[l][f][t][s]) return dp[l][f][t][s];
  int pos = flag ? digit[l] : 7;
  LL ret = 0;
  if(z) ret += dfs(l-1, f, t, s, 1, flag&&(0==pos));
  if(5 <= pos) ret += dfs(l-1, f+1, t, s, 0, flag&&(5==pos));
  if(3 <= pos) ret += dfs(l-1, f, t+1, s, 0, flag&&(3==pos));
  if(7 <= pos) ret += dfs(l-1, f, t, s+1, 0, flag&&(7==pos));
  if(!flag) dp[l][f][t][s] = ret;
  return ret;
}

LL f(LL x) {
  int pos = 0;
  int f = 0, t = 0, s = 0;
  while(x) {
    digit[++pos] = x % 10;
    x /= 10;
  }
  return dfs(pos, 0, 0, 0, 1, 1);
}


signed main() {
  // freopen("in", "r", stdin);
  memset(dp, -1, sizeof dp);
  while(~scanf("%lld", &x)) {
    printf("%lld\n", f(x));
  }
  return 0;
}

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

int main(){
	int N; cin>>N;
	vector<double> x(N);
	vector<string> u(N);
	double num=0;
	for(int i=0;i<N;i++){
		cin>>x[i]>>u[i];
	}
	for(int i=0;i<N;i++){
		if(u[i]=="JPY"){
			num+=x[i];
		}
		else{
			num+=x[i]*380000.0;
		}
	}

	cout<<num<<endl;

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
ll n,d,a;
cin>>n>>d>>a;
V<ll> x(n),h(n);
V<P> dd(n);
for(int i=0;i<n;i++){
    cin>>x[i]>>h[i];
    dd[i].fi=x[i];dd[i].se=h[i];
}
ll ans=0,now=0;
V<ll> t(n+3,0);
sort(all(x));
sort(all(dd));
for(int i=0;i<n;i++){
    now-=t[i];
    if(t[i]<0)exit(1);
    if(now<0)exit(1);
    if(dd[i].se-now<=0)continue;
    int it=lower_bound(all(x),x[i]+2*d)-x.begin();
    ans+=(dd[i].se-now+a-1)/a;
    t[it+(it<n&&x[it]==x[i]+2*d)]+=(dd[i].se-now+a-1)/a*a;
    now+=(dd[i].se-now+a-1)/a*a;
}
cout<<ans<<endl;
}


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

using namespace std;

int n,l,dp[100005],a[100005];

int func(int i){

  if(i>n)return 0;
  if(dp[i]>0)return dp[i];

  int res=0;
  if(a[i]<a[i-1])res=max(res,func(i-1));
  if(a[i]<a[i+1])res=max(res,func(i+1));

  return dp[i]=l-a[i]+res;
}

int main(void){
  
  while(cin >> n >> l){
    
    for(int i=0;i<n+2;i++)dp[i]=0;

    for(int i=1;i<n+1;i++)
      cin >> a[i];

    a[0]=a[n+1]=0;

    int res=0;
    for(int i=1;i<n+1;i++)
      res=max(res,func(i));

    cout << res << endl;
  }
  
  return 0;
}

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

int main() {
    ios::sync_with_stdio(0);
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0; i < n; ++i) cin >> h[i];
    sort(begin(h), end(h));
    int diff = 1e9 + 1;
    for(int i = 0, j = k - 1; j < n; ++j, ++i) {
        if(h[j] - h[i] < diff) diff = h[j] - h[i];
    }
    cout << diff << endl;
}

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

#ifdef LOCAL_DEBUG
    #include "/home/laxsuryavanshi/Desktop/cp/trace.hpp"
#else
    #define trace(...)
#endif // LOCAL_DEBUG

void solve_test();

int32_t main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0); std::cout.tie(0);
    #ifdef LOCAL_INPUT
    freopen("in", "r", stdin);
    #endif
    string s; cin>>s;
    int ans=0, len=0;
    for (int i=0; i<(int)s.length(); i++) {
        if (s[i] == 'R') len++;
        else {
            ans=max(ans, len);
            len=0;
        }
    }
    ans=max(ans,len);
    cout<<ans<<'\n';
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    int n;string s;int ans=0;
    cin>>n>>s;
    rep(i,n+1){
        string l=s.substr(0,i);
        string r=s.substr(i,n-i);
        int abcl[27]={},abcr[27]={},tmp=0;
        rep(i,l.size()){
            abcl[(l[i]-'a')]++;
        }
        rep(i,r.size()){
            abcr[(r[i]-'a')]++;
        }
        rep(i,27){
            if(abcr[i]>0&&abcl[i]>0)    tmp++;
        }
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 764
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Scanner;

public class Main {
	public static final Scanner sc = new Scanner(System.in);
	public static final int Max = 1 << 15;
	public static final BitSet isPrime = new BitSet(Max);
	public static final ArrayList<Integer> primes = new ArrayList<Integer>();

	public static void main(String[] args) {
		// init
		isPrime.set(2, Max);
		for (int i = 2; i < Max; i++) {
			if (!isPrime.get(i)) continue;
			if (i * 2 > Max) break;
			primes.add(i);
			for (int j = i * i; j < Max; j += i) {
				isPrime.clear(j);
			}
		}

		// main
		while (true) {
			final int in = sc.nextInt();
			if (in == 0) break;

			int ans = 0;
			for (Integer p : primes) {
				if (p > in / 2) break;
				final int re = in - p;
				if (isPrime.get(re)) ans++;
			}
			System.out.println(ans);
		}
	}
}

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

const int mod = 1e9 + 7;
int n, k;
vector<ll> ps, ng;
bool z;
ll ans = 1;

void nonPositive() {
	if (z) {
		cout << 0 << endl;
	} else {
		ans = -1;
		vector<ll> abs;
		for (ll i : ps)
			abs.push_back(i);
		for (ll i : ng)
			abs.push_back(i);
		sort(abs.begin(), abs.end());
		for (int i = 0; i < k; ++i)
			ans = ans * abs[i] % mod;
		if (ans < 0)
			ans += mod;
		cout << ans << endl;
	}
}

int main() {
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		if (a > 0)
			ps.push_back(a);
		else if (a < 0)
			ng.push_back(-a);
		else
			z = 1;
	}

	sort(ps.begin(), ps.end(), greater<ll>());
	sort(ng.begin(), ng.end(), greater<ll>());

	vector<ll> p;
	if ((k & 1) && !ps.size()) {
		nonPositive();
		return 0;
	}

	if (k & 1)
		ans = ps[0];
	for (int i = 0; i < ps.size() / 2; ++i)
		p.push_back(ps[2 * i + (k & 1)] * ps[2 * i + 1 + (k & 1)]);

	for (int i = 0; i < ng.size() / 2; ++i)
		p.push_back(ng[2 * i] * ng[2 * i + 1]);
	if (k / 2 > p.size()) {
		nonPositive();
		return 0;
	}

	sort(p.begin(), p.end(), greater<ll>());
	for (int i = 0; i < k / 2; ++i)
		ans = ans * (p[i] % mod) % mod;
	cout << ans << endl;
}


Measured memory_bytes: 7576
import numpy as P
M=10**9+7
n,k=map(int,input().split())
a=P.matrix([list(map(int,input().split()))for i in[0]*n],dtype='O')
b=P.eye(n,dtype='O')
while k:
 if k&1:b=b*a%M
 a=a*a%M
 k>>=1
print(b.sum()%M)

Measured memory_bytes: 12508
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  string s;cin>>s;
  lint res=1;
  lint l=0;lint r=0;
  vector<int> memo(2*n,0);
  rep(i,2*n){
      if((l-r+(int)(s[i]=='W'))%2==1){
          ++r;
          memo[i]=0;
      }
      else{
          ++l;
          memo[i]=1;
      }
      if(l<r)res=0;
  }
  lint l_num=0;
  rep(i,2*n){
      //cout<<memo[i];
      if(memo[i]==1)++l_num;
      else{
          res*=l_num;res%=MOD;
          --l_num;
      }
  }
  if(l_num!=0)res=0;
  rep1(i,n){
      res*=i;res%=MOD;
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 4408
/*
 * じょえチャンネル
 * 高評価・チャンネル登録よろしくおねがいします！
 * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
 */
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define inf (int)(3e18)
#define P pair<int,int>
#define mod (int)(1e9+7)
template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}

int N,Q;
string S;
set<int>st[26];
signed main(){
	cin>>N>>S>>Q;
	rep(i,N){
		st[S[i]-'a'].insert(i);
	}
	while(Q--){
		int type;cin>>type;
		if(type==1){
			int i;char j;cin>>i>>j;i--;
			st[S[i]-'a'].erase(i);
			st[j-'a'].insert(i);
			S[i]=j;
		}else {
			int l,r;cin>>l>>r;l--;r--;
			int cnt=0;
			rep(i,26){
				auto it=st[i].lower_bound(l);
				if(it!=st[i].end()){
					if(*it<=r)cnt++;
				}
			}
			cout<<cnt<<endl;
		}
	}
}


Measured memory_bytes: 24196
x = []

while True:
    x = input().split()
    if x[1] == "?":
        break 
    elif x[1] == "+":
        print(int(x[0]) + int(x[2]))
    elif x[1] == "-":
        print(int(x[0]) - int(x[2]))
    elif x[1] == "*":
        print(int(x[0]) * int(x[2]))
    elif x[1] == "/":
        print(int(x[0]) // int(x[2]))

Measured memory_bytes: 7732