akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main implements Runnable {


    private void solve() throws IOException {

        int N = nextInt();
        TreeSet<Integer> ts = new TreeSet<>();
        HashMap<Integer,Integer> hm = new HashMap<>();
        HashMap<Integer,Integer> times = new HashMap<>();
        int max = 0;
        for(int i = 0; i < N; ++i) {
            int cur = nextInt();
            max = Math.max(max, cur);
            ts.add(cur);
            if(!hm.containsKey(cur)) {
                hm.put(cur, i);
            }
            if(!times.containsKey(cur)) {
                times.put(cur, 1);
            } else {
                times.put(cur,times.get(cur) + 1);
            }
        }
        long[] ret = new long[N];
        while(true) {
            Integer need = ts.lower(max);
            if(need == null) {
                ret[(hm.get(max))] += (long)times.get(max) * (long)(max);
                break;
            } else {
                long diff = max - ts.lower(max);
                ret[(hm.get(max))] += (long)times.get(max) * (long)(diff);
                times.put(need,times.get(need) + times.get(max));
                if(hm.get(max) < hm.get(need)) {
                    hm.put(need,hm.get(max));
                }
                max = need;
            }
        }
        for(int i = 0; i < ret.length; ++i) {
            writer.println(ret[i]);
        }

    }



    public static void main(String[] args) {
        new Main().run();
    }

    BufferedReader reader;
    //    BufferedReader reader2;
    StringTokenizer tokenizer;
    PrintWriter writer;
    //    BufferedWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
//            reader = new BufferedReader(new FileReader("highcard.in"));
            //            reader2 = new BufferedReader(new FileReader("1.in"));
            tokenizer = null;
            writer = new PrintWriter(System.out);
//            writer = new     PrintWriter("highcard.out");
//                                                    writer = new BufferedWriter(System.out);
            //                        writer = new BufferedWriter(new OutputStreamWriter(System.out));
            solve();
            reader.close();
            //            reader2.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    short nextShort() throws IOException {
        return Short.parseShort(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }

        return tokenizer.nextToken();
    }

}

Measured memory_bytes: 69172
import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

// import java.text.DecimalFormat; 
// import java.text.DecimalFormatSymbols; 

public class Main {

	public static final int m = (int)1e9+7;
	
    public static void main(String args[] ) throws Exception {
        PrintWriter pw=new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        
        int n = sc.nextInt();
        long[] a = new long[n];
        long[] s = new long[n];
        for(int i=0;i<n;i++)
        	a[i] = sc.nextLong();
        
        s[n-1]=a[n-1];
        for(int i=n-2;i>=0;i--) {
        	s[i] = a[i]+s[i+1];
        	if(s[i]>=m) {
        		s[i]-=m;
        	}
        }
        
        long ans=0;
        for(int i=0;i<n-1;i++) {
        	ans +=(a[i]*s[i+1]);
        	if(ans>=m) {
        		ans=ans%m;
        	}
        }
        
        pw.print(ans);
        pw.close();
    }
    
    
    
    
    
    
   
   static <T> void deb(T x){
       System.out.println(x);
   }
   
   
   static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		public String next(int k) {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "Not able to read";
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
		
	    
	}
   
}

Measured memory_bytes: 57252
N,M=map(int,input().split())

L=[]
for i in range(N):
    x,y,z=map(int,input().split())
    L.append([x,y,z])

A=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]

ans=-1000000000000
B=[]
for i in range(8):
    for j in range(N):
        B.append(A[i][0]*L[j][0]+A[i][1]*L[j][1]+A[i][2]*L[j][2])
    B.sort(reverse=True)
    cnt=0
    for k in range(M):
        cnt+=B[k]
    if cnt>ans:
        ans=cnt
    B=[]
print(ans)

Measured memory_bytes: 40048
#include <iostream>
#include <vector>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<char> rev;
  rev.push_back(s[0]);
  for(int i=1;i<s.size();i++){
    if(s[i-1] != s[i]){
      rev.push_back(s[i]);
    }
  }

  int ans = rev.size()-1;

  cout << ans << endl;
}


Measured memory_bytes: 640
#include<cmath>
#include<cstdio>

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

using namespace std;

const double PI=acos(-1);

int R,r,d;

double f(double t){
	double a=1-(double)R/r;
	double x_dash=-(R-r)*sin(t)-a*d*sin(a*t);
	double y_dash= (R-r)*cos(t)+a*d*cos(a*t);
	return sqrt(x_dash*x_dash+y_dash*y_dash);
}

