akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <limits>
#include <map>
#include <vector>
#include <queue> 
#define LL long long
#define ft first
#define sd second
#define mp(x,y) make_pair(x,y)
//#define int LL
using namespace std;
const int N   = 1e5+10;
//const int mod = ;
const int INF =numeric_limits<int >::max();

#define rep(i,x,y) for (int i=x;i<=y;++i)
void read(int &x)
{
	x=0;
	char ch=getchar();
	int f=1;
	while (!isdigit(ch)) (ch=='-'?f=-1:0),ch=getchar();
	while ( isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	x*=f;
}

int cnt,n,m,a[N],pos[N];

signed main()
{
	read(n);read(m);
	rep(i,1,m) 
	{
		read(a[i]);if (a[i]&1) pos[++cnt]=i;
	}
	if (cnt>2) return printf("Impossible"),0;
	if (m==1&&n==1) return printf("1\n1\n1"),0;
	if (m==1) return printf("%d\n2\n%d 1",a[1],a[1]-1),0;
	if (cnt) swap(a[1],a[pos[1]]);
	if (cnt>1) swap(a[m],a[pos[2]]);
	rep(i,1,m) printf("%d%c",a[i],i==m?'\n':' ');
	--a[1],++a[m];
	printf("%d\n",a[1]?m:m-1);
	rep(i,1,m) if (a[i]) printf("%d ",a[i]);
	return 0;
	
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)
l = []

for k, v in cnt.items():
    if v>=2:
        l.append(k)

l.sort(reverse=True)

if len(l)==0:
    print(0)
elif len(l)==1:
    if cnt[l[0]]>=4:
        print(l[0]*l[0])
    else:
        print(0)
else:
    if cnt[l[0]]>=4:
        print(l[0]*l[0])
    else:
        print(l[0]*l[1])

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

vector<int64_t> v(100, 0LL);

int64_t lucas(int N)
{
  int64_t L = 0;
  // ベースケース
  if (N == 0)
  {
    return 2;
  }
  if (N == 1)
  {
    return 1;
  }

  int64_t left;
  int64_t right;
  if (v.at(N - 1) == 0)
  {
    left = v.at(N - 1) = lucas(N - 1);
  }
  else
  {
    left = v.at(N - 1);
  }
  if (v.at(N - 2) == 0)
  {
    right = v.at(N - 2) = lucas(N - 2);
  }
  else
  {
    right = v.at(N - 2);
  }

  return left + right;
}

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

  cout << lucas(N) << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
typedef long long ll;
using namespace std;

vector<pair<long long, long long>> prime_factorize(long long N) {
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n; cin >> n;
    ll A[10010];
    for(int i=0;i<n;i++) cin >> A[i];

    vector<vector<pair<ll,ll>>> v(n);
    map<ll,ll> p;
    ll LCM = 1;
    for(int i=0;i<n;i++){
        v[i] = prime_factorize(A[i]);
        for(auto c:v[i]){
            p[c.first] = max(p[c.first], c.second);
        }
    }
    for(auto q:p){
        LCM = LCM * modpow(q.first, q.second, MOD) % MOD;
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        ans = (ans + (LCM * modinv(A[i], MOD)) % MOD) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1920
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
typedef priority_queue<int> p_queue;
typedef long long ll;
ll n,cnt;
ll lastpos;
ll x,y;
struct robot{
	ll l;
	ll r;
}a[100010];
bool cmp(robot x,robot y){
	return x.r<y.r;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		a[i].l=x-y;
		a[i].r=x+y; 
	}
	sort(a,a+n,cmp);
	int pos=0;
	ll num=-1e9;
	while(pos<n){
		if(a[pos].l>=num)cnt++,num=a[pos].r;
		pos++;
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun main(args: Array<String>) = test2()

fun test2() = FastIO.exec {
    val (k, n) = readLine()!!.split(' ').map { it.toInt() }
    val aList = readLine()!!.split(' ').map { it.toLong() }

    val diff = LongArray(n)
    diff[0] = k - aList.last() + aList.first()

    for (i in 0 until n - 1) {
        diff[i + 1] = aList[i + 1] - aList[i]
    }

    val answer = diff.sum() - diff.max()!!

    println(answer)
}

// region

@Suppress("unused")
object FastIO {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    private var st = StringTokenizer("")
    val pw = PrintWriter(System.out)

    fun string(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
        return st.nextToken()
    }

    fun int() = Integer.parseInt(string())
    fun long() = java.lang.Long.parseLong(string())
    fun double() = java.lang.Double.parseDouble(string())
    fun nextLine() = br.readLine()!!
    fun println() = pw.println()
    fun <T> print(o: T) = pw.print(o)
    fun <T> println(o: T) = pw.println(o)

    inline fun exec(code: FastIO.() -> Unit) {
        code()
        pw.flush()
    }
}
// endregion


Measured memory_bytes: 81024
#include <stdio.h>

int main() {
    int n = 3, sum;

    int A[n];
    for(int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }

    for (int i = 0; i < n; i++) {
        sum += A[i];
    }
    if (22<=sum) {
        printf("bust");
        return 0;
    } else {
        printf("win");
        return 0;
    }
}

Measured memory_bytes: 128
import sys
readline = sys.stdin.readline
class UFP():
    def __init__(self, num):
        self.par = [-1]*num
        self.dist = [0]*num
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            res = 0
            xo = x
            while self.par[x] >= 0:
                res += self.dist[x]
                x = self.par[x]
            self.dist[xo] = res
            self.par[xo] = x
            return x
    
    def union(self, x, y, d):
        rx = self.find(x)
        ry = self.find(y)
        if rx != ry:
            if self.par[rx] > self.par[ry]:
                rx, ry = ry, rx
                x, y = y, x
                d = -d
            self.par[rx] += self.par[ry]
            self.par[ry] = rx
            self.dist[ry] = d + self.dist[x] - self.dist[y]
            return True
        else:
            if d + self.dist[x] - self.dist[y]:
                return False
            return True

N, M = map(int, readline().split())
T = UFP(N)
ans = 'No'
for _ in range(M):
    l, r, d = map(int, readline().split())
    l -= 1
    r -= 1
    if not T.union(l, r, d):
        break
else:
    ans = 'Yes'
print(ans)


Measured memory_bytes: 49624
#include <stdio.h>

int main()
{
  char a;
  scanf("%c",&a);
  char s[6] = {'a','i','u','e','o'};
  int i = 0;
  while (s[i])
  {
    if (s[i] == a)
    {
      printf("vowel");
      return(0);
    }
    i++;
  }
  printf("consonant");
}

Measured memory_bytes: 128
#include <iostream>
int main(){
	double x0,y0,x1,y1,x,y,s=0;
	char c;
	std::cin>>x0>>c>>y0;
	x1=x0;y1=y0;
	while(std::cin>>x>>c>>y){
		s+=x1*y-y1*x;
		x1=x;y1=y;
	}
	s+=x1*y0-y1*x0;
	std::cout<<(s<0?-s:s)/2<<"\n";
}

Measured memory_bytes: 1284
n, x = input().split()
n = int(n)
x = int(x)
i_min = 0
result = 0
m = []
for i in range (n):
  m.append(int(input()))
for i in range (n):
  x -= m[i]
  result += 1
for i in range (n):
  if m[i_min] > m[i]:
    i_min = i
for i in range (x):
  if x >= m[i_min]:
    x -= m[i_min]
    result += 1
  else:
    break

print(result)

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
        sum += A.at(i);
    }

    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    bool can = true;
    for (int i = 0; i < M; i++) {
        if (sum % (4 * M) == 0) {
            if (A.at(i) < sum / (4 * M)) {
                can = false;
            }
        }
        else {
            if (A.at(i) <= sum / (4 * M)) {
                can = false;
            }
        }
    }

    if (can) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

using namespace std ;

#define IOS ios::sync_with_stdio(0); cin.tie(0), cout.tie(0)
#define ll long long int 

#define fr first
#define se second

#define all(v) v.begin(),v.end() 
#define rall(v) v.rbegin(),v.rend()
#define sz(v) v.size() 

#define pb push_back
#define mp make_pair 

#define PI 3.141592653589793238



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


//bool valid(int x, int y){return x > 0 && x < 9 && y > 0 && y < 9;}

vector<int>v,vv;
int n, s1, s2;

int main(){
  cin >> n;
  v.resize(n);
  vv.resize(n);

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

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

  int mm = INT_MIN;
  for(int i = 0 ; i < (1<<n) ; i++){
    for(int j = 0 ; j < n ; j++)
      if(i&(1<<j))
        s1 += v[j], s2 += vv[j];
    mm = max(mm, s1-s2);
    s1 = 0, s2 = 0;
  }
  if(mm <= 0)
    return cout << 0, 0;
  cout << mm;
  return 0;
}


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

typedef long long ll;
const int maxn = 100000;

int n;
long long a[maxn], b[maxn];

int main(void) {
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}
	long long add = 0;
	for(int i = n-1; i >= 0; --i) {
		a[i] += add;
		if(a[i] % b[i]) {
			add += b[i] - a[i] % b[i];
		}
	}
	cout << add << endl;
	return 0;
}

Measured memory_bytes: 1792
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let n: usize = read!(usize);
    let a: Vec<u64> = read![[u64]];

    // 山iとi+1に降った雨量の和 s[i] (最後は山n-1と山0に降った雨量の和)
    // 総雨量 total
    let mut total = 0;
    let mut s = vec![0; n];

    for i in 0..n {
        total += a[i];
        s[i] = 2 * a[i];
    }

    let mut rain = Vec::with_capacity(n);

    // 山0に降った雨量 = total - (s[1] + s[3] + ... + s[n-2])
    let mut tmp = 0;
    for i in 1..(n - 1) {
        if i % 2 != 0 {
            tmp += s[i];
        }
    }
    rain.push(total - tmp);

    for i in 1..n {
        let prev_rain = rain[i - 1];
        rain.push(s[i - 1] - prev_rain);
    }

    let st = rain
        .into_iter()
        .map(|x| x.to_string())
        .collect::<Vec<_>>()
        .join(" ");
    println!("{}", st);
}


Measured memory_bytes: 14456
import collections
a = int(input())
words = [input() for i in range(a)]
c = collections.Counter(words)
key = len(c.keys())
tmp = 0
for i in range(len(words)-1):
	if len(words) == key:
		if words[i][-1] == words[i+1][0]:
			tmp += 1
		else:
			tmp = 0
	else:
		break
if tmp == len(words)-1:
	print("Yes")
else:
	print("No")


Measured memory_bytes: 3828
#include <iostream>
#include <algorithm>

using namespace std;

int a[100000], cost[100000];

int main() {
    int n, k;
    cin >> n;
    // k = 2;
    cin >> k;
    
    for(int i=0;i<n;++i) cin >> a[i];

    fill(cost+1, cost+n, 1 << 30);
    for(int i=0;i<n-1;++i) {
        for(int j=1;j<=k&&i+j<n;++j) {
            cost[i+j] = min(cost[i+j], cost[i] + abs(a[i+j] - a[i]));
        }
    }

    cout << cost[n-1] << "\n";
}

Measured memory_bytes: 1024
N = int(input())
a = list(map(int,input().split()))

def count_2(n):
  cnt = 0
  while n % 2 == 0:
    n //= 2
    cnt += 1
  return cnt

A =[0]

for i in a:
  A.append(count_2(i))
  
print(sum(A))  

Measured memory_bytes: 10096
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let q: usize = itr.next().unwrap().parse().unwrap();
    let mut out = Vec::new();

    let mut is_prime: Vec<bool> = vec![true; 100010];
    let mut cumsum: Vec<u64> = vec![0; 100010];
    is_prime[0] = false;
    is_prime[1] = false;
    for i in 2..100005 {
        if is_prime[i] {
            let mut j = i * 2;
            while j < 100005 {
                is_prime[j] = false;
                j += i;
            }
        }
    }
    for i in 1..100005 {
        if is_prime[i] && is_prime[(i + 1) >> 1] {
            cumsum[i] += 1;
        }
    }
    for i in 0..100005 {
        cumsum[i + 1] += cumsum[i];
    }

    for _ in 0..q {
        let l: usize = itr.next().unwrap().parse().unwrap();
        let r: usize = itr.next().unwrap().parse().unwrap();
        writeln!(out, "{}", cumsum[r] - cumsum[l - 1]).unwrap();
    }
    stdout().write_all(&out).unwrap();
}


