akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
ll n;
ll ans = 0;
ll solve(ll now, ll bit){
  if(n<now) return 0;
  if(bit == 0b111) ans++;
  solve(now*10+7, bit|0b100);
  solve(now*10+5, bit|0b010);
  solve(now*10+3, bit|0b001);
  return ans;
}
int main(){
  cin >> n;
  cout << solve(0, 0) << endl;
  return 0;
}


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

def main():
    N = int(input())
    X = list(map(int, input().split()))

    Y = sorted(X)
    m0, m1 = Y[int(N / 2) - 1], Y[int(N / 2)]

    for i in range(N):
        print(m0 if m0 < X[i] else m1)


if __name__ == '__main__':
    main()



Measured memory_bytes: 25264
N, M = map(int, input().split())
ans = [-1]*N

for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] > 0:
        if ans[s-1] == c:
            continue
        else:
            print(-1)
            exit(0)
    else:
        if s == 1 and c == 0 and N != 1:
            print(-1)
            exit(0)
        ans[s-1] = c

for i in range(N):
    if ans[i] == -1:
        if i == 0 and N != 1:
            ans[i] = 1
        else:
            ans[i] = 0

print("".join(map(str, ans)))


Measured memory_bytes: 3064
//BECAUSE ONE TRUTH PREVAILS
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
#define ma 1000001
void Sieve(unordered_map<LL,bool> &ans,unordered_map<LL,LL> &hash,set<LL> &arr)
{ 
    for(auto it:arr) 
    {
        for(LL i=2*it;i<=ma;i+=it)
        {
            ans[i]=true;
        } 
    }
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 

    LL N;
    cin>>N;
    vector<LL> ar(N);
    for(auto &it:ar)
    {
        cin>>it;
    }
    unordered_map<LL,LL> hash;
    for(auto it:ar)
    {
        hash[it]++;
    }
    unordered_map<LL,bool> ans;
    for(auto it:ar)
    {
        if(hash[it]>1)
        {
            ans[it]=true;
        }
    }
    set<LL> S;
    for(auto it:ar)
    {
        S.insert(it);
    }
    LL count=0;
    Sieve(ans,hash,S);
    for(auto it:ar)
    {
        if(ans[it]==false)
            count++;
    }
    cout<<count;
}

Measured memory_bytes: 61812
can = [0]
gets
A = gets.split.map &:to_i
gets
M = gets.split.map &:to_i
A.each_with_index {|e,i|
  i == 0 ? can << e : can.concat(can.map {|ele| ele + e})
  can.uniq!
}
M.each{|e|
  puts can.include?(e) ? 'yes' : 'no'
}

Measured memory_bytes: 6200
#include <iostream>