int main(){
	for(;scanf("%d%d%d",&R,&r,&d),R;){
		int k;
		if(d==0) k=1; // hypotrochoid が縮退して円になっている
		else{
			for(k=1;k*(r-R)%r!=0;k++);
		}
		double T=2*k*PI; // 周期

		double ans=0;
		int n=10000; // 何等分するか
		rep(i,n){
			double t1=T*i/n,t2=T*(i+1)/n;
			ans+=f((t1+t2)/2)*(t2-t1);
		}
		printf("%.9f\n",ans);
	}

	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N=in();
	vector<ll> A=vecin<ll>(N);
	sort(ALL(A));
	vector<ll> S(N+1,0);
	REP(i,N){
		S[i+1] = S[i]+A[i];
	}
	reverse(ALL(A));
	int sum=0;
	REP(i,N){
		if(!i) sum++;
		else{
			if(2*S[N-i]>=A[i-1]) sum++;
			else break;
		}
	}
	
	out(sum);
	return 0;
}


Measured memory_bytes: 1792
l = str(input())

c = 0

for i in range(len(l)):
  if l[i] == "a":
    c += 1
  elif l[i] == "e":
    c += 1
  elif l[i] == "i":
    c += 1
  elif l[i] == "o":
    c += 1
  elif l[i] == "u":
    c += 1
  else:
    c +=0

if c > 0:
  print("vowel")
else:
  print("consonant")

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){

	vector<int> w( 10, 0 );
	vector<int> k( 10, 0 );
	
	for( int i = 0; i < 10; i++)
		cin >> w[i];
	for( int i = 0; i < 10; i++)
		cin >> k[i];

	sort( w.begin(), w.end() );
	sort( k.begin(), k.end() );

	cout << w[9] + w[8] + w[7] << " " << k[9] + k[8] + k[7] << endl;

    return 0;
}

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

#define ll long long
ll dp[100005], hgt[100005], n, k;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	cin >> n >> k;
	for (ll i = 0; i < n; i++) {
		cin >> hgt[i];
	}
	dp[0] = 0; dp[1] = abs(hgt[1] - hgt[0]);
	for (ll i = 2; i < n; i++) {
		dp[i] = INT_MAX;
		for (int j = 1; j <= k; j++) {
			if (i - j < 0) {
				break;
			}
			dp[i] = min (dp[i], dp[i - j] + abs(hgt[i] - hgt[i - j]));
		}
	}
	cout << dp[n - 1] << "\n";
	return 0;
}

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

int main(){
	char input[1000];
	for(int i=0; i < 1000; i++) input[i] = '\0';
	while(scanf("%c", input) != EOF){
		for(int i=0; i < strlen(input); i++){
			if('a' <= input[i] && input[i] <= 'z'){
				input[i] += 'A' - 'a';
			}
			cout << input[i];
			input[i] = '\0';
		}
	}
}

Measured memory_bytes: 1112
#include <stdio.h>

typedef struct _Gem{
	int x;
	int y;
	bool hit;
} Gem;

static void
pick_gem(Gem* g, int n, int x, int y)
{
	for (int i = 0; i < n; i++) {
		if (!g[i].hit && g[i].x == x && g[i].y == y) {
			g[i].hit = true;
			return;
		}
	}
}

static bool
check_gem(Gem* g, int n)
{
	for (int i = 0; i < n; i++) {
		if (g[i].hit == false) {
			return false;
		}
	}
	
	return true;
}

int
main(void)
{
	
	char line[80];
	int n;
	int m;
	
	Gem g[20];
	
	char d[30];
	int l[30];

	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d", &n) != 1) {
			return 1;
		}

		if (n == 0) {
			break;
		}

		for (int i = 0; i < n; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			if (sscanf(line, "%d %d", &(g[i].x), &(g[i].y)) != 2) {
				return 1;
			}
			g[i].hit = false;
		}
		
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d", &m) != 1) {
			return 1;
		}
		
		for (int i = 0; i < m; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			if (sscanf(line, "%c %d", &(d[i]), &(l[i])) != 2) {
				return 1;
			}
		}
		
		int x = 10;
		int y = 10;
		for (int i = 0; i < m; i++) {
			if (d[i] == 'N') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, x, ++y);
				}
			} else if (d[i] == 'S') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, x, --y);
				}
			} else if (d[i] == 'E') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, ++x, y);
				}
			} else {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, --x, y);
				}
			}
		}
		printf("%s\n", (check_gem(g, n) ? "Yes" : "No"));
	}

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    long long a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;
    if(a>b) swap(a,b);
    a+=v*t;
    b+=w*t;
    if(a>=b) cout<<"YES\n";
    else cout<<"NO\n";
}

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

    solve();
    return 0;
}

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