Measured memory_bytes: 6780
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
N,X=map(int,input().split())
x=list(map(int,input().split()))
kari=[]
for i in range(N):
    kari.append(abs(x[i]-X))
ans=gcd(min(kari),max(kari))
for i in range(N):
    ans=gcd(ans,kari[i])
print(ans)

Measured memory_bytes: 14224
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  int a,b;
  cin>>a>>b;
  cout<<max({a+a-1,2*b-1,a+b});
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


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

int main() {

  int H,W;
  cin >> H >> W;

  vector<vector<char>> table(H,vector<char>(W));
  for(int i = 0;i < H;i++) {
    for(int j = 0;j < W;j++) {
      cin >> table.at(i).at(j);
    }
  }

  vector<vector<bool>> board(H,vector<bool>(W,false));

  for(int i = 0;i < H;i++) {
    for(int j = 0;j < W;j++) {
      int D[] = {1,-1};
  
      if(table.at(i).at(j) == '#') {
        for(int d = 0;d < 2;d++) { 
          int x = D[d] + j;
          if(x < 0 || x >= W) continue;
          if(table.at(i).at(x) == '#') board.at(i).at(j) = true;
        }

        for(int d = 0;d < 2;d++) {
          int y = D[d] + i;
          if(y < 0 || y >= H) continue;
          if(table.at(y).at(j) == '#') board.at(i).at(j) = true;
        }
      }else {
        board.at(i).at(j) = true;
      }
    }
  }

  string ans = "Yes";
  for(int i = 0;i < H;i++) {
    for(int j = 0;j < W;j++) {
      if(!board.at(i).at(j)) {
        ans = "No";
        break;
      }
    }
  }
  
  cout << ans << endl;

}