using namespace std;

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  for(int i=0;i<B;i++){
    if((A*i-C)%B==0){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" <<endl;
}


Measured memory_bytes: 256
N = int(input())
dp = [[0 for i in range(N)] for j in range(N)] 

for _ in range(N):
    inputs = list(map(int, input().split()))
    u = inputs[0]
    k = inputs[1]
    v = inputs[2:]
    #print(u, k, v)
    for each in v:
        dp[u-1][each-1] = 1

for i in range(N):
    print(*dp[i][:])

Measured memory_bytes: 8488
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//#define pb push_back
#define I push_back
const ll maxs = 1e6 + 7;

vector<ll>S;

void pre()
{
    S.I(2);
    ll day = 1;
    for(ll i = 3;i < maxs;++i)
    {
        
        if(day % 7 == 1 )
            S.I(i);
        else if(day % 7 == 2)
        {
            
            if(i % 100 == 0)
            {
                if(i % 400 != 0)
                    S.I(i);
            }
            else if(i % 4 != 0)
            {
                S.I(i);
            }
        }
        
         if(i % 100 == 0)
            {
                if(i % 400 != 0)
                    day++;
                else
                    day = day + 2;
            }
        else{
            if(i % 4 == 0)
                day = day  + 2;
            else
                day++;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s1,s2,s3;
    cin >> s1 ;
    
    for(ll i = 0;i < s1.size();++i)
        cout << "x";
    
    
}

Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::cmp;

struct Scanner<'a> {
    cin : StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin : StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

trait Monoid {
    fn unit() -> Self;
    fn ope(self, e: Self) -> Self;
    //fn shl(self, e: u32) -> Self;
    //fn trailing_zeros(self) -> u32;
    //fn trailing_nonzeros(self) -> u32;
}

#[derive(Clone, Debug)]
struct SegmentTree<T: Monoid>{
    size: usize,
    data: Vec<T>,
}

impl<T> SegmentTree<T>
where T: Monoid,
      T: Copy,
      T: std::fmt::Debug,
{
    fn new(n: usize) -> Self {
        SegmentTree{
            size : n,
            data : vec![T::unit(); 2*n+1],
        }
    }

    fn update(&mut self, idx: usize, e: T) {
        let mut idx = idx + self.size;
        while idx > 0 {
            self.data[idx] = self.data[idx].ope(e);
            idx >>= 1;
            //println!("{:?}", self.data);
        }
    }
    
    fn querry(&self, l: usize, r: usize) -> Result<T, &'static str> {
        if r == 0 { return Err("r must be nonzero value.") }
        let mut res = T::unit();
        let mut l = l + self.size;
        let mut r = r + self.size;
        //println!("{:?}", self.data);
        while l < r {
            //println!("[{},{})", l, r);
            if l & 1 == 1 { res = res.ope(self.data[l]); l += 1;}
            if r & 1 == 1 { res = res.ope(self.data[r-1]); r-= 1;}
            l >>= 1; r >>= 1;
        }
        Ok(res)
    }
}

impl Monoid for u32 {
    fn unit() -> u32 { 0 }
    fn ope(self, e: u32) -> u32 { self + e }
    //fn trailing_zeros(self) -> u32 { self.trailing_zeros() }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n : usize = sc.read();
    let q : usize = sc.read();
    let mut st = SegmentTree::<u32>::new(n);
    for _ in 0..q {
        match sc.read() {
            0 => {
                let (x, y) : (usize, u32) = (sc.read(), sc.read());
                st.update(x-1, y);
            },
            _ => {
                let (x, y) : (usize, usize) = (sc.read(), sc.read());
                println!("{}", st.querry(x-1, y).ok().unwrap());
            },
        }
    }
}



Measured memory_bytes: 5052
#include<bits/stdc++.h>
#define LL long long
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define TASK "B - Frog 2"
using namespace std;
///---------------------------------------------------
const int N = 1e5 + 5;
int n, k, a[N], F[N];
///---------------------------------------------------
void nhap(){
    cin>>n>>k;
    fo(i,1,n) cin>>a[i];
    memset(F,0x3f,sizeof(F));
}
///---------------------------------------------------
void solve(){
    F[1] = 0;
    F[2] = abs(a[1]-a[2]);
    fo(i,3,n) fo(j,max(1,i-k),i-1) F[i] = min(F[i], F[j]+abs(a[i]-a[j]));
    cout<<F[n];
}
///---------------------------------------------------
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    nhap();
    solve();
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int t[105],h[105];

int main(){
	int n,m;
	while(1){
		int tt=0,th=0,mint=200,minh=200;
		cin>>n>>m;
		if(n==0&&m==0) break;
		for(int i=0;i<n;i++){
			cin>>t[i];
			tt+=t[i];
		}
		for(int i=0;i<m;i++){
			cin>>h[i];
			th+=h[i];
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(tt-t[i]+h[j]==th-h[j]+t[i]){
					if(mint+minh>t[i]+h[j]){
						mint=t[i];
						minh=h[j];
					}
				}
			}
		}
		if(mint==200&&minh==200) cout<<-1<<endl;
		else cout<<mint<<" "<<minh<<endl;
	}
	return 0;
}


Measured memory_bytes: 2972
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

int main() {
  int n,k,s; cin>>n>>k>>s;
  if (s==(int)1e9) {
    for(int i=0;i<k;i++) {
      cout<<s<<" ";
    }
    for(int i=k;i<n;i++) {
      cout<<s-1<<" ";
    }
  } else {
    for(int i=0;i<k;i++) {
      cout<<s<<" ";
    }
    for(int i=k;i<n;i++) {
      cout<<s+1<<" ";
    }
  }
}

Measured memory_bytes: 1280
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let AB = readInts()
let A = AB[0]
let B = AB[1]
let kuku = A * B
if A <= 9 && B <= 9 {
  print(kuku)
} else {
  print(-1)
}



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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

bool dfs(VVI& G, int u, VI& parity, PLL& res){
  if(parity[u] > 0) res.FF++;
  else res.SS++;

  for(int to: G[u]){
	if(parity[to]){
	  if(parity[to] == parity[u])
		return false;
	}
	else{
	  parity[to] = -parity[u];
	  if(!dfs(G, to, parity, res))
		return false;
	}
  }
  return true;
}

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

  int V, E; cin >> V >> E;
  VVI G(V);
  REP(i,E){
	int u, v; cin >> u >> v;
	--u;
	--v;
	G[u].PB(v);
	G[v].PB(u);
  }

  map<PLL,int> xs;
  VI parity(V);
  REP(i,V){
	if(!parity[i]){
	  parity[i] = 1;
	  PLL res;
	  if(!dfs(G, i, parity, res)){
		cout << -1 << endl;
		return 0;
	  }
	  if(res.FF < res.SS) swap(res.FF, res.SS);
	  xs[res]++;
	}
  }

  int crt = 0, nxt = 1;
  vector<vector<bool>> dp(2, vector<bool>(V+1));
  dp[crt][0] = true;
  for(auto&& p_: xs){
	int num = p_.SS;
	int b = 1;
	while(num){
	  fill(ALL(dp[nxt]), false);
	  if(num < b)
		b = num;
	  num -= b;

	  PLL p(p_.FF.FF * b, p_.FF.SS*b);
	  for(int i=V;i-p.FF>=0;--i)
		dp[nxt][i] = dp[nxt][i] || dp[crt][i-p.FF];
	  for(int i=V;i-p.SS>=0;--i)
		dp[nxt][i] = dp[nxt][i] || dp[crt][i-p.SS];
	  
	  b <<= 1;
	  swap(crt, nxt);
	}
  }

  LL ans = 0;
  REP(i,V+1) if(dp[crt][i]) maxi(ans, (LL)i*(V-i));
  cout << ans - E << endl;

  return 0;
}

