akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let (s, w) = read();
    let ans = solve(s, w);
    write(ans);
}

fn read() -> (i32, i32) {
    let mut l1 = String::new();
    std::io::stdin().read_line(&mut l1).ok();
    let mut iter = l1.trim().split_whitespace();
    let s: i32 = iter.next().unwrap().parse().unwrap();
    let w: i32 = iter.next().unwrap().parse().unwrap();

    (s, w)
}

fn write(s: &str) {
    println!("{}", s);
}

fn solve<'a>(s: i32, w: i32) -> &'a str {
    if w >= s {"unsafe"} else {"safe"}
}

Measured memory_bytes: 2084
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    s=input()
    print(min(s.count("1"),s.count("0"))*2)
#%%submit!
resolve()

Measured memory_bytes: 39152
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
#define rrep(i, n) for(i = n - 1; i >= 0; i--)
using namespace std;

int h, w;
string s[2000];
int dpU[2001][2001];
int dpD[2001][2001];
int dpL[2001][2001];
int dpR[2001][2001];

int main() {
	int dir, i, j;
	
	cin >> h >> w;
	rep(i, h) cin >> s[i];
	
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '#') dpL[i][j] = j;
			else if (j == 0) dpL[i][j] = -1;
			else dpL[i][j] = dpL[i][j - 1];
		}
		
		rrep(j, w) {
			if (s[i][j] == '#') dpR[i][j] = j;
			else if (j == w - 1) dpR[i][j] = w;
			else dpR[i][j] = dpR[i][j + 1];
		}
	}
	
	rep(j, w) {
		rep(i, h) {
			if (s[i][j] == '#') dpU[i][j] = i;
			else if (i == 0) dpU[i][j] = -1;
			else dpU[i][j] = dpU[i - 1][j];
		}
		
		rrep(i, h) {
			if (s[i][j] == '#') dpD[i][j] = i;
			else if (i == h - 1) dpD[i][j] = h;
			else dpD[i][j] = dpD[i + 1][j];
		}
	}
	
	int ans = 0;
	rep(i, h) {
		rep(j, w) {
			int a = dpR[i][j] - dpL[i][j] - 1;
			int b = dpD[i][j] - dpU[i][j] - 1;
			int score = a + b - 1;
			ans = max(ans, score);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 66944
#include<iostream>

using namespace std;

int a,b;

int main() {
	cin >> a >> b;
	if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
		cout << "Possible";
	} else {
		cout << "Impossible";
	}
	cout << "\n";
	return 0;
}

Measured memory_bytes: 256
import math
def AGC017C(a,f):
    p=0
    for i in range(f,a+1,2):
        p+=math.factorial(a)//math.factorial(a-i)//math.factorial(i)
    return p

n,p=map(int,input().split())
d={1:0,0:0}
a=list(map(int,input().split()))
for i in a:
    d[i%2]+=1
if p==0:
    print((2**d[0])*AGC017C(d[1],0))
else:
    if d[1]==0:
        print(0)
    else:
        print((2**d[0])*(AGC017C(d[1],1)))

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

using namespace std;

int main(void){
    long double N, K;
    long double ans = 0;
    cin>>N>>K;
    long double C = 1.0/N;

    for(int i=1; i<N+1; i++){
        int sum = i;
        int cnt = 0;
        while(sum < K){
            sum *= 2;
            cnt++;
        }
        ans += C * pow(0.5, cnt);
    }

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

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

int main()
{
    double n;
    while (cin >> n) {
        double nums[10];
        nums[0] = n;
    
        for(int i=1;i < 10;++i) {
            if ((i+1)%2) nums[i] = nums[i-1]/3;
            else nums[i] = nums[i-1]*2;
        }
    
        double sum = 0.0;
    
        for(int i=0;i < 10;++i) sum += nums[i];

        printf("%.8f\n", sum);
    }

    return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  int a,b[100],c=0;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b[i];
  }
  sort(b,b+a);
  b[a-1]/=2;
  for(int i=0;i<a;i++){
    c+=b[i];
  }
  cout<<c<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>

using namespace std;

struct en {
    int x,y,r,c;
    vector<int> over;
};

int n, ans;
vector<en> e;
char dp[1<<24];

void solve(int bit) {
    vector<vector<int> > a(5, vector<int>());
    for (int i = 0; i < n; i++) {
        if (bit & (1<<i)) continue;
        bool f = true;
        for (int j = 0; j < e[i].over.size(); j++) {
            int t = e[i].over[j];
            if (!(bit & (1<<t))) f = false;
        }
        if (f) a[e[i].c].push_back(i);
    }
    
    
    if (a[1].size() < 2 && a[2].size() < 2 && a[3].size() < 2 && a[4].size() < 2) {
        ans = max(ans, dp[bit]-'a');
        return;
    }
    
    for (int i = 1; i < 5; i++) {
        if (a[i].size() >= 2) for (int j = 0; j < a[i].size()-1; j++) {
            for (int k = j+1; k < a[i].size(); k++) {
                int nbit = bit;
                nbit |= (1<<a[i][j]);
                nbit |= (1<<a[i][k]);
                if (dp[nbit] != 0) continue;
                dp[nbit] = dp[bit]+2;
                solve(nbit);
            }
        }
    }
}

int main(void){
    while (cin>>n && n) {
        ans = 0;
        vector<en> e2(n);
        e = e2;
        memset(dp, 0, sizeof(dp));
        dp[0] = 'a';
        for (int i = 0; i < n; i++) {
            cin >> e[i].x >> e[i].y >> e[i].r >> e[i].c;
            for (int j = 0; j < i; j++) {
                int tx = e[j].x - e[i].x;
                int ty = e[j].y - e[i].y;
                double t = sqrt(tx*tx + ty*ty);
                if (t < e[i].r + e[j].r) e[i].over.push_back(j);
            }
        }
        
        solve(0);
        cout << ans << endl;;
    }
}

Measured memory_bytes: 19408
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

constexpr Int mod = 1e9+7;
const vector<vector<vector<Int>>> a = {
	{
		{1, 0, 0, 0},
		{0, 1, 0, 0},
		{0, 0, 2, 0},
		{0, 0, 1, 3}
	},
	{
		{1, 0, 0, 0},
		{1, 2, 0, 0},
		{1, 0, 2, 0},
		{0, 1, 1, 3}
	},
	{
		{0, 0, 0, 0},
		{0, 1, 0, 0},
		{0, 0, 1, 0},
		{0, 0, 0, 3}
	},
	{
		{1, 0, 0, 0},
		{0, 2, 0, 0},
		{0, 0, 1, 0},
		{0, 1, 0, 3}
	}
};
Int l, r;
vector<vector<Int>> dp;

vector<Int> p(vector<vector<Int>> b, vector<Int> v){
	vector<Int> res(v.size(), 0);
	for(size_t i=0; i<v.size(); ++i)
		for(size_t j=0; j<b[i].size(); ++j)
			res[i] = (res[i] + (b[i][j] * v[j]) % mod) % mod;
	return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> l >> r;
	Int cl = 0;
	while((l >> cl) > 0) ++cl;
	Int cr = 0;
	while((r >> cr) > 0) ++cr;
//	cerr << cr << " " << cl << "\n";
	dp.resize(cr, vector<Int>(4, 0));
	if(cl == cr){
		dp[0][0] = 1;
	}else{
		dp[0][1] = 1;
		for(size_t i=1; (Int)i<cr-cl; ++i) dp[i][3] = 1;
		dp[cr-cl][2] = 1;
	}
//	for(size_t i=0; i<dp.size(); ++i)
//		for(size_t j=0; j<4; ++j)
//			cerr << dp[i][j] << " \n"[j==3];
	for(size_t i=1; i<dp.size(); ++i){
		size_t j = dp.size() - i - 1;
		size_t k = ((l >> j) & 1) * 2 + ((r >> j) & 1);
//		cerr << j << " " << k << "\n";
		vector<Int> t = p(a[k], dp[i-1]);
		for(size_t l=0; l<4; ++l) dp[i][l] = (dp[i][l] + t[l]) % mod;
	}
	Int ans = 0;
	for(auto i:dp.back()) ans = (ans + i) % mod;
	cout << ans << "\n";
//	for(size_t i=0; i<dp.size(); ++i)
//		for(size_t j=0; j<4; ++j)
//			cerr << dp[i][j] << " \n"[j==3];
}

Measured memory_bytes: 256
//from PKU1125
#define M 501
double dist[M][M],d;
next[M][M],x[M],y[M];
main(){
	int a,b,k,n,i,j;
	for(;scanf("%d",&n),n;){
		/*initialize*/
		for(i=1;i<=n;i++)scanf("%d",&a),scanf("%d%d",x+a,y+a);
		for(i=1;i<=n;i++)for(j=1;j<=n;next[i][j]=j,j++)
			dist[i][j]=(d=hypot(x[i]-x[j],y[i]-y[j]))<50.1?d:999;

		{/*warshall-floyd*/
			int k,i,j;
			for(k=1;k<=n;k++)
				for(i=1;i<=n;i++)
					for(j=1;j<=n;j++){
						if(dist[i][j]>dist[i][k]+dist[k][j])
							dist[i][j]=dist[i][k]+dist[k][j],next[i][j]=next[i][k];
					}
		}

		{/*query*/
			for(scanf("%d",&k);k;k--){
				scanf("%d%d",&a,&b);
				if(dist[a][b]>998)puts("NA");
				else{
					for(j=a;j!=b;j=next[j][b])printf("%d ",j);
					printf("%d\n",b);
				}
			}
		}
	}exit(0);
}

Measured memory_bytes: 1216
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	vector<int> x(3);
	cin >> x[0] >> x[1] >> x[2];
	SORT(x);
	cout << x[2] - x[0] << endl;
	
	return 0;
}

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

using namespace std;
using ll = long long;

#define int ll
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#define pb push_back
#define sz(x) int(x.size())

const int N = 1e6 + 100;
vector<int> g[N];
int n;
int a;
int b;
int da[N];
int db[N];

void dfs(int v, int p, int d[N]) {
	for (int u : g[v]) {
		if (u == p) {
			continue;
		}
		d[u] = d[v] + 1;
		dfs(u, v, d);
	}
}


signed main() {
#ifdef LC
	assert(freopen("input.txt", "r", stdin));
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> a >> b;
	--a;
	--b;
	for (int i = 0; i < n - 1; ++i) {
		int v;
		int u;
		cin >> v >> u;
		--v;
		--u;
		g[v].pb(u);
		g[u].pb(v);
	}
	dfs(a, a, da);
	dfs(b, b, db);
	int answer = 0;
	for (int i = 0; i < n; ++i) {
		if (da[i] >= db[i]) {
			continue;
		}
		answer = max(answer, db[i] - 1);
	}
	cout << answer << "\n";
	return 0;
}


Measured memory_bytes: 38272
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  string ans = "";
  for (int i = 0; i < 2; i++) {
    string head = "";
    head += string(ty - sy + i, 'U');
    head += string(tx - sx + i, 'R');
    head = string(i, 'L') + head;
    head += string(i, 'D');

    string tail = "";
    tail += string(ty - sy + i, 'D');
    tail += string(tx - sx + i, 'L');
    tail = string(i, 'R') + tail;
    tail += string(i, 'U');
    
    ans += head + tail;
  }

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


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

int main(){
int buy,oturi,kouka;
while(1){
cin>>buy;
if(buy==0){
break;
}
oturi=1000-buy;
if(oturi>500){
oturi-=500;
kouka+=1;
}
while(oturi>=100){
oturi-=100;
kouka+=1;
}
while(oturi>=50){
oturi-=50;
kouka+=1;
}
while(oturi>=10){
oturi-=10;
kouka+=1;
}
while(oturi>=5){
oturi-=5;
kouka+=1;
}
while(oturi>=1){
oturi-=1;
kouka+=1;
}
cout<<kouka<<'\n';
kouka=0;
}

return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;

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

int edy[] = {1, 0, -1, -1, -1, 0, 0};
int ody[] = {1, 1, 0,  -1,  0, 1, 0};

class State
{
public:
	int x,y,c,t;
	State(int x, int y, int c, int t)
		:x(x),y(y),c(c),t(t)
	{}

	bool operator<(const State& s) const
	{
		return c > s.c;
	}
};

bool vis[300][300][6];
bool field[300][300];

int main()
{
	memset(vis, 0, sizeof(vis));
	memset(field, 0, sizeof(field));

	int sx,sy,gx,gy;
	cin >> sx >> sy >> gx >> gy;
	sx += 150; sy += 150;
	gx += 150; gy += 150;

	int N;
	cin >> N;
	while(N--) {
		int x,y;
		cin >> x >> y;
		x += 150, y += 150;

		field[x][y] = 1;
	}

	int lx, ly;
	cin >> lx >> ly;

	priority_queue<State> q;
	q.push(State(sx,sy,0,0));

	int res = -1;
	while(!q.empty()) {
		State s = q.top(); q.pop();

		if(s.x == gx && s.y == gy) {
			res = s.c;
			break;
		}

		if(vis[s.x][s.y][s.t]) continue;
		vis[s.x][s.y][s.t] = 1;

		int cmd = abs((s.x-150)*(s.y-150)*s.t)%6;
		for(int i=0; i<7; i++) {
			int tx = s.x + dx[i];
			int ty = s.y;
			int tc = s.c + (cmd == i ? 0 : 1);
			int tt = (s.t + 1) % 6;

			if(s.x%2 == 0) ty += edy[i];
			if(s.x%2 == 1) ty += ody[i];

			if(abs(tx-150) > lx || abs(ty-150) > ly) continue;
			if(field[tx][ty]) continue;

			if(vis[tx][ty][tt]) continue;

			q.push(State(tx, ty, tc, tt));
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 2280
package main

import "fmt"

func main() {
	var n, m, x int
	fmt.Scan(&n, &m, &x)

	a := make([][]int, n)
	p := make([]int, n)
	for i := 0; i < n; i++ {

		fmt.Scan(&p[i])
		a[i] = make([]int, m)
		for j := 0; j < m; j++ {
			fmt.Scan(&a[i][j])
		}
	}

	ans := 1200001
	var tot int
	var ok bool
	for bits := 0; bits < 1<<n; bits++ {
		tot = 0
		ok = true
		skill := make([]int, m)
		for i := 0; i < n; i++ {
			if (bits>>i)&1 == 1 {
				tot += p[i]
				for j := 0; j < m; j++ {
					skill[j] += a[i][j]
				}
			}
		}

		for _, v := range skill {
			if v < x {
				ok = false
				break
			}
		}

		if ok {
			if ans > tot {
				ans = tot
			}
		}
	}

	if ans != 1200001 {
		fmt.Println(ans)
	} else {
		fmt.Println("-1")
	}

}


Measured memory_bytes: 2220
#include <stdio.h>
 
int main(){
 int w,h,x,y,r;
 scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
 if(0<w && w<=100 && 0<h && h<=100 && 0<r && r<=100 && -100<=x && x<=100 && -100<=y && y<=100) {
  if(0<=x-r && x+r<=w && 0<=y-r && y+r<=h){
   printf("Yes\n");
  }else{
   printf("No\n");
  }
 }
 
 return 0;
}

Measured memory_bytes: 584
<?php
// A
fscanf(STDIN, '%d', $T);
for ($t  = 0; $t < $T; $t++) {
    fscanf(STDIN, '%d %d %d %d %d', $N, $A, $B, $C, $D);
    $memo = [0, $D];
    $ans[] = f($N);
}
echo implode(PHP_EOL, $ans);

function f($N)
{
    global $memo, $A, $B, $C, $D;
    if (isset($memo[$N])) return $memo[$N];
    $c = $N * $D;
    foreach ([[2, $A], [3, $B], [5, $C]] as list($x, $X)) {
        $q = intdiv($N, $x);
        $r = $N % $x;
        $c = min($c, $X + $r * $D + f($q));
        if ($r > 0) $c = min($c, $X + ($x - $r) * $D + f($q + 1));
    }
    $memo[$N] = $c;
    return $memo[$N];
}


Measured memory_bytes: 17136
k = int(input())
l = set()


def construct(lunnum: str, depth: int, flag: bool):
    global l
    if depth == 0:
        l.add(int(lunnum))
        return
    m = int(lunnum[-1])
    for i in range(0, 10) if flag else set([max(0, m - 1), m, min(9, m + 1)]):
        construct(lunnum + str(i), depth - 1, (i == 0) & flag)


construct("0", 10, True)
ls = sorted(list(l))
print(ls[k])


Measured memory_bytes: 83136
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return n
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()

	c := map[byte]int{
		'M': 0,
		'A': 0,
		'R': 0,
		'C': 0,
		'H': 0,
	}

	for i := 0; i < n; i++ {
		s := nextString()
		if strings.IndexAny(s, "MARCH") != 0 {
			continue
		}
		c[s[0]]++
	}

	answer := 0

	answer += c['M'] * c['A'] * c['R']
	answer += c['M'] * c['A'] * c['C']
	answer += c['M'] * c['A'] * c['H']
	answer += c['M'] * c['R'] * c['C']
	answer += c['M'] * c['R'] * c['H']
	answer += c['M'] * c['C'] * c['H']
	answer += c['A'] * c['R'] * c['C']
	answer += c['A'] * c['R'] * c['H']
	answer += c['A'] * c['C'] * c['H']
	answer += c['R'] * c['C'] * c['H']

	fmt.Println(answer)
}


Measured memory_bytes: 1536
#include<iostream>

// 10^n (n = 0, 1, 2,...)
int pow10(int n){
    int power = 1;
    for(int i = 0; i < n; i++){
        power *= 10;
    }
    return power;
}


int main(){
    int N;
    std::cin >> N;
    int N_ketayou = N;
    int N_keta = 0;
    while(N_ketayou > 0){
        N_keta++;
        N_ketayou /= 10;
    }
    
    int num = 0;
    // 1桁だけ例外処理
    if(N_keta == 1){
        num += N;
        std::cout << num << std::endl;
        return 0;
    }else{
        num += 9;
    }


    // Nが1桁ではない場合のN_keta - 1まで処理
    for(int keta = 3; keta < N_keta; keta++){
        if(keta % 2 == 0) continue;
        num += pow10(keta - 1) * 9;
    }

    // N_ketaの処理
    if(N_keta % 2 == 1){
        num += N - pow10(N_keta - 1) + 1;
    }


    std::cout << num << std::endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

auto print = [](auto &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, u, v;
  cin >> n >> u >> v;
  u--;v--;
  VVI g(n);
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  VI c(n, 0), d(n, 0);
  vector<bool> visit(n, false);
  queue<int> q;
  q.push(u);
  visit[u] = true;
  while(!q.empty()) {
    int s = q.front(); q.pop();
    for(int t : g[s]) {
      if(!visit[t]) {
        c[t] = c[s] + 1;
        visit[t] = true;
        q.push(t);
      }
    }
  }
  q.push(v);
  fill(all(visit), false);
  visit[v] = true;
  while(!q.empty()) {
    int s = q.front(); q.pop();
    for(int t : g[s]) {
      if(!visit[t]) {
        d[t] = d[s] + 1;
        visit[t] = true;
        q.push(t);
      }
    }
  }
  int ans = 0;
  rep(i, n) {
    if(c[i] < d[i]) {
      ans = max(ans, d[i]);
    }
  }
  out(ans - 1);
  return 0;
}


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

int main() {
    string s, ans="1";
    int k;
    cin >> s >> k;
    for(int i=0; i<k; i++) {
        if(s.at(i)!='1') {
            ans=s.at(i);
            break;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll d , g;
  cin >> d >> g;
  vector<ll> p(d), c(d);
  REP(i, d) cin >> p[i] >> c[i];

  ll ans = INF;
  REP(i, 1<<d){
    ll a = 0;
    ll b = 0;
    REP(j, d){
      if(i & (1<<j)) a += 100*(j+1)*p[j]+c[j], b+=p[j];
    }
    if(a < g){
      REPr(j, d){
        if(i & (1<<j)) continue;
        REP(k, p[j]){
          if(a >= g) break;
          a += 100*(j+1);
          b++;
        }
      }
    }
    chmin(ans, b);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<queue>
#include<string>
#include<cmath>
#include<tuple>
#include <algorithm>
#define INF 1111111111
using namespace std;
typedef pair<int,int> P;
typedef tuple<int,int,int> tup;
typedef long long ll;
vector<int> vec(100100);
vector<int> passed(100100);
vector<int> dx = {-1,1};
int n,k;

int main() {
  cin >> n ;
  if(n>=100 && n<112)
    cout << 111 << endl;
  else if(n>=112 && n<223)
    cout << 222 << endl;
  else if(n>=223 && n<334)
    cout << 333 << endl;
  else if(n>=334 && n<445)
    cout << 444 << endl;
  else if(n>=445 && n<556)
    cout << 555 << endl;
  else if(n>=556 && n<667)
    cout << 666 << endl;
  else if(n>=667 && n<778)
    cout << 777 << endl;
  else if(n>=778 && n<889)
    cout << 888 << endl;
  else if(n>=889 && n<1000)
    cout << 999 << endl;
}

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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)
// ----------------------------------------------------------------------

// ----------------------------------------------------------------------
int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  ll N; cin >> N;
  vector<ll> D(N);
  for (int i = 0; i < N; i++) cin >> D.at(i);
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < i; j++) {
      ans += D.at(i) * D.at(j);
    }
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;

    cin>>n;

    for(int i=1;i<=n;i++)
        cin>>A[i];

    sort(A+1,A+n+1);

    cout<<A[n/2+1]-A[n/2];

    return 0;
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


int main() {
	int A, B, C, D, AB, CD;
	cin >> A >> B >> C >> D;
	AB = A * B; CD = C * D;
	cout << (AB > CD ? AB : CD) << endl;

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

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

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

int main()
{
    int n;
    vl t;
    cin >> n;
    t.resize(n);
    rep(i,n) cin >> t[i];

    ll ans = 1;
    rep(i,n){
        ans = lcm(ans, t[i]);
    }
    cout << ans << endl;
}


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

using namespace std;

int main() {
    char buf[1<<17];
    scanf("%s\n", buf);
    string s(buf);

    int n=0;
    size_t mid=(s.length()+1)/2;
    for (size_t i=0; i<mid; ++i)
        if (s[i] == 'p') --n;

    for (size_t i=mid; i<s.length(); ++i)
        if (s[i] == 'g') ++n;

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


Measured memory_bytes: 384
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();     
        int H, W;
        {int[] a = r.ii(); H = a[0]; W = a[1];}
        char[][] s = new char[H][W];
        for(int i = 0; i < H; i++){
            String t = r.s();
            for(int j = 0; j < W; j++)
                s[i][j] = t.charAt(j);
        }
        int[][] tate = new int[H][W];
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                int temp = 0;
                int start = j;
                while(j < W && s[i][j] == '.'){
                    j++;
                    temp++;
                }
                for(int k = start; k < j; k++){
                    tate[i][k] = temp; 
                }
            }
        }
        int[][] yoko = new int[H][W];
        for(int j = 0; j < W; j++){
            for(int i = 0; i < H; i++){
                int temp = 0;
                int start = i;
                while(i < H && s[i][j] == '.'){
                    i++;
                    temp++;
                }
                for(int k = start; k < i; k++){
                    yoko[k][j] = temp; 
                }
            }
        }
        int ans = 0;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                int temp = tate[i][j]+yoko[i][j]-1;
                if(ans < temp)
                    ans = temp;
            }
        }
        println(ans);        
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 65664
package main
import "fmt"
func main(){
    // Your code here!
    var x, y, z int
    fmt.Scan(&x, &y, &z)
    if x == y || x == z || y == z{
        if x == y && x == z && y ==z {
            fmt.Println("No")
            return 
        }
        fmt.Println("Yes")
        return
    }
     fmt.Println("No")
}

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

using namespace std;

#define ll long long

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> x(n, 0);
    for (int i=0; i<n; ++i)
        cin >> a[i];

    for (int i=0; i<n; ++i) {
        x[0] += pow(-1, i) * a[i];
    }

    for (int i=1; i<n; ++i) {
        x[i] = 2*a[i-1] - x[i-1];
    }

    for (int i=0; i<n; ++i)
        cout << x[i] << " ";

}


Measured memory_bytes: 2048
#include <bits//stdc++.h>
using namespace std;
int in(void){int x;cin>>x;return x;}
#define ll long long int
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
long long int dx[4]={1,0,-1,0};
long long int dy[4]={0,1,0,-1};
int main() {
	char x;
	cin>>x;
	if(x=='A')x='T';
	else if(x=='T')x='A';
	else if(x=='C')x='G';
	else if(x=='G')x='C';
	cout<<x;
	return 0;
}



Measured memory_bytes: 256
from collections import deque

N = int(input())

queue = deque()
queue.append((0,))
while queue:
    s = queue.popleft()
    if len(s) == N:
        print(''.join('abcdefghij'[i] for i in s))
        continue
    for i in range(max(s) + 2):
        queue.append(s + (i,))

Measured memory_bytes: 67548
#include<stdio.h>

int main(void){
    int h,w,i,j;
    i = 0;
    j = 0;
    while(1){
    scanf("%d %d",&h,&w);
        if(h == 0 && w == 0){
            break;
        }
        while(i < h){
            while(j < w){
                printf("#");
                j++;
            }
            j = 0;
            printf("\n");
            i++;
        }
        i = 0;
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, bigCt(0);
    cin>>n;
    vector<bool> v(8,false);
    
    for(int i=0;i<n; i++){
        int x;
        cin>>x;
        if(x<3200) v[x/400]=true;
        else bigCt++;
    }
    int s=0;
    for(bool b:v){
        s+=b;
    }
    cout<<max(s,1)<<" "<<s+bigCt;
    
    return 0;
}

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

const int MAX = 500000;
const int SENTINEL = 2000000000;

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int left, int right, int mid){
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid + i];
  L[n1] = SENTINEL;
  R[n2] = SENTINEL;
  int i = 0, j = 0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }
    else{
      A[k] = R[j++];
    }
  }
}

void mergesort(int A[], int left, int right){
  if(right - left > 1){
    int mid = (left + right) / 2;
    mergesort(A, left, mid);
    mergesort(A, mid, right);
    merge(A, left, right, mid);
  }
}

int main(){
  int n;
  cin >> n;
  int S[MAX];
  for(int i=0;i<n;i++){
    cin >> S[i];
  }
  mergesort(S, 0, n);
  for(int i=0;i<n;i++){
    if(i != n-1) cout << S[i] << " ";
    else cout << S[i] << endl;
  }
  cout << cnt << endl;
  return 0;
}



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

int main() {
  string s;
  cin >> s;
  if (s == "MON") {
    cout << 6 << endl;
  }
  else if (s == "TUE") {
    cout << 5 << endl;
  }
  else if (s == "WED") {
    cout << 4 << endl;
  }
  else if (s == "THU") {
    cout << 3 << endl;
  }
  else if (s == "FRI") {
    cout << 2 << endl;
  }
  else if (s == "SAT") {
    cout << 1 << endl;
  }
  else  {
    cout << 7 << endl;
  }
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func newInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {

	var n, cnt int
	sc.Split(bufio.ScanWords)
	n = newInt()
	l := make([]int, n)

	for i := 0; i < n; i++ {
		l[i] = newInt()
	}

	for i := 0; i < n; i++ {
		for j := 1; j < n; j++ {
			for k := 2; k < n; k++ {
				if i >= j || j >= k {
					continue
				}
				if l[i] != l[j] && l[j] != l[k] && l[k] != l[i] {
					total := l[i] + l[j] + l[k]
					if l[i]*2 >= total || l[j]*2 >= total || l[k]*2 >= total {
						continue
					}
					cnt++
				}
			}
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 1780
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

string b[] = {
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz",
};

int main() {
	int n; cin >> n; cin.ignore();
	for (int i = 0; i < n; i++) {
		string s; getline(cin, s);
		int cnt = -1;
		for (int j = 0; j < s.size(); j++) {
			if (s[j] != '0')cnt++;
			else if (cnt != -1) {
				printf("%c", b[s[j - 1] - '0'][cnt%b[s[j - 1] - '0'].size()]);
				cnt = -1;
			}
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
    return 0;
}

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

using namespace std;

struct node{
    queue<int> connect;
    int dist;
    int mark;
};

int main(){

    int N,M;
    int tmpa,tmpb=0;
    cin >> N >> M;
    node nds[N];
    queue<int> que;
    que.push(1);
    for(int i=0;i<N;i++){
        nds[i].dist=-1;
        nds[i].mark=-1;
    }
    nds[0].dist = 0;
    nds[0].mark = 1;
    for(int i=0;i<M;i++){
        cin >> tmpa >> tmpb;
        nds[tmpa-1].connect.push(tmpb);
        nds[tmpb-1].connect.push(tmpa);
    }

    int focus;
    while(!que.empty()){
        //queをpopしたノードへ移動
        focus=que.front();
        que.pop();
        //cout << focus << endl;
        //queに接続先ノードをpush
        while(!nds[focus-1].connect.empty()){
            int p = nds[focus-1].connect.front();
            nds[focus-1].connect.pop();
            if(nds[p-1].dist == -1 || nds[focus-1].dist + 1 < nds[p-1].dist){
                nds[p-1].dist = nds[focus-1].dist + 1;
                nds[p-1].mark = focus;
                que.push(p);
            }
        }
    }
    bool can = true;
    for(int i=1;i<N;i++){
        if(nds[i].mark == -1)can = false;
    }
    if(can){
        cout << "Yes" << endl;
        for(int i=1;i<N;i++){
            cout << nds[i].mark << endl;
        }
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 71976
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr ll MOD = 998244353;

ll pow(ll n, ll k, ll m) {
	ll r = 1;
	for (; k > 0; k >>= 1) {
		if (k & 1) r = (r*n) % m;
		n = (n*n) % m; 
	}
	return r;
}

int main() {
	ll n; cin >> n;
	ll ans = 0;
	vector<ll> res(1000001, 0);
	vector<ll> c(1000001, 0);
	for (ll i = 0; i < n; ++i) {
		ll a; cin >> a;
		c[a]++;
	}
	for (ll i = 1000000; i > 0; --i) {
		ll sum_of_sq = 0; ll sq_of_sum = 0;
		for (ll j = 1; j*i < 1000001; ++j) {
			sum_of_sq += pow(j*i, 2, MOD) * c[j*i];
			sum_of_sq %= MOD;
			sq_of_sum += j*i * c[j*i];
			sq_of_sum %= MOD;
		}
		sq_of_sum = pow(sq_of_sum, 2, MOD);
		ll dif = (sq_of_sum - sum_of_sq + MOD) % MOD;
		res[i] = dif * pow(2*i, MOD-2, MOD);
		res[i] %= MOD;
		for (ll j = 2; j*i < 1000001; ++j) {
			res[i] += (MOD - res[j*i]) * j;
			res[i] %= MOD;
		}
		ans += res[i];
		ans %= MOD;

	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long int
#define inf 1000000000000
#define MOD 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define for0(i, n) for (int i = 0; i < n; i++)
#define tc(t) int t; cin >> t; while (t--)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ps(x,y)         fixed<<setprecision(y)<<x
using namespace std;
using namespace __gnu_pbds;

int main()
{
	IOS
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	int n;
	cin >> n;
	ll a[n + 1], b[n + 1];
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	sort(a, a + n);
	sort(b, b + n);
	if (n % 2)
	{
		cout << (b[n / 2] - a[n / 2]) + 1 << endl;
	}
	else
	{
		cout << b[n / 2] - a[n / 2] + b[(n - 1) / 2] - a[(n - 1) / 2] + 1 << endl;
	}
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    double R;
    cin >> R;
    printf("%.5f\n", 2*R*M_PI);
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int count, sum = 0;
  bool b = true;
  for(int i = 0; i < N; i++) {
    if(A.at(i) % 2 == 1) {
      cout << "0" << endl;
      b = false;
      break;
    }
  }
  while(b) {
    for(int i = 0; i < N; i++) {
      A.at(i) = A.at(i) / 2;
    }
    count++;
    for(int i = 0; i < N; i++) {
      if(A.at(i) % 2 == 1) {
        b = false;
        cout << count << endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N,M,X,Y;
cin >> N >> M >> X >> Y;
vector<int> A(N);
vector<int> B(M);
int mini = INF,maxi = -1;
for (int i = 0;i < N;i++) {
    cin >> A.at(i);
    if (A.at(i) > maxi) maxi = A.at(i);
}

for (int i = 0;i < M;i++) {
    cin >> B.at(i);
    if (B.at(i) < mini) mini = B.at(i);
}
bool ans = false;
for (int Z = X+1;Z <= Y;Z++) {
    if (maxi < Z && mini >= Z) {
        ans = true;
    }
    } 

if (ans == true) cout << "No War" << endl;
else cout << "War" << endl;


return 0;
}


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

//highlight color RGB = [70,70,70]
#define asll unsigned long long
#define ll long long
#define ld long double
#define imt int
#define pii pair<int,int>
#define st first
#define nd second
#define kj <<" "<<
#define kjb <<" ";
#define dg <<","<<
#define ml <<endl;
#define co cout<<
#define ter cout<<endl;
#define sibi cout<<"TES"<<endl;
#define tes(x) cout<<"TES "<<x<<endl;
#define psbk(x) push_back(x);
#define For(x,a,b) for(int x=(a);x<(b);x++)
#define FOR(x,n) for(int x=0;x<(n);x++)
#define kera(x,m) for( int i = 0;i < m ; i++ ){ cout<<"x["<< i <<"] =" kj x[i] ml}
#define kpr(x) cout<<"("<<x.st dg x.nd <<")" ml
#define kkor(p) cout<<"("<<p.x dg p.y <<")" ml
#define m_p make_pair
asll M=1e9+7;
int n,m,tc;
int p,q,r;
ll ps[200005];
ll a[200005];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(0);
	srand(time(0));
	cin>>n;
	ps[0]=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		ps[i]=ps[i-1]+a[i];
		ps[i]=ps[i]%M;
	}
	ll hasil=0;
	ll js;
	for(int i=1;i<=n;i++){
		int j=i+1;
		js=a[j]*ps[i];
		js%=M;
		hasil+=js;
		hasil%=M;
	}
	cout<<hasil<<endl;
	
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_K 100
#define MAX_N 100
#define N_ROCK 2000001
i64 K, X;


int main() {
  cin >> K >> X;

  i64 min_l = max(X - K + 1, (i64)-1000000);
  i64 max_r = min(X + K  -1,  (i64)1000000);
  for (i64 i = min_l; i <= max_r; i++) {
    cout << i << " ";
  }
  cout << endl;

  return 0;
}

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

int main() {
	int a,c,m[1000],i;
	while(cin>>a){
		int b=0;
		for(i=0;i<a;i++){ 
			cin>>m[i];
			if(m[i]%2==0){
				b++;
			}
		}
		c=pow(3,a)-pow(2,b);
		cout<<c<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int N=100010;
int n,A[N],num[N],id[N],c;
int dfs(int v,int p){
    if(p!=-1){
        if(id[v]){
            if(id[v]==id[p]){
                return num[p]-num[v]+1;
            }
            else return 0;
        }else{
            num[v]=num[p]+1;
            id[v]=c;
        }
    }
    return dfs((v+A[v])%n,v);
}
int main(){
    cin>>n; 
    for(int i=0;i<n;i++){
        scanf("%d",A+i);
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(id[i]) continue;
        c++;
        id[i]=c;
        num[i]=1;
        ans+=dfs(i,-1);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4412
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

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

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<int> w(n);
		REP(i, n) cin >> w[i];
		int ss = 0;
		REP(i, n) ss += w[i];
		int sum = 0;
		int ans = 10000000;
		REP(i, n-1) {
			sum += w[i];
			chmin(ans, abs(sum - (ss-sum)));
			DEBUG(ans);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
	ll n, a, b; cin >> n >> a >> b;
	ll x[100001];
	repe(i, 1, n)cin >> x[i];
	ll ans = 0;
	rep(i, 1, n) {
		ans += min((x[i + 1] - x[i])*a, b);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
def put_class(n):
  if n <= 48:
    print("light fly")
  elif n <= 51:
    print("fly")
  elif n <= 54:
    print("bantam")
  elif n <= 57:
    print("feather")
  elif n <= 60:
    print("light")
  elif n <= 64:
    print("light welter")
  elif n <= 69:
    print("welter")
  elif n <= 75:
    print("light middle")
  elif n <= 81:
    print("middle")
  elif n <= 91:
    print("light heavy")
  else:
    print("heavy")

while True:
  try:
    put_class(float(input()))
  except EOFError:
    break



Measured memory_bytes: 5576
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   int k;
   cin>>k;
   cin>>s;
   int len=s.size();
   if(k<len){
    string s1(s.begin(),s.begin()+k);
    cout<<s1<<"..."<<endl;
   }
   else
   {
       cout<<s<<endl;
   }
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
char a[60];
int num[100];
int m[100];
int main(){
	int n;
	scanf("%d",&n);
	memset(m,51,sizeof(m));
	while(n--){
		scanf("%s",a);
		memset(num,0,sizeof(num));
		for(int i = 0;i<strlen(a);i++){
			if(a[i]=='a')num[1]++;
			else if(a[i]=='b')num[2]++;
			else if(a[i]=='c')num[3]++;
			else if(a[i]=='d')num[4]++;
			else if(a[i]=='e')num[5]++;
			else if(a[i]=='f')num[6]++;
			else if(a[i]=='g')num[7]++;
			else if(a[i]=='h')num[8]++;
			else if(a[i]=='i')num[9]++;
			else if(a[i]=='j')num[10]++;
			else if(a[i]=='k')num[11]++;
			else if(a[i]=='l')num[12]++;
			else if(a[i]=='m')num[13]++;
			else if(a[i]=='n')num[14]++;
			else if(a[i]=='o')num[15]++;
			else if(a[i]=='p')num[16]++;
			else if(a[i]=='q')num[17]++;
			else if(a[i]=='r')num[18]++;
			else if(a[i]=='s')num[19]++;
			else if(a[i]=='t')num[20]++;
			else if(a[i]=='u')num[21]++;
			else if(a[i]=='v')num[22]++;
			else if(a[i]=='w')num[23]++;
			else if(a[i]=='x')num[24]++;
			else if(a[i]=='y')num[25]++;
			else if(a[i]=='z')num[26]++;
		}
		for(int i = 1;i<=26;i++){
			if(m[i]>num[i])
				m[i]=num[i];
		}
	}
		for(int j = 1;j<=26;++j){
			for(int i = 0;i<m[j];i++){
				printf("%c",j-1+'a');
			}
		}
}

Measured memory_bytes: 128
S = input()
N = len(S)

def kaibun(s, n):
    if n % 2 == 1:
        front = s[:n//2+1]
        back = s[n//2:]
    else:
        front = s[:n//2]
        back = s[n//2:]

    return front == "".join(reversed(back))


if kaibun(S, N) and kaibun(S[:(N-1)//2], (N-1)//2) and kaibun(S[(N+3)//2-1:], (N+3)//2-2):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064