Measured memory_bytes: 256
class nCrMod():
    def __init__(self, mod):
        self.mod = mod
        self.fac = [1, 1]
        self.finv = [1, 1]
        self.inv = [0, 1]

    def prep(self, n):
        mod = self.mod
        f, fi = self.fac[-1], self.finv[-1]
        for i in range(len(self.fac), n + 1):
            fn = f * i % mod
            v = -self.inv[mod % i] * (mod // i) % mod
            fin = fi * v % mod
            f, fi = fn, fin
            self.fac.append(f)
            self.finv.append(fi)
            self.inv.append(v)

    def __call__(self, n, r):
        if len(self.fac) <= n:
            self.prep(n)
        return self.fac[n] * self.finv[r] * self.finv[n - r] % self.mod


def main():
    S = int(input())
    mod = 10 ** 9 + 7
    nCr = nCrMod(mod)
    r = 0
    for i in range(1, S // 3 + 1):
        r = (r + nCr(S - i * 3 + i - 1, i - 1)) % mod
    return r

print(main())


Measured memory_bytes: 9336
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
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; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
constexpr int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

int main ()
{
    int N;string S;int K;
    cin>>N>>S>>K;
    char tmp = S[K-1];
    for (int i = 0; i < N; i++)
    {
        if(S[i]!=tmp){
            cout<<"*";
        }
        else cout<<tmp;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

struct P{ int number, dist, value; };

const int N = 16;
int n;
double memo[N][1 << N];
int nxt[N][1 << N];

double rec(vector<P>& v, int p, int w, int u, int now)
{
	if(u + 1 == 1 << n) return 0;
	if(memo[now][u] != -1)
	{
		return memo[now][u];
	}
	
	double min = 1 << 30;
	
	rep(i, n) if(!(u >> i & 1))
	{
		double time = rec(v, v[i].dist, w + v[i].value, u | 1 << i, i + 1) + (w ? 1.0 : 0.0) * abs(v[i].dist - p) * (70 + w * 20) / 2000.0;
		
		if(time < min)
		{
			min = time;
			nxt[now][u] = i + 1;
		}
	}
	
	return memo[now][u] = min;
}

void print(vector<P>& v)
{
	for(int u = 0, p = 0; n--; )
	{
		int x = nxt[p][u];
		
		cout << v[x - 1].number << (n ? " " : "\n");

		u |= 1 << (x - 1);
		p = x;
	}
}

/*
 ツ経ツ路ツ閉慊個ウツつェツつ、ツづ慊つュツ個セツづづづ按つ「
 */
int main()
{
	cin >> n;
	
	vector<P> v(n);
	rep(i, n) cin >> v[i].number >> v[i].dist >> v[i].value;
	
	rep(i, N) rep(j, 1 << N) memo[i][j] = -1;

	rec(v, 0, 0, 0, 0);
	
	print(v);
}

Measured memory_bytes: 10000
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007


#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int x;
  string s="ai1333";
  cin>>x;
  rep(i,x/100)s+='3';
  cout<<s<<endl;
  return 0;
}



Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define fs first
#define sc second
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

void solve(){
   int a,b,c,x,y;
   cin>>a>>b>>c>>x>>y;
   int maxp=max(x,y);
   int minp=min(x,y);
   int sum=0;
   for(int i=0;i<2*minp;i++){
       sum+=c;
   }
   if(maxp!=minp){
    for(int i=0;i<maxp-minp;i++){
            if(maxp==x)sum+=a;
            else sum+=b;
    }
 }
int suml=0;
rep(i,x)suml+=a;
rep(i,y)suml+=b;
int summ=0;
rep(i,2*maxp)summ+=c;
cout<<min(summ,min(sum,suml));
}

int main(){
    cout<<std::fixed<<std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println(c >= a && c <= b ? "Yes" : "No");
	}
}

Measured memory_bytes: 35724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
// constexpr long double EPS = 1e-15;
// const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

void solve() {
    int n;
    cin >> n;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (i * j == n) {
                cout << "Yes" << endl;
                return;
            }
        }
    }
    cout << "No" << endl;
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 256
(defun f(s)
  (let ((l (length s)))
	(cond ((= l 1) (parse-integer s))
		  ((= l 2) 9)
		  ((= l 3) (+ 9 (- (parse-integer s) 99)))
		  ((= l 4) (+ 9 (- 999 99)))
		  ((= l 5) (+ 9 (- 999 99) (- (parse-integer s) 9999)))
		  (t (+ 9 (- 999 99) (- 99999 9999)))
		  )))

(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))
(defun g()
  (let* ((line (read-line nil nil)))
  (format t "~A~%" (f line))))