Measured memory_bytes: 9504
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<cstdio>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	int a,b,c;
	cin>>a>>b>>c;
	int ans=max(a,max(b,c))-min(a,min(b,c));
	cout<<ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3188
#include <stdio.h>

#define INF 1000000000

int prim(int n);

int g[101][101];

int main(){
  int i,j,n;

  
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      scanf("%d",&g[i][j]);
    }
  }

  printf("%d\n",prim(n));


  return 0;
}


int prim(int n){
  int i,u,mincost,color[101],pi[101],d[101];

  for(i=1;i<=n;i++){
    d[i]=INF;
    pi[i]=-1;
    color[i]=1;
  }

  d[1]=0;

  while(1){
    mincost=INF;

    for(i=1;i<=n;i++){
      if(color[i] && d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }

    if(mincost==INF) break;

    color[u]=0;

    for(i=1;i<=n;i++){
      
      if(g[u][i]!=-1){
	if(color[i] && g[u][i]<d[i]){
	  pi[i]=u;
	  d[i]=g[u][i];
	}
      }

    }

  }

  mincost=0;
  for(i=1;i<=n;i++){
    mincost+=d[i];
  }

  return mincost;

}



Measured memory_bytes: 2104
#import math
#import itertools
#from collections import deque

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n,k=INTM()
    ans=0
    for i in range(1,n+1):
        temp=i
        ct=0
        while temp<k:
            ct+=1
            temp*=2
        ans+=(1/(n*(2**ct)))
    
    print(ans)


if __name__=='__main__':
    do()

Measured memory_bytes: 9128
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <limits>
using ll = long long;
int MOD = 1e9 + 7;
using namespace std;
struct UnionFind
{
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    int root(int x)
    { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {                     // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry)
            return;   //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y)
    { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main()
{
    long double n, m, d;
    cin >> n >> m >> d;
    if(d>n-1){
        cout << 0 << endl;
        return 0;
    }
    long double k;
    if(d==0){
        k = n;
    }else{
        k = 2 * (n - d);
    }
    cout << setprecision(20) << k / (n * n) * (m - 1) << endl;
}

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

namespace ConsoleApp1 {
    public class Class {
        static void Main(string[] args) {
            var NK = RL<int>();
            var P = RL<double>().Select(x => (x + 1) / 2).ToArray();
            for (var i = 1; i < P.Length; i++) {
                P[i] += P[i - 1];
            }

            for (var i = NK[0] - 1; i >= NK[1]; i--) {
                P[i] -= P[i - NK[1]];
            }

            Console.Write(P.Max());
        }

        static T[] RL<T>() where T : IComparable {
            if (typeof(T) == typeof(int)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
            }
            if (typeof(T) == typeof(long)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
            }
            if (typeof(T) == typeof(double)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(double.Parse).ToArray();
            }
            if (typeof(T) == typeof(decimal)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(decimal.Parse).ToArray();
            }
            return (T[])(object)Console.ReadLine().Trim().Split().ToArray();
        }
    }
}

Measured memory_bytes: 37724
object Main {
  def main(args: Array[String]): Unit = {
    val S = io.StdIn.readLine()
    if (S.startsWith("A") && S.substring(2, S.length - 1).count(_ == 'C') == 1 && S.count(_.isUpper) == 2) {
      println("AC")
    } else {
      println("WA")
    }
  }
}


Measured memory_bytes: 25412
#include<bits/stdc++.h>
using namespace std;
typedef pair<vector<int>,int> P;
int n,ans=9;
vector<int> v[2];
map<vector<int>,int> s[2];

void bfs(bool f){
  queue<P> Q;
  Q.push(P(v[f],0));
  while(!Q.empty()){
    P t=Q.front();Q.pop();
    vector<int> b=t.first;
    int d=t.second;
    if(f&&s[0].count(b))ans=min(ans,s[0][b]+d);
    if(s[f].count(b))continue;
    s[f][b]=d;
    if(d==4)continue;
    for(int i=0;i<n;i++)
      for(int j=i+2;j<=n;j++){
	reverse(b.begin()+i,b.begin()+j);
	Q.push(P(b,d+1));
	reverse(b.begin()+i,b.begin()+j);
      }
  }
}

int main(){
  cin>>n;
  for(int i=1,a;i<=n;i++){
    cin>>a;
    v[0].push_back(a);
    v[1].push_back(i);
  }
  bfs(0),bfs(1);
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

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

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n, k;
	cin >> n >> k;
	
	ll cnt = 0;
	FORE(i, 1, n) {
		if (i % k == 0) cnt++;
	}
	ll ans = (ll) (pow(cnt, 3));
	
	if (k % 2 == 1) {
		cout << ans << endl;
	} else {
		cnt = 0;
		FORE(i, 1, n) {
			if ((i + (k / 2)) % k == 0) cnt++;
		}
		cout << ans + (ll) (pow(cnt, 3)) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
	static ArrayList<Integer>[] graph;
	static HashMap<Integer, Integer> map = new HashMap<>();
	static int[] ans;
	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		graph = new ArrayList[n + 1];
		for (int i = 1; i <= n; i++) {
			graph[i] = new ArrayList<Integer>();
		}
		int q = sc.nextInt();
		for (int i = 0; i < n - 1; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			graph[a].add(b);
			graph[b].add(a);
		}
		for (int i = 0; i < q; i++) {
			int idx = sc.nextInt();
			int value = sc.nextInt();
			if (map.containsKey(idx)) {
				map.put(idx, map.get(idx) + value);
			} else {
				map.put(idx, value);
			}
		}
		ans = new int[n + 1];
		set(1, 0, -1);
		StringBuilder sb = new StringBuilder();
		for (int i = 1; i <= n; i++) {
			if (i != 1) {
				sb.append(" ");
			}
			sb.append(ans[i]);
		}
		System.out.println(sb);
	}
	
	static void set(int idx, int value, int from) {
		if (map.containsKey(idx)) {
			value += map.get(idx);
		}
		ans[idx] = value;
		for (int next : graph[idx]) {
			if (next == from) {
				continue;
			}
			set(next, value, idx);
		}
	}
}


Measured memory_bytes: 232224
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>
#include <set>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x)
#define PUT(x) printf("%d\n",x)
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };
const int disLD[3] = { 0,1,0 };

const char disC[4] = { 'U','D','R','L' };
const char disY[4] = { -1,1,0,0 };
const char disX[4] = { 0,0,1,-1 };

int main(void) {

	ll a, b;
	cin >> a >> b;

	if (a <= 8 && b <= 8) {
		cout << "Yay!" << endl;
	}else{
		cout << ":(" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
month = [0,31,29,31,30,31,30,31,31,30,31,30,31]
week = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']

while True:
    m,d = list(map(int,input().split()))
    if m == 0 and d == 0:
        break
    day = 3
    x = 1
    y = 1
    while x != m or y != d:
        if y == month [x]:
            x += 1
            y = 1
        else:
            y += 1
        day += 1
        day %= 7
    print(week [day])

Measured memory_bytes: 7444
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<utility>
#define LL long long

using namespace std;

int N,p=1;
pair<int,int>xy[10];
bool visit[10];
double ans=0.0;

void solve(int bef, double total, string s){
	bool flg=true;
	for(int i=0; i<N; i++){
		int tmp=0;
		if(!visit[i]){
			flg=false;
			visit[i]=true;
			tmp=(xy[i].first-xy[bef].first)*(xy[i].first - xy[bef].first);
			tmp+=(xy[i].second-xy[bef].second)*(xy[i].second - xy[bef].second);
			solve(i,total+sqrt(tmp),s+to_string(i));
			visit[i]=false;
		}
	}
	if(flg){
		ans+=total;
		//cout << s << endl;
	}
	return;
}

int main() {
	cin >> N;
	for(int i=0; i<N; i++){
		int a,b;
		cin >> a >> b;
		xy[i]={a,b};
		visit[i]=false;
		 p *= (i+1);
	}
	for(int i=0; i<N; i++){
		visit[i]=true;
		solve(i,0.0,"");
		visit[i]=false;
	}
	cout << setprecision(20) << ans/(double)p << endl;
	return 0;
}




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

using namespace std;

int main(void) {
    int h, w;
    cin >> h >> w;
    vector<string> S(h);
    for (auto &s: S) {
        cin >> s;
    }
    for (int y = 0; y < h; ++y) {
        for (int x = 0; x < w; ++x) {
            if (S[y][x] == '#') {
                bool exist = false;
                for (int i = -1; i <= 1; ++i) {
                    for (int j = -1; j <= 1; ++j) {
                        if (abs(i) != abs(j)) {
                            int idx_y = y + i;
                            int idx_x = x + j;
                            if (idx_y < 0 || idx_y >= h) continue;
                            if (idx_x < 0 || idx_x >= w) continue;
                            if (S[idx_y][idx_x] == '#') {
                                exist = true;
                                break;
                            }
                        }
                    }
                }
                if (!exist) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    if (k <= a) {
        ans = k;
    } else if (a < k && k <= a + b) {
        ans = a;
    } else {
        ans = a - (k - a - b);
    }
    cout << ans << endl;

}

Measured memory_bytes: 3652
#include <stdio.h>

int stack(int);

int main(int argc, char const *argv[])
{
	int input, data;

	while(1){
		if(scanf("%d", &input) == EOF){
			break;
		}

		data = stack(input);

		if(data != 0){
			printf("%d\n", data);
		}
	}

	return 0;
}

int stack(int x){
	static int box[100];
	static int num = 0;

	if(x == 0){
		num--;
	} else {
		box[num] = x;
		num++;
		return 0;
	}

	return box[num];
}

Measured memory_bytes: 600
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, T, A = sc.nextInt()
  val Hs = List.fill(N)(sc.nextInt())
  val (_, index) :: _ = Hs.zipWithIndex.sortBy { case (h, _) => (A - T + h * 0.006).abs }
  println(index + 1)
}


Measured memory_bytes: 56060
#pragma GCC optimize("O3") //コンパイラ最適化用

#define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示
#include <algorithm>   //sort,二分探索,など
#include <bitset>      //固定長bit集合
#include <chrono>      //実行時間計測
#include <cmath>       //pow,logなど
#include <complex>     //複素数
#include <deque>       //両端アクセスのキュー
#include <functional>  //sortのgreater
#include <iomanip>     //setprecision(浮動小数点の出力の誤差)
#include <iostream>    //入出力
#include <iterator>    //集合演算(積集合,和集合,差集合など)
#include <map>         //map(辞書)
#include <numeric>     //iota(整数列の生成),gcdとlcm,accumulate
#include <queue>       //キュー
#include <set>         //集合（順序保持）
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility> //pair
#include <vector>  //可変長配列
using namespace std;
typedef long long ll;
typedef long double ld;

#define REP(i, n) for (int i = 0; i < ll(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < ll(b); i++)
#define FORD(i, a, b) for (int i = a; i > ll(b); i--)
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size()) // sizeをsize_tからllに直しておく
const long long INF = 1e12;
const int MOD = 1e9 + 7;
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define Umap unordered_map
#define Uset unordered_set
#define int long long
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000

// https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed#c%E3%81%A7%E3%81%AE%E5%AE%9F%E8%A3%85
void print() { cout << endl; }

template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}

template <class T> void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}

template <class T> void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}

void add(long long &a, long long b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}
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;
}

signed main() {

    int n, k;
    cin >> n >> k;
    vector<int> A(n);
    REP(i, n) { cin >> A.at(i); }
    REP(i, n - k) {
        if (A[i] < A[i + k]) {
            print("Yes");
        } else {
            print("No");
        }
    }
}


Measured memory_bytes: 4792
# include <iostream>
using namespace std;
int main(){

  int n;
  cin >> n;

  int sum = 0;
  for(int i=0; i<n; i++){
    int x;
    cin >> x;
    sum += x;
    sum %= 2;
  }

  cout << (sum == 0 ? "YES" : "NO") << endl;
  return 0;
}

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

using namespace std;

const int inf = 999999;

int prim(int a[101][101], int n)
{
	int r = 0, mcost[101];
	bool vis[101];
	
	fill(mcost, mcost+101, inf);
	fill(vis, vis+101, false);
	mcost[0] = 0;
	
	while(1){
		int v = -1;
		
		for(int i = 0; i < n; i++){
			if(!vis[i] && (v == -1 || mcost[v] > mcost[i])){
				v = i;
			}
		}
		
		if(v == -1){
			break;
		}
		vis[v] = true;
		r += mcost[v];
		
		for(int i = 0; i < n; i++){
			mcost[i] = min(mcost[i], a[v][i]);
		}
	}
	
	return r;
}

int main()
{
	int n, m, a[101][101], s, t, u;
	
	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0){
			break;
		}
		
		fill(&a[0][0], &a[100][100], inf);
		for(int i = 0; i <= n; i++){
			a[i][i] = 0;
		}
		
		while(m--){
			cin >> s >> t >> u;
			a[s][t] = a[t][s] = u;
		}
		
		cout << prim(a, n) << endl;
	}
	
	return 0;
}

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

#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(a) (a).begin(),(a).end()

using namespace std;

using ll = long long;

int main() {
    int N, A;
    cin >> N >> A;
    vector<int> x(N);
    REP(i, N) cin >> x[i];

    int x_sum = accumulate(all(x), 0);
    vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>>(N + 1, vector<ll>(x_sum + 1, 0)));
    REP(i, N + 1) {
        dp[i][0][0] = 1;
    }

    FOR(i, 1, N + 1) {
        FOR(j, 1, N + 1) {
            FOR(k, 1, x_sum + 1) {
                dp[i][j][k] = dp[i - 1][j][k];
                if (k - x[i - 1] >= 0) {
                    dp[i][j][k] += dp[i - 1][j - 1][k - x[i - 1]];
                }
            }
        }
    }

    ll result = 0;
    FOR(i, 1, N + 1) {
        if (A * i <= x_sum) {
            result += dp[N][i][A * i];
        }
    }
    cout << result << endl;
    return 0;
}

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

