akhauriyash/Code-Regression huggingface dataset:
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),fast;
	ll a , b ;
	cin>> a >> b ;
	a--,b--;
	ll ans = ceil(1.0*b/a);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3

import array
import math
import os
import sys


def main():
    N = read_int()
    print(solve(N))


def solve(N):
    best = N - 1
    x = 2
    while x * x <= N:
        if N % x == 0:
            y = N // x
            best = min(best, x + y - 2)
        x += 1
    return best


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()


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

int main() {
  int N;
  int five_count = 0;
  int seven_count = 0;
  
  for (int i = 0; i < 3; i++) {
    cin >> N;
    
    if (N == 5) {
      five_count++;
    }
    
    if (N == 7) {
      seven_count++;
    }
  }
  
  if (five_count == 2 && seven_count == 1) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}
    
    

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

#define LL long long 
using namespace std;

int main(){
	LL h,w;
	cin >> h >> w;
	LL a,ans;
	//1列or1行だったら0で終了
	if(h==1 || w==1){
		cout << "1" << endl;
		return 0;
	}
	//hの切り上げ計算
	a=h/2;
	if(h%2==1){
		a++;
	}
	//計算
	if(w%2==0){
		ans=h*(w/2);
	}else{
		ans=h*((w-1)/2)+a;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<ll, ll>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const ll INF = 1E+18;

ll dp[515][100005];

int main(){
    ll n;
    cin >> n;
    vector<ll> v(n);
    vector<ll> w(n);
    rep(i, n) cin >> v[i] >> w[i];
    
    dp[0][0] = 0LL;
    rep(i, 512) {
        if (i==n) break;
        rep(j, 100002) {
        
        if (i==0) {
            if (j>=w[0]) dp[i][j] = v[0];
        }
        else {
            dp[i][j] = dp[(i+1)/2-1][j];

            if (j-w[i]>=0) {
                chmax(dp[i][j], dp[(i+1)/2-1][j-w[i]]+v[i]);
            }
        }
        }
    }
    
    ll q;
    cin >> q;
    
    rep(qi, q) {
        ll u, l;
        cin >> u >> l;
        u--;
        if (u<512) {
            cout << dp[u][l] << endl;
            continue;
        } 
        ll num = 0;
        ll temp = u;
        vector<ll> iw;
        vector<ll> iv;
        while (temp>=512) {
            iw.push_back(w[temp]);
            iv.push_back(v[temp]);
            num++;
            temp = (temp+1)/2-1;
        }
        ll ans = 0;
        
        rep(i, 1LL<<num) {
            ll sumw = 0;
            ll sumv = 0;
            rep(j, num) {
                if ((i>>j&1)==0) continue;
                sumw += iw[j];
                sumv += iv[j];
            }
            if (l-sumw>=0) {
                chmax(ans, dp[temp][l-sumw]+sumv);
            }
        }
        
        
        cout << ans << endl;
    }
    
    return 0;
}


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

int main()
{
  string a, b, c;
  cin >> a >> b >> c;
  
  if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import networkx as nx
n,m=map(int,input().split())
if m==0:print(1);exit()
a=[[i for i in input().split()] for _ in range(m)]
g=nx.Graph()
for x in a:
     g.add_edge(x[0],x[1])
print(len(max(nx.connected_components(g),key=len)))

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

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;}

int f(int x){
    int res = 0;
    while(x%2 == 0){
        x /= 2;
        res++;
    }
    return res;
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    rep(i,n){
        if(a[i]%2 == 1){
            cout << 0 << endl;
            return 0;
        }
        a[i] /= 2;
    }

    int t = f(a[0]);
    rep(i,n){
        if(f(a[i]) != t){
            cout << 0 << endl;
            return 0;
        }
        a[i] >>= t;
    }
    m >>= t;

    ll l = 1;
    rep(i,n){
        l = lcm(l, a[i]);
        if(l > m){
            cout << 0 << endl;
            return 0;
        }
    }
    
    m /= l;
    int ans = (m+1)/2;
    cout << ans << endl;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const ll Mod = 998244353;
const ll Inf = 1e15;
const ll Log = 20;
const int Maxn = 1e5 + 10;
const int sig = 27;

const int Base = 101;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, k;
	cin >> n >> k;
	if(k > (n + 1) / 2) return cout << -1, 0;
	ll c = n + n;
	ll a = ((n-1) / 2);
	ll b = n;
	while(b < 2*n){
		cout << a + k << " " << b + k << " " << c + k << '\n';
		b += 2;
		a --;
		c ++;
	}
	b = n + 1;
	a = n - 1;
	while(b < 2*n){
		cout << a + k << " " << b + k << " " << c + k << '\n';
		b += 2;
		a --;
		c ++;
	}
	return 0;
}
/*
abacabacca

*/


Measured memory_bytes: 2304
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

bool check(ll m,int N,vector<ll> &sum){
    for(int s=0;s<=N;s++){
        ll f = sum[s];
        ll itr1 = lower_bound(sum.begin()+s,sum.begin()+s+N,f+m)-sum.begin();
        ll itr2 = lower_bound(sum.begin()+s,sum.begin()+s+N,sum[itr1]+m)-sum.begin();
        if(sum[N+s]-sum[itr2]>=m)return true;
    }
    return false;
}

int main(){
    int N;
    cin >> N;
    vector<int> A(2*N);
    rep(i,N)cin >> A[i];
    for(int i=N;i<2*N;i++)A[i]=A[i-N];
    vector<ll> sum(2*N+1);
    rep(i,2*N){
        sum[i+1]=sum[i]+A[i];
    }

    //check(m):=mid以上の最小になるよう２か所切ったとき、最小がmよりも大きいかどうか

    ll low = 1,high=sum[N];
    while(high-low>1){
        ll mid = (low+high)/2;
        if(check(mid,N,sum)){
            low=mid;
        }else{
            high=mid;
        }
    }
    cout << low << endl;
    return 0;
}


Measured memory_bytes: 5220
#include<stdio.h>

#include<stdio.h>

int main(){
    long int N, i;
    long int A[1000000];
    long int B[1000000];
    long int count = 0;
    scanf("%ld", &N);
    for(i = 0; i < N+1; i++){
        scanf("%ld", &A[i]);
    }
    for(i = 0; i < N; i++){
        scanf("%ld", &B[i]);
    }
    for(i = 0; i < N; i++){
        if(A[i] + A[i+1] <= B[i]){
            count += A[i] + A[i+1];
            A[i+1] = 0;
        }else if(A[i] <= B[i]){
            count += B[i];
            A[i+1] = A[i+1] - (B[i] - A[i]);
        }else{
            count += B[i];
            A[i] = A[i] - B[i];
        }
        
    }
    printf("%ld\n", count);
    return 0;
}

Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define For1(i, n) for(int i = 1; i <= (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

#define Pt first
#define Px second.first
#define Py second.second

int main(void){
    Cin(int, n);
    vc<pair<double, pair<int, int>>> e(n);
    For(i, n){
        Cin(int, x, y);
        e[i].Px = x;
        e[i].Py = y;
        e[i].Pt = atan2(y, x);
    }
    Sort(e);
    
    double ans = 0;
    For(i, n) For(j, n+1){
        ll x = 0, y = 0;
        For(k, j) x += e[(i+k)%n].Px, y += e[(i+k)%n].Py;
        // printf("(%d, %d) %g\n", i, j, sqrt(Sq(x) + Sq(y)));
        Maxi(ans, sqrt(Sq(x) + Sq(y)));
    }
    printf("%.20f\n", ans);
}




Measured memory_bytes: 512
n,k,*l=map(int,open(0).read().split())
for _ in range(min(k,41)):
  s=[0]*(n+1)
  for i in range(n):
    s[max(i-l[i],0)]+=1
    s[min(i+l[i]+1,n)]-=1
  l[0]=min(s[0],n)
  for i in range(1,n):
    l[i]=min(l[i-1]+s[i],n)
print(*l)

Measured memory_bytes: 170828
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	A, B := sc.nextStr(), sc.nextStr()
	if A == "H" {
		fmt.Fprintln(wtr, B)
	} else {
		if B == "H" {
			fmt.Fprintln(wtr, "D")
		} else {
			fmt.Fprintln(wtr, "H")
		}
	}

	wtr.Flush()
}


Measured memory_bytes: 640
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int m = scan.nextInt();
    int sum = 0;
    int count = 0;
    int[] a = new int[n];
    for (int i = 0;i<n;i++){
      a[i] = scan.nextInt();
      sum += a[i];
    }
    for (int j=0;j<n;j++){
      if (a[j]*4*m>=sum){
        count += 1;
      }
    }

    if (count<m){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }
  }
}


Measured memory_bytes: 35880
from fractions import gcd
from functools import reduce
N, M = map(int, input().split())
A = list(map(int, input().split()))
AA = list(map(lambda x: x//2, A))
def lcm(x, y):
    return x * y // gcd(x, y)
b0 = AA[0]&-AA[0]
for a in AA[1:]:
    if b0 != a&-a:
        print(0)
        break
else:
    a = reduce(lcm, AA)
    print(M//a - M//(2*a))


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

#define PI 3.1415926535

int main(void){
  int R;
  double result;
  if(scanf("%d",&R) != 1){
    printf("***SCANF ERROR***\n");
    exit(1);    
  }
  result=2*PI*(double)R;

  printf("%.10f\n",result);
  
  return 0;
}


Measured memory_bytes: 1744
#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() {
  int w, h, n;
  cin >> w >> h >> n;
  vector<int> x(n), y(n), a(n);
  rep(i, n) cin >> x[i] >> y[i] >> a[i];

  vector<vector<int>> white(w, vector<int>(h, 1));
  rep(i, n) rep(j, w) rep(k, h) {
    if (a[i] == 1 && j < x[i]) white[j][k] = 0;
    if (a[i] == 2 && j >= x[i]) white[j][k] = 0;
    if (a[i] == 3 && k < y[i]) white[j][k] = 0;
    if (a[i] == 4 && k >= y[i]) white[j][k] = 0;
  }

  int s = 0;
  rep(i, w) rep(j, h) s += white[i][j];
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3676
#include<stdio.h>

int main(void)
{
	int k,s;
	int x,y,z;
	int count=0;
	
	scanf("%d",&k);
	scanf("%d",&s);
	
	for(x=0; x<=k; x++){
		for(y=0; y<=k; y++){
			z = s - x - y;
			if(z>=0 && z<=k) count++;

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int h,n;cin>>h>>n;
    int sum=0;
    for(int i=0;i<n;i++){
        int t;cin>>t;
        sum+=t;
    }
    if(sum>=h)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
	return 0;
}

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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

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

signed main() {
	ll n;
  ll l[87];
  l[0] = 2;
  l[1] = 1;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    l[i] = l[i - 1] + l[i - 2];
  }
  cout << l[n] << endl;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N, K;
	cin >> N >> K;

	vector <int> A(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> A[ii];
	}

	bool ok = true;
	for (int ii = 0; ii < N - K; ++ii){
		if (A[ii] >= A[ii+K]){
			cout << "No" << "\n";
		} else{
			cout << "Yes" << "\n";			
		}
	}	


	return 0;
}


Measured memory_bytes: 4032
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final long a = fs.nextInt();
        final long b = fs.nextInt();
        final long c = fs.nextInt();
        final long d = fs.nextInt();


        long answer = 0;


        if(a>0 && d<0 || b<0 && c>0) {
        	// MAXが負になるパターン
        	answer = Math.multiplyExact(a, c);

        }


		if(Math.multiplyExact(a, c) > answer) {
			answer = Math.multiplyExact(a, c);
		}
		if(Math.multiplyExact(a, d) > answer) {
			answer = Math.multiplyExact(a, d);
		}

		if(Math.multiplyExact(b, c) > answer) {
			answer = Math.multiplyExact(b, c);
		}
		if(Math.multiplyExact(b, d) > answer) {
			answer = Math.multiplyExact(b, d);
		}
		System.out.print(answer);




    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

int main(){
	int a,n,sum=0;
	cin>>n;
	for (int i = 0; i < n; i++){
		cin>>a;
		if(a%2==0)
			sum++;
	}

	cout<<pow(3,n)-pow(2,sum)<<endl;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  
  cin >> a >> b;
  
  if((a+b) % 2 == 1) {
    cout << "IMPOSSIBLE" << endl;
  }
  else if((a+b) % 2 == 0){
    cout << (a+b) / 2 << endl;
  }
  
}

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

int main(){
    int n,d,i,j,k,c=0;
    cin>>n>>d;
    vector<vector<int>> v(n,vector<int>(d));
    for(i=0;i<n;i++){
        for(j=0;j<d;j++) cin>>v[i][j];
    }
    double l=0;
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            for(k=0;k<d;k++){
                l+=pow(v[i][k]-v[j][k],2);
            }
            l=sqrt(l);
            if(l==floor(l)) c++;
            l=0;
        }
    }
    cout<<c<<endl;
    return 0;
}

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

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

using namespace std;

int main(){
	optimizar_io;
	int A, B;
	cin >> A >> B;
	cout << max(0, A - 2 * B) << endl;
	return 0;
}


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

const int mod = 998244353;

long long binpow(long long b, int e) {
  long long res = 1;
  while (e) {
    if (e & 1) res *= b, res %= mod;
    e >>= 1;
    b *= b;
    b %= mod;
  }
  return res;
}

long long inv(long long x) {
  return binpow(x, mod - 2);
}

int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string str;
  cin >> str;
  int n = str.size(), ans = 0;
  for (int i = 0; i < str.size() / 2; i++) {
    if (str[i] != str[n - 1 - i]) ++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#include <bits/stdc++.h>
using namespace std;


int main() {
	int A, B, H, M;
	double res, hx, hy, mx, my;
	const double PI=3.14159265358979323846;

	cin >> A >> B >> H >> M;

	mx = B*sin(M*PI/30);
	my = B*cos(M*PI/30);

	hx = A*sin((H*60+M)*PI/360);
	hy = A*cos((H*60+M)*PI/360);

	res = (mx-hx)*(mx-hx) + (my-hy)*(my-hy);
	res = pow(res, 0.5);

	cout << fixed << setprecision(10) << res;
	
	return 0;
}

Measured memory_bytes: 4188
### main

while true
  n = gets.strip.to_i
  break if n == 0

  words = []
  hists = {}

  n.times do
    ws = gets.strip.split(' ')

    for w in ws
      if hists[w].nil?
        words << w
        hists[w] = 1
      else
        hists[w] += 1
      end
    end
  end
  #p words
  #p hists

  k = gets.strip

  kwords = words.select{|w| w[0] == k}.sort{|a, b|
    (cmp = hists[b] <=> hists[a]) != 0 ? cmp : a <=> b
  }[0, 5]
  #p kwords

  puts(kwords.empty? ? 'NA' : kwords.join(' '))
end

Measured memory_bytes: 6216
#include <iostream>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef vector<LL> VLL;
const LL LLMAX = numeric_limits<LL>::max();

int main()
{
  // Read inputs
  
  int A, B, Q;
  cin >> A >> B >> Q;

  VLL s(A), t(B), x(Q);
  for (int i = 0; i < A; ++i) cin >> s[i]; sort(s.begin(), s.end());
  for (int i = 0; i < B; ++i) cin >> t[i]; sort(t.begin(), t.end());
  for (int i = 0; i < Q; ++i) cin >> x[i];

  // Create tables of distances to nearest next points
  VLL st(A, LLMAX), ts(B, LLMAX);
  int j;
  for (int i = 0; i < A; ++i) {
    j = lower_bound(t.begin(), t.end(), s[i]) - t.begin();
    if (j < B) st[i] = min(st[i], abs(s[i] - t[j]));
    if (j > 0) st[i] = min(st[i], abs(s[i] - t[j - 1]));
  }
  for (int i = 0; i < B; ++i) {
    j = lower_bound(s.begin(), s.end(), t[i]) - s.begin();
    if (j < A) ts[i] = min(ts[i], abs(t[i] - s[j]));
    if (j > 0) ts[i] = min(ts[i], abs(t[i] - s[j - 1]));
  }
  
  // Solve each cases
  for (int i = 0; i < Q; ++i) {
    LL ans = LLMAX;
    
    int j;
    j = lower_bound(s.begin(), s.end(), x[i]) - s.begin();
    if (j < A) ans = min(ans, abs(s[j] - x[i]) + st[j]);
    if (j > 0) ans = min(ans, abs(s[j - 1] - x[i]) + st[j - 1]);
    
    j = lower_bound(t.begin(), t.end(), x[i]) - t.begin();
    if (j < B) ans = min(ans, abs(t[j] - x[i]) + ts[j]);
    if (j > 0) ans = min(ans, abs(t[j - 1] - x[i]) + ts[j - 1]);
    
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 5248
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

current_eat = -2
manzoku = 0
for n in range(N):
    eat_index  = A[n] - 1
    manzoku += B[eat_index]
    if(current_eat  +1 == eat_index):
        manzoku += C[current_eat]
    current_eat = eat_index
print(manzoku)

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

using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pii = pair<ll, ll>;

template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}

int main() {
  ios::sync_with_stdio(false);
  ll n, m, a, b;
  cin >> n >> m;
  vvi g = vvi(n);
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<pii> sign = vector<pii>(n, make_pair(-1, 1e6));
  sign[0] = make_pair(0, 0);

  queue<ll> q;

  q.push(0);
  bool able = true;
  while (!q.empty()) {
    ll p = q.front();
    q.pop();
    ll previous = p;
    ll score = sign[p].second;

    if (score > n) {
      break;
    }
    // cerr << "previous:" << previous << endl;
    // cerr << "score:" << score << endl;
    // cerr << p << endl;
    for (ll i : g[previous]) {
      if (i == 0) continue;
      if (sign[i].first == -1) {
        // cerr << '\t' << i;
        // cerr << '\t' << sign[i] << endl;
        sign[i].first = previous;
        sign[i].second = score + 1;
        // cerr << '\t' << "updated:" << sign[i] << endl;
        q.push(i);
      }
    }
  }

  // cerr << "test" << endl;
  for (int i = 1; able && i < n; i++) {
    // cerr << sign[i] << endl;
    if (sign[i].first == -1) {
      able = false;
    }
  }

  if (able) {
    cout << "Yes" << endl;
    for (int i = 1; i < n; i++) {
      cout << sign[i].first + 1 << endl;
    }
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 13660
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  string S;
  cin >> S;
  if(S == "AAA" || S == "BBB") cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


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

using namespace std;

int main()
{	
    string S;
    cin >> S;
    int ret = 10000;
    
    for(int i = 0; i < 26; i++) 
    {
        int cnt = 0;
        int cnt2 = -1;
        
        for(int j = 0;j < S.size();j++) 
        {
            if(S.at(j) == 'a' + i)
            {
                cnt = max(cnt,j - cnt2 - 1);
                cnt2 = j;
            }
        }
        int a = S.size();
        cnt = max(cnt, a - cnt2 - 1);
        ret = min(ret, cnt);
    }
    cout << ret << endl;
    return 0;
}

 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using ul = unsigned long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

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

    vector<ll> v(n);
    rep(i, n) { cin >> v[i]; }

    ll ans = 0;
    rep(a, k + 1) {
        rep(b, k - a + 1) {
            ll ans_temp = 0;
            ll rem = k - a - b;
            vector<ll> v_temp;
            if (a + b >= n) {
                rem = k - n;
                v_temp = v;
            } else {
                rep(i, a) { v_temp.push_back(v[i]); }
                rep(i, b) {
                    ll index = n - i - 1;
                    v_temp.push_back(v[index]);
                }
            }
            sort(v_temp.begin(), v_temp.end());
            for (auto value : v_temp) {
                ans_temp += value;
            }
            rep(i, rem) {
                if (i == v_temp.size())
                    break;
                if (v_temp[i] < 0)
                    ans_temp -= v_temp[i];
            }
            ans = max(ans, ans_temp);
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << endl;
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << endl;
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  string str;
  cin >> str;
  int count=0;
  rep(i, 0, 3){
    if(str[i]=='o'){
      ++count;
    }
  }

  cout << (700+100*count) << endl;
  return 0;
}


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

void main()
{
    auto nkc = readln.split.to!(int[]);
    auto N = nkc[0];
    auto K = nkc[1];
    auto C = nkc[2];
    auto S = readln.chomp;

    int[] ls, rs;
    ls.length = N;
    ls[] = -1;
    rs.length = N;
    rs[] = -1;

    int i, c;
    foreach (_; 0..K) {
        while (S[i] == 'x') ++i;
        ls[i] = c++;
        i += C+1;
    }
    i = N-1;
    c = 0;
    foreach (_; 0..K) {
        while (S[i] == 'x') --i;
        rs[i] = c++;
        i -= C+1;
    }

    foreach (j; 0..N) {
        if (ls[j] == K-rs[j]-1) writeln(j+1);
    }
}

Measured memory_bytes: 4220
class SegmentTreeRMQ():
    """Range Minimum Query"""
    
    def __init__(self, lst, max_num=float("inf")):
        """
        Args:
            lst: 元のリスト
            max_num: セグ木の各ノードの初期値
        """
        self.MAX_NUM = max_num #セグ木のノードの最大値
        N = len(lst)
        i, total = 1, 1
        while True:
            if N <= i:
                break
            i *= 2
            total += i
        self.N = i  # セグ木の葉の数
        self.nodes = [self.MAX_NUM for _ in range(total)]
        for i in range(len(lst)):
            self.update(i, lst[i])
    
    def update(self, i, x):
        """元のリストlst[i]に対応するセグ木のノード値をxに変更し、セグ木全体を更新する"""
        ni = self._lst2node(i)
        self.nodes[ni] = x
        while ni > 0:
            ni = (ni-1)//2
            l, r = ni*2+1, ni*2+2
            self.nodes[ni] = min(self.nodes[l], self.nodes[r])

    def query(self, a, b):
        """区間[a,b)のクエリに応答する"""
        return self._find(a, b, 0, 0, self.N)

    def _lst2node(self, i):
        """元の配列lst[i]は、セグ木のi+N-1番目のノード(Nは歯の数)"""
        return i+self.N-1
    
    def _find(self, a, b, k, l, r):
        """区間[a,b)のクエリに対して、担当区間[l,r)のノードkが応答する"""
        if r <= a or b <= l:
            # 区間がかぶらない場合
            return self.MAX_NUM
        if a <= l and r <= b:
            # 担当区間がすっぽり含まれる場合
            return self.nodes[k]
        # それ以外
        ret1 = self._find(a, b, 2*k+1, l, (l+r)//2)  # 左の子に聞く
        ret2 = self._find(a, b, 2*k+2, (l+r)//2, r)  # 右の子に聞く
        return min(ret1, ret2)


N, Q = map(int, input().split())
lst = [2**31-1 for _ in range(N)]
rmq = SegmentTreeRMQ(lst, 2**31-1)

for q in range(Q):
    com, x, y = map(int, input().split())
    
    if com == 0:
        rmq.update(x,y)
    else:
        print(rmq.query(x,y+1))


Measured memory_bytes: 9828
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	String s = scan.next();

	if(s.charAt(0) != 'A'){
	    System.out.println("WA");
	}else{
	    int count = 0;
	    int point = 0;
	    for(int i = 2; i < s.length()-1; i++){
		if(s.charAt(i) == 'C'){
		    count++;
		    point = i;
		}
	    }
	    if(count != 1){
		System.out.println("WA");
	    }else{
		int flag = 1;
		for(int i = 0; i < s.length(); i++){
		    if(i == 0 || i == point){
			//何もしない
		    }else{
			if(s.charAt(i) < 'a' || s.charAt(i) > 'z'){
			    flag = -1;
			}
		    }
		}
		if(flag == 1){
		    System.out.println("AC");
		}else{
		    System.out.println("WA");
		}
	    }
	}
    }
}


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

int main(){
  double L;
  cin >> L;
  //printf("%f\n", L);
  //double L = (double) l;
  double a = L/3;
  double b = a*2;
  double c = L - b;
  printf("%f\n", c*a*a);
}

Measured memory_bytes: 256
n=int(input())

a = []

for _ in range(n):
  a.append(input())

print("AC x " + str(a.count("AC")))
print("WA x " + str(a.count("WA")))
print("TLE x " + str(a.count("TLE")))
print("RE x " + str(a.count("RE")))


Measured memory_bytes: 16164
#include <stdio.h>

int main(void)
{
	int n, i, j, kaikyuu[6] = {0};
	float k[5] = {165.0, 170.0, 175.0, 180.0, 185.0}, cm;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%f", &cm);
		
		j = 0;
		while (1){
			if (j == 5){
				kaikyuu[j]++;
				break;
			}
			else if (cm < k[j]){
				kaikyuu[j]++;
				break;
			}
				
			j++;
		}
	}
	
	for (i = 0; i < 6; i++){
		printf("%d:", i + 1);
		
		for (j = 0; j < kaikyuu[i]; j++){
			printf("*");
		}
		puts("");
	}
	
	return (0);
}

Measured memory_bytes: 644
def main():
    s = input()
    t = input()
    ans = 0
    substr = ''
    len_s = len(s)
    len_t = len(t)
    if t in s:
        print(0)
    else:
        for i in range(len_s - len_t + 1):
            substr = s[i: i + len_t]
            tmp = 0
            for sn, tn in zip(substr, t):
                if sn == tn:
                    tmp += 1
            ans = max(ans, tmp)
            if ans == len_t - 1:
                break
        print(len(t) - ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9128
n,k = map(int,input().split())
a = list(map(int,input().split()))
x = [False for _ in range(k+1)]
x[0] = False
for i in range(1,k+1):
  if a[0] > i:
    x[i] = False
  else:
    for ai in a:
      if ai <= i:
        if not x[i-ai]:
          x[i] = True
          break
if x[k]:
  print("First")
else:
  print("Second")
          
      


  

Measured memory_bytes: 3864
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		int T = sc.nextInt();
		int[] n = new int[N + 1];
		int t = 0, c = 0;

		// 入力値を設定
		for (int i = 0; i < N; i++) {
			n[i] = sc.nextInt();
		}
		t = n[0] + T - 1;
		c = T;
		for (int i = 1; i < N; i++) {
			if (t < n[i]) {
				c += T;
			} else {
				c += T - (1 + (t - n[i]));
			}
			t = n[i] + T - 1;
		}
		
		System.out.print(c);

		sc.close();
	}
}


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

using namespace std;
int n;
int main()
{
    cin>>n;
    if(n%10==3)cout<<"bon";
    else if(n%10==0||n%10==1||n%10==6||n%10==8)cout<<"pon";
    else cout<<"hon";
    return 0;
}


Measured memory_bytes: 3632
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

X = get_int

if X == 1
  puts 'Hello World'
else
  A = get_int
  B = get_int

  puts A + B
end


Measured memory_bytes: 14348
#include<iostream>
using namespace std;
int main() {
	int x;
  	cin >> x;
  	bool ok = false;
  	for(int i = 1; i < 10; i++) {
    	for(int j = i; j < 10; j++) {
        	if(i * j == x) {
            	ok = true;
              	break;
            }
        }
      	if(ok) break;
    }
  	
  	if(ok) cout << "Yes";
  	else cout << "No";
}

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

int findSumOfDigits(int n){
  int sum = 0;
  while(n > 0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  int N,A,B;
  cin >> N >> A >> B;
  
  int total = 0;
  for(int i = 0; i <= N; i++){
    int sum = findSumOfDigits(i);
    if(A <= sum && sum <= B){
      total += i;
    }
  }
 
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 1e9+7;//998244353
// #define LOCAL LDD
#define int LL
string arr[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI","SAT"};
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);;
#endif
  int n,m;cin >> n >> m;
  n++;
  string s;cin >> s;
  if(s[n-1]=='1'||s[0]=='1'){
    cout << -1 << endl;
    return 0;
  }
  vector<int> v;
  reverse(ALL(s));
  int l = 0;;
  vector<int> cn;
  for(int i=0;i<n;i++) if(s[i]=='0') cn.push_back(i);
  while(l<cn.size()){
    int r = l;
    while(r+1<cn.size()&&cn[r+1]-cn[l]<=m) r++;
    if(l==r){
      cout << -1 << endl;
      return 0;
    }
    v.push_back(cn[r]-cn[l]);
    l = r;
    if(cn[l]==n-1) break;
  }
  reverse(ALL(v));
  for(auto it:v) cout << it << " ";cout << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

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

ll n, m, x, y, ans, dp[M];
vector<ll> adj[M];
bool avail[M];

void dfs(ll u){
    avail[u] = true;
    for (ll x : adj[u]){
        if (!avail[x]) dfs(x);
        dp[u] = max(dp[u], dp[x] + 1);
    }
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    cin >> n >> m;
    while (m--){
        cin >> x >> y;
        adj[x].push_back(y);
    }
    for (int i = 1; i <= n; i++){
        if (!avail[i]){
            dfs(i);
            ans = max(ans, dp[i]);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 31232
s = input()
m = 0
c = 0
S = {"A", "C", "G", "T"}
for i in range(len(s)):
    if s[i] in S:
        c += 1
    else:
        if c != 0:
            if c > m:
                m = c
            c = 0

if c > m:
    m = c

print(m)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
int main(void){
    int len,x,i;
    char *st;
    scanf("%d %d",&len,&x);
    st=(char*)malloc(sizeof(char*)*len+1);
    scanf("%s",st);
    for(i=0;i<len;i++){
        if(i==x-1){
            st[i]+=32;
        }
    }
    printf("%s\n",st);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		
		long ans=0;
		for (int i = 0;; i++) {
			long square = i*i;
			if (square>n) {
				break;
			}else{
				ans=square;
			}
		}
		
		System.out.println(ans);
		scanner.close();

	}

}

Measured memory_bytes: 23636
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#define full(c) c.begin() c.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int max_digit = 0;
string make(string t)
{
    string ret = "";
    bool flag = true;
    for(int i = 0; i < t.size(); i++)
    {
        if(t[i] >= '0' && t[i] <= '9')
        {
            int j = i;
            int cnt = 0;
            string str = "";
            while(t[j] >= '0' && t[j] <= '9')
            {
                cnt++;
                j++;
                str += t[i];
                i++;
            }
            int tmp = max_digit - cnt;
            while(tmp--) ret += '0';
            ret += str;
        }
        ret += t[i];
    }
    return ret;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<string> vec;
    for(int i = 0; i <= n; i++)
    {
        string s;
        cin >> s;
        vec.push_back(s);
    }
    int cnt = 0;
    for(int i = 0; i < vec.size(); i++)
    {
        int tmp = 0;
        for(int j = 0; j < vec[i].size(); j++)
        {
            if(vec[i][j] >= '0' && vec[i][j] <= '9') cnt++;
            else cnt = 0;
            tmp = max(cnt, tmp);
        }
        max_digit = max(tmp, max_digit);
    }
    for(int i = 0; i < vec.size(); i++) vec[i] = make(vec[i]);
    for(int i = 1; i < vec.size(); i++)
    {
        bool ok = true;
        bool flag = false;
        for(int j = 0; j < min(vec[0].size(), vec[i].size()); j++)
        {
            if(vec[0][j] == vec[i][j]) continue;
            flag = true;
            if(vec[0][j] < vec[i][j]) break;
            else ok = false;
        }
        if(flag == false && vec[0].size() > vec[i].size()) ok = false;
        cout << (ok ? '+' : '-') << "\n";
    }
    return 0;
}






Measured memory_bytes: 10672
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
#define int ll
using pii = pair <int, int>;
#define INF 0x7f7f7f7f7f7f7f7f
const bool debug = 0;
const int mod = 1000000007;

string str;
int32_t main()
{
    int n; cin >> n;
    while(n)
    {
        char u = ('a'+n%26);
        if (u == 'a') u = 'z';
        else u--;
        str += u;
        n -= (u-'a'+1);
        n /= 26;
    }
    reverse(all(str));
    cout << str << '\n';
}

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

int main()
{
	int N; cin >> N;
	vector<string> S(N);
	vector<int> b(4, 0);
	rep(i, N) {
		string s; cin >> s;
		if (s == "AC") ++b[0];
		else if (s == "WA") ++b[1];
		else if (s == "TLE") ++b[2];
		else if (s == "RE") ++b[3];
	}
	cout << "AC x " << b[0] << endl;
	cout << "WA x " << b[1] << endl;
	cout << "TLE x " << b[2] << endl;
	cout << "RE x " << b[3] << endl;

	return 0;
}


Measured memory_bytes: 5260
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> flag(N,0);
  vector<long long> H(N);
  for(int i=0;i<N;i++) cin >> H.at(i);

  int A,B;
  for(int i=0;i<M;i++){
    cin >> A >> B;
    if(H.at(B-1)<H.at(A-1)){
      flag.at(B-1)=1;
    }
    else if(H.at(A-1)<H.at(B-1)){
      flag.at(A-1)=1;
    }
    else if(H.at(A-1)==H.at(B-1)){
      flag.at(A-1)=1;
      flag.at(B-1)=1;
    }
  }

  int ans=0;
  for(int i=0;i<N;i++){
    if(flag.at(i)==0) ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 4508
//#include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <limits>
#include <map>
#include <vector>
#include <queue> 
#define LL long long
#define ft first
#define sd second
#define mp(x,y) make_pair(x,y)
//#define int LL
#define db double
using namespace std;
const int N   = 13;
//const int mod = ;
const int INF =numeric_limits<int >::max();
#define For(n) for (int i=1;i<=n;++i)
#define rep(i,x,y) for (int i=x;i<=y;++i)
void read(int &x)
{
	x=0;
	char ch=getchar();
	int f=1;
	while (!isdigit(ch)) (ch=='-'?f=-1:0),ch=getchar();
	while ( isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	x*=f;
}
int n,m;
char a[N][N];

int v1[N],v2[N];

int dfs2(int x)
{
	if (x>m) return 1;
	if (v2[x]) return dfs2(x+1);
	int t=0;
	rep(i,1,m) if (!v2[i]) ++t;
	rep(i,x,m) if (!v2[i])
	{
		v2[i]=x,v2[x]=i;int ok=1;
		rep(j,1,n) if (a[j][x]!=a[v1[j]][i]||a[j][i]!=a[v1[j]][x]) 
		{
			ok=0;
			break;
		}
		if (ok&& ((t&1)||(i!=x))&&dfs2(x+1)) return 1;
		v2[i]=v2[x]=0;
	}
	return 0;
}

int dfs1(int x)
{
	if (x>n) return dfs2(1)	;
	if (v1[x]) return dfs1(x+1);
	int t=0;
	rep(i,1,n) if(!v1[i]) ++t;
	rep(i,x,n) if (!v1[i])
	{
		v1[i]=x,v1[x]=i;
		if ((t&1 || i!=x) && dfs1(x+1)) return 1;
		v1[i]=v1[x]=0;
	}
	return 0;
}

signed main()
{
	read(n);read(m);
	rep(i,1,n) scanf("%s",a[i]+1);
	return printf("%s",dfs1(1)?"YES":"NO"),0;
}


Measured memory_bytes: 256
# coding: utf-8

N = int(input().rstrip())
data = []
yen_1btc = 380000
total = 0

for i in range(N):
    data.append(input().rstrip().split())
    if data[i][1] == "JPY" :
        total += int(data[i][0])
    else:
        total += float(data[i][0]) * yen_1btc


print(total)


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
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;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  ll a, b; char c;cin >> a >> c >> b;
  ll ans = (c=='+')?a+b:a-b;
  // bool ok = false;

  cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


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

int main() {
  int n;
  string s;
  cin>>n>>s;
  int p=s.size();
  for(int i=0;i<p;i++){
    int x=s[i]-'A';
    x+=n;
    x%=26;
    s[i]='A'+x;
  }
  cout<<s<<endl;
}

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

int main(){
  int n,m,c;
  cin>>n>>m>>c;
  int b[m];
  for(int i=0;i<m;i++)
    cin>>b[i];
  int a[n][m];
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
      cin>>a[i][j];
  int count = 0;
  for(int i=0;i<n;i++){
    int sum = c;
    for(int j=0;j<m;j++)
      sum += a[i][j]*b[j];
    if(sum > 0)
      count++;
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

void solve()
{
	ll n;
	cin >> n;
	
	vector<ll> a(n);
	for(ll i = 0; i < n; i++)
		cin >> a[i];
	sort(a.begin(), a.end());
	
	int cnt = 0;
	for(int i = 0; i < n; i++)
	{
		for(int j = i; j < n; j++)
		{
			for(int k = j; k < n; k++)
			{
				if(a[i] + a[j] > a[k] && a[i] != a[j] && a[j] != a[k] && a[i] != a[k])
					cnt++;
			}
		}
	}
	cout << cnt << "\n";
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//int TT; cin >> TT; 
	//for(int tt = 1; tt <= TT; tt++)
		solve();
}


Measured memory_bytes: 3656