(g)


Measured memory_bytes: 12904
import java.util.*

fun main(args: Array<String>) {
    val s = readNext().split("")
    val t = readNext().split("")

    var resultCount = 0
    if (s.get(1).equals(t.get(1))) {

        resultCount++
    }
    if (s.get(2).equals( t.get(2))) {
        resultCount++
    }
    if (s.get(3).equals( t.get(3))) {
        resultCount++
    }
    println(resultCount)
}

    fun readNext(): String {
        return readLine()!!
    }


Measured memory_bytes: 36080
#include <bits/stdc++.h>
#define INT_MAX 2147483647
#define INT_MIN -2147483647
using namespace std;
int n, m, h[100010];
vector<int> nod[100100];

int main() {
    cin.tie(0); ios::sync_with_stdio(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> h[i];
    for (int i = 1; i <= m; i++) {
        int a, b;
        cin >> a >> b;
        nod[a].push_back(b);
        nod[b].push_back(a);
    }

    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        bool ok = true;
        for (int x : nod[i])
            if (h[x] >= h[i])
                ok = false;
        if (ok)
            cnt++;
    }

    cout << cnt;
    return 0;
}


Measured memory_bytes: 9140
#include <stdio.h>
#include <math.h>
int main(int argc, char const *argv[])
{
  int n,k,sa;
  int max=0;
  scanf("%d%d",&k,&n);
  int a[n];
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(int i=0;i<n-1;i++){
    sa=a[i+1]-a[i];
    if(max<sa) max=sa;
  }
  sa=k-a[n-1]+a[0];
  if(max<sa) max=sa;
  printf("%d",k-max);
  return 0;
}


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

