akhauriyash/Code-Regression huggingface dataset:
// Template
#include <bits/stdc++.h>
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, r) for (int i = (l); i < (r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T& x, const T& y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T& x, const T& y) {if (x < y) {x = y; return 1;} return 0;}
struct IOSET {IOSET() {cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10);}} ioset;

constexpr int D = 365;
int c[26], d[D][26], t[D];

void input() {
    cin >> c[0];
    rep(i, 26) cin >> c[i];
    rep(i, D) rep(j, 26) cin >> d[i][j];
}
void output() {
    rep(i, D) cout << t[i] + 1 << "\n";
}

// day 日目までのスコアを求める
int score(int day) {
    int ans = 0;
    int last[26];
    rep(i, 26) last[i] = -1;
    rep(i, day + 1) {
        ans += d[i][t[i]];
        last[t[i]] = i;
        rep(j, 26) ans -= c[j] * (i - last[j]);
    }
    return ans;
}

int main() {
    input();
    
    // 貪欲
    rep(i, D) {
        int max_score = -inf, max_id = -1;
        rep(j, 26) {
            t[i] = j;
            if (chmax(max_score, score(i))) max_id = j;
        }
        t[i] = max_id;
    }
    
    output();
}


Measured memory_bytes: 3656
#include<iostream>
using namespace std;
int main(){
	int X,Y,sum;
	cin>>X>>Y;
	if(X==1)sum+=300000;
	else if(X==2)sum+=200000;
	else if(X==3)sum+=100000;
	if(Y==1)sum+=300000;
	else if(Y==2)sum+=200000;
	else if(Y==3)sum+=100000;
	if(X==Y&&X==1)sum+=400000;
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
w = [input() for i in range(n)]

if len(w) != len(set(w)):
    print("No")
    exit()

h, b = [], []
for i in range(n):
    if i != 0:
        h.append(w[i][0])
    if i != n-1:
        b.append(w[i][-1])

for i, j in zip(h, b):
    if i != j:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3064
import java.util.*;

public class Main {


    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());
        int[][] targetMap;
        int prevValue = 0;
        int max = Integer.MIN_VALUE;
        int ans = 0;

        targetMap = new int[4][N+2];

        String[] line = sc.nextLine().split(" ");

        for(int i = 0; i < N;i++){
            targetMap[1][i+1] = Integer.parseInt(line[i]);
        }

        line = sc.nextLine().split(" ");

        for(int i = 0; i < N;i++){
            targetMap[2][i+1] = Integer.parseInt(line[i]);
        }
        
        int indexX = 1;
        while(indexX <= N){

            for(int x = 1;x <= indexX;x++){
                ans += targetMap[1][x];
            }

            for(int nextX = indexX;nextX <= N;nextX++){
                ans += targetMap[2][nextX];
            }

            if (ans > max){
                max = ans;
            }

            ans = 0;
            indexX++;
        }

        System.out.println(max);
    }

 }


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

typedef long long ll;