int main() {
    int n; cin >> n;
    vector<int> h(n);
    for (int &hi: h) cin >> hi;
    bool ok = true;
    h[0]--;
    for (int i = 1; i < n; i++) {
        if (h[i - 1] > h[i]) ok = false;
        else if (h[i - 1] < h[i]) h[i]--;
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 640
// https://atcoder.jp/contests/abc102/tasks/arc100_b

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%lld%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 2*1e5;
const int A_I_MAX = 1e9;
const ll INF = 1e18;

struct half_sum {
  ll v1;
  ll v2;
  ll d() { return abs(v1 - v2); };
};

int N;
int A[N_MAX];

ll acc[N_MAX + 1];
ll sums[4];

vector<half_sum> half_cand(int s, int t) {
  vector<half_sum> ret;
  half_sum hs1, hs2;
  int i = upper_bound(acc + s, acc + t, (acc[s] + acc[t]) / 2) - acc;
  // printf("  s: %d, t: %d, i: %d\n", s, t, i);
  hs1 = { acc[i - 1] - acc[s], acc[t] - acc[i - 1] };
  hs2 = { acc[i] - acc[s], acc[t] - acc[i] };
  // printf("  hs1: %lld %lld\n", hs1.v1, hs1.v2);
  // printf("  hs2: %lld %lld\n", hs2.v1, hs2.v2);
  if (hs1.v1 > 0 && hs1.d() <= hs2.d()) ret.push_back(hs1);
  if (hs1.v1 == 0 || hs1.d() >= hs2.d()) ret.push_back(hs2);
  return ret;
}

void solve() {
  ll ans = INF;
  REP(i, N) acc[i + 1] = acc[i] + A[i];
  // DUMP(acc, N + 1);
  FOR(k, 2, N - 2) {
    // printf("k: %d\n", k);
    auto hss1 = half_cand(0, k);
    auto hss2 = half_cand(k, N);
    for (auto hs1 : hss1) for (auto hs2 : hss2) {
      sums[0] = hs1.v1;
      sums[1] = hs1.v2;
      sums[2] = hs2.v1;
      sums[3] = hs2.v2;
      // printf("  sums: "); DUMP(sums, 4);

      ll d = *max_element(sums, sums + 4) - *min_element(sums, sums + 4);
      // printf("  d: %lld\n", d);
      ans = min(ans, d);
    }
  }
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N) scanf("%d", A + i);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 2688
use proconio::input;

fn main() {
    input! {
        a: i32,
        b: i32,
        _c: i32,
        mut k: i32
    }

    let mut sum = 0;

    if a <= k {
        sum += a;
    } else {
        sum = k;
    }
    k = k - a;

    k = k - b;

    if k > 0 {
        sum = sum - k;
    }
    println!("{}", sum);
}


Measured memory_bytes: 2140
import java.util.*;

public class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		List<Map<Integer, Double>> group = new ArrayList<>();
		for(int i = 0; i < 3; i++){
			Map<Integer, Double> g = new TreeMap<>();
			for(int j = 0; j < 8; j++){
				String line = sc.nextLine();
				g.put(Integer.valueOf(line.split(" ")[0]), Double.valueOf(line.split(" ")[1]));
			}
			group.add(g);
		}
		sc.close();
		
		//1st and 2nd
		group.forEach(G -> 
			G.entrySet().stream()
			.sorted(Comparator.comparingDouble(Map.Entry<Integer, Double>::getValue))
			.limit(2)
			.forEach(E -> System.out.printf("%d %.2f\n", E.getKey(), E.getValue()))
		);
		
		//consolation
		Map<Integer, Double> consolation = new TreeMap<>();
		group.forEach(G -> G.entrySet()
			.stream()
			.sorted(Comparator.comparingDouble(Map.Entry<Integer, Double>::getValue))
			.skip(2)
			.forEach(E -> consolation.put(E.getKey(), E.getValue())));
		consolation.entrySet()
			.stream()
			.sorted(Comparator.comparingDouble(Map.Entry<Integer, Double>::getValue))
			.limit(2)
			.forEach(C -> System.out.printf("%d %.2f\n", C.getKey(), C.getValue())
		);
	}
	
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvb = vector<vb>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;
constexpr int dx[2] = {0, 1};
constexpr int dy[2] = {1, 0};

int bfs(const vvi& a, int maxv) {
    int h = a.size(), w = a[0].size();
    int M = maxv * (h + w) / 2 + 1;

    vector<vector<bool>> seen(h, vector<bool>(w, false));

    queue<pair<int, int>> q;
    q.emplace(0, 0);

    vector<vvb> dp(h, vvb(w, vb(M, false)));
    dp[0][0][a[0][0]] = true;

    // O(H * W * M)
    while (!q.empty()) {
        pair<int, int> curr_cord = q.front();
        q.pop();

        int curr_y = curr_cord.first;
        int curr_x = curr_cord.second;

        if (seen[curr_y][curr_x]) { continue; }
        seen[curr_y][curr_x] = true;

        rep(i, 0, 2) {
            int next_y = curr_y + dy[i];
            int next_x = curr_x + dx[i];

            if (next_y >= h || next_x >= w) { continue; }
            q.emplace(next_y, next_x);

            rep(curr, 0, M) {
                if (!dp[curr_y][curr_x][curr]) { continue; }

                if (curr + a[next_y][next_x] < M) {
                    dp[next_y][next_x][curr + a[next_y][next_x]] = true;
                }
                if (abs(curr - a[next_y][next_x]) < M) {
                    dp[next_y][next_x][abs(curr - a[next_y][next_x])] = true;
                }
            }
        }
    }

    rep(i, 0, M) {
        if (dp[h - 1][w - 1][i]) { return i; }
    }
    return -1;
}

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

    int h, w;
    cin >> h >> w;

    vvi a(h, vi(w));
    rep(y, 0, h) {
        rep(x, 0, w) { cin >> a[y][x]; }
    }

    int maxv = 0;
    rep(y, 0, h) {
        rep(x, 0, w) {
            int b;
            cin >> b;
            a[y][x] = abs(a[y][x] - b);
            maxv = max(maxv, a[y][x]);
        }
    }

    cout << bfs(a, maxv) << endl;
    return 0;
}