int main() {
  int N;
  cin>>N;
  int V[N];
  int C[N];
  for(int i=0;i<N;i++) cin>>V[i];
  for(int i=0;i<N;i++) cin>>C[i];
  int ans=0;
  for(int i=0;i<N;i++){
    if(V[i]>C[i]) ans+=V[i]-C[i];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
        sc.Split(bufio.ScanWords)
        for i := 0; i < 3000; i++ {
                x := nextInt()
                y := nextInt()

                if x == 0 && y == 0 {
                        break
                }
                if x <= y {
                        fmt.Println(x, y)
                } else {
                        fmt.Println(y, x)
                }
        }
}


Measured memory_bytes: 1112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+5,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
PII a[N];
int cnt,ans[N];
int main(){
	int h,w,n;
	scanf("%d%d%d",&h,&w,&n);
	for(int i=1;i<=n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		for(int r=x-2;r<=x;r++)
			for(int c=y-2;c<=y;c++)
			if(r>0&&c>0&&r+2<=h&&c+2<=w)
			a[cnt++]={r,c}; 
	}
	sort(a,a+cnt);
	for(int i=0,j;i<cnt;){
		 j=i+1;
		 int x=a[i].fi,y=a[i].se;
		 while(j<cnt&&x==a[j].fi&&y==a[j].se) j++;
		 ans[j-i]++;
		 i=j;
	}
	ll s=1LL*(h-2)*(w-2);
	for(int i=1;i<10;i++) s-=ans[i];
	printf("%lld\n",s);
	for(int i=1;i<10;i++) printf("%d\n",ans[i]);
	return 0;
}


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

using namespace std;
#define ll long long int


int main()
{
    ll n,k;
    cin >> n >> k;
    if(n%k==0){
        cout << 0 << endl;
        return 0;
    }
    cout << min(abs(n%k), abs(n%k - k)) << endl;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL<<60;
#define rev(s) (string((s).rbegin(), (s).rend()))

int main () {

    int n,k;cin>>n>>k;
    int h[100010];
    rep(i,n) {
        cin>>h[i];
    }

    ll dp[100010];
    rep(i,n) {
        dp[i]=INF;
    }

    dp[0]=0;

    for(int i=1;i<n;i++) {
        for (int j=1;j<=k;j++) {
            if (i-j>=0) {
                dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
            }
            else {
                break;
            }
        }
    }

    cout<<dp[n-1]<<endl;

}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

typedef long long int ll;

int main() {

  int n, m;
  cin >> n >> m;

  vector<int> v(m);
  rep(i, m) { cin >> v[i]; }
  int sum = 0;
  rep(i, m) { sum += v[i]; }
  if (n <= sum) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 640
while 1:
    tmp=input().split()
    tmp[0]=int(tmp[0])
    tmp[2]=int(tmp[2])
    if tmp[1]=='?':
        break
    if tmp[1]=='+':
        print(tmp[0]+tmp[2])
    if tmp[1]=='-':
        print(tmp[0]-tmp[2])
    if tmp[1]=='*':
        print(tmp[0]*tmp[2])
    if tmp[1]=='/':
        print(int(tmp[0]/tmp[2]))



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

def prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True

def factors(p, n):
    ret = 0
    m = p
    while m <= n:
        ret += n // m
        m *= p        
    return ret

ans = 1
for i in range(1, n+1):
    if prime(i):
        ans = ans * (factors(i, n) + 1) % (10**9 + 7)
print(ans)



Measured memory_bytes: 3060
# -*- coding: utf-8 -*-

N = int(raw_input())
for i in range(N):
    a, b, c = map(int, raw_input().split())
    if a > c:
        a, c = c, a
    if b > c:
        b, c = c, b
    if a*a+b*b == c*c:
        print "YES"
    else:
        print "NO"

Measured memory_bytes: 6232
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
#define MAXN 1001
#define ll long long
ll ans, cnt, a[MAXN], b[MAXN], c[MAXN], d[MAXN], A[MAXN];
ll n, m, q;
void check()
{
	cnt = 0;
	for(ll i=1;i<=q;i++)
	{
		if(A[b[i]] - A[a[i]] == c[i])
		cnt += d[i];
	}
	ans = max(ans, cnt);
}
void dfs(ll id)
{
	if(id == n+1)
	{
		check();
		return ;
	}
	for(ll i=A[id-1];i<=m;i++)
	{
		A[id] = i;
		dfs(id+1);
	}
}
int main()
{
	scanf("%lld%lld%lld",&n,&m,&q);
	for(int i=1;i<=q;i++)
		scanf("%lld%lld%lld%lld",&a[i],&b[i],&c[i],&d[i]);
	A[0] = 1;
	dfs(1);
cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3700
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String sa = sc.nextLine();
    char[] s = sa.toCharArray();
    Boolean f = (s[0] != s[1] || s[0] != s[2] || s[1] != s[2]);
    if(f) {
      System.out.println("Yes");
    } else {
	  System.out.println("No");
    }
  }
}

Measured memory_bytes: 21460
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	int N;
	scanf("%d", &N);
	return !printf("%d\n", N / 3);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vp;
bool visited[100005];
class UnionFind
{
public:
  ll par[100005];
  ll siz[100005];
  void init(void)
  {
    for(ll i=1;i<=100000;i++)
      {
	par[i]=i;
	siz[i]=1;
      }
  }
  ll root(ll x)
  {
    while(par[x]!=x)
      {
	x=par[x]=par[par[x]];
      }
    return x;
  }
  void unite(ll x, ll y)
  {
    x=root(x);
    y=root(y);
    if(x==y) return;
    if(siz[x]<siz[y]) swap(x,y);
    siz[x]+=siz[y];
    par[y]=x;
    return;
  }
  bool issame(ll x, ll y)
  {
    return root(x)==root(y);
  }
  ll size(ll x)
  {
    return siz[root(x)];
  }
};
int main(int argc,char const* argv[])
{
  int N,M;
  UnionFind uf;
  uf.init();
  cin >> N >> M;
  ll ans=N;
  for(int i=0;i<M;i++)
    {
      int x,y,z;
      cin >> x >> y >> z;
      uf.unite(x,y);
    }
  for(int i=1;i<=N;i++)
    {
      ll ro=uf.root(i);
      if(!visited[ro])
	{
	  visited[ro]=true;
	  ans-=(uf.size(ro)-1);
	}
    }
  cout << ans << endl;
  return 0;
}


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

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

const int MaxN = 15, MaxM = 110, inf = 0x3f3f3f3f;

int n, m, sum;
int mat[MaxN][MaxN], f[1 << MaxN][MaxN], p[1 << MaxN];

void Init()
{
	memset(p, 0x00, sizeof p);
	memset(mat, 0x00, sizeof mat);
	memset(f, 0xff, sizeof f);
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		--a, --b;
		mat[a][b] = mat[b][a] = c;
		sum += c;
	}
	for (int i = 0; i < (1 << n); ++i)
	{
		for (int j = 0; j < n; ++j) if ((i >> j) & 1)
			for (int k = j + 1; k < n; ++k)
			{
				if ((i >> k) & 1)
					p[i] += mat[j][k];
			}
	}
}

void Main()
{
	f[1][0] = 0;
	for (int i = 0; i < (1 << n); ++i)
		for (int j = 0; j < n; ++j)
		{
			if (f[i][j] == -1)
				continue;
			int x = (((1 << n) - 1) ^ i) | (1 << j);
			for (int y = x; y >= 0; --y)
			{
				y &= x;
				f[i | y][j] = max(f[i | y][j], f[i][j] + p[y]);
			}
			for (int k = 0; k < n; ++k)
			{
				if ((i >> k) & 1)
					continue;
				if (mat[j][k] == 0)
					continue;
				f[i | (1 << k)][k] = max(f[i | (1 << k)][k], f[i][j] + mat[j][k]);
			}
		}
	int ans = inf;
	for (int i = 0; i < (1 << n); ++i)
		ans = min(ans, sum - f[i][n - 1]);
	cout << ans << endl;
}

int main()
{
	Init();
	Main();
	return 0;
}


Measured memory_bytes: 2304
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		
		while(sc.hasNext()){
			int num = sc.nextInt();
			
			for(int i = 0; i < 10; i++){
				for(int j = 0; j < 10; j++){
					for(int k = 0; k < 10; k++){
						for(int l = 0; l < 10; l++){
							if((i + j + k + l) == num)
								count++;
						}//l
					}//k
				}//j
			}//i
			System.out.println(count);
			count = 0;
		}
	}
}

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

