akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

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

    LL tmp = 1000000000;
    LL x, y;

    x = ( tmp - s % tmp ) % tmp;
    y = ( s + x ) / tmp;

    cout << "0 0 1000000000 1 " << x << " " << y << endl;

    return 0;
}



Measured memory_bytes: 256
n=int(input())
arr = list(map(int, input().split()))
z=1
flag=0
zero=1
for i in range(n):
    z=z*arr[i]
    if(z>1000000000000000000):
        flag=1
        break
for i in range(n):
    if(arr[i]==0):
        zero=0
if(flag==0 or zero==0):
    print(z*zero)
else:
    print("-1")
    



Measured memory_bytes: 84808
a,b = map(int,input().split())
py = sorted([list(map(int,input().split()))+[i] for i in range(b)])
c = 1
ans1 = [['0'*(6 - len(str(py[0][0])))+str(py[0][0])+'000001',py[0][2]]]
for i in range(1,b):
  ans = '0'*(6 - len(str(py[i][0])))
  ans += str(py[i][0])
  if py[i-1][0] == py[i][0]:
    c += 1
  else:
    c = 1
  ans += '0'*(6 - len(str(c)))
  ans += str(c)
  ans1.append([ans,py[i][2]])
ans1 = sorted(ans1,key=lambda x:x[1])
for i in ans1:
  print(i[0])

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

using namespace std;

//#define MD 10

int main(){
   int n;
    cin>>n;
    vector<int> t(n),a(n);
    for(int i=0;i<n;i++){
        cin>>t[i]>>a[i];
    }
    vector<long long int> anst(n),ansa(n);
    anst[0]=t[0];
    ansa[0]=a[0];
    
    for(int i=1;i<n;i++){
        long long int at=(anst[i-1]+t[i]-1)/t[i],aa=(ansa[i-1]+a[i]-1)/a[i];
        long long int x=max(at,aa);
        anst[i]=x*t[i];
        ansa[i]=x*a[i];
     }
    
    cout<<anst[n-1]+ansa[n-1]<<endl;
   return 0;
}

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

namespace ConsoleApp3
{
    class Program
    {
        static long gcd(long A, long B)
        {
            while (B > 0)
            {
                var c = A % B;
                A = B;
                B = c;
            }

            return A;
        }

        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select((c => int.Parse(c))).ToArray();


            var L = new long[N + 1];
            var R = new long[N + 1];

            L[0] = A[0];
            R[N - 1] = A[N - 1];
            for (int i = 1; i < N - 1; i++)
            {
                L[i] = gcd(L[i - 1], A[i]);
                R[N - i - 1] = gcd(R[N - i], A[N - i - 1]);
            }