Measured memory_bytes: 5760
import math


def run(a, b, x):
    if a*a*b >= 2*x:
        tan = a * (b**2) / (2*x)
    else:
        tan = (2*b) / a - ((2*x) / a**3)
    ret = math.degrees(math.atan(tan))
    return ret


def main():
    a, b, x = map(int, input().split())
    print(run(a, b, x))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/numeric>
#define     __        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define     pi        acos(-1)
#define     ll        long long int
#define     mem(a)    memset(a,0,sizeof(a))
#define     mems(a)   memset(a,-1,sizeof(a))
#define     pii       pair<int,int>
#define     N         200005
using namespace std;

int main()
{
    int a[5];

    for(int i=0;i<3;i++) cin >> a[i];

    sort(a,a+3);

    cout << a[0]+a[1];

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define eb emplace_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3+5;
const lli INF = 1e18;
const lli MOD = 1e9+7;

bool mm[N];
vi primes(1,2);
ld nk[N][N];
void sieve(){
	for(int i = 4; i<N; i+=2)mm[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!mm[i])for(int j = i*i; j<N; j+=i)mm[j]=1;
	for(int i = 3; i<N; i+=2)if(!mm[i])primes.pb(i);
}

void pascal(){
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7

int main(){
	ld a=1,n; cin>>n;
	bool can = 0;
	int z = 0;
	fore(i,0,n){
	 	ld b; cin>>b;
		if(b==0)z++;
		a*=b;
		if(can)if(a>ld(1e18)){can=0; a=-1;}
	}
	if(z)a=0;
	cout<<(a>ld(1e18)?-1:lli(a))<<ENDL;

}


Measured memory_bytes: 3792
n, m = map(int, input() .split())
man = []
Location = []

for i in range(n):
    a, b = map(int, input() .split())
    man.append([a, b])
#print(man)
for i in range(m):
    a, b = map(int, input() .split())
    Location.append([a, b])
#print(Location)

for i in range(n):
    dis = []
    for j in range(m):
        dis.append(abs(man[i][0] - Location[j][0]) + abs(man[i][1] - Location[j][1]))
    print(dis.index(min(dis)) + 1)

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

int main(void){
    int n,a,b;
    cin >> n >> a >> b;
    int train=n*a;
    int ans=min(train,b);
    cout << ans << endl;
    
    return 0;
}












Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt(), A = sc.nextInt(), B = sc.nextInt();
        String S = sc.next();
        int countAB = 0, countB = 0;
        for (int i = 0;i < N;i++){
            if (S.charAt(i) == 'a' && countAB < A+B){
                System.out.println("Yes");
                countAB++;
            } else if (S.charAt(i) == 'b' && countAB < A+B && countB < B){
                System.out.println("Yes");
                countAB++;
                countB++;
            }else{
                System.out.println("No");
            }
        }

    }
}

Measured memory_bytes: 35224
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