c = [int(x) for x in input().split()]

even = [[int(x),0] for x in range(10**5+1)]

odd = [[int(x),0] for x in range(10**5+1)]

for i in range(len(c)):
    if i % 2 == 0:
        even[c[i]][1] += 1
    else:
        odd[c[i]][1] += 1

even = sorted(even,key = lambda x:-x[1])
odd = sorted(odd,key = lambda x:-x[1])

if even[0][0] == odd[0][0]:
    print(min(n-even[0][1]-odd[1][1],n-even[1][1]-odd[0][1]))
else:
    print(n-even[0][1]-odd[0][1])


Measured memory_bytes: 35848
#include <fstream>
#include <iostream>

#include <cassert>
#include <climits>

#include <string.h>

#include <deque>
#include <map>
#include <stack>
#include <vector>

#include <algorithm>

using namespace std;

int main()
{
//    std::ifstream ifs("input/dpl_1_a.txt");
//    if (!ifs)
//        assert(false);
//    std::cin.rdbuf(ifs.rdbuf());

    // 額面とコインの種類.
    int n, m;
    std::cin >> n >> m;
    assert(n >= 1 && n <= 50000);
    assert(m >= 1 && m <= 20);

    int coins[m];
    for (int i = 0; i < m; ++i)
    {
        std::cin >> coins[i];
    }

    // キーに額面､値にコインの枚数を取る配列.
    std::vector<int> dp = std::vector<int>(n + 1, INT_MAX);
    dp[0] = 0;

    for (int i = 0; i < m; ++ i)
    {
        for (int j = coins[i]; j <= n; ++j)
        {
            // 対象コインの額面 ~ n円までインクリメントし続け, 最低枚数を更新する.
            dp[j] = std::min(dp[j], dp[j - coins[i]] + 1);
        }
    }

    std::cout << dp[n] << std::endl;
}