ll N, t = 5, i = 1, ans = 0;
int main() {
    cin >> N;
    if(N % 2 == 1) {
        cout << 0;
        return 0;
    }
    N /= 2;
    while(t <= N) {
        ll d = N / t;
        d -= d / 5;
        ans += d * i;
        i++;
        t *= 5;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8
import math
#N, M = map(int,input().split())
N = int(input())
#K = int(input())
#S = input()
ans = 0
flg = True
#l = list(map(int,input().split()))
#A = list(map(int,input().split()))
for i in range(N//4+1):
    amari = N - 4*i
    if amari%7 == 0:
        print("Yes")
        flg = False
        break
if flg:
    print("No")

Measured memory_bytes: 9076
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
const int mm=1e6;
ll d[mm];
ll mod=1e9+7;
int main()
{
	int n,i;
	cin>>n;
	for(i=0;i<n;i++)
	cin>>d[i];
	sort(d,d+n);
	int s=0;
	for(i=0;i<n-1;i++)
	{
		if(d[i]==d[i+1])
		s=1;
	 } 
	 if(s)
	 printf("NO\n");
	 else
	 printf("YES\n");
   
   
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


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

  ll a, b, h;
  cin >> a >> b >> h;

  cout << (a+b)*h/2 << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define all(x) (x).begin(), (x).end()
#define li long long
#define itn int
 
using namespace std;
 
inline int nxt(){
	int n;
	scanf("%d", &n);
	return n;
}

void panic() {
	puts("0");
	exit(0);
}

int main(){

	int n = nxt();
	vector<int> a(n), b(n), h(n);
	for (int i = 0; i < n; i++) {
		a[i] = nxt();
	}
	for (int i = 0; i < n; i++) {
		b[i] = nxt();
	}

	for (int i = 0; i < n; i++) {
		if (i > 0 && a[i] < a[i - 1]) {
			panic();
		}
		if (i == 0 || a[i] != a[i - 1]) {
			h[i] = a[i];
		}
	}

	// cerr << "q";

	for (int i = n - 1; i >= 0; i--) {
		if (i < n - 1 && b[i] < b[i + 1]) {
			panic();
		}
		if (i == n - 1 || b[i] != b[i + 1]) {
			if (h[i] && h[i] != b[i]) {
				panic();
			} else {
				h[i] = b[i];
			}
		}
	}

	// cerr << "w";

	int mx = 0;
	for (int i = 0; i < n; i++) {
		mx = max(mx, h[i]);
		if (mx != a[i]) {
			panic();
		}
	}

	// cerr << "e";

	mx = 0;
	for (int i = n - 1; i >= 0; i--) {
		mx = max(mx, h[i]);
		if (mx != b[i]) {
			panic();
		}
	}

	// cerr << "r";

	int l = 0;
	for (int i = 0; i < n; i++) {
		if (i > 0 && a[i] > a[i - 1]) {
			l = i;
		}
	}
	int r = n - 1;
	for (int i = n - 1; i >= 0; i--) {
		if (i < n - 1 && b[i] > b[i + 1]) {
			r = i;
		}
	}

	long long ans = 1;
	const int mod = 1000000007;

	for (int i = 0; i < l; i++) {
		if (h[i] == 0) {
			ans = ans * a[i] % mod;
		}
	}
	for (int i = n - 1; i > r; i--) {
		if (h[i] == 0) {
			ans = ans * b[i] % mod;
		}
	}
	for (int i = l + 1; i < r; i++) {
		if (h[i] == 0) {
			ans = ans * a[i] % mod;
		}
	}

	printf("%d\n", (int)ans);

	return 0;
}

Measured memory_bytes: 1408
#include <ctime>
#include <cstdio>
const int Maxn=100000;
int n;
int head[Maxn+5],arrive[Maxn<<1|5],nxt[Maxn<<1|5],tot;
void add_edge(int from,int to){
	arrive[++tot]=to;
	nxt[tot]=head[from];
	head[from]=tot;
}
int deg[Maxn+5];
int root;
int check_dfs(int u,int fa){
	int sum_1=0,sum_2=0;
	for(int i=head[u];i;i=nxt[i]){
		int v=arrive[i];
		if(v==fa){
			continue;
		}
		int tmp=check_dfs(v,u);
		if(tmp==1){
			return 1;
		}
		if(tmp==2){
			sum_1++;
		}
		if(tmp==3){
			sum_2++;
		}
	}
	if(sum_1>=2){
		return 1;
	}
	if(sum_1==1){
		return 3;
	}
	return 2;
}
int main(){
	clock_t begin=clock(),end;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		add_edge(u,v);
		add_edge(v,u);
		deg[u]++,deg[v]++;
	}
	for(int i=1;i<=n;i++){
		if(deg[i]!=1){
			root=i;
			break;
		}
	}
	int last=0;
	while(1){
		end=clock();
		if((end-begin)*1.0/CLOCKS_PER_SEC>0.9){
			break;
		}
		root=-1;
		for(int i=last+1;i<=n;i++){
			if(deg[i]!=1){
				root=i;
				break;
			}
		}
		if(root==-1){
			break;
		}
		last=root;
		if(check_dfs(root,0)==1){
			puts("First");
			return 0;
		}
	}
	puts("Second");
	return 0;
}


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

int main(void){
	int n, i;
	int c[9];
	memset(c, 0, sizeof(c));
	scanf("%d\n", &n);
	int s=0;
	for(i=0; i<n; i++){
		int a;
		scanf("%d\n", &a);
		if(a>=3200){
			c[0]++;
		}else{
			int j = a/400+1;
			if(c[j]==0){c[j]=1; s++;}
		}
	}
	int min = s==0?1:s;
	int max = s+c[0];
	printf("%d %d\n", min, max);
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}

int ctoi(char c){return c - '0';}

bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

bool isPrime(ll n) {
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return false;
	}
  return true;
}
vector<ll> primes(ll n){
  vector<ll> v(1,1);
  for (ll i = 2; n >= i * i; ++i) {
		if(!(n % i)){
      v.pb(i);
	  }
  }
  if(v.size()==1)v.pb(n);
  return v;
}


int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n;cin>>n;
  vector<int> a(n);rep(i,n)cin>>a[i];

  ll ans = 1;
  map<int,ll> cnt;
  rep(i,n){
    if(a[i] == 0)ans *= 3 - cnt[0];
    else if(cnt.count(a[i]))ans *= cnt[a[i]-1] - cnt[a[i]];
    else ans *= cnt[a[i]-1];
    cnt[a[i]]++;
    ans %= INF;
  }
  print(ans);
  return 0;
} 

Measured memory_bytes: 6912
import math
k,n=map(int,input().split())
arr=list(map(int,input().split()))
right_dis=k-arr[-1]
ans=1000000000000000
ans=min(ans,k-right_dis-arr[0])
# print(ans)
for i in range(1,len(arr)):
	dis=k-abs(arr[i]-arr[i-1])
	# print(dis,i)
	ans=min(ans,dis)
print(ans)

Measured memory_bytes: 78796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define reverse(s) reverse(s.begin(),s.end())


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

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

int main(){
    int x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int x3,x4,y3,y4;
    x3 = x2-(y2-y1);    y3 = y2+x2-x1;
    x4 = x1-(y2-y1);    y4 = y1+x2-x1;

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

    return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;


int main(void)
{
	int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
	int solu = 1, sugar = 0;
	
	for (int a = 0; 100 * A*a <= F; a++) {
		for (int b = 0; 100 * A*a + 100 * B*b <= F; b++) {
			for (int c = 0; 100 * A*a + 100 * B*b + C * c <= F; c++) {
				for (int d = 0; 100 * A*a + 100 * B*b + C * c + D * d <= F; d++) {
					if ((100 * A*a + 100 * B*b + C * c + D * d)*E < (100 + E)*(C * c + D * d))break;
					if ((100 * A*a + 100 * B*b + C * c + D * d)*sugar <= (C * c + D * d)*solu) {
						sugar = C * c + D * d;
						solu = sugar + 100 * A*a + 100 * B*b;
						//cout << solu << " " << sugar << endl;
					}
				}

			}

		}

	}


	cout << solu << " " << sugar << endl;

	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

int main(void){

  
  int N;
  vector<int> v;
  double ans = 0.0;
  
  cin >> N;

  for(int i=0; i < N ; i++){
    int tmp;
    cin >> tmp;
    v.push_back(tmp); 
  }

  sort(v.begin(),v.end()); 

ans = (double)(v.at(0) + v.at(1))/2.0;

for(int i = 2; i < N ; i++){
  ans = (double)(ans + v.at(i))/2.0;
}

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




Measured memory_bytes: 256
#include <stdio.h>

int d;
int c[27];
int s[366][26];


int main(){
  scanf("%d",&d);
  for(int i=0;i<d;i++){
    scanf("%d",&c[i]);}
  for(int i=0;i<d;i++){
    for(int j=0;j<26;j++){
      scanf("%d",&s[i][j]);}}

  int last[27]={};
  for(int i=1;i<=d;i++){
    int max=0;
    int maxid=0;
    for(int j=0;j<26;j++){
      int tmp = c[j]*(i-last[j])+s[i-1][j];
      if(tmp>max){
	max = tmp;
	maxid = j;}
    }
    last[maxid]=i;
    printf("%d\n",maxid+1);}

  return 0;
}


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

using namespace std;

int main()
{
    long int L, R;

    cin >> L >> R;

    R = min(R, L+2019*2);

    int m = 2019;

    for(long int i=L; i<R; i++)
    {
        for(long int j=i+1; j<=R; j++)
        {
            int ans = (i * j) % 2019;
            m = min(m, ans);
        }
    }

    cout << m << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(n) for( int i = 0 ; i < n ; i++ )
#define REP(n) for( int i = 1 ; i <= n ; i++ )
#define repll(n) for( ll i = 0 ; i < n ; i++ )
#define REPll(n) for( ll i = 1 ; i <= n ; i++ )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , c = 0;
    cin >> n;
    int a[n];
    rep(n) {
	    cin >> a[n];
	    c += a[n];
	}
	cout << c - n;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n;
    scanf("%lld", &n);
    ll ans=n-1;
    ll cnt=sqrt(n);
    for(ll i=2;i<=cnt;i++){
        if(n%i==0){
            ll c=n/i;
            ans=min(ans,i+c-2);
        }
    }
    printf("%lld\n", ans);
    return 0;
}

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

using namespace std;

int main()
{
   int N;
   cin >> N;
   vector<int> a(N);
   for (int i = 0; i < N; i++){
       cin >> a.at(i);
   }
   
   int cnt = 0;
   for (int i = 0; i < N; i++){
       while (a.at(i) % 2 == 0){
           a.at(i) /= 2;
           cnt++;
       }
   }
   cout << cnt << endl;
}

Measured memory_bytes: 256
A,B = map(int,input().split())
if A == 1 or A == 2 or A==3 or A==4 or A==5 or A==6 or A==7 or A==8 or A==9:
    if B == 1 or B == 2 or B==3 or B==4 or B==5 or B==6 or B==7 or B==8 or B==9:
        print(A*B)
    else:
        print('-1')
else:
    print('-1')

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N, K; scanf("%d %d", &N, &K);
  ll ans = 0;
  for (int b = 1; b <= N; ++b) {
    int r = N % b;
    ll val = N / b * max(0, b - K) + max(0, r - K + 1);
    ans += val;
  }
  if (K == 0) { ans -= N; }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
'''
left = 0
right = 0
for i in x:
    right += i
reco = 0
i = 0
while right > left:
    left += x[i]
    right -= x[i]
    i += 1
    if right <= left:
        print(min(reco, 0-(right - left)))
        break
    else:
        reco = right - left
'''
mid_index = len(x)//2
left = 0
right = 0
for i in range(mid_index):
    left += x[i]
for i in range(mid_index, len(x)):
    right += x[i]
reco = 0
if right == left:
    print(0)
while right != left:
    if right > left:
        reco = right -left
        right -= x[mid_index]
        left += x[mid_index]
        mid_index += 1
        if right <= left:
            print(min(reco, left-right))
            break
    else:
        reco = left - right
        right += x[mid_index-1]
        left -= x[mid_index-1]
        mid_index -= 1
        if right >= left:
            print(min(reco, right-left))
            break


Measured memory_bytes: 3064
n,k = map(int,input().split())
x = list(map(int,input().split()))
x = sorted(x)
ans = []
for i in range(n-k+1):
  lr = abs(x[i]) + abs(x[i+k-1] - x[i])
  rl = abs(x[i+k-1]) + abs(x[i] - x[i+k-1])
  ans.append(lr)
  ans.append(rl)
print(min(ans))

Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  int n,m;
  cin >> n >> m;
  int cnt = 0;
  vi a(n);
  int sum  = 0;
  rep(i,n){
    cin >> a[i];
    sum+=a[i];
  }
  rep(i,n){
    if(a[i]>=(sum+4*m-1)/(4*m))cnt++;
  }
  if(cnt>=m)cout << "Yes" << endl;
  else cout << "No" << endl;
  
}






Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define EPS 1e-10
#define equals(a, b) (fabs(a - b) < EPS)

class Vector {
public:
  double x, y;
  Vector() {}
  Vector(double x, double y) : x(x), y(y) {}

  Vector operator+(Vector v) { return Vector(x + v.x, y + v.y); }
  Vector operator-(Vector v) { return Vector(x - v.x, y - v.y); }
  Vector operator*(double s) { return Vector(s*x, s*y); }
  double norm() { return x * x + y * y; }
  double abs() { return sqrt(norm()); }
};

// inner product
double dot(Vector v1, Vector v2) { return v1.x * v2.x + v1.y * v2.y; }

// cross product
double cross(Vector v1, Vector v2) { return v1.x * v2.y - v1.y * v2.x; }

class Line {
public:
  Vector v1, v2;
  Line() {}
  Line(Vector v1, Vector v2) : v1(v1), v2(v2) {}
};

bool is_parrallel(Vector a, Vector b) { return equals(cross(a, b), 0); }
bool is_parrallel(Line a, Line b) {
  return is_parrallel(a.v1 - a.v2, b.v1 - b.v2);
}

bool is_orthogonal(Vector a, Vector b) { return equals(dot(a, b), 0); }
bool is_orthogonal(Line a, Line b) {
  return is_orthogonal(a.v1 - a.v2, b.v1 - b.v2);
}

Vector project(Line l, Vector v) {
  Vector a = v - l.v1;
  Vector b = l.v2 - l.v1;
  return l.v1 + b * (dot(a, b) / b.norm());
}

int main() {
  int x0, y0, x1, y1;
  cin >> x0 >> y0 >> x1 >> y1;
  auto line = Line(Vector(x0, y0), Vector(x1, y1));
  int nq;
  cin >> nq;
  for (int i = 0; i < nq; i++) {
    int x, y;
    cin >> x >> y;
    auto ans = project(line, Vector(x, y));
    printf("%.10f %.10f\n", ans.x, ans.y);
  }
}

Measured memory_bytes: 3224
#include<stdio.h>
int main()
{
	int a, b, c, div = 0;
	scanf("%d %d %d", &a,&b,&c);
	for (int i = a ; i <= b; i++)
	{
		if(c % i == 0)
		{
			div++;
		}
	}
	printf("%d\n",div);
	return 0;
}


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

int main(){
    string a,b;
    cin>>a>>b;
    int asz,bsz;
    asz=a.size();
    bsz=b.size();
    if(asz<bsz) { cout<<"LESS"; return 0; }
    else if(asz>bsz) { cout<<"GREATER"; return 0; }
    else {
        for(int i=0;i<asz;i++){
          if(a[i]<b[i]) { cout<<"LESS"; return 0; }
          else if(a[i]>b[i]) { cout<<"GREATER"; return 0; }
          else continue;
        }
    }
    cout<<"EQUAL";

}


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

#define QUEUE_SIZE 100000
#define next(a) (((a)+1)%QUEUE_SIZE)
#define max(a,b) ((a) > (b) ? (a) : (b))

int queue[QUEUE_SIZE];
int front;
int rear;

void init(){
	front = rear = 0;
}
void enqueue(int x){
	if(next(rear)==front){
		printf("full");
		exit(1);
	}
	queue[rear]=x;
	rear = next(rear);
}
int dequeue(){
	if(front==rear){
		printf("Nodata");
		exit(1);
	}
	int x  = queue[front];
	front = next(front);
	return x;
}
int isempty(){
	return front==rear;
}
int main(){
	int n,ans;
	scanf("%d",&n);
	int i,j,temp;
	int x,y;
	int m[2][n];
	int s[2][100]={};
	for(i=0;i<2;i++){
		for(j=0;j<n;j++)scanf("%d",&m[i][j]);
	}
	int ue[n];
	ue[0]=m[0][0];
	int sita[n];
	for(i=1;i<n;i++)ue[i]=ue[i-1]+m[0][i];
	sita[n-1]=m[1][n-1];
	for(i=n-1;i>=0;i--){
		sita[i-1]=sita[i]+m[1][i-1];
	}
	ans=sita[0]+ue[0];
	for(i=0;i<n;i++){
		ans = max(ans,(sita[i]+ue[i]));
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long a, b, c;
	cin >> a >> b >> c;
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		puts("0");
		return 0;
	}
	if (a > b) swap(a, b);
	if (b > c) swap(b, c);
	if (a > b) swap(a, b);
	printf("%lld\n", a * b);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

int main() {
	int i, j;
	int n;
	cin >> n;
	for (int i = 0; i < 26; i++) {
		for (j = 0; j < 16; j++) {
			if (4 * i + 7 * j == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] p = new int[n];
		for(int i = 0;i < n;++i){
			p[i] = scan.nextInt();
		}
		Arrays.sort(p);
		int sum = 0;
		for(int i = 0;i < k; ++i){
			sum += p[i];
		}
		System.out.print(sum);

	}
}


Measured memory_bytes: 38772
k = int(input())

from collections import deque
d = deque([1,2,3,4,5,6,7,8,9])

count = 0
for _ in range(k):
    i = d.popleft()
    dd = [i * 10 + (i % 10) + j - 1 for j in range(3)]
    dd = dd[1:] if i % 10 == 0 else dd[:2] if i % 10 == 9 else dd
    for j in dd:
        d.append(j)

else:
    print(i)

Measured memory_bytes: 48348
#include<bits/stdc++.h>
using namespace std;
const int N = 110;
long long w[N], v[N];
int n, W;
long long f[100010];

int main()
{
    scanf("%d%d", &n, &W);
    for(int i = 1; i <= n; i ++)
    {
        scanf("%lld%lld", &w[i], &v[i]);
        f[i] = 0;
    } 
    for(int i = 1; i <= n; i ++)
    {
        for(int j = W; j >= w[i]; j --)
        {
            f[j] = max(f[j], f[j - w[i]] + v[i]);
        }
    }
    printf("%lld\n", f[W]);
    return 0;
}

Measured memory_bytes: 1024
N, M = map(int, input().split(' '))
X =[int(i) for i in input().split(' ')]
if M > N:
    X.sort()
    X_n = X.copy()

    X_n.insert(0, X[0])

    del X_n[-1]

    X_section  = [X[i] - X_n[i] for i in range(len(X))]

    X_section.sort(reverse = True)

    X_result = X_section[N-1:]

    result = sum(X_result)

    print(result)
else:
    print(0)

Measured memory_bytes: 13832
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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 (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int D; cin >> D;
	int C[26];
	int S[370][26];
	VI T(D);
	REP(i, 26)cin >> C[i];
	REP(i, D)REP(j, 26)cin >> S[i][j];
	//cout << "L" << endl;
	REP(i, D) {
		cin >> T[i];
		T[i]--;
	}
	
	int last[26] = { 0 };
	REP(i, 26)last[i] = -1;
	int ans = 0;
	REP(i, D) {
		ans += S[i][T[i]];
		last[T[i]] = i;
		REP(j, 26) {
			ans -= C[j] * (i - last[j]);
		}
		cout << ans << '\n';
	}


	return 0;
}



Measured memory_bytes: 3700
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
/*
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};
*/
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

//デバッグ
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};


ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}


//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

ll N, X;
vector<ll> S;
ll dp[210][100010];
int main(){
  cin >> N >> X;
  S.resize(N);
  rep(i, N) cin >> S[i];
  sort(S.begin(), S.end());
  rep(i, N+1)rep(j, X+1) dp[i][j] = 0;
  rep(j, X+1) dp[0][j] = j;
  rep(i, N){
    rep(j, X+1){
      dp[i+1][j] += dp[i][j] * i + dp[i][j%S[i]] % MOD;
      dp[i+1][j] %= MOD;
    }
  }


  cout << dp[N][X] << endl;
}


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

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

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb(i) push_back(i)
#define fs first
#define sc second

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

int main(){
	string str;
	cin >> str;
	rep(i,12){
		cout << str[i];
		if(i==3) cout << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 384
v,e=map(int,input().split())
from collections import defaultdict
incnt=defaultdict(int)
edges=[[] for i in range(0+v)]
for i in range(e):
    """#weighted->erase_,__,___=map(int,input().split())
    edges[_].append((__,___))
    incnt[__]+=1
    """
    _,__=map(int,input().split())
    edges[_].append(__)
    incnt[__]+=1
    """
"""#weighted->erase
from collections import deque
dq=deque([])
topo=[]
for i in range(v):
    if incnt[i]==0:
        dq.append(i)
while dq:
    a=dq.popleft()
    for to in edges[a]:
        incnt[to]-=1
        if incnt[to]==0:dq.append(to)
    topo.append(a)
print(*topo,sep="\n")


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

ll solve() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N), F(N);
    for ( int i = 0; i < N; i++ ) cin >> A[i];
    for ( int i = 0; i < N; i++ ) cin >> F[i];
    std::sort(A.begin(), A.end());
    std::sort(F.begin(), F.end(),greater<>());
    
    ll sm = 0;
    for ( int i = 0; i < N; i++ ) {
        sm += A[i];
    }
    if ( sm <= K ) return 0;

    auto check = [&](ll m) {
        ll k = 0;
        for ( int i = 0; i < N; i++ ) {
            if ( F[i]*A[i] > m ) {
                ll d = A[i] - m/F[i];
                k += d;
            }
        }
        return k <= K;
    };

    ll l = 0, r = 1e12+1;
    while ( r - l > 1 ) {
        ll m = (l+r)/2;
        if ( check(m) ) r = m;
        else l = m;
    }
    return r;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    map<char,int> mp;
    for(int i=0; i<4; i++){
        mp[s[i]]++;
    }
    bool flag=true;
    for(auto p:mp){
        if(p.second!=2)flag=false;
    }
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n, t; cin>>n>>t;
  vi tl(t+1,0);
  vi tr(t+1,0);
  int l, r;
  rep(i,n) { cin >> l >> r; tl[l]++; tr[r]++; }
  rep(i,1,t+1) { tl[i] += tl[i-1]; tr[i] += tr[i-1]; }
  int nmax = 0;
  rep(i,t+1) { nmax = max(nmax, tl[i]-tr[i]); }
  cout << nmax << endl;
}


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int[] ans =new int[s.length()];
		int bound = 0;
		boolean flag = true;
		int r = 0;
		int l = 0;

		for(int i = 0; i < s.length(); i++) {
			if(flag  && s.charAt(i) == 'L') {
				bound = i-1;
				ans[bound] += (r%2==0) ? r/2 : (r/2)+1;
				ans[bound+1] += r/2;
				r = 0;
				flag = false;
			}else if(!flag && s.charAt(i) == 'R') {
				ans[bound] += l/2;;
				ans[bound+1] += (l%2==0) ? l/2 : (l/2)+1;
				l = 0;
				flag = true;
			}
			if(flag)r++;
			else 	l++;
		}

		ans[bound] += l/2;;
		ans[bound+1] += (l%2==0) ? l/2 : (l/2)+1;

		for(int i = 0; i < s.length(); i++)
			System.out.printf("%d ",ans[i]);

		sc.close();
	}
}

Measured memory_bytes: 60532
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

struct Edge {
    int to;
    int c;
};

template <typename T, typename U>
U value_or(std::map<T, U>& m, T key, U val) {
    return m.count(key) ? m[key] : val;
}

const int inf = 1 << 28;

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<Edge>> graph(n);
    for (int i = 0; i < m; ++i) {
        int p, q, c;
        cin >> p >> q >> c;
        p--;
        q--;
        graph[p].push_back((Edge){q, c});
        graph[q].push_back((Edge){p, c});
    }

    for (int i = 0; i < n; ++i) {
        sort(graph[i].begin(), graph[i].end(), [](auto& a, auto& b) {
            return a.c == b.c ? a.to < b.to : a.c < b.c;
        });
    }

    map<pair<int, int>, int> dist;
    dist[{0, -1}] = 0;

    deque<pair<int, int>> que;
    que.emplace_back(0, -1);
    while (!que.empty()) {
        auto cur = que.front();
        que.pop_front();

        if (cur.first == n - 1) {
            cout << dist[{cur.first, cur.second}] << endl;
            return 0;
        }

        int d = dist[cur];

        if (cur.second == -1) {
            for (auto& e : graph[cur.first]) {
                if (value_or(dist, {e.to, e.c}, inf) > d + 1) {
                    dist[{e.to, e.c}] = d + 1;
                    que.emplace_back(e.to, e.c);
                }
            }
        } else {
            auto r = equal_range(graph[cur.first].begin(),
                                 graph[cur.first].end(), (Edge){0, cur.second},
                                 [](auto& a, auto& b) { return a.c < b.c; });

            for (auto it = r.first; it != r.second; ++it) {
                auto e = *it;
                if (value_or(dist, {e.to, e.c}, inf) > d) {
                    dist[{e.to, e.c}] = d;
                    que.emplace_front(e.to, e.c);
                }
            }

            if (r.second - r.first != graph[cur.first].size()) {
                if (value_or(dist, {cur.first, -1}, inf) > d) {
                    dist[{cur.first, -1}] = d;
                    que.emplace_front(cur.first, -1);
                }
            }
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 29568
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

string a, b, c;
int i, j;


int main() {

	cin >> a >> b >> c;

	a = a.substr(0, 1);
	b = b.substr(0, 1);
	c = c.substr(0, 1);
	transform(a.begin(), a.end(), a.begin(), ::toupper);
	transform(b.begin(), b.end(), b.begin(), ::toupper);
	transform(c.begin(), c.end(), c.begin(), ::toupper);

	cout << a << b << c << endl;
	return 0;
}

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

#define N 100000
using namespace std;


typedef struct{
  int num[N];
  int head;
  int tail;
}Queque;


//grobal
Queque que;

  //add to head position
void push(int);
  //delete head position
void pop(void);
  //return now of stck
int front(void);


int main(){
  //format
  que.head=0;
  que.tail=0;

  int pasttime=0;
  int i,n,q,tim=0;
  string name[N];
  int finishcount=0;
  int flag[N];
  int st;

  //load n and q
  cin >>n>>q;

  //load name and time
  for(i=0;i<n;i++){
    cin >>name[i]>>tim;
    push(tim);
  }

  //format flag
  for(i=0;i<n;i++){
    flag[i]=0;
  }
  
  i=0;

  while(1){
    if(finishcount==n) break;
    //i->n i=0 continue
    else if(i==n){
      i=0;
      continue;
      }
    //flag=1 go next
      else if(flag[i]==1){
      i++;
      continue;
    }
    //load
    st=front();

    if(st>q){
      push(st-q);
      pop();
      pasttime+=q;
    }

    else{
      pop();
      pasttime+=st;
      flag[i]=1;
      finishcount++;
      //print
      cout <<name[i]<<" "<<pasttime<<endl;
    } 
    
    i++;
  }
    
  
  return 0;
  
}

  //add to head position
  void push(int x){
    que.num[que.tail]=x;
    que.tail++; 
 }
  //delete head position
  void pop(void){
    que.head++;
  }
  //return now of stck
  int front(void){
    return que.num[que.head];
  }

Measured memory_bytes: 0
from collections import deque

N,M=map(int,input().split())
G=[[] for _ in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  G[a].append(b)
  G[b].append(a)

def bfs(s):
    seen = [0]*(N+1)
    d = [0]*(N+1)
    prev = [0]*(N+1)
    todo = deque()
    seen[s]=1
    todo.append(s)
    while len(todo):
      a = todo.popleft()
      for b in G[a]:
        if seen[b] == 0:
          seen[b] = 1
          todo.append(b)
          d[b] += d[a] + 1
          prev[b] = a
    return prev
  
prev = bfs(1)

print('Yes')
print(*prev[2:])

Measured memory_bytes: 35360
while True:
    m,f,r = map(int, input().split())
    if(m==-1 or f == -1):
        if (m == -1 and f == -1 and r == -1):
            break
        else:
            print('F')
    else:
        score = m + f
        if(score >= 80):
            print('A')
        elif(score >= 65):
            print('B')
        elif(score >= 50):
            print('C')
        elif(score >= 30):
            if(r >= 50):
                print('C')
            else:
                print('D')
        else:
            print('F')


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

using namespace std;

int main(){
    string a,b,u;
    int num1,num2;

    cin >> a >> b;
    cin >> num1 >> num2;
    cin >> u;

    if(a == u)
        printf("%d %d\n",num1-1,num2);
    else
        printf("%d %d\n",num1,num2-1);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <map>
#include <algorithm>

int main()
{
	int A, B, C;
	std::string ans = "No";

	std::cin >> A >> B >> C;

	if ((A != B) && (A != C) && (B != C)){
		ans = "No";
	}
	else if ((A == B) && (A == C) && (B == C)){
		ans = "No";
	}
	else{
		ans = "Yes";
	}

	std::cout << ans << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int h[n];
	int ans[n];
	for(int i=0;i<n;i++) 
		{
			cin>>h[i];
			ans[i] = INT_MAX;
		}
	ans[0]=0;
	ans[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;i++)
	{
		ans[i] = ans[i-1]+abs(h[i]-h[i-1]);

		for(int j=2;j<=k && (i-j>=0);j++)
		{
			ans[i] = min(ans[i],ans[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<ans[n-1]<<endl;
}

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

int main() {
  int N;float wa=0;cin>>N;
  for(int i=0; i<N; i++){
    float x;string v;
    cin >> x >> v;
    wa+=(v=="JPY")? x:x*380000;
  }
  cout<<fixed<<setprecision(10);
  cout<<wa<<endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;

int main(){
  string s, t;
  cin >> s >> t;
  sort(ALL(s));
  sort(ALL(t));
  reverse(ALL(t));
  if (s < t) cout << "Yes\n";
  else cout << "No\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
const int  N = 2e5 + 314;
void foo(){
    int n;
    cin>>n;
    vi v(n);
    map<int, int>mp, cnt;
    for(int i = 0; i < n; i++){
        cin>>v[i];
        cnt[v[i]]++;
    }
    for(auto it:cnt){
        if(it.s>=2){
            cout<<"NO";
            return;
        }
    }
    cout<<"YES";
}
int main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)foo();
}

Measured memory_bytes: 10368
N, M = list(map(int, input().split()))
SC = []
for i in range(M):
    s, c = list(map(int, input().split()))
    SC.append([s-1, c])

ans = [None] * N
r = True
for s, c in SC:
    if ans[s]:
        if ans[s] == c:
            pass
        else:
            r = False
    else:
        ans[s] = c

# print(ans, r)

if N == 1 and M == 0:
    print(0)
elif not r:
    print(-1)
elif N == 1 and ans[0] == 0:
    print(0)
elif ans[0] == 0:
    print(-1)
else:
    x = ''
    for i, ai in enumerate(ans):
        if i == 0 and ai is None:
            x += '1'
        elif ai is None:
            x += '0'
        else:
            x += str(ai)
    print(x)
        

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    string s;
    cin>>s;
    rep(i, s.size()) s.at(i) = 'x';
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
for i in range(0,n):
    a = b = 0
    arr = list(int(x) for x in input().split())
    ans = "YES"
    for j in range(0,10):
        if arr[j] < a and arr[j] < b:
            ans = "NO"
            break
        else:
            if a > b:
                if a < arr[j]:
                    a = arr[j]
                else :
                    b = arr[j]
            else:
                if b < arr[j]:
                    b = arr[j]
                else:
                    a = arr[j];
    print(ans)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define flood2(x) memset(x, -0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)


int n, m, dp[2][2005][2005], ans;
string s, t;
int main(){
    flood2(dp[0]);
    cin >> n >> m >> s >> t;
    fox(l, n+1){
        fox(l2, m+1){
            //cout << dp[0][l][l2] << ":" << dp[1][l][l2] << ' ';
            ans=max(ans, dp[0][l][l2]);
            //if (l==n || l2==m) continue;
            if (l2<m && t[l2]=='I')
            dp[0][l][l2+1]=max(dp[0][l][l2+1], dp[1][l][l2]+1);
            else
            dp[1][l][l2+1]=max(dp[1][l][l2+1], dp[0][l][l2]+1);
            if (l<n && s[l]=='I')
            dp[0][l+1][l2]=max(dp[0][l+1][l2], dp[1][l][l2]+1);
            else
            dp[1][l+1][l2]=max(dp[1][l+1][l2], dp[0][l][l2]+1);
        }
        //cout << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 34600
#include <stdio.h>

int main(){
  int a, b, n, i, j;
  scanf("%d%d%d",&a,&b,&n);
  int s[n],f[n];
  bool used[1024];
  for (i = 0; i < 1024; i++) used[i] = false;
  for (i = 0; i < n; i++) {
    scanf("%d%d",&s[i],&f[i]);
    for (j = s[i]; j < f[i]; j++) used[j] = true;
  }
  for (i = a; i < b; i++) {
    if(used[i]) {printf("1\n");
    return 0;}
  }
  printf("0\n");
  return 0;
}


Measured memory_bytes: 2696
#include <iostream>
using namespace std;
int main()
{
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int cnt = 0;
    for(int i=0; i<=A; i++)
    {
        for(int j=0; j<=B; j++)
     	{
     	  	for(int k=0; k<=C; k++)
     	  	{
               if(500*i+100*j+50*k == X) cnt++;
     	  	}
        }
    }
    
    cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
# frozen_string_literal: true

require 'thread'

n = gets.to_i
ab = (n - 1).times.map { gets.split.map(&:to_i) }

h = Array.new(n + 1) { 0 }

nh = Array.new(n + 1) { [] }

colors = Array.new(n - 1) { 0 }

0.upto(n - 2) do |i|
  e = ab[i]
  h[e[0]] += 1
  h[e[1]] += 1
  nh[e[0]].push [e[1], i]
  nh[e[1]].push [e[0], i]
end

max = h.max
max_node = h.find_index(max)

q = Queue.new

ncolor = max
q.push [max_node, -1]
color_base = 1

loop do
  break if q.empty?

  node, edge = q.pop
  color_base = colors[edge] % ncolor + 1 if edge >= 0
  nh[node].each do |e|
    n = e[0]
    i = e[1]
    next if i == edge

    q.push [n, i]
    colors[i] = color_base
    color_base = color_base % ncolor + 1
  end
end

puts ncolor
puts colors


Measured memory_bytes: 29948
n = gets.chomp.to_i
change = []
if n != 0
  while n != 1 do
    if n < 0 #正の時の計算
      if n % (-2) != 0
        d = 1
        n = n / (-2) + 1
      else
        d = n % (-2)
        n = n / (-2)
      end
    else #負の時の計算
      if n % (-2) != 0
        d = 1
        n = n / (-2) + 1
      else
        d = n % (-2)
        n = n / (-2)
      end
    end
    change.insert(0, d)
  end
  change.insert(0,n)

  answer = ""
  change.each do |char|
    answer =  answer + char.to_s
  end

  puts answer
else
  puts "0"
end


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

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pint;

const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;


int main() {
    int x, a, b; cin >> x >> a >> b;
    if (-a + b <= 0) cout << "delicious" << endl;
    else if (-a + b <= x) cout << "safe" << endl;
    else cout << "dangerous" << endl;

    return 0;
}


    


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

long long r, c, sum = 0;
vector<vector<long long>> v;

int main() {
  cin >> r >> c;
  v.assign(r + 1, vector<long long>(c + 1, 0));
  for(int i = 0; i < r; ++i) {
    for(int j = 0; j < c; ++j) {
      cin >> v[i][j];
      sum += v[i][j];
      v[i][c] += v[i][j];
      v[r][j] += v[i][j];
    }
  }
  v[r][c] = sum;
  for(int i = 0; i <= r; ++i) {
    for(int j = 0; j <= c; ++j) {
      if(j != 0) cout << " ";
      cout << v[i][j];
    }
    cout << endl;
  }

  return 0;
}


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

int64_t lucas(int64_t N){
  if ((int64_t)N == 0LL){
   return 2LL; 
  }
  if ((int64_t)N == 1LL){
   return 1LL; 
  }
  vector<int64_t> v(N);
  v.at(0) = 2LL;
  v.at(1) = 1LL;
  for (int i = 2;i<N;i++){
    v.at(i) = v.at(i-2) + v.at(i-1);
  }
  
  return v.at(N-1) + v.at(N-2);
 
}
 
int main() {
  //N 番目のリュカ数
  int N;
  cin >> N;
  cout << lucas(N) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;

#define MAX_V 100001
#define INF (1e9 + 1)

struct edge{
  int to,cost;
};

int V,E,r,a,b,c;

vector< edge > G[MAX_V];


int d[MAX_V];
void dijkstra(){
  int i;
  for(i=0;i<MAX_V;i++)d[i]=INF;
  d[r]=0;
  priority_queue< pair<int,int> > Q;
  Q.push( make_pair(0,r) );
  while(!Q.empty()){
    pair<int,int> p=Q.top();
    Q.pop();
    int pos=p.second,cost=-p.first;
    if( cost > d[pos] )continue;
    for(i=0;i<G[pos].size();i++){
      edge e=G[pos][i];
      int to=e.to;
      int newcost=cost+e.cost;
      if( newcost < d[to]){
        d[to]=newcost;
        Q.push( make_pair(-d[to],to) );
      }
    }
  }

  for(i=0;i<V;i++){
    if(d[i]==INF)printf("INF\n");
    else printf("%d\n",d[i]);
  }
}

int main(){
  int i;
  scanf("%d %d %d",&V,&E,&r);
  for(i=0;i<E;i++){
    scanf("%d %d %d",&a,&b,&c);
    G[a].push_back((edge){b,c});
  }
  dijkstra();
  return 0;
}



Measured memory_bytes: 12612