ll n;
ll a,b;
int main(){
	cin >> n;
	lp(sqrt(n)) {
		if (n%(i+1) == 0) {
			a = i + 1;
//			cout << a << endl;
		}
	}
	b = n / a;
//	cout << b << endl;
	int cnt = 1;
	lp(10) {
		b = b / 10;
		if (b != 0) {
			cnt++;
		}
		else break;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
// using namespace std;
int N;
int i = 2;
long long num;
char buf[8], out[20];
char k;
s;
size_t ii;
int main()
{
  s = read(0, buf, 8);
  for (;;)

  {
    k = buf[ii++];
    if (k < '0')
      break;
    N = N * 10 + k - '0';
  }
  // printf("%d\n", N);
  long long ans = (long long)N * (N + 1) - 1;

  for (; i * i <= N; i++)
  {
    num = N / i;
    // ans += (long long)(num - i + 1) * i * (i + num) - i * i;
    ans += (num * num - i * i + num) * i;
  }
  printf("%lld\n", ans);
}


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

using namespace std;
using ll = long long;

int main(){
    cout << fixed << setprecision(20);
    int n, k;
    while(cin >> n >> k){
        double ans = 0;
        double coin = 0.5;
        for( int i = 1; i <= n; i++ ){
            int temp = i;
            int cnt = 0;
            while(temp<k){
                cnt++;
                temp = temp*2;
            }

            ans += pow( coin, cnt );
        }
        ans = ans/(double)n;
        cout << ans << "\n";
    }
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if((a < c && c < b) || (a > c && c > b)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
using namespace std;
int main()
{
    int K;
    int arr[33]={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};
    cin>>K;
    cout<<arr[K-1]<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

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

const LL INF=1<<30;
const LL MOD=1000000007;

LL gcd(LL a,LL b){
    if(b==0)return a;

    return gcd(b,a%b);
}


int main(){
    int n;
    cin>>n;
    LL a;
    LL ma=-INF,mi=INF;
    for(int i=0;i<n;++i){
        cin>>a;
        if(ma<=a)ma=a;
        if(mi>=a)mi=a;
    }
    cout<<ma-mi<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a,b;
    string s;
    cin >> a >> b; 
   if(a-b <= 0)
        cout << 0 << endl;
    else cout << a-b << endl;
    return 0;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine(H.Where(v => v >= K).Count());
	}
	int N, K;
	int[] H;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		H = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int n;
int heights[100005];
ll memo[100005];

ll dp(int idx){
    ll &res = memo[idx];
    if(res != -1){
        return res;
    }
    if(idx == n - 1){
        return res = 0;
    }
    if(idx == n - 2){
        return res = dp(idx + 1) + abs(heights[idx] - heights[idx + 1]);
    }
    return res = min(dp(idx + 1) + abs(heights[idx] - heights[idx + 1]), dp(idx + 2) + abs(heights[idx] - heights[idx + 2]));
}
int main(){
    memset(memo, -1, sizeof memo);
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &heights[i]);
    }
    printf("%lld", dp(0));
}


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

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(0LL, c - (a-b)) << '\n';
}


Measured memory_bytes: 256
use std::io::Read;
use std::cmp::Reverse;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();

    let mut graph: Vec<Vec<usize>> = vec![Vec::new(); n];
    for _ in 0..m {
        let a: usize = iterator.next().unwrap().parse().unwrap();
        let b: usize = iterator.next().unwrap().parse().unwrap();
        graph[a - 1].push(b - 1);
        graph[b - 1].push(a - 1);
    }

    const INF: usize = std::usize::MAX;

    let mut ans: Vec<usize> = vec![0; n];

    let mut d: Vec<usize> = vec![INF; n];
    let mut color: Vec<Color> = vec![Color::WHITE; n];
    let mut pq: BinaryHeap<Reverse<(usize, usize)>> = BinaryHeap::new();

    d[0] = 0;
    pq.push(Reverse((0, 0)));
    color[0] = Color::GRAY;

    while !pq.is_empty() {
        let f = pq.pop().unwrap().0;

        let u = f.1;
        color[u] = Color::BLACK;

        if d[u] < f.0 {
            continue;
        }

        for j in 0..graph[u].len() {
            let v = graph[u][j];
            if color[v] == Color::BLACK {
                continue;
            }
            if d[v] > d[u] + 1 {
                d[v] = d[u] + 1;
                ans[v] = u;
                pq.push(Reverse((d[v], v)));
                color[v] = Color::GRAY;
            }
        }
    }

    let mut result = String::from("Yes\n");
    for i in 1..n {
        result.push_str(&format!("{}\n", ans[i] + 1));
    }
    return result.trim().to_string();
}

#[derive(Clone, PartialEq)]
enum Color { WHITE, GRAY, BLACK }


Measured memory_bytes: 16144
n=int(input())
a = [int(i) for i in input().split()]
mod = 10**9+7
ans = 3

red=1
gre=0
blu=0
for i in range(1,n):
    temp=0
    if a[i] == red:
        temp+=1
    if a[i] == gre:
        temp+=1        
    if a[i] == blu:
        temp+=1
    if temp!=0:
        ans*=temp
    
        ans=ans%mod
    if a[i]==red:
        red+=1
        continue
    if a[i]==gre:
        gre+=1
        continue
    if a[i]==blu:
        blu+=1
        continue
    else:
      ans=0
    
if a[0]!=0:
  ans=0
    
print(ans)

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define REP(i,n) for (int i = 0; i < n; ++ i)
#define FOR(i,a,b) for (int i = a; i <= b; ++ i)
#define FORD(i,b,a) for (int i = b; i >= a; -- i)
#define debug(x) cerr << #x << ": " << x << "\n"
#define task ""
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> li;
typedef vector<int> vi;

const int N = 1000 + 5;
const int M = 2000 + 5;
const ll md = 1e9 + 7;
struct Edge{
	int u, v, c;
	bool operator < (Edge oth) {
		return c < oth.c;
	}
} e[M]; 
int n, m, lab[N], rnk[N];
ll x;

ll Pow(int x) {
	if (x == 0) return 1;
	else {
		ll res = Pow(x / 2);
		res = res * res % md;
		if (x % 2) res = res * 2 % md;
		return res;
	}
}
int root(int u) {
	if (lab[u] == -1) return u;
	else return lab[u] = root(lab[u]);
}
void join(int u, int v) {
	u = root(u), v = root(v);
	if (rnk[u] > rnk[v]) {
		lab[v] = u;
	} else {
		lab[u] = v;
		if (rnk[u] == rnk[v]) rnk[v] ++;
	}
}
ll MST() {
	ll res = 0;
	REP(i, m) {
		int u = e[i].u, v = e[i].v;
		if (root(u) != root(v)) {
			join(u, v);
			res += e[i].c;
		}
	}
	return res;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	//freopen(task".inp", "r", stdin);
	//freopen(task".out", "w", stdout);
	cin >> n >> m >> x;
	REP(i, m) {
		cin >> e[i].u >> e[i].v >> e[i].c;
	}	
	sort(e, e+m);
	int cnt1 = 0, cnt2 = 0, cnt0 = 0;
	REP(i, m) {
		memset(lab, -1, sizeof lab);
		memset(rnk, 0, sizeof rnk);
		join(e[i].u, e[i].v);
		ll tmp = e[i].c + MST();
		if (tmp < x) cnt0 ++;
		else if (tmp == x) cnt1 ++;
		else if (tmp > x) cnt2 ++;
	}
	//cer  << cnt0 << " " << cnt1 << " " << cnt2 << "\n";
	if (cnt1 == 0) cout << 0;
	else if (cnt0 == 0) {
		//cout << ((Pow(n-1) - 2) * Pow(m-n+1) % md + 2 * (Pow(cnt1 - n + 1) - 1) % md * Pow(cnt2) % md) % md;
		cout << (Pow(cnt1) - 2) * Pow(cnt2) % md;
	} else cout << 2 * (Pow(cnt1) - 1) % md * Pow(cnt2) % md;
}


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

using namespace std;

int main() {
    pair<int, int> p[6];
    for (int i = 0; i < 6; ++i) {
        cin >> p[i].first >> p[i].second;
        if (p[i].first > p[i].second)
            swap(p[i].first, p[i].second);
    }
    sort(p, p + 6);
    
    if (!(p[0].first == p[1].first && p[0].second == p[1].second)) {
        cout << "no" << endl;
        return 0;
    }
    if (!(p[2].first == p[3].first && p[2].second == p[3].second)) {
        cout << "no" << endl;
        return 0;
    }
    if (!(p[4].first == p[5].first && p[4].second == p[5].second)) {
        cout << "no" << endl;
        return 0;
    }
    
    int a = p[0].first, b = p[0].second, c;
    if (a == p[2].first)
        c = p[2].second;
    else if (a == p[2].second)
        c = p[2].first;
    else {
        cout << "no" << endl;
        return 0;
    }
    
    if (!((p[4].first == b && p[4].second == c) || (p[4].first == c && p[4].second == b)))
        cout << "no" << endl;
    else
        cout << "yes" << endl;
    
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int>a(n+1);
  vector<int>b(n+1);
  for(int i=0;i<n+1;i++) cin >> a.at(i);
  for(int i=0;i<n;i++) cin >> b.at(i);
  b.at(n)=0;
  
  int64_t x=0;
  int tmp=0;
  
  x+=min(a.at(0),b.at(0));
  tmp=max(0,b.at(0)-a.at(0));

  for(int i=1;i<n+1;i++){
     x+=min(a.at(i),b.at(i)+tmp);
     tmp=max(0,b.at(i)-max(0,a.at(i)-tmp));
  }
  cout << x;
}


Measured memory_bytes: 1024
X = int(input())
def is_prime(n):
    if n == 1:
       return False
    for i in range(2,int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    return True
for i in range(2,100004):
    if i >= X and is_prime(i) == True:
        print(i)
        break

Measured memory_bytes: 3060
N = int(input())


for h in range(1, 3501):
    for n in range(1, 3501):
        if 4*h*n-N*n-N*h == 0:
            continue
        else:
            w = N * h * n /(4*h*n-N*n-N*h)
            if w > 0 and w.is_integer():
                print(h, n, int(w))
                exit()

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

int main () {
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];  
  }
  sort(a, a + n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i == n - 1) {
      // mこ割り振る
      if (m == a[i]) {
        ans++; 
      }  
      break;
    }
    if (m >= a[i]) {
      m = m - a[i];
      ans++;  
    }  
  }
  cout << ans << endl;

}

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