Measured memory_bytes: 3184
import java.util.Scanner;
import java.util.Arrays;

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

    	int dice_num = scan.nextInt();
    	dice = new Dice[dice_num];

    	for(int i = 0; i < dice_num; i++){
    		dice[i] = new Dice();
    	}

    	for(int i = 0; i < dice_num; i++){
    		for(int j = 0; j < 6; j++){
    			dice[i].surface[j] = scan.nextInt();
    		}
    	}

    	for(int n = 0; n < dice_num - 1; n++){
    		for(int m = n + 1; m < dice_num; m++){
				for(int i = 0; i < 4; i++){
					for(int j = 0; j < 4; j++){
			    		for(int k = 0; k < 4; k++){
			    			dice[m].spinVertical();
			    			if(Arrays.equals(dice[n].surface, dice[m].surface)) {
			    				System.out.println("No");
			    				return;
			    			}
			        	}
			    		dice[m].spinHorizontal();
		    		}
		    		dice[m].spinVertical();
				}
    		}
		}
    	System.out.println("Yes");
     }
}

class Dice{
	int[] surface = new int[6];

	public void spinVertical (){
		int temp3 = surface[0];
		surface[0] = surface[1];
		surface[1] = surface[5];
		surface[5] = surface[4];
		surface[4] = temp3;
	}

	public void spinHorizontal(){
		int temp2 = surface[0];
		surface[0] = surface[3];
		surface[3] = surface[5];
		surface[5] = surface[2];
		surface[2] = temp2;
	}
}

Measured memory_bytes: 29456
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>

#define ll long long

using namespace std;