int main()
{
	int a,b;
  	cin>>a>>b;
  	string ans;
 
  	if (a == b)
    {
      	for (int i=0; i<a; i++)
        {
          	ans += to_string(a);
        }
      	cout<<ans<<endl;
    }
  	else
    {
      	if (a>b)
        {
          	for (int i=0; i<a; i++)
            {
              	ans+= to_string(b);
            }
          	cout<<ans<<endl;
        }
      	else
        {
          	for (int i=0; i<b; i++)
            {
              	ans += to_string(a);
            }
          	cout<<ans<<endl;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>

#define G_SIZE 100
struct node{
	int d, l;
};

int buff[10000], qi, qj;
void enque(int id)
{
	buff[qj++] = id;
	return;
}

int deque(void)
{
	if(qi < qj){
		return(buff[qi++]);
	}
	return(-1);
}

void bfs(struct node G[][G_SIZE+1], int size, int id)
{
	int u, v, i;
	enque(id);
	while((u = deque()) != -1){
		if(u == 1){
			G[u][u].d = 0;
		}
		for(i = 1; i <= size; i++){
			if((G[u][i].l == 1) && (G[i][i].d == -1)){
				v = i;
				G[v][v].d = G[u][u].d + 1;
				enque(v);
			}
		}
	}
	return;
}

int main(int argc, char* argv[])
{
	int u, k, n, v, i, j;
	struct node G[G_SIZE+1][G_SIZE+1];

	for(i = 1; i <= G_SIZE; i++){
		for(j = 1; j <= G_SIZE; j++){
			G[i][j].d = -1;
			G[i][j].l = 0;
		}
	}

	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &u);
		scanf("%d", &k);
		for(j = 0; j < k; j++){
			scanf("%d", &v);
			G[u][v].l = 1;
		}
	}

	bfs(G, n, 1);

	for(i = 1; i <= n; i++){
		printf("%d %d\n", i, G[i][i].d);
	}

	return(0);
}

Measured memory_bytes: 684
#include <iostream>
#include <vector>
#include <string>
#include <complex>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define REP(i,n) for(int i=0;i<n;i++)
#define pb push_back


// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

typedef complex<int> xy_t;

int main(void) {
	// cin, coutの結びつきを解除し、速くする
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int x1, x2, x3, x4;
	int y1, y2, y3, y4;
	cin >> x1 >> y1 >> x2 >> y2;


	x4 = x1 - (y2 - y1);
	y4 = y1 + (x2 - x1);

	x3 = x2 + x4 - x1;
	y3 = y2 + y4 - y1;

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;


}



Measured memory_bytes: 256
import sys
from collections import Counter
input = sys.stdin.readline
N, K = map(int, input().split())
mod = 10 ** 9 + 7
e = [[] for _ in range(N + 1)]
for _ in range(N - 1):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)
if N == 1:
  print(K)
  exit(0)