#define INF 100000000
#define EPS 1e-9

using namespace std;

typedef long long ll;

vector<int> ans_list;

bool dp[1000001];

int main(){

	int Q;
	cin >> Q;

	memset(dp, 0, sizeof(dp));

	while (Q){
		Q--;
		int N;
		cin >> N;
		int ans = 0;
		memset(dp, 0, sizeof(dp));

		while (N/10 > 0){
			if (dp[N]){
				ans = -1;
				break;
			}
			int tmp = 0;
			for (int i = 1; N/pow(10,i) > 0; i++){
				tmp = max(tmp, (N / (int)pow(10, i)) * (N % (int)pow(10, i)) );
			}
			dp[N] = false;
			N = tmp;
			ans++;
		}

		ans_list.push_back(ans);

	}
	
	for (int i = 0; i < ans_list.size(); i++){
		cout << ans_list[i] << endl;
	}

	return 0;

}

Measured memory_bytes: 2280
import java.util.*;

public class Main {

	private static final double RATE = 380000.0;

	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		double totalAmtJpy = 0;
		
		for(int i=0; i<N; i++) {
			String amtString = sc.next();
			String currency = sc.next();
			if(currency.equals("JPY")){
				totalAmtJpy += (double)Integer.parseInt(amtString);
			}else if (currency.equals("BTC")){
				double btc = Double.parseDouble(amtString);
				totalAmtJpy += btc * RATE;
			}else {
				throw new IllegalArgumentException();
			}
		}
		