            long ans = 0;
            for (int i = 0; i < N; i++)
            {
                if (i == 0)
                {
                    ans = Math.Max(ans, R[i + 1]);
                }
                else if (i == N - 1)
                {
                    ans = Math.Max(ans, L[i - 1]);
                }
                else
                {
                    ans = Math.Max(ans, gcd(L[i - 1], R[i + 1]));
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 29788
import java.util.*;

public class Main {
	private static long max = 0;
	private static List<Long> getStrings(Scanner sc, int num) {
		List<Long> stringList = new ArrayList<>();
		while(num>0) {
			Long nextInt = sc.nextLong();
			stringList.add(nextInt);
			if (nextInt > max) {
				max = nextInt;
			}
			num--;
		}
		return stringList;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		List<Long> array= getStrings(sc, n);
		long l = 0;
		long r = max;
		while (r-l>1) {
			long mid = (l+r)/2;
			long re = split(array, mid);
			if (re <= k) {
				r = mid;
			} else {
				l = mid;
			}
		}
		System.out.println(r);
	}

	private static long split(List<Long> array, long standard) {
		long result = 0;
		for(Long t: array) {
			result += t/standard;
			if (t % standard != 0) {
				result++;
			}
			result--;
		}
		return result;
	}

}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int x, a, b;
	cin >> x >> a >> b;
	if (abs(x - a) > abs(x - b))
	{
		cout << "B" << endl;
	}
	else
	{
		cout << "A" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n, i, MAR_num, NUM, CARD[5][14]={};
    char MAR;
    cin >> n;
    for(i=0; i<n; i++){
        cin >> MAR >> NUM;
        if(MAR == 'S') MAR_num=1;
        if(MAR == 'H') MAR_num=2;
        if(MAR == 'C') MAR_num=3;
        if(MAR == 'D') MAR_num=4;
        CARD[MAR_num][NUM]=1;
    }
    
    for(MAR_num=1; MAR_num<=4; MAR_num++){
        for(NUM=1; NUM<=13; NUM++){
            if(CARD[MAR_num][NUM] == 0){
                if(MAR_num == 1) cout << "S " << NUM << endl;
                if(MAR_num == 2) cout << "H " << NUM << endl;
                if(MAR_num == 3) cout << "C " << NUM << endl;
                if(MAR_num == 4) cout << "D " << NUM << endl;
            }
        }
    }
    return 0;
}



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

typedef long long LL;
const int V = 2e5 + 5;
const int N = 1e6;
const LL mod = 924844033;
const LL g = 5;

struct edge {
  int nxt, to;
} e[V << 1];
LL fac[N], inv[N], a[N], b[N], c[N];
int pos[N], fir[V], sz[V], cnt = 0, n;

inline void addedge(int x, int y) {
  e[++ cnt] = (edge) { fir[x], y  };
  fir[x] = cnt;
}

inline LL pow(LL x, LL exp) {
  LL r = 1; x %= mod;
  exp = (exp + mod - 1) % (mod - 1);
  for (; exp; exp >>= 1, x = x * x % mod)
    if (exp & 1) r = r * x % mod;
  return r;
}

inline void pre(int n) {
  int t = n >> 1;
  for (int i = fac[0] = 1; i < n; i ++) {
    fac[i] = fac[i - 1] * i % mod;
    pos[i] = (pos[i >> 1] >> 1) ^ (t * (i & 1));
  }
  a[n - 1] = inv[n - 1] = pow(fac[n - 1], mod - 2);
  for (int i = n - 1; i; i --) a[i - 1] = inv[i - 1] = inv[i] * i % mod;
}

inline void dfs(int x, int fa) {
  sz[x] = 1;
  for (int i = fir[x]; i; i = e[i].nxt)
    if (e[i].to != fa) {
      dfs(e[i].to, x);
      sz[x] += sz[e[i].to];
      b[sz[e[i].to]] --;
    }
  if (x != 1) b[n - sz[x]] --;
}

inline void NTT(LL *a, int n, LL t) {
  for (int i = 0; i < n; i ++)
    if (pos[i] < i) swap(a[pos[i]], a[i]);
  LL x, y, per, cur;
  for (int i = 2, ii = 1; i <= n; i <<= 1, ii <<= 1) {
    per = pow(g, t * (mod - 1) / i);
    for (int j = 0; j < n; j += i) {
      cur = 1;
      for (int k = j; k < j + ii; k ++) {
        x = a[k];
        y = cur * a[k + ii] % mod;
        a[k] = x + y;
        if (a[k] >= mod) a[k] -= mod;
        a[k + ii] = x - y;
        if (a[k + ii] < 0) a[k + ii] += mod;
        cur = cur * per % mod;
      }
    }
  }
  if (t == -1) {
    LL I = pow((LL)n, mod - 2);
    for (int i = 0; i < n; i ++) a[i] = a[i] * I % mod;
  }
}

int main() {
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; i ++) {
    scanf("%d%d", &x, &y);
    addedge(x, y); addedge(y, x);
  }
  int k = 1;
  for (; k <= n; k <<= 1);
  k <<= 1;
  pre(k);
  dfs(1, 0); b[n] = n;
  for (int i = 0; i < k; i ++) {
    b[i] = b[i] * fac[i] % mod;
    if (b[i] < 0) b[i] += mod;
  }
  reverse(b, b + n + 1); b[n] = 0;
  for (int i = n + 1; i <= k; i ++) a[i] = b[i] = 0;
  NTT(a, k, 1);
  NTT(b, k, 1);
  for (int i = 0; i < k; i ++) a[i] = a[i] * b[i] % mod;
  NTT(a, k, -1);
  for (int i = n - 1; i >= 0; i --)
    printf("%lld\n", a[i] * inv[n - i] % mod);
  return 0;
}


Measured memory_bytes: 39296
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String out = "";
    int n = scanner.nextInt();
    scanner.nextLine();
    for (int ii = 0; ii < n; ii++) {
      String line = scanner.nextLine();
      String[] work = line.split(":");
      int hh = Integer.parseInt(work[0]);
      int mm = Integer.parseInt(work[1]);
      double mmr = 360 / 60 * mm;
      double hhr = 360 / 12 * hh + mmr / 12;
      double r = Math.abs(mmr - hhr);
      if (r > 180) {
        r = 360 - r;
      }
      //out += r + " ";
      if (0 <= r && r < 30) {
        out += "alert";
      } else if (90 <= r && r <= 180) {
        out += "safe";
      } else {
        out += "warning";
      }
      out += "\n";
    }
    System.out.print(out);
  }
}

Measured memory_bytes: 49608
def main():
    S = list(input())
    T = input()
    judge = False
    lastidx = -1
    for i in range(len(S)-len(T)+1):
        judgetmp = True
        for j in range(len(T)):
            if S[i+j] != T[j] and S[i+j] != "?":
                judgetmp = False
                break
        if judgetmp:
            judge = True
            lastidx = i
    if not judge: return "UNRESTORABLE"
    for i in range(len(T)):
        S[lastidx+i] = T[i]
    return "".join(S).replace("?", "a")

print(main())


Measured memory_bytes: 61540
# -*- coding: utf-8 -*-
import sys


def main():
    K = int( sys.stdin.readline() )
 
    A = 7

    for i in range(K):
        if A % K == 0:
            print(i+1)
            return

        A = (A * 10) + 7
        A %= K
    