elif N == 2:
  print(K * (K - 1))
  exit(0)
s = [1]
vis = [0] * (N + 1)
order = []
parent = [0] * (N + 1)
children = [0] * (N + 1)
while len(s):
  x = s.pop()
  vis[x] = 1
  order.append(x)
  for y in e[x]:
    if vis[y]: continue
    s.append(y)
    parent[y] = x
    children[x] += 1
cs = Counter()
cr = children[1]
for y in range(2, N + 1): cs[children[y]] += 1
#print(cs, cr)
res = [0] * (K + 1)
l = 0
csmx = 0
if len(cs): csmx = max(cs.keys())

for c in range(K + 1):
  if c <= 1 and (cr > 0): continue
  if c <= 2 and (len(cs) > 0): continue
  if c - 1 >= cr and (c - 2 >= csmx):
    l = c
    break
if l == 0:
  print(0)
  exit(0)

class Factorial:
  def __init__(self, n, mod):
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i):
    return self.f[i]
  def ifactorial(self, i):
    return self.i[i]
  def combi(self, n, k):
    return self.f[n] * self.i[n - k] % mod * self.i[k] % mod

f = Factorial(K, mod)
smcs = sum(cs.values())
res[l] = f.factorial(l) * f.ifactorial(l - cr - 1) % mod
for k, v in cs.items():
  res[l] *= pow(f.factorial(l - 2) * f.ifactorial(l - k - 2) % mod, v, mod)
  res[l] %= mod
