akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <map>
#include <string>

int main() {
	std::queue< std::pair<std::string, int> > queue;
	int n;
	int q;
	std::cin >> n >> q;
	for (int i = 0; i < n; i++) {
		std::string name;
		int time;
		std::cin >> name >> time;
		queue.push(std::make_pair(name, time));
	}
	// Round-Robin
	int t = 0;
	while (!queue.empty()) {
		std::pair<std::string, int> p = queue.front();
		queue.pop();
		if (p.second <= q) {
			t += p.second;
			std::cout << p.first << " " << t << std::endl;
		} else {
			t += q;
			p.second -= q;
			queue.push(p);
		}
	}
	return 0;
}

Measured memory_bytes: 6324
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
#define ll long long
#define INFTY 1 << 21
ll min(ll a, ll b) { return b < a ? b : a; }
ll max(ll a, ll b) { return b < a ? a : b; }

int main() {
  int N;
  cin >> N;
  int A[N], B[N], C[N - 1];
  int ans = 0;

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

  for (int i = 0; i < N; i++) {
    cin >> B[i];
    ans += B[i];
  }

  for (int i = 0; i < N - 1; i++) {
    cin >> C[i];
  }

  for (int i = 0; i < N - 1; i++) {
    if ((A[i + 1] - A[i]) == 1) {
      ans += C[A[i] - 1];
    }
  }

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


Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)

cnt = 0
allp = 0
min = 10000000000
A.each do |a|
  cnt += 1 if a < 0
  allp += a.abs
  min = a.abs if a.abs < min
end

if cnt.even?
  puts allp
else
  puts allp - min - min
end

Measured memory_bytes: 8580
use proconio::{fastout, input};
#[fastout]
fn main() {
    input! { s:String }
    let st = s;
    if st.chars().last().unwrap() == 's' {
        println!("{}es", &st[..st.len()]);
    } else {
        println!("{}s", &st[..st.len()]);
    }
}


Measured memory_bytes: 2136
import java.util.*
import java.io.PrintWriter



fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val cout = PrintWriter(System.`out`)
    val n = cin.nextInt()
    val a = Array<Int>(n, { cin.nextInt() - 1 })
    val b = Array<Int>(n, { cin.nextInt() })
    val c = Array<Int>(n - 1, { cin.nextInt() })

    var ans = 0
    for (i in 0..n-1) {
        ans += b[i]
        if (i != 0) {
            if (a[i] == a[i-1] + 1) {
                ans += c[a[i-1]]
            }
        }
    }
    cout.println(ans)
    cout.flush()
}


fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() =listOfString().map { it.toInt() }
fun listOfLong() =listOfString().map { it.toLong() }
fun listOfDouble() =listOfString().map { it.toDouble() }

Measured memory_bytes: 31268
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#define N 200001
#define lc(x) (x<<1)
#define rc(x) (x<<1|1)
#define l(x) tree[x].l
#define r(x) tree[x].r
#define sum(x) tree[x].sum
#define tag(x) tree[x].tag
#define all(x) (x).begin(),(x).end()
using namespace std;vector<int> buc[N];long long ans[N];
struct edge{int v,next;edge(){}edge(int _v,int _next){v=_v;next=_next;}}e[N<<1];int head[N],sz;
void init(){memset(head,-1,sizeof(head));sz=0;}void insert(int u,int v){e[++sz]=edge(v,head[u]);head[u]=sz;}
struct node{int l,r,sum,tag;node(){tag=-1;}}tree[N<<2];void pushup(int x){sum(x)=sum(lc(x))+sum(rc(x));}
void apply(int x,int p){sum(x)=p*(r(x)-l(x)+1);tag(x)=p;}void pushdown(int x){if(!~tag(x))return;apply(lc(x),tag(x));apply(rc(x),tag(x));tag(x)=-1;}
void build(int l,int r,int x){l(x)=l;r(x)=r;if(l==r)return;build(l,l+r>>1,lc(x));build((l+r>>1)+1,r,rc(x));pushup(x);}
int query(int l,int r,int x){if(l<=l(x)&&r(x)<=r)return sum(x);pushdown(x);int ans=0;if(l<=l(x)+r(x)>>1)ans+=query(l,r,lc(x));if(r>l(x)+r(x)>>1)ans+=query(l,r,rc(x));return ans;}
void cover(int l,int r,int p,int x){if(l<=l(x)&&r(x)<=r){apply(x,p);return;}pushdown(x);if(l<=l(x)+r(x)>>1)cover(l,r,p,lc(x));if(r>l(x)+r(x)>>1)cover(l,r,p,rc(x));pushup(x);}
int n,c[N],siz[N],dep[N],dfn[N],clk;void dfs(int u,int f){dfn[u]=++clk;dep[u]=dep[f]+1;for(int i=head[u];~i;i=e[i].next)if(e[i].v!=f)dfs(e[i].v,u),siz[u]+=siz[e[i].v];++siz[u];}
bool cmp(int a,int b){return dep[a]>dep[b];}
int main()
{
	scanf("%d",&n);init();for(int i=1;i<=n;++i)scanf("%d",c+i);for(int i=1,u,v;i<n;++i)scanf("%d%d",&u,&v),insert(u,v),insert(v,u);build(1,n,1);
	dfs(1,0);for(int i=1;i<=n;++i)buc[c[i]].push_back(i),ans[i]=1ll*n*(n+1)/2;
	for(int i=1;i<=n;++i)
	{
		sort(all(buc[i]),cmp);cover(1,n,0,1);
		for(int _=0;_<buc[i].size();++_)
		{int j=buc[i][_];
			for(int k=head[j],x;~k;k=e[k].next)if(dep[e[k].v]>dep[j])x=siz[e[k].v]-query(dfn[e[k].v],dfn[e[k].v]+siz[e[k].v]-1,1),ans[i]-=1ll*x*(x+1)/2;
			cover(dfn[j],dfn[j]+siz[j]-1,1,1);
		}
		int x=n-query(1,n,1);ans[i]-=1ll*x*(x+1)/2;
	}
	for(int i=1;i<=n;++i)printf("%lld\n",ans[i]);return 0;
}

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