int main(){

    int N;
    string S;
    cin >> N >> S;

    int tmp;
    char tmp1;

    for(int i = 0;i < S.size();i++){
        tmp = S[i];
        tmp += N;
        if(tmp > 'Z'){
            tmp -= 26;
        }
        tmp1 = tmp;
        cout << tmp1;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()

{
    long long r,d,x2000;
    cin>>r>>d>>x2000;
    long long y=x2000;
    for(long long i=1;i<=10;i++)
    {
        y=y*r-d;
        cout<<y<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,i;
	cin >> a >> b;
	c = min(a,b);
	for(i=0;i<(a*b)/c;i++)
	{
		cout << c;
	}
	cout << endl;
	return 0;
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	long double a,b,c,d;
	cin>>a>>b;
	d=b*100;
	string s=to_string(d);
	c=a*(stoll(s))/100;
	cout<<fixed<<setprecision(0)<<floorl(c)<<endl;
}


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

int main() {
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    int ans = H*W - h*W - w*H + h*w;
    cout << ans << endl;
    return 0;
}

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

int main(){
    int N, X, A[200];
    cin>>N>>X;
    int S=0, min=1000000;
    for(int i=0; i<N; ++i){
      cin>>A[i];
      S+=A[i];
      if(A[i]<min){
        min=A[i];
      }
	}
	int rest=X-S;
	int t=rest/min;
	cout<<N+t<<endl;
	return 0;
}

Measured memory_bytes: 256
s = input()
ans = 0
DNA = ['A', 'C', 'G', 'T']
count = 0
for i in range(len(s)):
    c = s[i]
    if c in DNA:
        count += 1
    else:
        ans = max(ans, count)
        count = 0
    if i == len(s) - 1:
        ans = max(ans, count)
print(ans)


Measured memory_bytes: 38256
import sys


if __name__ == "__main__":
    n = int(input())
    h = list(map(int,input().split()))
    cnt = 0
    ans = 0
    while True:
        if sum(h) == 0:
            break
        koho = []
        p = []
        for i in range(n):
            if h[i] != 0:
                koho.append(h[i])
            else:
                p.append(koho)
                p.append([0])
                koho = []
        if len(koho)>0:
            p.append(koho)
        for i in range(len(p)):
            if len(p[i]) == 0:
                continue
            d = min(p[i])
            ans += d
            for j in range(len(p[i])):
                p[i][j] -= d
        h = []
        for i in range(len(p)):
            for j in range(len(p[i])):
                h.append(p[i][j])
        cnt += 1
    print(ans)

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

int main() {
  
  int A,B,n;
  cin >> A >> B;
  
  for (int i = A; i <= B; i++) {

    int a,b,c,d;
    a = i/10000;
    b = i/1000%10;
    c = i/10%10;
    d = i%10;
    
    if ( a == d && b == c) n++;
  }
  cout << n << endl;
}


Measured memory_bytes: 256
def get_num(u, map, vis):
    if u in vis:
        return 0;
    else:
        vis[u] = True;
    ans = 0;
    if u in map:
        for v in map[u]:
            ans += get_num(v, map, vis);
    else:
            ans += 1;
    return ans;
def main():
    while True:
        n = int(input());
        if n == 0:
            break;
        edge = {}; name = {}; vis = {};
        for i in range(0, n):
            str = input();
            u = name[i] = str.split(':')[0];
            group = str.split(':')[1].split('.')[0].split(',');
            for v in group:
                if u in edge:
                    edge[u][v] = True;
                else:
                    edge[u] = {v:True};
        print(get_num(name[0], edge, vis));
main();



Measured memory_bytes: 5716
n=int(input())
a=list(map(int,input().split()))

border_4 = n//2
border_2 = n

cnt_4=0
cnt_2=0

for i in range(n):
    if a[i]%4==0:
        cnt_4+=1
        cnt_2+=1
    elif a[i]%2==0:
        cnt_2+=1
    else:
        continue


if cnt_4>=border_4:
    print('Yes')
elif n-cnt_4*2<=(cnt_2-cnt_4):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 14252
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main(){
  string s;
  cin >> s;
  int rem = 0;
  rep(i, s.size()) {
    if(s[i] == 'g')
      rem++;
    else
      rem--;
  }
  cout << rem/2 << endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
	bool a[101];
	int n,i,j,s=0;
	cin>>n;
	for(i=1;i<=100;i++) a[i]=0;
	for(i=1;i<=n;i++){
		cin>>j;
		a[j]=1;
	}
	for(i=1;i<=100;i++) s+=a[i];
	cout<<s<<endl;
	return 0;
}

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

long long mod_pow(long long x, long long n, long long mod)
{
    long long res = 1;
    while(n>0)
    {
        if(n&1)   res = res * x % mod;
        x = x*x%mod;
        n >>= 1;
    }
    return res;
}
int main()
{
    long long m, n;
    cin >> m >> n;
    cout << mod_pow(m,n,1000000007) << endl;
    return 0;
}

Measured memory_bytes: 3080
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    string N; cin >> N;
    if(count(N.begin(),N.end(),'7')) return "Yes";
    else return "No";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Measured memory_bytes: 3640
X = int(input())
s = [0] * 200
for i in range(200):
    s[i] = i**5
k = 0
for i in range(200):
    if k == 1:
        break
    else:
        for j in range(200):
            if k == 1:
                break
            else:
                if s[i] - s[j] == X:
                    print(i,j)
                    k = 1
                elif s[j] - s[i] == X:
                    print(j,i)
                    k = 1
                elif s[i] + s[j] == X:
                    print(i,-j)
                    k = 1
                elif s[i] + s[j] == -X:
                    print(-i,j)
                    k = 1

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

int main(){
  int n,a,b,c=0,ans;
  cin >> n >>a>>b;
  for(int i=1;i<=n;++i){
  	ans=i%10+i/10%10+i/100%10+i/1000%10+i/10000;
  	if(ans>=a&&ans<=b)c+=i;
  }
  cout << c << endl;
  return 0;
}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()


N, A, B, C = map(int, input().split())
strings = [input() for _ in range(N)]


def dfs(index, hp):
    if index == N:
        return ''

    s1, s2 = strings[index]
    if hp[s1] > 0:
        hp2 = hp.copy()
        hp2[s1] -= 1
        hp2[s2] += 1
        ret = dfs(index + 1, hp2)
        if ret != False:
            return  s2 + ret
    if hp[s2] > 0:
        hp2 = hp.copy()
        hp2[s2] -= 1
        hp2[s1] += 1
        ret = dfs(index + 1, hp2)
        if ret != False:
            return s1 + ret

    return False


d = {'A': A, 'B': B, 'C': C}
ans = dfs(0, d)
if ans == False:
    print('No')
else:
    print('Yes')
    for c in ans:
        print(c)



Measured memory_bytes: 133648