#print(res)
revs = [0] * (K + 1)
for i in range(K + 1): revs[i] = pow(i, mod - 2, mod)
for i in range(l, K):
  res[i + 1] = res[i] * pow(i - 1, smcs, mod) % mod
  res[i + 1] *= (i + 1) * revs[i - cr] % mod
  res[i + 1] %= mod
  for k, v in cs.items():
    res[i + 1] *= pow(revs[i - k - 1], v, mod)
    res[i + 1] %= mod

print(res[-1])

Measured memory_bytes: 71656
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = IR(5)
    k = II()
    if max(a) - min(a) > k:
        print(":(")
    else:
        print("Yay!")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 4720
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
INF = float("inf")
import sys
sys.setrecursionlimit(10000)


def solve(N, Z, W, a):
    ans = abs(a[-1] - W)
    if len(a) > 1:
        ans = max(ans, abs(a[-2] - a[-1]))
    return ans


def main():
    N, Z, W = map(int, input().split())
    a = list(map(int, input().split()))
    print(solve(N, Z, W, a))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4084
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

// UnionFindを構築します
// 使用例:
// UnionFind uni(n);
// cout << uni.Same(1, 2) ? "YES" : "NO" << endl; <- NO
// uni.Unite(1, 2);
// cout << uni.Same(1, 2) ? "YES" : "NO" << endl; <- YES
// cout << uni.GetSize(1) << endl;                <- 2
class UnionFind
{
    private:
      vector<int> par;
      vector<int> rank;
      vector<int> sz;