		System.out.println(totalAmtJpy);
		sc.close();
	}

}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

//DFS
vector<int> seen;
void dfs(const Graph &G, int v, int s, int &size){
  seen[v] = s;
  size++;
  for(auto next_v : G[v]){
    if(seen[next_v]==s)continue;
    dfs(G,next_v,s,size);
  }
}

int main(){
  int N,M,K;
  cin >> N >> M >> K;
  Graph G(N+1),B(N+1);//1 to n index;
  vector<set<int>> F(N+1);
  rep(i,M){
    int a,b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
    F[a].insert(b);
    F[b].insert(a);
  }
  rep(i,K){
    int c,d;
    cin >> c >> d;
    B[c].push_back(d);
    B[d].push_back(c);
    F[c].insert(d);
    F[d].insert(c);
  }

  //最低限のdfsだけするように工夫したが結局TLE
  map<int,int> m;
  seen.assign(N+1, -1);
  rep1(i,N){
    if(seen[i]==-1){//まだ訪れていない
      int size = 0;
      dfs(G,i,i,size);
      m[i]=size;//連結成分のサイズ
      //cout<<size<<endl;
    }
    int res = m[seen[i]]-1;
    //cout<<res<<endl;
    for(auto v: F[i]){
      if(seen[v]==seen[i])res--;
    }
    cout<<res<<endl;
  }
  return 0;
}