int main(){
  long long N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  long long ans1 = 0, ans2 = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(j > i && vec.at(i) > vec.at(j)){
        ans1 += 1;
      }
      if(vec.at(i) > vec.at(j)){
        ans2 += 1;
      }
    }
  }
  long long ans3 = 0;
  long long k = K*(K-1) / 2 % 1000000007;
  ans3 = K * ans1 + ans2 * k;
  cout << ans3 % 1000000007 << endl;
}
      

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int NIL = -1;
const int INF = (1<<21);
const long long MOD = 1e9+7;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main() {
  int N, M; cin >> N >> M;
  int left = 1, right = N;
  for (int i = 0; i < M; ++i) {
    int l, r; cin >> l >> r;
    if (left < l) left = l;
    if (right > r) right = r;
  }
  int ans = right - left + 1;
  if (ans < 0) cout << 0 << endl;
  else cout << right - left + 1 << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#define ll long long
using namespace std;
int main () {
	int q,p = 0,n; cin >> q; ll ans = 0;
	while (q--){
		cin >> n;
		if (n<p) ans += p-n;
		else p=n;
	} cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3148
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=2e9,MOD=1e9+7,MAX=1e5+2;


int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS;
    int n;
    cin>>n;
    string s;
    while(true){
        s=to_string(n);
        char c=s[0];
        int f=0;
        lp(i,0,sz(s))
            if(s[i]!=c)
                f=-1;
        if(~f)
            break;
        n++;
    }
    cout<<n;
}


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

int main(){
  int mod=pow(10,9)+7;
  int n,k;
  cin>> n >> k;
  
  vector<int> ans(k);  
  if (n==k) ans.at(0)=1;
  else{//そういえばパスカルの三角形というものがありました
    int num=max(k,n-k);
    vector<vector<int64_t>> dp(num,vector<int64_t> (k+1)); //dp[i][j]はi+1個のボールをj+1分割する場合の数
    dp.at(0).at(0)=1;
    for (int i=1; i<num; i++){
      dp.at(i).at(0)=1;
      auto before=dp.at(i-1);
      for (int j=1; j<=min(i,k); j++){
        dp.at(i).at(j)=before.at(j-1)+before.at(j);
        dp.at(i).at(j)%=mod;
      }
    }
  
    auto blue=dp.at(k-1),red=dp.at(n-k-1); //n==kの時ここでout of rangeになる
    ans.at(0)=(2+red.at(1))%mod;
    for (int i=1; i<k; i++){
      ans.at(i)=(blue.at(i)*(red.at(i-1)+2*red.at(i)+red.at(i+1)))%mod; //おそらくここでまた桁が足りなくなってた
    }
  }
  
  for (int i: ans) cout<< i <<endl;
}

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

#include <iostream>

class BTripleDots {
public:
    void solve(std::istream& in, std::ostream& out) {
        int k;
        std::string s;
        in >> k >> s;
        if(s.length() > k){
            for(int i = 0; i < k; i++){
                out << s[i];
            }
            out << "..." << std::endl;
        }else{
            out << s << std::endl;
        }
    }
};


int main() {
    BTripleDots solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3628
using System;

class Program
{
    static void Main()
    {
        var S = Console.ReadLine();
        var T = Console.ReadLine();

        var counter = 0;
        for (int i = 0; i < S.Length; i++)
        {
            if (S[i] == T[i])
            {
                counter++;
            }
        }
        Console.WriteLine(counter);
    }
}


Measured memory_bytes: 13140
A=[int(input()) for _ in range(5)]

cnt1=0
cnt2=10

for i in range(5):
	if 0<A[i]-(A[i]//10)*10<cnt2:
		cnt1=i
		cnt2=A[i]-(A[i]//10)*10

res=A[cnt1]
		
for i in range(5):
	if i!=cnt1:
		res+=((A[i]+9)//10)*10

print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
  int n;
  string s;
  cin >> n >> s;

  for (int i = 0; i < s.size(); i++) {
    int a = s.at(i) - 'A';
    char c = (a + n) % 26 + 'A';
    cout << c;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n,k;
	cin>>n>>k;
	ll res=1LL;
	for(int i=1;i<=n;i++)
	{
		if(2LL*res<res+k)
		{
			res*=2;
		}
		else res+=k;
	}
	cout<<res;
}

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

using namespace std;

const int maxx = 100050;
int a[maxx],b[4];
int n;
void init()
{
    for(int i = 0; i < 100000; i++)
    {
        a[i] = i*i;
    }
}

int main()
{
    init();
    scanf("%d",&n);
    for(int i = 0; i < 100000; i++)
    {
        if(a[i] > n) {
            printf("%d\n",a[i-1]);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdin = new Scanner(System.in);
		int n, m;
		n = stdin.nextInt();
		String[] Blue = new String[n];
		for (int i = 0; i < n; i++) {
			Blue[i] = stdin.next();
		}
		m = stdin.nextInt();
		String[] Red = new String[m];
		for (int i = 0; i < m; i++) {
			Red[i] = stdin.next();
		}
		int a = 0, b = 0, c, cmax = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (Blue[i].equals(Blue[j])) {
					a++;
				}
			}
			for (int k = 0; k < m; k++) {
				if (Blue[i].equals(Red[k])) {
					b++;
				}

			}
			c = a - b;
			a=0;b=0;
			if (c > cmax) {
				cmax = c;
			}
		}
		System.out.println(cmax);
	}
	

}

Measured memory_bytes: 23764
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<functional>
#include<string>

using namespace std;

int main(void){

    int n;
    cin >> n;

    vector<int> a(n);

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

    int count = 0;
    for(int i = 0;i < n;i++) {
        if(a[i] == count+1) count++;
    }

    int ans = (count == 0 ? -1 : n - count);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,h;
int a[100005];
int ans;
int main() {
	cin>>h>>n;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) ans+=a[i];
	if(ans>=h) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 640
N, M = map(int, input().split())
H_list = list(map(int, input().split()))
ab_list = [[i] for i in range(N)]
for i in range(M):
    ab = list(map(int, input().split()))
    ab_list[ab[0]-1].append(ab[1]-1)
    ab_list[ab[1]-1].append(ab[0]-1)
ans = N
for i in ab_list:
    for j in range(1, len(i)):
        if H_list[i[0]] <= H_list[i[j]]:
            ans -= 1
            break
print(ans)

Measured memory_bytes: 35400
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        Console.WriteLine(Console.ReadLine().Split().Select(long.Parse).Aggregate(0L, GCD));
    }

    static long GCD(long a, long b)
    {
        while (true)
        {
            if (a > b)
            {
                if (b == 0) return a;
                a %= b;
            }
            else
            {
                if (a == 0) return b;
                b %= a;
            }
        }
    }
}

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

int main()
{
    int n;
    ll tmp, res = 1, max = 1000000000000000000;
    cin >> n;
    bool ng = false;

    for(int i = 0; i < n; ++i)
    {
        cin >> tmp;
        if(tmp == 0)
        {
            cout << 0 << "\n";
            return 0;
        }
        if(ng || tmp > max / res || res * tmp > max)
        {
            ng = true;
        }
        res *= tmp;
    }

    cout << (ng ? -1 : res) << "\n";
    return 0;
}

Measured memory_bytes: 3640
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
int main()
{
	fast;
	ll n, k, x, y, ans = 0;
	cin >> n >> k >> x >> y;
	if (n > k)
	{
		cout << k*x + (n - k)* y << endl;
	}
	else
	{
		cout << n*x << endl;
	}


	return 0;
}

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

int main() {
   int k, n;
   string s;
   cin >> k >> s;
   n = s.size();

   if(n <= k) {
      cout << s << endl;
      return 0;
   } else {
      s = s.substr(0, k);
      cout << s << "..." << endl;
   }
}

Measured memory_bytes: 3604
X, K, D = map(int, input().split())
X = abs(X)
if X > D*K:
    print(X-D*K)
else:
    n, c = divmod(X, D)
    if n%2:
        if K%2:
            print(c)
        else:
            c = D-c
            print(c)
    else:
        if K%2:
            c = D-c
            print(c)
        else:
            print(c)


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

int main(){
    int X,Y; cin >> X >> Y;
    int a,b,f;

    rep(a,X){
        b = X - a;
        f = 2 * a + 4 * b;
        if(f == Y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3640
// #pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define S second
#define F first

using namespace std;

const ll N = 1e5 + 5;

int main()
{
    int n, xx, c = 0;
    scanf("%d", &n);
    multiset<int> s;
    for(int i = 0 ; i < n ; i++)
    {
        scanf("%d", &xx);
        if(s.empty())
        {
            c++;
            s.emplace(xx);
        }
        else
        {
            auto i = s.lower_bound(xx);
            if(i != s.begin()) i--;
            if(*i < xx) s.erase(i);
            else c++;
            s.emplace(xx);
        }
    }
    printf("%d\n", c);
    return 0;
}


Measured memory_bytes: 4992
#include<cstdio>
#include<algorithm>
using namespace std;
int a,b,c,K,ans;
int main(){
	scanf("%d%d%d%d",&a,&b,&c,&K);
	int x;
	x=min(a,K);ans+=x;K-=x;
	x=min(b,K);K-=x;
	x=min(c,K);ans-=x;K-=x;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1712
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

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

    if(N%2!=0){
        cout << "No" << endl;
        return 0;
    }
    
    int n = N/2;
    for(int i=0;i<n;i++){
        if(S[i]!=S[i+n]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
return 0;
}


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

int main() {
	int m = 0;
	int f = 0;
	int r = 0;
	while (true) {
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		if (m == -1 || f == -1) cout << "F" << endl;
		if ((m + f) >= 80) cout << "A" << endl;
		if ((m + f) >= 65 && (m + f) < 80) cout << "B" << endl;
		if ((m + f) >= 50 && (m + f) < 65) cout << "C" << endl;
		if ((m + f) >= 30 && (m + f) < 50 && r >= 50 && m > -1 && f > -1) cout << "C" << endl;
		if ((m + f) >= 30 && (m + f) < 50 && r < 50 && m>-1 && f > -1) cout << "D" << endl;
		if ((m + f) < 30) cout << "F" << endl;
	}
	return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<double> vec(N);
    for(int i=0; i<N; i++){
        cin >> vec[i];
    }

    while(vec.size()>=2){
        sort(vec.begin(),vec.end());
        double g = (vec[0] + vec[1])/2.0;
        reverse(vec.begin(), vec.end());
        vec.pop_back();
        vec.pop_back();
        vec.push_back(g);
    }

    cout << vec[0] << endl;
}


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

int main(void) {
  ios::sync_with_stdio(false);
  int N, M, K;
  cin >> N >> M >> K;

  vector<bool> NM(N * M + 1, false);
  for (int i = 0; i < N; ++i) {
    int num = i * M;
    NM[num] = true;
    for (int j = 0; j < M; ++j) {
      num += (N - i);
      num -= i;
      NM[num] = true;
    }
  }

  if (NM[K])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
#define N 1048573
//1048573

int t[N];
string a,str;

int hash2(int x){
  return 1 + x%(N-1);
}

int hash(){
  int x=0;
  for(int i=0;i<(int)str.size();i++){
    x*=4;
    if(str[i]=='A')x++;
    else if(str[i]=='T')x+=2;
    else if(str[i]=='G')x+=3;
    else x+=4;
  }
  return x;
}

bool find(){
  int x=hash();
  int y=hash2(x);
  int i=x%N;
  while(1){
    if(t[i]==-1)return false;
    else if(t[i]==x)return true;
    i=(i+y)%N;
  }
}

void insert(){
  int x=hash();
  int y=hash2(x);
  int i=x%N;
  while(1){
    if(t[i]==x)return;
    if(t[i]==-1){
      t[i]=x;
      return;
    }
    i=(i+y)%N;
  }
}
int main(){
  for(int i=0;i<N;i++)t[i]=-1;
  int Tc;
  cin>>Tc;
  while(Tc--){
    cin>>a>>str;
    if(a=="insert"){
      insert();
    }else{
      cout<<(find()?"yes":"no")<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 5300
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define MAX_N 100001
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef pair<int, int> P;

bool operator< (const P &a,const P &b){
  return a.first < b.first;
};
int main()
{
  bool used[300010];
  int i,N,a[300010];
  long long int lsum=0,rsum=0,res=-999999999999999;
  P s,t;
  cin >> N;
  REP(i,3*N)scanf("%d",&a[i]);
  priority_queue<P,vector<P>, greater<P> > left,right;
  REP(i,N){
    lsum += a[i];
    left.push(P(a[i],i));
  }
  for(i=N;i<3*N;i++)
    right.push(P(a[i],i));
  for(i=0;i<N;i++){
    s = right.top();right.pop();
    rsum += s.first;
    used[s.second] = 1;
  }
  res = max(res,lsum-rsum);
  for(i=N;i<2*N;i++){
    s = left.top();
    if(s.first < a[i]){
      left.pop();
      lsum -= s.first;
      lsum += a[i];
      left.push(P(a[i],i));
    }
    if(used[i] == 1){
      used[i] = 0;
      rsum -= a[i];
      do{
        s = right.top();right.pop();
      }while(s.second <= i && !right.empty());
      used[s.second] = 1;
      rsum += s.first;
    }
    res = max(res,lsum - rsum);
  }
  
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 4340
#include<iostream> 
#include<cstdio>
#include<cstring>
#include<algorithm>
#define sc scanf
using namespace std;
int n,e,b,ans;
inline bool judge(int p){
	int w=0;
	do{
		w+=p%10;
		p/=10;
	}while(p);
	return (w>=b&&w<=e);
}
int main(){
	sc("%d%d%d",&n,&b,&e);
	for(int i=1;i<=n;i++)if(judge(i))ans+=i;
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


void solve(void)
{

 
  int w, h, x, y;
  cin >> w >> h >> x >> y;
  double ans = double(w*h)/2;
  cout<<ans<<" ";
  if(w == 2*x && h == 2*y) cout <<1<< endl;
  else cout <<0<< endl;
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn int
using ll = long long;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


const int MAX = 100005;
const int NIL = -1;

struct Node {
	int parent;
	int left;
	int right;
};


Node T[MAX];
int n, Depth[MAX], Degree[MAX], Sibling[MAX], Height[MAX];

void print(int u) {
	int i, c;
	cout << "node " << u << ": ";
	cout << "parent = " << T[u].parent << ", ";
	cout << "sibling = " << Sibling[u] << ", ";
	cout << "degree = " << Degree[u] << ", ";
	cout << "depth = " << Depth[u] << ", ";
	cout << "height = " << Height[u] << ", ";

	if (T[u].parent == NIL) cout << "root";
	elif(T[u].left == NIL && T[u].right == NIL) cout << "leaf";
	else cout << "internal node";
	cout << endl;
	/*cout << '[';
	for (i = 0, c = T[u].left; c != NIL; i++, c = T[c].right) {
	if (i) cout << ", ";
	cout << c;
	}
	cout << ']' << endl;*/
}

void rec(int u, int p) {
	Depth[u] = p;
	if (T[u].right != NIL) rec(T[u].right, p);
	if (T[u].left != NIL) rec(T[u].left, p + 1);
}

void DepRec(int id, int depth) {
	if (id == NIL)
		return;
	Depth[id] = depth;
	DepRec(T[id].left, depth + 1);
	DepRec(T[id].right, depth + 1);
}

int HeightRec(int id) {
	int h1 = 0, h2 = 0;
	if (T[id].left != NIL)
		h1 = HeightRec(T[id].left) + 1;
	if (T[id].right != NIL)
		h2 = HeightRec(T[id].right) + 1;
	return Height[id] = max(h1, h2);
}

signed main() {
	int i, j, n, id, left, right;
	cin >> n;
	rep(i, n) T[i].parent = T[i].left = T[i].right = Sibling[i] = NIL;
	rep(i, n) Degree[i] = 0;
	rep(i, n) {
		cin >> id >> left >> right;
		T[id].left = left;
		T[id].right = right;
		if (left != NIL) {
			T[left].parent = id;
			if(right != NIL) Sibling[left] = right;
			Degree[id]++;
		}
		if (right != NIL) {
			T[right].parent = id;
			if(left != NIL) Sibling[right] = left;
			Degree[id]++;
		}
	}
	int root;
	rep(i, n) if (T[i].parent == NIL) root = i;
	DepRec(root, 0);
	HeightRec(root);
	rep(i, n) print(i);
	return 0;
}


Measured memory_bytes: 3120
import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
import heapq


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

data = getInputListInt()
n = data[0]
k = data[1]

counter = 1
num = k

flg = True
while flg:
    if n > num-1:
        num *= k
        counter += 1
    else:
        flg = False

print(counter)

Measured memory_bytes: 13872
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();

		int  a[] = new int[N];
		int count = 0;

		for(int i = 0; i < N; i++) {
			a[i] = scan.nextInt();
		}

		int x = 1;
		for(int i = 0; i < N; i++) {
			// 左からi番目 == i
			// すぬけさんが満足
			if(a[i] == x) {
				x++;
			}else {
				count++;
			}
		}

		// 砕くの不可能
		if(count == a.length) {
			System.out.println(-1);
		}else {
			System.out.println(count);
		}

	}
}

Measured memory_bytes: 83676
#include <stdio.h>

int main(){
	int i, j, n, s[10000], q, t[500], c=0;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &s[i]);
	}
	scanf("%d", &q);
	for(i = 0; i < q; i++){
		scanf("%d", &t[i]);
	}
	
	for(j = 0; j < q; j++){
		i = 0;
		s[n] = t[j];
		while(s[i] != t[j]){
			i++;
		}
		if(i != n)
		c++;
	}
	
	printf("%d\n", c);
	
	return 0; 
}

Measured memory_bytes: 640
#include<cstdio>

int main(){
	char s[100001];
	scanf("%s",s);
	if(s[2]=='\0'&&s[0]==s[1]){
		printf("1 2\n");
		return 0;
	}
	for(int i=0;s[i+2]!='\0';i++){
		if(s[i]==s[i+1]||s[i]==s[i+2]||s[i+1]==s[i+2]){
			printf("%d %d\n",i+1,i+3);
			return 0;
		}
	}
	printf("-1 -1\n");
	return 0;
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)

as = Array.new(n, true)
m.times do
  i = gets.to_i
  as[i] = false
end

ans = Array.new(n + 1, 0)
mod = 10 ** 9 + 7

ans[0] = 1
ans[1] = 1 if as[0]

2.upto(n) do |i|
  ans[i] += ans[i - 1] if as[i - 1]
  ans[i] += ans[i - 2] if as[i - 2]
  ans[i] %= mod
end

puts ans[n]


Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

vector<P> vp;

int main(){
    int n, m;
    cin >> n >> m;
    rep(i, n){
        ll a, b;
        cin >> a >> b;
        vp.push_back({a,b});
    }
    sort(vp.begin(), vp.end());
    
    ll cnt = 0;
    ll ans = 0;

    rep(i, n){
        if (cnt + vp[i].second <= m){
            ans += vp[i].first * vp[i].second;
            cnt += vp[i].second;
        }
        else {
            ans += vp[i].first * (m - cnt);
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5252
from itertools import chain
N,K = map(int,input().split())
num_bool = [0]*(10**5)
numarray_ind = list()

for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1] += b
# print(num_bool)
sum_count = 0
k=1
for i in range(10**5):
    sum_count += num_bool[i]
    if(sum_count >= K):
        break
    k+=1
print(k)

Measured memory_bytes: 5864
//  IT'S NEVER TOO LATE...

		    #include <bits/stdc++.h>
			#include <complex>
		    #define ll long long

			#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
			#define forn(i, n) fore(i, 0, n)
			#define fori(i, l, r) fore(i, l, (r) + 1)
			#define sz(v) int((v).size())
			#define all(v) (v).begin(), (v).end()
			#define pb push_back
			#define mp make_pair
		    #define ff first
		    #define ss second
			#define inf 1e9
		    
			#define C complex<int>
			#define X real()
			#define Y imag()

		    using namespace std; 

		    const double PI = atan(1)*4;

		    const int mod=1e9+7;


		    bool isprime(int n)
		    {
		        for(int i=2;i*i<=n;i++)
		            if(n%i==0)
		                return false;
		        return true;
		    }
		     
		    bool comp(pair<double,int> a, pair<double,int> b)
		    {
		    	if( b.ff == a.ff )
		    		return a.ss < b.ss ;
		    	return b.ff < a.ff ;
		    }

		    int modpow(int b,int p,int m)
		    {
		    	if(p==0) return 1%m;
		    	if(p%2) return (b*modpow(b,p-1,m))%m;
		    	int u=modpow(b,p/2,m);
		    	return (u*u)%m;
		    }

		    vector<int> ar[100005];
		    int vis[100005],from[100005];
		    double dis[100005];
		    
		     
		/*    void dikstra(int s,int n)
		    {
		    	forn(i,n+3)
		    	{
		    		dis[i]=inf;
		    		vis[i]=0;
		    		from[i]=-1;
		    	}

		    	dis[s]=0;
		    	priority_queue<pair<int,int>> q;
		    	q.push({0,s});
		    	from[s]=s;

		    	while(!q.empty())
		    	{
		    		pair<int,int> a;
		    		a=q.top();
		    		q.pop();
		    		//cout<<a.ss<<" ";

		    		if(vis[a.ss]) continue;
		    		vis[a.ss]=1;

		    		for(pair<int,int> b:ar[a.ss])
		    		{
		    			if(dis[b.ff]>dis[a.ss] + b.ss)
		    			{
		    				dis[b.ff]=dis[a.ss] + b.ss;
		    				from[b.ff]=a.ss;
		    				q.push({-dis[b.ff],b.ff});
		    			}
		    		}
		    	}
		    }*/

		    int main()
		    {
		    	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		     
		    	int tt=1;
		    	//cin>>tt;
		    	
		    	while(tt--)
		    	{
		    		int n,m;
		    		cin>>n>>m;

		    		int dp[n+1][m+1];
	
		    		string s[n];
		    		forn(i,n) cin>>s[i];

		    		fori(i,0,n)
		    		{
		    			fori(j,0,m)
		    			{
		    				dp[i][j]=0;
		    			}
		    		}
		    		dp[1][1]=1;

		    		for(int i=1;i<=n;i++)
					{
						for(int j=1;j<=m;j++)
						{
							if(s[i-1][j-1]=='.')
							{
								if(i-1>=1)
									dp[i][j]=(dp[i][j]%mod+(dp[i-1][j])%mod)%mod;
								if(j-1>=1)
									dp[i][j]=(dp[i][j]%mod+(dp[i][j-1])%mod)%mod;
							}
						}
					}

		    		cout<<dp[n][m];
		    	}

		    	cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";

		    	return 0;
		    }
		    				//              NOW IT'S TIME TO WAKE UP...

Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
// int dx[4]    = {1, 0, -1, 0};
// int dy[4]    = {0, 1, 0, -1};
// ll pas[5001][5002];

signed main() {
    IOS();
    string s;
    cin >> s;
    int n   = s.size();
    bool ok = false;
    for (int left = 0; left < n; ++left) {
        for (int right = left; right < n; ++right) {
            string t = s.substr(0, left) + s.substr(right, n - right);
            if (t == "keyence") ok = true;
        }
    }
    cout << (ok ? "YES" : "NO") << endl;

    return 0;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  if(A+B > C+D){
    cout << "Left" << endl;
  }
  
  if(A+B == C+D){
    cout << "Balanced" << endl;
  }
  
  if(A+B < C+D){
    cout << "Right" << endl;
  }  
}


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

int main(){

    vector<char> v;
    vector<int> v2(26);
    for(int i=0; i<26; i++) v.push_back('a' + i);

    char ch;
    while((ch=getchar()) != EOF)
        for(int i=0; i<26; i++){
            if(ch == v[i]) v2[i]++;
            else if(ch == (v[i]-32)) v2[i]++;
    }

    for(int i=0; i<26; i++){
        cout << v[i] << " : " << v2[i] << endl;
    }

    return 0;
}


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

using namespace std;

using ll = long long int;

int main() {
    // Input
    int A, B;
    cin >> A >> B;

    // Process
    int ans = A * B;

    // Output
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("Ofast")   	//Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
 
using namespace std;
 
#define  fastio         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define rep for(ll i=0;i<n;i++)

int main(){

    ll n;
    cin>>n;
    ll mov = INT64_MAX;
    for(ll i=1;i<=sqrt(n);i++){
        if(n%i==0){
            ll j=n/i;
            mov = min(mov,(j-1)+(i-1));
        }
    }

    cout<<mov<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  map<string,int> mp;
  long long result = 0;
  int n;cin>>n;
  for(int i=0;i<n;++i){
    string s;cin>>s;
    sort(s.begin(),s.end());
    result += mp[s];
    mp[s]++;
  }
  cout<<result<<endl;
  return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define For(a, b, c) for(int a = b; a < c; ++a)
#define Ford(a, b, c) for(int a = b; a > c; --a)

#define int long long
#define ii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
#define reset(a, b) memset(a, b, sizeof(a))
#define bit(x, i) (x >> (i - 1) & 1ll)
#define onbit(x, i) (x | (1ll << (i - 1)))
#define offbit(x, i) (x & ~(1ll << (i - 1)))
#define bitone(i) __builtin_popcountll(i)
#define bitl(i) __builtin_clz(i)
#define bitr(i) __builtin_ctz(i)
#define INF 1000000000000
#define vll vector<ll>
#define vi vector<int>
#define fio ifstream cin("a1.in"); ofstream cout("a1.out")
/********************************************************

Digvijay Bahadur Singh
MNNIT

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


const int MOD=998244353;
const int N = 1e6+100;

/********************************************************************/
                 /* GRAPH*/
//vector<vector<ll>> g;
//vector<bool> vis1,vis2;
/*******************************************************************/
ll power(ll a,ll b)
{
   ll ans =1;
   while(b>0){
   if(b&1) ans = (ans%MOD * a%MOD)%MOD;
   a = (a%MOD * a%MOD)%MOD;
   b=b>>1;
   }
   return ans%MOD;
}
int dp[6200][6200];
int lps(string s)
{
   int n=s.length();
   
   for(int i=0;i<n;i++)
   {
      dp[i][i]=1;
   }
   for(int l=2;l<=n;l++)
   {
      for(int j=0;j<n;j++)
      {
        int i=j+l-1;
         if(s[j]==s[i]&&l==2)
         {
            dp[j][i]=2;

         }
         else if(s[j]==s[i])
         {
            dp[j][i]=dp[j+1][i-1]+2;
         }
         else
         {
            dp[j][i]=max(dp[j+1][i],dp[j][i-1]);
         }
         
      }
   }
   return dp[0][n-1];
}

signed main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
   // fio;
  
    	ll T=1;
   //  cin>>T;
  
   
    
    while(T--)
  {
     ll h,w;
     cin>>h>>w;
     ll ans;
     if(h==1||w==1)
     {
        cout<<1<<"\n";
        return 0;
     }
     if(h%2==0)
     {
        ans=(h/2)*w;
     }
     else
     {
        ans=(h/2)*w + ceil(1.0*w/2);
     }
     
     cout<<ans<<"\n";

    

     

     

  }

  
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
	int run,out,n,score;
	run=out=score=0;
	char eve[10];
	scanf("%d",&n);
	while(n--){
		while(out<3){
			scanf("%s",eve);
			if(strcmp(eve,"HIT")==0){
				run++;
				if(run>3) score++;
			}
			else if(strcmp(eve,"OUT")==0) out++;
			else if(strcmp(eve,"HOMERUN")==0){
				if(run>=3) run=3;
				score += run+1;
				run=0;
			}
		}
		printf("%d\n",score);
		run=out=score=0;
	}
	return 0;
}
			

Measured memory_bytes: 1024
#include <iostream>

using namespace std;
string s[26]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","p","q","r","s","t","u","v","w","x","y","z"};
string a;
int main()
{
    cin>>a;
    for (int i=0;i<=25;i++)
    {
        if (s[i]==a)
        {
            cout<<s[i+1];
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <iostream>
#include <set>
#include <utility>
#include <tuple>
#include <vector>
using namespace std;

struct Median {
private:
  multiset<long long> l, r;
  long long lsum, rsum;

  void balance(){
    while(r.size() and l.size() and *begin(r) < *rbegin(l)){
      long long mi = *begin(r);
      l.insert(mi);
      lsum += mi;
      r.erase(begin(r));
      rsum -= mi;
    }
    while(r.size() > l.size()+1){
      long long mi = *begin(r);
      l.insert(mi);
      lsum += mi;
      r.erase(begin(r));
      rsum -= mi;
    }
    while(l.size() > r.size()){
      long long ma = *rbegin(l);
      r.insert(ma);
      rsum += ma;
      l.erase(l.find(ma));
      lsum -= ma;
    }
  }

public:
  Median() : lsum(0), rsum(0) {}

  void dump(){
    cerr << "lsum = " << lsum << " : rsum = " << rsum << endl;
    for(auto e : l)
      cerr << e << " ";
    cerr << " | " ;
    for(auto e : r)
      cerr << e << " ";
    cerr << endl;
  }

  void add(long long x){
    r.insert(x);
    rsum += x;
    balance();
  }

  void erase(long long x){
    if(l.find(x) != l.end()){
      auto itr = l.find(x);
      lsum -= x;
      l.erase(itr);
    }else{
      auto itr = r.find(x);
      assert(itr != r.end());
      rsum -= x;
      r.erase(itr);
    }
    balance();
  }

  long long median(){
    if((l.size()+r.size())%2)
      return *begin(r);
    long long m = *begin(r) + (*rbegin(l));
    return m/2;
  }

  long long score(){
    long long m = median();
    long long ret = rsum - m*r.size() + m*l.size() - lsum;
    return ret;
  }
};

int main(){
  int W, H, N;
  cin >> W >> H >> N;
  vector<pair<int,int>> V;
  Median X, Y;
  for(int i = 0; i < N; ++i){
    long long x, y;
    cin >> x >> y;
    V.emplace_back(x,y);
    X.add(x);
    X.add(x);
    Y.add(y);
    Y.add(y);
  }
  long long ans = 1e18, mx , my;
  for(auto p : V){
    long long x, y;
    tie(x,y) = p;
    X.erase(x);
    Y.erase(y);

    long long score = X.score() + Y.score();
    // cerr << x << " " << y << " " << score << endl;
    // cerr << "! " << X.score() << " " << Y.score() << endl;
    // cerr << "? " << X.median() << " " << Y.median() << endl;
    // X.dump();
    // Y.dump();
    if(score < ans){
      mx = X.median();
      my = Y.median();
      ans = score;
    }else if(score == ans){
      if(X.median() < mx) mx = X.median(), my = Y.median();
      else if(X.median() == mx){
        my = min(my,Y.median());
      }
    }
    X.add(x);
    Y.add(y);
  }
  cout << ans << "\n" << mx << " " << my << endl;
}



Measured memory_bytes: 22376
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

int main() {
  int r;
  cin >> r;
  cout << r*r << endl;
}

Measured memory_bytes: 256
// ABC170 A - Five Variables
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  // 初期値
  vector<int> vec(5);
  for (int i = 0; i < 5; i++) {
    cin >> vec.at(i);
  }
  
  // Main loop
  for (int i = 0; i < 5; i++) {
    if (vec.at(i) == 0) {
      cout << i + 1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3592
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
//↓10進数でi桁目の数を取り出すセット
unsigned long long deci[20]={1};
//iは0-indexedなので注意！
int deciBit(long long N,int i){
	N/=deci[i];
	return (int)(N%10);
}
//↑10進数でi桁目の数を取り出すセット
int main(){
	for(int i=1;i<20;i++){
		deci[i]=deci[i-1]*10;
	}
	int N;
	cin>>N;
	int ans=INF;
	for(int i=1;i<N;i++){
		int temp=0;
		for(int j=0;j<7;j++){
			temp+=deciBit(i,j);
			temp+=deciBit(N-i,j);
		}
		ans=min(ans,temp);
	}
	cout<<ans<<endl;
	return 0;
}

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

int GCD(int a, int b){
	if(a % b == 0) return b;
	if(b % a == 0) return a;
	if(a > b) return GCD(b, a%b);
	else return GCD(a, b%a);
}

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	vector<int> B(N);
	B[0] = A[0];
	for(int i=1;i<N;i++){
		B[i] = GCD(B[i-1],A[i]);
	}
	vector<int> C(N);
	C[0] = 1;
	C[1] = max(A[0],A[1]);
	if(N > 2){
			C[2] = max(GCD(A[0],A[2]),GCD(A[1],A[2]));
	}
	for(int i=3;i<N;i++){
		C[i] = max(B[i-1], GCD(C[i-1],A[i]));
	}
	cout << C[N-1] << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, k;
    cin >> n >> k;
    double odp = 0;
    double kostka = 1.0 / (double) n;
    for (int i = 1; i <= n; ++i)
    {
        double moneta = 1;
        int wyn = i;
        while (wyn < k)
        {
            wyn *= 2;
            moneta *= 0.5;
        }
        odp += kostka * moneta;
    }
    cout << fixed << setprecision(10);
    cout << odp;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
int main() {
  int a;
  string s;
  cin >> a >>s;
  if(a >=3200){
	cout <<  s << endl;
  }else{
    cout << "red" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    // 青いカード
    int N;
    cin >> N;
    vector<string> blue( N );
    for( auto &x : blue )
    {
        cin >> x;
    }
    // 赤いカード
    int M;
    cin >> M;
    vector<string> red( M );
    for( auto &x : red )
    {
        cin >> x;
    }
    // 青いカードに含まれた文字列のうち、赤いカードに書かれている文字列を全探索し削除する
    sort( ALL( blue ) );
    sort( ALL( red ) );
    REP( i, (int)red.size() )
    {
        REP( j, (int)blue.size() )
        {
            if( red[ i ] == blue[ j ] )
            {
                blue.erase( begin( blue ) + j );
                red.erase( begin( red ) + i );
            }
        }
    }
    // 青いカードに書かれた文字列の重複数をカウントする
    map<string, int> mp;
    REP( i, (int)blue.size() )
    {
        ++mp[ blue[ i ] ];
    }
    // 青いカードに書かれた文字列の MAX を取る
    int res{};
    for( auto && x : mp )
    {
        res = max( res, x.second );
    }
    // 青いカードの文字列が赤いカードの文字列に全て含まれていたら 0,
    // そうでない場合は青いカードに含まれた文字列の重複数が多いものを出力する
    cout << ( mp.empty() ? 0 : res ) << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a_list = [None] * N
for i in range(N):
    a_list[i] = int(input())

#remove duplicate
sorted_a = sorted(a_list, reverse = True)
max_a = sorted_a[0]

result = []
for a in a_list:
    if a == max_a:
        print(sorted_a[1])
    else:
        print(max_a)


Measured memory_bytes: 14076