    public:
      UnionFind(int n) : par(n), rank(n, 0), sz(n, 1)
      {
          iota(par.begin(), par.end(), 0);
      }
      int Find(int x)
      {
          if (par[x] == x) return x;
          else
          {
              int r = Find(par[x]);
              return par[x] = r;
          }
      }
      bool Unite(int x, int y)
      {
          x = Find(x);
          y = Find(y);
          if (x == y) return false;

          if (rank[x] < rank[y]) swap(x, y);
          par[y] = x;
          if (rank[x] == rank[y]) rank[x]++;
          sz[x] += sz[y];
          return true;
      }
      bool Same(int x, int y)
      {
          if (Find(x) == Find(y)) return true;
          else return false;
      }
      int GetSize(int x)
      {
          return sz[Find(x)];
      }
};

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    vector<int> x(m), y(m), z(m);
    REP(i, m) cin >> x[i] >> y[i] >> z[i];
    REP(i, m) x[i]--, y[i]--;

    UnionFind uf(n);
    REP(i, m)
    {
        uf.Unite(x[i], y[i]);
    }

    map<int, int> mp;
    REP(i, n) mp[uf.Find(i)]++;
    cout << mp.size() << endl;
}

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

string s;
int main (){
    cin >> s;
    int n = s.size();
    int ans = 0;
    int l = 0;
    int r = 0;
    for(int i=0; i<n; i++) {
        if( s[i] == '0' ) l++;
        if( s[i] == '1' ) r++;
        if( l > 0 && r > 0) {
            l--;
            r--;
            ans += 2;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    ll n , a , b;
    cin >> n >> a >> b;
    ll m = n - (n/(a+b))*(a+b) ;
    if (m < a) cout << a*(n/(a+b)) +m;
    else cout << a*(n/(a+b)) + a;
}


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 = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		String ans = "";
		if(a > b) {
			for(int i = 0; i < a;i++) {
				ans += String.valueOf(b);
			}
		}else {
			for(int i = 0; i < b;i++) {
				ans += String.valueOf(a);
			}

		}
		
		System.out.println(ans);
		
	}
	
	
	

}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;

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

    for (int i = 1; i <= n; i++) {
        int x = i;
        if (x % 3 == 0) {
            cout << " " << i;
            continue;
        }
        while (true) {
            if (x % 10 == 3) {
                cout << " " << i;
                break;
            }
            x /= 10;
            if (x) {
                continue;
            }
            break;
        }
    }
    cout << endl;
}