Measured memory_bytes: 36864
#include<cstdio>
#include<algorithm>
using namespace std;
const int M=2e5+7;
int read(){
	int ans=0,f=1,c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1; c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar();}
	return ans*f;
}
int x[5],y[5];
int main(){
	x[1]=read(); y[1]=read();
	x[2]=read(); y[2]=read();
	x[3]=x[2]-(y[2]-y[1]);
	y[3]=y[2]-(x[1]-x[2]);
	x[4]=x[1]-(y[2]-y[1]);
	y[4]=y[1]-(x[1]-x[2]);
	printf("%d %d %d %d\n",x[3],y[3],x[4],y[4]);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int int_sort( const void * a , const void * b );
int gcd(int a, int b);

int main(void){

  int N, X;
  scanf("%d %d\n", &N, &X);

  int a;
  int *dist;
  dist = (int*)malloc(N*sizeof(int));
  for(int i=0; i<N; i++){
    scanf("%d", &a);
    dist[i] = a-X;
    if(dist[i]<0) dist[i] = -dist[i];
  }

  if(N==1){
    printf("%d\n",dist[0]);
    return 0;
  }

  qsort(dist,N,sizeof(int),int_sort);

  a=dist[0];
  int b;

  for(int i=1; i<N; i++){

    b = gcd(dist[i],a);
   if(b==1){
      printf("1\n");
      return 0;
    }
   a=b;

  }

  printf("%d\n", b);
  return 0;
}

int int_sort( const void * a , const void * b ) {
  if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
    if( *( int * )a == *( int * )b ) {
      return 0;
    }
  return 1;
}


int gcd(int a, int b){
  int r,tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  r = a % b;

  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

  return b;

}




Measured memory_bytes: 892
#include <bits/stdc++.h>
     
using namespace std;
typedef long long ll;
const int nmax=200001; 
vector<int> V[nmax];
ll count1[nmax];
int N,Q;
ll ans[nmax];
void print_vector_int(vector<int> & S){
    int i,n;
    n = S.size();
    for(i=0;i<n;i++){
        if (i != 0) {
            cout << " ";
        }
        cout << S[i];
    }
    cout << endl;
}

void DFS(int start,int p){
    int i,n;
    // cout << "I am " << start << endl;
    if (p>=0){
        count1[start] += count1[p];
    }
    n = V[start].size();
    for(i=0;i<n;i++){
        if (V[start][i] != p){
            DFS(V[start][i],start);
        }
    }
    if (p<0){
        for(i=1;i<=N;i++){
            if(i!=1){
                cout << " ";
            }
            cout << count1[i];
        }
        cout << endl;
    }
}

void solve(){
    DFS(1,-1);
}

int main() {
    int i,j; 
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> Q; 
    // cout << N << " " << Q << endl;
    i=0; 
    for(i=1; i<= N-1; i++){
        int x,y;
        cin >> x >> y;
        V[x].push_back(y);
        V[y].push_back(x);
    }
    //for(i=1; i<= N; i++){
    //    cout << i << " ";
    //    print_vector_int(V[i]);
    //}
    for(i=1;i<=N;i++){
        count1[i] = 0;
    }
    for(i=1;i<=Q;i++){
        int p,q;
        cin >> p >> q;
        count1[p] = count1[p] + q;
    }
    solve();
}


Measured memory_bytes: 24320
from math import fabs
a, b = map(int, input().split())
if a <= 0 and 0 <= b:
    print("Zero")
else:
    if a > 0:
        print("Positive")
    else:
        if (fabs(b - a) + 1) % 2 == 0:
            print("Positive")
        else:
            print("Negative") 

Measured memory_bytes: 9180
//20190619
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;

    int i;
    float money;
    string s;

    float total = 0;
    for(i=0;i<n;i++){
        cin >> money >> s;
        if(s == "BTC") money *= 380000.0;
        total += money;
    }

    cout << total << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using vpi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion


LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 



/*****************************************************************************/

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

	int n, c, k;
	cin >> n >> c >> k;
	vi t(n);
	f_vI(t, n);
	sort(all(t));
	int tmp = 0;
	int memo;
	int ans = 0;
	f(i, 0, n) {
		if (tmp == 0) {
			memo = t[i];
		}
		tmp++;
		if (t[i] > memo + k || tmp > c) {
			tmp = 0;
			ans++;
			i--;
		}
	}
	cout << ans + 1;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdlib.h>

using namespace std;

int main() {

	int m, f, r;
	char score;

	while (true) {

		cin >> m >> f >> r;

		if (m == -1&&f == -1&&r == -1) {
			break;
		}
		else if ((m == -1 || f == -1)|| m + f < 30) {
			score = 'F';
		}
		else if (m + f < 50&&!(r >= 50)) {
			score = 'D';
		}
		else if ((m + f < 50 && r >= 50) || m + f < 65) {
			score = 'C';
		}
		else if (m + f <80) {
			score = 'B';
		}else {
			score = 'A';
		}
		cout << score << endl;
	}

	//cin >> /*変数他*/;
	//cout << /*文字列*/ << endl;
	return 0;
}


Measured memory_bytes: 3084
/* You are being watched. */


//~ while (clock() <= 69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

using namespace std;

//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template <typename T>
//~ using ordered_set =
  //~ tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
#define show(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

void solve() {
  string s; cin >> s;
  string t; cin >> t;
  t.pop_back();
  if(s == t) {
    print("Yes");
  }
  else {
    print("No");
  }
}

int main() {
  int t; t = 1;
  while(t--) solve();
}


Measured memory_bytes: 3648
/*
* @Author: _dp95
* @Date:   2019-02-10 23:31:56
*/
/*
* @Author: _dp95
* @Date:   2019-02-10 23:31:40
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000*100 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

ll a[ MAX ], b[ MAX ] ;
ll dp[ 105 ][ MAX ] ;

int main( ){
  timesaver ;
  int n, w ;
  cin >> n >> w ;
  for( int i = 0 ; i < n ; i++ ){
    cin >> a[ i ] >> b[ i ] ;
  }
  for( int i = 0 ; i <= n ; i++ ){
    for( int j = 0 ; j <= w ; j++ ){
      if( i == 0 or j == 0 )
        dp[ i ][ j ] = 0 ;
      else if( a[ i - 1 ] <= j )
        dp[ i ][ j ] = max( dp[ i - 1 ][ j - a[ i - 1 ] ] + b[ i - 1 ], dp[ i - 1 ][ j ] ) ;
      else
        dp[ i ][ j ] = dp[ i - 1 ][ j ] ;
    }
  }
  //*/
  cout << dp[ n ][ w ] << nl ;
}

Measured memory_bytes: 159232
# coding:UTF-8

# 入力される宝石の数を取得
jewel_count = int(input())

# 宝石の価値を取得
jewels_value = input().split()

# 宝石の値段を取得
jewels_cost = input().split()

# 最大値計算用の領域を初期化
max_value = 0

# 価値 - 値段がプラスになるもののみを足し込んでいく
for i in range(jewel_count):
    # 価値 - 値段 の差異を取得
    difference_num = int(jewels_value[i]) - int(jewels_cost[i])

    # 差異が０でなければ、最大値計算の対象とする
    if (difference_num > 0):
        max_value += difference_num

print(max_value)

Measured memory_bytes: 2940
from collections import deque
H, W = map(int, input().split())
S = []
w = 0
for i in range(H):
    s = input()
    w += s.count(".")
    S.append(list(s))

Q = deque([(0, 0, 0)])
ans = float("inf")
flag = False
while Q:
    i, j, n = Q.popleft()
    if i == H-1 and j == W-1:
        flag = True
        ans = min(ans, n)
    if S[i][j] == ".":
        S[i][j] = "#"
        for dx, dy in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
            if 0 <= i + dx < H and 0 <= j + dy < W:
                Q.append((i+dx, j+dy, n+1))
if flag:
    print((w-2)-(ans-1))
else:
    print(-1)



Measured memory_bytes: 3316