    print(-1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9108
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

struct Edge {
  int to, cost, money;
  Edge(){}
  Edge(int to, int cost, int money) : to(to), cost(cost), money(money) {}
  bool operator < (const Edge &r) const {
    return cost < r.cost;
  }
};

signed main() {
  int N, M, S;
  cin >> N >> M >> S;

  int MAX = N*50;
  S = min(MAX, S);
  vector<vector<Edge>> graph(N);
  vector<int> u(M), v(M), a(M), b(M);
  REP(i, M){
    cin >> u[i] >> v[i] >> a[i] >> b[i];
    u[i]--; v[i]--;

    graph[u[i]].emplace_back(v[i], b[i], a[i]);
    graph[v[i]].emplace_back(u[i], b[i], a[i]);
  }

  vector<int> c(N), d(N);
  REP(i, N) cin >> c[i] >> d[i];

  vector<vector<int>> dist(N, vector<int>(MAX+5, INF));
  dist[0][S] = 0;

  queue<pair<int, int>> q;
  q.push({0, S});

  while(!q.empty()){
    auto p = q.front(); q.pop();
    int v = p.first;
    int m = p.second;

    if(m+c[v] <= MAX){
      if(dist[v][m+c[v]] > dist[v][m]+d[v]){
        dist[v][m+c[v]] = dist[v][m]+d[v];
        q.push({v, m+c[v]});
      }
    }
    for(auto u : graph[v]){
      if(m-u.money >= 0 && dist[u.to][m-u.money] > dist[v][m]+u.cost){
        dist[u.to][m-u.money] = dist[v][m]+u.cost;
        q.push({u.to, m-u.money});
      }
    }
  }

  FOR(i, 1, N){
    int ret = INF;
    REP(j, MAX){
      chmin(ret, dist[i][j]);
    }

    cout << ret << "\n";
  }

  return 0;
}

Measured memory_bytes: 5308
N = int(input())
a = {i: int(input()) for i in range(1, N + 1)}
i = 1
cnt = 0
while True:
    cnt += 1
    if a[i] == 2:
        print(cnt)
        break
    if cnt == N:
        print(-1)
        break
    i = a[i]

Measured memory_bytes: 17892
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    int n=s.size();
    string vec;
    for(int i=0;i<n;i++){
      if(s[i]=='0'){
        vec.push_back(s[i]);
      }
      else if(s[i]=='1'){
        vec.push_back(s[i]);
      }
      else if(vec!=""&&s[i]=='B'){
        vec.pop_back();
      }
    }
        cout<<vec<<endl;
}


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

int main() {
    string s; cin >> s;
    int n = s.size();
    int scnt = 0;
    int ans = 0;
    rep(i, n){
        if(s[i] == 'S'){
            scnt++;
        } else {
            if(scnt == 0){
                ans++;
            } else {
                scnt--;
            }
        }
        if(i == n-1){
            ans += scnt;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3720
// ------------------------------------
// Date:2018/ 3/ 6
// Problem:ABC 081 Non-Decreasing d.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;

int main()
{
  int N;
  scanf("%d", &N);
  vector< int > A(N);
  int mMax, mMin;
  mMax = mMin = 0;
  REP(i, N) {
    scanf("%d", &A[i]);
    // 最大値と最小値の番号を導出
    mMin = (A[i] < A[mMin] ? i : mMin);
    mMax = (A[i] > A[mMax] ? i : mMax);
  }

  bool positive;
  vector< pair< int, int > > o;
  if (A[mMin] <= 0 and A[mMax] > 0) {
    if (abs(A[mMin]) > abs(A[mMax])) {
      // 全部マイナスに
      REP(i, N) {
	if (i == mMin) continue;
	o.emplace_back(make_pair(mMin, i));
	A[i] += A[mMin];
      }
      positive = false;
    } else {
      // 全部プラスに
      REP(i, N) {
	if (i == mMax) continue;
	o.emplace_back(make_pair(mMax, i));
	A[i] += A[mMax];
      }
      positive = true;
    }
  } else if (A[mMin] >= 0 and A[mMax] >= 0) {
    // 最初から全部プラス
    positive = true;
  } else {
    // 最初から全部マイナス
    positive = false; 
  }

  // ここから確定演出
  if (!positive) {
    // 全部マイナス
    RREP(i, N - 1) {
      //if (A[i] <= A[i + 1]) continue;

      // 前の値に加えられる時
      o.emplace_back(make_pair(i+1, i));
      //A[i] = A[i + 1];
      //++i;
    }
  } else {
    // 全部プラス
    REP(i, N - 1) {
      //if (A[i] <= A[i + 1]) continue;

      // 次の値に加えられる時
      o.emplace_back(make_pair(i, i+1));
      //A[i + 1] += A[i];
      //--i;
    }
  }
  
  printf("%d\n", o.size());
  REP(i, o.size()) {
    printf("%d %d\n", (o[i].first) + 1, (o[i].second) + 1);
  }
  
  return 0;
}



Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    string s;
    scan(s);
    auto n = s.length.to!int;

    bool check(int x) {
        if (2*x <= n) {
            return true;
        }

        foreach (i ; n - x .. x) {
            if (s[i] != s[n - x]) {
                return false;
            }
        }

        return true;
    }

    int ok = 1, ng = n + 1;

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }

    writeln(ok);
}










void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 2556
#import<iostream>
#import<map>
#import<queue>
#import<cstdlib>
#import<cstring>
using namespace std;struct B{int z[2];char s[14];bool operator<(const B&r)const{return strcmp(s,r.s)<0;}};main(){int a[13][5]={{2,-1},{2,5,-1},{0,1,3,6,-1},{2,7,-1},{5,-1},{1,4,6,9,-1},{2,5,7,10,-1},{3,6,8,11,-1},{7,-1},{5,10,-1},{6,9,11,12,-1},{7,10,-1},{10,-1}},X[]={2,1,2,3,0,1,2,3,4,1,2,3,2},Y[]={0,1,1,1,2,2,2,2,2,3,3,3,4},v,d,s,i,j,t,u;B g={0,0,"0123456789:;0"};for(;;){map<B,int>m;queue<B>q;B b={i=-1,-1};for(;++i<13;!v?b.z[*b.z>=0]=i:0){cin>>v;if(v<0)return 0;b.s[i]=48+v;}b.s[13]=0;m[b]=1;for(q.push(b);!q.empty();q.pop()){B&b=q.front();if(!strcmp(b.s,g.s))break;d=0;for(i=13;i--;v?d+=abs(X[v]-X[i])+abs(Y[v]-Y[i]):0)v=b.s[i]-48;s=m[b];if(s+d<22)for(j=0;j<2;j++)for(i=0;~a[u=b.z[j]][i];i++){B n=b;t=n.z[j]=a[u][i];if(t-n.z[1-j]){swap(n.s[u],n.s[t]);int&r=m[n];if(!r)r=s+1,q.push(n);}}}printf(m[g]?"%d\n":"NA\n",m[g]-1);}}

Measured memory_bytes: 1456
from sys import stdin
from itertools import repeat
def main():
    r, c = map(int, stdin.readline().split())
    n = int(stdin.readline())
    a = map(int, stdin.read().split(), repeat(10, 3 * n))
    rs = [[] for i in xrange(c)]
    cs = [[] for i in xrange(r)]
    for i in xrange(n):
        a[i*3] -= 1
        y = a[i*3]
        a[i*3+1] -= 1
        x = a[i*3+1]
        rs[x].append((y, a[i*3+2]))
        cs[y].append((x, a[i*3+2]))
    v = [None] * c
    rd = [None] * r
    st = []
    pu = st.append
    po = st.pop
    for i in xrange(c):
        if v[i] is not None:
            continue
        if not rs[i]:
            continue
        mnc = rs[i][0][1]
        pu((rs[i][0][0], rs[i][0][1], i, 0))
        mnr = 0
        while st:
            y, base, x, dr = po()
            for nx, val in cs[y]:
                tmp = val - dr
                if v[nx] is None:
                    v[nx] = tmp
                    if mnc > tmp:
                           mnc = tmp
                    for ny, nval in rs[nx]:
                        if not rd[ny]:
                            rd[ny] = 1
                            if 0 > nval - tmp < -mnr:
                                mnr = tmp - nval
                            pu((ny, nval, nx, nval - tmp))
                elif v[nx] != tmp:
                    print "No"
                    return
        if mnc < mnr:
            print "No"
            return
    print "Yes"
main()

Measured memory_bytes: 55588
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int N;
double x[10];
string u[10];

int main(){
    cin>>N;
    rep(i,N) cin>>x[i]>>u[i];

    double ans=0;
    rep(i,N){
        if(u[i]=="JPY"){
            ans+=x[i];
        }else{
            ans+=380000.0*x[i];
        }
    }

    cout<<setprecision(16)<<ans<<endl;
}

Measured memory_bytes: 256
// Problem : C - Scc Puzzle
// Contest : AtCoder - AtCoder Beginner Contest 055
// URL : https://atcoder.jp/contests/abc055/tasks/arc069_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

#define spc ' '
#define endl '\n'

using namespace std;


int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	unsigned long long n, m;
	cin >> n >> m;
	if(n>=m){
	    cout << m/2;
	}
	else{
	    m-=n*2;
	    cout <<  n + m/4;
	}
	return 0;
}

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

main() {
    int X,Y,x,y; cin >> X >> Y >> x >> y;
    int c;
    if(X/2==x && X%2==0 && Y/2==y && Y%2==0)c=1; 
    else c=0;
    cout << fixed << setprecision(6) << (double)X*Y/2 << " " << flush;
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,y,ans,ic,uc,hc;
int main(){
    cin>>n>>y;


    for(int i=0;i<n+1;i++){
        if(1000*i>y||i>n)break;
        for(int u=0;u<n+1;u++){
            if(1000*i+5000*u>y||i+u>n)break;
            for(int h=0;h<n+1;h++){
                if(1000*i+5000*u+10000*h>y||i+u+h>n)break;
                if(1000*i+5000*u+10000*h==y&&i+u+h==n){
                    ic=h;
                    uc=u;
                    hc=i;
                    ans=1;
                    break;
                }
            }if(ans)break;
        }if(ans)break;
    }

    for(int i=0;i<1000000000*1000;i++){
        int aho;
    }








    if(ans==1){
        cout<<ic<<" "<<uc<<" "<<hc<<endl;
    }else{
        cout<<"-1 -1 -1"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
ll x;

int main() {
    cin >> x;
    ll lo = 1, hi = 1e9;
    while(lo < hi){
        ll md = lo + (hi - lo)/2;
        if(md * (md + 1)/2 >= x)
            hi = md;
        else
            lo = md + 1;
    }
    cout << lo << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

ll n, q;
string s;

void solve() {
    ll k;
    cin >> k;
    ll d = 0, m = 0, dm = 0, ans = 0;
    rep(i, n) {
        if (i >= k) {
            if (s[i - k] == 'D') {
                dm -= m;
                d--;
            }
            else if (s[i - k] == 'M') {
                m--;
            }
        }
        if (s[i] == 'D') {
            d++;
        }
        else if (s[i] == 'M') {
            m++;
            dm += d;
        }
        else if (s[i] == 'C') {
            ans += dm;
        }
    }
    cout << ans << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    cin >> n >> s >> q;
    rep(i, q) solve();
    return 0;
}


Measured memory_bytes: 4260
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    X = I()

    ans = 0
    for i in range(1, int(X ** 0.5) + 1):
        for j in range(2, max(int(math.log2(X)) + 1, 3)):
            tmp = i ** j
            if tmp <= X:
                ans = max(tmp, ans)

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10284
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int a, b;
    cin >> a >> b;
    cout << max({a+b, a-b, a*b}) << endl;
}

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

using namespace std;

typedef long long ll;

int main()
{
	ll sum=0,ans=0;
	ll n,a;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a);
		if(a==0)
		{
			ans+=sum/2;
			sum=0;
		} 
		else
			sum+=a;
	}
	if(sum)
		ans+=sum/2;
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
  
namespace ConsoleApplication32
{
    class Program
    {  
      static void Main()
      {
		  int a = int.Parse(Console.ReadLine());
		  double[] b = new double[a];
		  string d,e,f,g,h,i;
		  d=e=f=g=h=i="";
		  for(int c =0; c<a;c++)
		  {
		  b[c]=double.Parse(Console.ReadLine());
		  if(b[c]<165)
		  d+="*";
		  if(b[c]>=165&&b[c]<170)
		  e+="*";
		 if(b[c]>=170&&b[c]<175)
		  f+="*";
		 if(b[c]>=175&&b[c]<180)
		  h+="*";
		 if(b[c]>=180&&b[c]<185)
		  i+="*";
		 if(b[c]>=185)
		  g+="*";
		 
	  }
	  Console.WriteLine("1:{0}",d);
	   Console.WriteLine("2:{0}",e);
	    Console.WriteLine("3:{0}",f);
	     Console.WriteLine("4:{0}",h);
	      Console.WriteLine("5:{0}",i);
	       Console.WriteLine("6:{0}",g);
	  }
  }
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

vector<ll> fact,inv;

ll f(ll a,ll b, ll p){  // a^b mod pを求める
	if (b == 0)return 1;
	else if (b % 2 == 0){
		ll d = f(a,b/2,p);  //a^b = a^(2k) = (a^k)^2  k = b / 2
		return d * d % mod;
	}else{
		return a * f(a,b-1,p) % mod;
	}
}

void init(ll n){
	fact.resize(n+1,1);
	inv.resize(n+1,1);
	for(int i = 2; i <= n; i++)  //　nまでの階乗を求める
		fact[i] = fact[i-1] * i % mod;
	for(int i = 2; i <= n; i++)  //a^(-1) mod p = a^(p-2) mod p  ここをもう少し早くできるぽい
		inv[i] = f(fact[i],mod-2,mod) % mod;
}

ll comb(ll n,ll k){  //n_C_k
	if (n < k) return 0;
	return (fact[n] * inv[k] % mod) * inv[n-k] % mod;
}

ll func(ll k,ll i){
	if(k<i)return 0;
	if(i==1)return 1;
	return comb(k-1,i-1);
}

int main()
{
	ll n,k;
	cin>>n>>k;

	init(2*n);

	repi(i,1,k+1){
		ll ans = comb(n-k+1,i);
		ans *= func(k,i);
		cout<<ans%mod<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());???????????????
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

long s[100001];
long a[100001];
long cnt[100001];

int main() {
	memset(cnt, 0, sizeof(cnt));
	long n, m;
	cin >> n >> m;
	for (long i = 1; i <= n - 1; ++i) {
		cin >> s[i];
	}
	for (long i = 0; i < m; ++i) {
		cin >> a[i];
	}
	long mp = 1;						//???????????¨??????
	for (long i = 0; i < m; ++i) {
		long x = mp, y = mp + a[i];
		mp += a[i];
		if (x > y) { swap(x, y); }
		++cnt[x]; --cnt[y];
	}
	long ans = 0;
	for (long i = 1; i < n; ++i) {
		cnt[i] += cnt[i - 1];
		ans += s[i] * cnt[i];
	}
	cout << ans % 100000 << endl;

	return 0;
}

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

typedef long long ll;

int main() {
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    int ans = 1e9;
    rep(i, max(X, Y) + 1) {
        ans = min(ans, i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B);
    }
    cout << ans << endl;
}

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


using namespace std;
typedef long long LL;
const int maxn = 100010;
string op;

bool judge(int &s, int &e, int &l)
{
    int mid = (e - s) / 2 + s;
    if(mid == s)
        mid++;
    printf("%d\n", mid);
    fflush(stdout);
    cin>>op;
    if(op == "Vacant")
        return true;
    else
    {
        int m;
        if(op == "Male")
            m = 1;
        else
            m = 2;
        if((s % 2 == mid % 2 && l == m ) || (s % 2 != mid % 2 && l != m ))
        {
            s = mid;
            l = m;
        }
        else
        {
            e = mid;
        }
        return false;
    }
}

int main()
{
    int n, s, e, l;
    scanf("%d", &n);
    printf("0\n");
    fflush(stdout);
    cin>>op;
    if(op == "Vacant")
        return 0;
    else
    {
        if(op == "Male")
            l = 1;
        else
            l = 2;
        s = 0;
        e = n - 1;
        while(!judge(s, e, l));
        return 0;
    }
    return 0;
}


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

/*vector<int> p(n);
cin >> p[i]*/

int main(){

    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int k;
    cin >> k;

    cout << a[k-1] << endl;
    
    return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << max(a + b, max(a - b, a * b)) << endl;
  return 0;
}

Measured memory_bytes: 256
N, W = map(int, input().split())
goods = [list(map(int, input().split())) for i in range(N)]
V = sum([x[1] for x in goods])
INF = 10**10
dp = [[INF]*(V+1) for i in range(N+1)]
for i in range(N+1):
    dp[i][0] = 0
for i in range(N):
    for j in range(V):
        if j+1 >= goods[i][1]:
            dp[i+1][j+1] = min(dp[i][j+1], dp[i][j+1-goods[i][1]] + goods[i][0])
        else:
            dp[i+1][j+1]= dp[i][j+1]
ans = 0
for i in range(V):
    if dp[N][i+1] <= W:
        ans = i+1
print(ans)

Measured memory_bytes: 119916
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
static const int N = 36;

int isStable(char [N][3],char [N][3]);
int n;

int main(){
  int i,j,a,b,stable[2];
  char A[N][3];
  char B[N][3];
  char C[N][3];
  char swap[3];
  int minj;

  scanf("%d",&n); /*Input an integer n, the number of elements in sequence*/

  for(i=0;i<n;i++){
    scanf("%s",A[i]);/* Input N elements of the sequence*/
  }
  for(i=0;i<n;i++){
    strcpy(B[i],A[i]);
    strcpy(C[i],A[i]);
  }
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(B[j][1]<B[j-1][1]){
	strcpy(swap,B[j]);
        strcpy(B[j],B[j-1]);
        strcpy(B[j-1],swap);
      }
     }
    }
  for(i=0;i<n;i++){
      if(i<n-1) printf("%s ",B[i]);/*Output the sorted sequence*/
      else printf("%s\n",B[i]);
    }
  
  stable[0]=isStable(A,B);
  if(stable[0]==1) printf("Not stable\n");
  else printf("Stable\n");

  for(i=0;i<n;i++){
      minj = i;
     for(j=i;j<n;j++){
       if(C[j][1]<C[minj][1])
	minj = j;
     }
     if(i!=minj){
        strcpy(swap,C[i]);
        strcpy(C[i],C[minj]);
        strcpy(C[minj],swap);
       }
      }
    for(i=0;i<n;i++){
      if(i<n-1) printf("%s ",C[i]);/*Output the sorted sequence*/
      else printf("%s\n",C[i]);
    }
     stable[1]=isStable(A,C);
     if(stable[1]==1) printf("Not stable\n");
     else printf("Stable\n");

    return 0;
   } 

int isStable(char in[N][3], char out[N][3]){
  int i,j,a,b;
   for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      for(a=0;a<n;a++){
	for(b=a+1;b<n;b++){
	  if((in[i][1]== in[j][1]) && (strcmp(in[i],out[b])==0)&& (strcmp(in[j],out[a])==0)) return 1;
          
	}
       }
      }
     }
      return 0;
}

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

using namespace std;
#define int long long

signed main(){
    string s;
    cin >> s;
    
    int C=0,F=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='C') C++;
        if(C>0 && s[i]=='F') F++;
    }
    
    if(C>0 && F>0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

const bool DEBUG = false;

int N, D;

void input() { cin >> N >> D; }

int main(int argc, char const *argv[]) {
  input();

  int ans = N / (2 * D + 1);
  if (N % (2 * D + 1) != 0) ans++;
  cout << ans << endl;
  return 0;
}


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

typedef unsigned long long ll;
#define M 1000000007

ll pow(ll m, ll n){
	  if(n==0) return 1;
	  if(n%2==1)	return pow(m*m%M,n/2) % M * m % M;
	  return pow(m*m%M,n/2) % M;
}

int main(){

	  ll m,n; cin >> m >> n;
	  cout << pow(m,n)%M << endl;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int a, b;
	cin >> a >> b;
	string hu, re;
	int ans = 0;
	for (int i = a; i <= b; ++i)
	{
		hu = re = to_string(i);
		reverse(re.begin(), re.end());
		ans += (hu == re);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    ll x;
    cin>>x;
    ll y[x];
    ll sum=0;
    for (int i=0;i<x;i++){
        cin>>y[i];
        sum+=y[i];
    }
    ll ans=0;
    for (int i=0;i<x;i++){
      ans+=y[i]*(sum-y[i]);
    }
    cout<<ans/2;
    return 0;
}


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

int main()
{
   const long long int MX=1e6+6;
   bool prime[MX];
   prime[0]=prime[1]=0;
   for(long long int i=2;i<=MX;i++)prime[i]=true;
   for(long long int i=2;i<=MX;i++){ 
       if(prime[i]==true){
           for(long long int j=i*i;j<=MX;j+=i){ 
               prime[j]=false;
           } } } 
           
           int n;
           cin>>n;
           for(int i=n; ;i++){ 
               if(prime[i]){ 
                   return cout<<i,0;
               }
           }
 

     
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define mat vector<vec>

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

vector<vector<ll>> bunkai(ll a){
  if(a<=0) return {};
  if(a==1) return {{1,1}};
  vector<ll> f;
  ll b=a;
  for(ll i=2;i*i<=a;i++){
    if(b%i==0){
      f.push_back(i);
      b=b/i;
      i--;
    }
  if(b==1)break;
  }
  if(b!=1)f.push_back(b);

  vector<vector<ll>> u;
  ll p=f[0];
  ll c=1;
  for(ll i=1;i<f.size();i++){
    if(f[i]==p)c++;
    else{
      u.push_back({p,c});
      p=f[i];
      c=1;
    }
  }
  u.push_back({p,c});

  return u;
}

ll powmod(ll a,ll n,ll m) {
    if(n == 0)
        return 1;

    if(n % 2 ==0){
        ll r = powmod(a,n/2,m);
        return r*r % m;
    }

    return a*powmod(a,n-1,m)%m;
}

ll factmod(ll a,ll b,ll m) {
  if(a<b)return 0;
  ll s=1;
  while(a>=b){
    s = s*a % m;
    a -= 1;
  }
  return s;
}

ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

ll combmod(ll a,ll b,ll m){
  if(b==0)return 1;
  ll c=factmod(a,a-b+1,m);
  ll d=modinv(factmod(b,1,m),m);
  ll e=(c*d)%m;
  return e;
}

void modsum(ll &a,ll b,ll m){
  a+=b;
  a%=m;
}

void modsub(ll &a,ll b,ll m){
  a-=b;
  a+=m;
  a%=m;
}

void modmul(ll &a,ll b,ll m){
  a*=b;
  a%=m;
}

void modquo(ll &a,ll b,ll m){
  a*=modinv(b,m);
  a%=m;
}

int main(){

  ll n,m;
  cin >> n >> m;

  mat f=bunkai(m);
  ll ans=1;

  if(m==1){
    cout << 1 << endl;
    return 0;
  }

  for(ll i=0;i<f.size();i++){
    modmul(ans,combmod(f[i][1]+n-1,n-1,mod),mod);
  }

  cout << ans << endl;

}

Measured memory_bytes: 3616
#include<cstdio>
#include<algorithm>
using std::min;

const int N=200000;

int main()
{
	int a,b,n,Min=0x5FFFFFFF;
	long long S=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d %d",&a,&b);
		S+=a;
		if(a>b)
			Min=min(Min,b);
	}
	if(Min==0x5FFFFFFF)
		puts("0");
	else
		printf("%lld\n",S-Min);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
struct edge { int to, cost; };
vector<edge> G[21];
int search(int start, int goal)
{
    //first := cost, second := now vertex
    priority_queue<P, vector<P>, greater<P>> que;
    vector<int> dist(21, INF);
    que.push(P(0, start));
    dist[start] = 0;
    while(not que.empty())
    {
        P now = que.top(); que.pop();
        if(now.second == goal) break;
        if(dist[now.second] < now.first) continue;
        for(int u = 0; u < G[now.second].size(); u++)
        {
            edge e = G[now.second][u];
            if(now.first + e.cost < dist[e.to])
            {
                dist[e.to] = now.first + e.cost;
                que.push(P(dist[e.to], e.to));
            }
        }
    }
    return dist[goal];
}
int main()
{
    int n, m; cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int a, b, c, d;
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        G[a].push_back({b, c});
        G[b].push_back({a, d});
    }
    int start, goal, v, p;
    scanf("%d,%d,%d,%d", &start, &goal, &v, &p);
    int ans = v - p;
    int a = search(start, goal);
    int b = search(goal, start);
    cout << ans - a - b << endl;
    return 0;
}




Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>

using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	ll N;
	cin >> N;
	vector<ll> V(N, 0);
	for (ll n = 0; n < N; n++)cin >> V[n];
	sort(V.begin(), V.end(), [](ll a, ll b) {return a < b; });
	cout << V.back() - V[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import math

N = 1000000

TABLE = [True] * N

def sieve():
    TABLE[1] = False

    sqrtn = int(math.sqrt(N))

    for i in range(2, sqrtn+1):
        if TABLE[i]:
            for j in range(2*i, N, i):
                TABLE[j] = False

    """
    for i in range(4, N, 2):
        TABLE[i] = False

    for i in range(6, N, 3):
        TABLE[i] = False

    for i in range(6, N, 6):
        p1 = 6*i - 1
        p2 = 6*i + 1

        if p1 >= N: break

        if TABLE[p1]:
            for j in range(2*p1, N, p1):
                TABLE[j] = False

        if p2 >= N: break

        if TABLE[p2]:
            for j in range(2*p2, N, p2):
                TABLE[j] = False
    """

def main():
    sieve()

    for line in sys.stdin:
        n = int(line)

        cnt = sum(map(lambda k: TABLE[k], range(1, n+1)))
        print(cnt)

if __name__ == "__main__": main()

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    if (a < b) {
        rep(i, b) cout << a;
    } else {
        rep(i, a) cout << b;
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std ;

typedef long long ll ;
#define rep (i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N, T;
	
	cin >> N >> T;

	ll a[N];

	#if 0
	int pre = -1;
	std::vector<ll> v;

	for (int i = 0; i < N; i++)
	{
		cin >> a[i];
		if (pre == -1)
		{
			pre = a[i];
		}
		else if (a[i] < a[i-1] )
		{
			v.pb(a[i-1] - pre);
			pre = a[i];
		}
		else if (i == N-1)
		{
			v.pb(a[i] - pre);
		}
		
	}

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

	int count = 1;
	//cout << v.size() << "; cc:" << endl;
	for (int i = v.size() - 2; i >= 0; i--)
	{
		//cout << v[i] << endl;
		if (v[i] == v[v.size()-1])
		{
			count++;
		}
	}
	#endif
	std::vector<ll> v;
	for (int i = 0; i < N; i++)
	{
		cin >> a[i];
	}
	int max = a[N-1];

	int count = 0;
	for (int i = N - 1; i >= 0; i--)
	{
		if (max > a[i])
		{
			v.pb(max-a[i]);
		}
		else
		{
			max = a[i];
		}
	}
	sort(v.begin(), v.end());

	for (int i = v.size() - 1; i >= 0; i--)
	{
		if (v[i] == v[v.size() - 1])
		{
			count++;
		}
	}
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 2168
//iが有限なら、そんなに長く一致することはないだろうという雑な考察
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

void z_algo(string &s, vector<int> &A) {
	A.resize(s.length());
	
	int j = 0;
	for (int i = 1; i < s.length(); ) {
		while (i + j < s.length() && s[j] == s[i + j]) {
			j++;
		}
		A[i] = j;
		if (j == 0) { i++; continue; }
		
		int l = i + 1, r = i + j;
		while (l < r) {
			if (l + A[l - i] < r) {
				A[l] = A[l - i];
				l++;
			}
			else {
				break;
			}
		}
		i = l;
		j = r - l;
	}
	A[0] = s.length();
	
	/*cout << "s = " << s << endl;
	for (int i = 0; i < s.length(); i++) {
		cout << "A[" << i << "] = " << A[i] << endl;
	}*/
}

string s, t;

int main() {
	cin >> s >> t;
	
	string tmp = s;
	while (s.length() < t.length()) {
		s += tmp;
	}
	int slen = s.length();
	int tlen = t.length();
	
	//s.length() >= t.length()と仮定する。答えiが有限ならば、一致する長さは2 * s.length()未満
	//になるはず。つまり、s + s + sとtの周期文字列が2 * s.length()以上一致するかを判定したい。
	//2 * s.length()以上の長さでtの周期文字列を何でもいいから生成。その後、z-algorithmを適用する。
	tmp = t;
	while (t.length() < 2 * slen) {
		t += tmp;
	}
	
	s = t + "." + s + s + s;
	
	vector<int> A;
	z_algo(s, A);
	
	int i;
	int maxLen = 0;
	for (i = t.length() + 1; i < t.length() + 1 + slen;  i++) {
		if (A[i] >= 2 * slen) {
			cout << "-1" << endl;
			return 0;
		}
		maxLen = max(maxLen, A[i]);
	}
	
	cout << maxLen / tlen << endl;
	return 0;
}

Measured memory_bytes: 29196
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main(){
    long long X,Y,A,B,C;
    long long ans=0;
    cin >> X >> Y >> A >> B >> C;
    long long P[A];
    long long Q[B];
    vector<long long> v = {};
    long long tmp;

    for(long long i=0;i<A;i++)cin >> P[i];
    for(long long i=0;i<B;i++)cin >> Q[i];
    for(long long i=0;i<C;i++){
        cin >> tmp;
        v.push_back(tmp);
    }
    sort(P, P+A);
  
    for(long long i=0;i<min(X,A);i++){
        v.push_back(P[A-1-i]);
    }
    sort(Q, Q+B);
    for(long long i=0;i<min(Y,B);i++){
        v.push_back(Q[B-1-i]);
    }
    sort(v.begin(), v.end());
  //for(long long i=0;i<(min(A,X)+min(B,Y)+C);i++)cout <<  v[i] << endl;
    for(int i=0;i<(X+Y);i++){
        ans += v[(min(A,X)+min(B,Y)+C)-1-i];
      //cout << v[-1-i] << endl;
    }
    cout << ans << endl;
    

}

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

using namespace std;
typedef long long ll;

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

  int one = 0;
  int zero = 0;
  for (int i = 0; i < s.length(); i++)
  {
    if (s[i] == '0')
    {
      zero++;
    }
    else
    {
      one++;
    }
  }

  cout << 2 * std::min(one, zero) << endl;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(ll i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll n; cin >> n;
    vector<ll> lis(n+1), ruiseki(n+1);
    REP(i, 0, n+1){cin >> lis[i];}
    ruiseki[n] = lis[n];
    for(int i = n-1; i >= 0; i--){
        ruiseki[i] = ruiseki[i+1] + lis[i];
    }
    if(n == 0){
        if(lis[0] == 1){
            cout << 1 << endl;
            return 0;
        }else if(lis[0] == 0){
            cout << 0 << endl;
            return 0;
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    vector<ll> tree(n+1);
    if(lis[0] == 1){
        cout << -1 << endl;
        return 0;
    }
    tree[0] = 1;
    ll next = tree[0];
    for(int i = 1; i < n+1; i++){
        tree[i] = min(ruiseki[i], next*2);
        next = tree[i] - lis[i];
        if(next < 0){
            cout << -1 << endl;
            return 0;
        }
    }
    ll ans = 0;
    REP(i, 0, n+1){
        ans += tree[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 5636