Measured memory_bytes: 3096
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)



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

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

	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ans += A[i] / 2LL;
		if (i == N - 1)break;
		if (A[i] % 2 == 0)continue;
		if (A[i + 1] == 0)continue;
		ans += 1;
		A[i + 1] -= 1;
	}
	puts(ans);

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    vector<ll>abc = { a,b,c };
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)cout << 0 << endl;
    else {
        sort(all(abc));
        cout << abc[0] * abc[1] << endl;
    }
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int p,q,r; 
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>p>>q>>r;
	cout<<min(p+q,min(p+r,q+r))<<endl;
	return 0;
}


Measured memory_bytes: 256
import fractions

from sys import stdin


def main():
    n = int(stdin.readline())
    a = list(map(int, stdin.readline().split()))
    sa = set(a)

    lcm = 1

    for ai in sa:
        lcm = (ai * lcm) // fractions.gcd(ai, lcm)

    ans = 0

    for ai in a:
        ans += lcm // ai
    ans %= 10 ** 9 + 7

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 6496
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let c: i32 = read();

    println!("{}", c - std::cmp::min(c, a - b));
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <iostream>
#include <stack>
using namespace std;
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
int color[MAX],d[MAX],f[MAX];
int n,t;
int N[MAX][MAX];
void dfs(int u){
    color[u] = GRAY;
    d[u] = ++t;
    for(int v=0;v<n;v++){
        if(N[u][v]!=0&&color[v]==WHITE){
            dfs(v);
        }
    }
    color[u] = BLACK;
    f[u] = ++t;
}
void dfs_init(){
    t = 0;
    for(int i=0;i<n;i++){
        color[i] = WHITE;
    }
    for(int i=0;i<n;i++){
        if(color[i]==WHITE)
            dfs(i);
    }
    for(int i=0;i<n;i++){
        cout<<i+1<<" "<<d[i]<<" " <<f[i]<<endl;
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            N[i][j] = 0;
        }
    }
    for(int i=0;i<n;i++){
        int u,k;
        cin>>u>>k;
        for(int j=0;j<k;j++){
            int v;
            cin>>v;
            N[i][v-1] = 1;
        }
    }
    dfs_init();
    return 0;
}



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

using namespace std;

int main() {
    string s;
    cin >> s;

    set<char> st(s.begin(), s.end());
    if (st.size() == 26) {
        cout << "None" << endl;
    } else {
        for (char ch = 'a'; ch <= 'z'; ++ch) {
            if (st.find(ch) == st.end()) {
                cout << ch << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 512
<?php
while(fscanf(STDIN,"%d %d %d %d %d %d",$a,$b,$c,$d,$e,$f)){
    $x = ($e*$c-$b*$f)/($a*$e-$b*$d);
    $y = (-$d*$c+$a*$f)/($a*$e-$b*$d);
    if($x==0)$x=0;
    if($y==0)$y=0;
    printf("%.3f %.3f\n",$x,$y);
}
?>

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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
#define mini(x,y) x=min(x,y)
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


const int N = 2e5+5;


void solve() {

   int d,t,s;
   cin>>d>>t>>s;
   if(d<=t*s)
     cout<<"Yes";
   else
     cout<<"No";
  
}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
   // cin >> t;
    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}




int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}


int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}

int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


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

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


void solve(long long N, long long X, std::vector<long long> L){
    long long x = 0;
    int res = 0;
    for(int i=0;i<N&&x<=X;++i){
        x+=L[i];
        res++;
    }
    if(x<=X)res++;
    cout<<res<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&L[i]);
    }
    solve(N, X, std::move(L));
    return 0;
}


Measured memory_bytes: 256