akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int n;

int main(void){
	cin >> n;
	int res = 0;
	for(int i = 1; i <= n; i++){
		if(i%2 == 0) continue;

		int num = 0;
		for(int j = 1; j <= i; j++){
			if(i%j == 0) num++;
		}

		if(num == 8) res++;
	}

	cout << res << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a[3],w=0,x=0,y=0,z=0;
	while(cin>>a[0]>>a[1]>>a[2]){
		sort(a,a+3);
        if(a[0]+a[1]<=a[2])break;
		if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])x++;
		else if(a[0]*a[0]+a[1]*a[1]>a[2]*a[2])y++;
		else z++;
		w++;
	}
	cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
    return 0;
    }


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

using namespace std;
typedef long long ll;
typedef long  double lb;
int mod=1e9+7;
const int N=2e5+100;

queue<ll>q;
int main()
{
    int k;
    cin>>k;
    for(int i=1;i<=9;i++) q.push(i);
    for(int i=1;i<k;i++){
        ll a=q.front();
        ll si=a%10;
        q.pop();
        if(si==0){
            q.push(a*10);
            q.push(a*10+1);
        }
        else if(si==9){
            q.push(a*10+si-1);
            q.push(a*10+si);
        }
        else {
            q.push(a*10+si-1);
            q.push(a*10+si);
            q.push(a*10+si+1);
        }
    }
    cout<<q.front();
    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
 // sum(x) x以下の和
// sum(a,b) a以上b以下の和
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {  //x=1ならsumは個数のカウント
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int i,int j) {
    if(i>0) return sum(j)-sum(i-1);
    else return sum(j) ; } 
};

 int main(){
 ll n, q; cin>>n>>q ;
 vector<ll> C(n) ;
 rep(i,n) cin>>C[i] ;
 map<ll,vector<ll>> mp ;
 
 rep(i,n){
   mp[C[i]].pb(i) ;
 }

 vector<pair<P,ll>> xx ;
 for(auto u : mp){
   auto& v= u.se ;
   ll s= v.size() ;
   rep(i,s-1){
     xx.eb(mpa(mpa(v[i+1],0),v[i])) ;
   }
 }

 rep(i,q){
   ll a,b ;
   cin>>a>>b ;
   a--; b-- ;
   xx.eb(mpa(mpa(b,i+1),a)) ;
 }
 sort(xx.begin(),xx.end()) ;
 BIT<ll> b(n) ;
 ll ss= xx.size() ;
 vector<ll> ans(q) ;
 rep(i,ss){
   if(xx[i].fi.se==0) b.add(xx[i].se) ;
   else{
    ll now=  b.sum(xx[i].se,xx[i].fi.fi) ;
    ans[xx[i].fi.se-1]= xx[i].fi.fi-xx[i].se+1-now ;
   }
 }
 rep(i,q) cout<<ans[i]<<endl ;
   return 0 ;
 }



Measured memory_bytes: 82020
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
T = iil()
m = ii()
drink = []
for i in range(m):
    drink.append(iil())

time = sum(T)
for item in drink:
    dif = item[1] - T[item[0]-1]
    print(time + dif)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace Topic04
{
    class ALDS1_4_A
    {
        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            List<int> S = ReadLine().Split()
                .Select(n => int.Parse(n)).ToList();
            
            int Q = int.Parse(ReadLine());
            List<int> T = ReadLine().Split()
                .Select(n => int.Parse(n)).ToList();

            WriteLine(T.Intersect(S).Count().ToString());
            ReadKey();
        }
    }
}



Measured memory_bytes: 20332
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: usize, b: usize, c: usize,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}

fn main() {
    input!{ n: usize, t: usize, tuples: [(usize, usize);n]}
    let mut ans=1001;
    for (c_i, t_i) in tuples {
        if t_i > t { continue; }
        if c_i < ans {
            ans = c_i;
        }
    }
    if ans == 1001 { println!("TLE"); } else { println!("{}", ans); }
}

Measured memory_bytes: 4352
n,p=map(int,input().split())
a=list(map(lambda x:int(x)%2,input().split()))
d=[0]*n
if p==1:
    if a[0]==1:
        d[0]=1
    else:
        d[0]=0
else:
    if a[0]==1:
        d[0]=1
    else:
        d[0]=2
for i in range(1,n):
    if a[i]==0:
        d[i]=d[i-1]+d[i-1]
    else:
        d[i]=d[i-1]+(2**i-d[i-1])
print(d[n-1])

Measured memory_bytes: 38384
#include<iostream>
using namespace std;
int main() {
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (x - r >= 0 && x + r <= W&&y - r >= 0 && y + r <= H)
		cout << "Yes\n";
	else cout << "No\n";
	cin >> x;
}

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

int main() {
	int n, m, l;
	cin >> n >> m >> l;

	int A[100][100] = {};
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> A[i][j];
		}
	}

	int B[100][100] = {};
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> B[i][j];
		}
	}
	
	long long C[100][100] = {};
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				C[i][j] += A[i][k] * B[k][j];
			}
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			cout << C[i][j];
			(j == l - 1) ? (cout << endl) : (cout << " ");
		}
	}

	return 0;
}


Measured memory_bytes: 3264
N=int(input())
A=[list(map(int, input().split())) for i in range(2)]
M=A[0][0]+sum(A[1])
t=M
for i in range(1,N):
    t+=A[0][i]
    t-=A[1][i-1]
    M=max(M,t)
print(M)

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main() {
	int N, L;
	cin >> N >> L;
	vector<string> S(N);
	string S0 = "";

	for (int i = 0; i < N; i++) {
		cin >> S.at(i);
	}
	
	sort(S.begin(), S.end());

	for (int i = 0; i < N; i++) {
		S0 += S.at(i);
	}

	cout << S0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n = 3;
    vector<string> f(n); rep(i, n) cin >> f[i];

    string res = "";
    rep(i, n) res += f[i][i];

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
score = 0
for i in range(n):
    score += b[ a[i]-1 ]
bonus = 0
for j in range(1,n):
    if a[j-1]+1 == a[j]:
        bonus += c[ a[j] -2 ]
print(score+bonus)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
#define LL long long

int N,W;
LL w[105],v[105];
LL dp[105][100005];

int main()
{
	
	cin>>N>>W;
	for(int i=0;i<N;i++)
		cin>>w[i]>>v[i];
	
	for(int i=1;i<=W;i++)
		if(w[0]<=i) dp[0][i]=v[0]; 
	for(int i=1;i<N;i++)
	for(int j=1;j<=W;j++)
		if(j<w[i]) dp[i][j]=dp[i-1][j];
		else dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
	cout<<dp[N-1][W];
	
	return 0;
}

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

int main() {
	int N, K;
	cin >> N >> K;
	int A[200000];
	for (int i = 0;i<N;i++)cin >> A[i];

	//各jに対しA_i=jなるiの個数をカウント
	vector<int>c(200000, 0);
	for (int i = 0;i<N;i++) c[A[i]] += 1;

	//降順にソートして、K番目まで足す
	sort(c.begin(), c.end());
	reverse(c.begin(), c.end());
	int ans = 0;
	for (int i = 0;i<K;i++) ans += c[i];
	ans = N - ans;

	cout << ans;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int N,M,X,data,cnt=0,cnt2=0;
	cin>>N>>M>>X;
	int arr[N];
	for(int i=0;i<N;i++)arr[i]=0;
	for(int i=0;i<M;i++){
		cin>>data;
		arr[data]=1;
	}
	for(int i=0;i<X;i++){
		if(arr[i]==1)cnt++;
	}
	for(int i=X;i<N;i++){
		if(arr[i]==1)cnt2++;
	}
	cout<<min(cnt, cnt2)<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma once
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endlhttps://stopwatch.onl.jp/#
#endif
using namespace std;
int main() {
  int N,K,Q,tmp;
  cin >> N>>K>>Q;
  vector<int> list(N,K-Q);
  rep(i,Q){
    cin >> tmp;
    list[tmp-1]++;
  }
  rep(i, N) {
    if (list[i] > 0) {
      cout << "Yes" << endl;
    }else {
      cout << "No" <<endl;
    }
  }

  
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
  cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> vec;
vec.at(i)
vector<vector<int>> vec(10, vector<int>(10));
sort(all(vec));
sort(all(vec), greater<int>());
    //配列の内容表示
dout << "====vecの内容====\n";
for (int i = 0; i < N; i++) dout << vec[i] << endl;
dout << "====ここまで====\n";
*/

Measured memory_bytes: 1152
function main(s) {

    var r = s.trim();
    var inject = [0, 4, 6, 8];
    for (var i = 0; i < inject.length; i++) {
        var j = inject[i];
        if (r[j] !== 'A') r = r.slice(0, j) + "A" + r.slice(j, r.length);
    }
    console.log(r === "AKIHABARA" ? "YES" : "NO");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 20680
N, M = map(int, input().split())
A = list(map(int, input().split()))
a = []

for i in range(M):
  b = list(map(int, input().split()))
  a.append(b)
  
from operator import itemgetter
A.sort()
a.sort(key = itemgetter(1))
count = 0
for i in range(N):
  if A[i] < a[-1-count][1]:
    A[i] =  a[-1-count][1]
    a[-1-count][0] -= 1
    if a[-1-count][0] == 0:
      count += 1
    if count == M:
      break
print(sum(A))  

Measured memory_bytes: 32980
#include<cstdio>

int main(void){
  int a,b,c;

  scanf("%d %d %d",&a,&b,&c);

  if(a==b&& b==c)
    printf("1\n");
  else if(a==b||b==c||c==a)
    printf("2\n");
  else
    printf("3\n");

  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int robot[] = new int[N];
        int ans = 0;
        for (int i = 0; N > i; i++) {
            robot[i] = sc.nextInt();
        }
        for (int j = 0; N > j; j++) {
            if (robot[j] < K - robot[j]) {
                ans += 2 * robot[j];
            } else {
                ans += 2 * (K - robot[j]);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <stack>
#include <string>

using namespace std;

int sequence[500][501];

int main() {
  for (;;) {
    int H, W;
    cin >> H >> W;
    if (!H && !W) return 0;
    string cells[H];
    for (int i = 0; i < H; i++)
      cin >> cells[i];
    for (int i = 0; i < W; i++)
      sequence[0][i] = cells[0][i] == '.';
    for (int i = 1; i < H; i++)
      for (int j = 0; j < W; j++)
        sequence[i][j] = cells[i][j] == '.' ? sequence[i-1][j] + 1 : 0;
    int result = 0;
    for (int i = 0; i < H; i++) {
      int *row = sequence[i];
      stack<pair<int, int> > s;
      row[W] = 0;
      for (int j = 0; j <= W; j++)
        if (s.empty() || row[j] > s.top().first)
          s.push(make_pair(row[j], j));
        else if (row[j] < s.top().first) {
          int k;
          for (; !s.empty() && row[j] <= s.top().first; s.pop()) {
            k = s.top().second;
            result = max(result, (j - k) * s.top().first);
          }
          s.push(make_pair(row[j], k));
        }
    }
    cout << result << endl;
  }
}

Measured memory_bytes: 2168
N, K = map(int, input().split())
S = input()

prev = None
num_regions = 0
score = 0
for c in S:
  if c != prev:
    num_regions += 1
  else:
    score += 1
  prev = c

if K >= num_regions // 2:
  print(N-1)
else:
  print(score + K*2)

Measured memory_bytes: 3316
import java.lang.Math;
import java.util.*;


public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);

        String str = scanner.nextLine();
        String str2 = scanner.nextLine();
        String[] params = str.split(" ", 0);
        String[] params2 = str2.split(" ", 0);

        int[] intArray = new int[params.length];
        int[] intArray2 = new int[params2.length];

        for (int i = 0; i < params.length; i++) {
            intArray[i] = Integer.parseInt(params[i]);
        }

        int total_vote = 0;
        for (int j = 0; j < params2.length; j++) {
            intArray2[j] = Integer.parseInt(params2[j]);
            total_vote += Integer.parseInt(params2[j]);
        }

        double test = 1 / (4 * intArray[1]);
        //int minimum_vote = (int)(total_vote * (double)1 / (4 * intArray[1]));
        int minimum_vote = (int)Math.ceil((total_vote * (double)1 / (4 * intArray[1])));
        int chose_product = 0;

        for (int k = 0; k < params2.length; k++) {
            if(intArray2[k] >= minimum_vote) {
                chose_product++;
            }
        }
        //System.out.println(total_vote);
        //System.out.println(minimum_vote);


        if (chose_product >= intArray[1]) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

int main(void){
	int N,K,x;
	cin >> N >> K;
	vector<int> A(N);
    for(int i=0;i<N;i++){
    	cin >> A.at(i);
	}
	
	x=(N-K)/(K-1)+1;
	if((N-K)%(K-1)!=0)x++;

    cout << x << endl;
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int a[200014], b[200014];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    sort(a, a + n);
    sort(b, b + n);
    int m1, m2;
    if (n & 1 == 1) {
        m1 = a[(n-1)/2];
        m2 = b[(n-1)/2];
    } else {
        m1 = a[n/2-1] + a[n/2];
        m2 = b[n/2-1] + b[n/2];
    }
    cout << m2 - m1 + 1 << endl;
    return 0;
}

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

int func(float n) {
	float f = (float)((int)n);
	if (n - f < 0.5)return (int)f;
	return (int)f + 1;
}
int main() {
	float sum = 0, cnt = 0;
	float i, j;
	float C = 0;
	while (scanf("%f,%f", &i, &j) != EOF) {
		sum += i*j; cnt += j;
		C++;
	}
	cout << sum << endl << func(cnt / C) << endl;
	return 0;
}



Measured memory_bytes: 3280
#include<stdio.h>
#include<math.h>
int main(void){
	double x[3],y[3],l,m,n,a,b,c,d,e,f;
	int i,h;
	scanf("%d",&h);
	for(i=0; i<h; i++){
	scanf("%lf%lf%lf%lf%lf%lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);

	a=x[0]-x[1];
	b=y[0]-y[1];
	c=(x[1]*x[1]+y[1]*y[1])-(x[0]*x[0]+y[0]*y[0]);
	d=x[1]-x[2];
	e=y[1]-y[2];
	f=(x[2]*x[2]+y[2]*y[2])-(x[1]*x[1]+y[1]*y[1]);

	l=(c*e-b*f)/(a*e-b*d);
	m=(c*d-a*f)/(b*d-a*e);
	n=-1*(x[0]*x[0]+y[0]*y[0]+l*x[0]+m*y[0]);
	a=l/(-2);
	b=m/(-2);
	c=sqrt(a*a+b*b-n);

	printf("%.3f %.3f %.3f\n",a,b,c);
	}

	return 0;
}

Measured memory_bytes: 664
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s=="MON")
	{
		cout<<'6';
	}
	if(s=="TUE")
	{
		cout<<'5';
	}
	if(s=="WED")
	{
		cout<<'4';
	}
	if(s=="THU")
	{
		cout<<'3';
	}
	if(s=="FRI")
	{
		cout<<'2';
	}
	if(s=="SAT")
	{
		cout<<'1';
	}
	if(s=="SUN")
	{
		cout<<'7';
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define mp make_pair
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll mod=1000000007;


int main(){
    ll n,k,ans=0;
    cin>>n>>k;
    vl a(n);
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    rep(i,n-k){
        ans+=a[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<endl
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define PI 3.14159265358979323846264338327
#define INF 2e14
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

string s,t;
set<int> sa[26]; //locations of letters in s

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>s>>t;
	forn(i,0,s.length()){
		sa[s[i]-'a'].insert(i);
	}
	
	forn(i,0,t.length()){
		if(sa[t[i]-'a'].empty()){
			cout<<-1<<'\n';
			return 0;
		}
	}
	
	int p=-1,mul=0;
	
	/*forn(i,0,26){
		cout<<char('a'+i)<<':';
		for(set<int>::iterator it=sa[i].begin();it!=sa[i].end();it++) cout<<*it<<" ";
		cout<<'\n';
	}*/
	
	forn(i,0,t.length()){
		if(p>=0) p%=t.length();	//cout<<"t["<<i<<"]:";
		set<int>::iterator ptr=sa[t[i]-'a'].upper_bound(p);
		if(ptr==sa[t[i]-'a'].end()){ //cout<<"overflow...";
			mul++;
			ptr=sa[t[i]-'a'].lower_bound(0);
		}
		
		p=*ptr; //cout<<p<<'\n';
	}
	
	cout<<mul*s.length()+p+1<<'\n';
	
	return 0;
}


Measured memory_bytes: 5200
#include<iostream>
#include<bits/stdc++.h>
#include<string>
#include<time.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first    
#define se second 
void solve()
{   
    string s;
    cin>>s;
    if(s[0]=='7' || s[1]=='7' || s[2]=='7')
        cout<<"Yes";
    else
        cout<<"No";
}
int main(){ 
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    //# ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output2.txt", "w", stdout);
    // #endif  
    // clock_t tStart = clock();
    // ll t;
    // cin>>t;
    // while(t--)
        solve();
    //printf("\nTime taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int r;
int main () {
cin >> r;
if (r<1200) {
	cout << "ABC" << endl;
}
else if (r<2800) {
	cout << "ARC" << endl;
}
else {
	cout << "AGC" << endl;
	}
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	while (true) {
		int m, min, max;
		cin >> m >> min >> max;
		if (m == 0 && min == 0 && max == 0)break;

		VI p(m);
		rep(i, m)cin >> p[i];

		SORT(p); REVE(p);
		int ans = 0, ans1;
		FOR(i, min, max + 1) {
			int x = p[i - 1] - p[i];
			if (x >= ans)ans = x, ans1 = i;
		}
		cout << ans1 << endl;
	}
}


Measured memory_bytes: 3076
N = int(input())
L = list(map(int, input().split()))

L.sort(reverse = True)
i = j = k = 0
cnt = 0

while i<len(L)-2:
    j = i + 1
    while j<len(L)-1:
        k = j + 1
        if L[i] != L[j]:
            while k<len(L):
                if L[j] != L[k] and L[i] < L[j] + L[k]:
                    cnt += 1
                k += 1
        j += 1
    i += 1

print(cnt)


Measured memory_bytes: 9088
A,B,M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
z = []
x = []
y = []
c = []
for i in range(M):
    z.append(list(map(int, input().split())))
    x.append(z[i][0])
    y.append(z[i][1])
    c.append(z[i][2])

mi = min(a) + min(b)

for i in range(M):
    if a[x[i]-1] + b[y[i]-1] - c[i] < mi:
        mi = a[x[i]-1] + b[y[i]-1] - c[i]

print(mi)

Measured memory_bytes: 42668
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	ll n,i,j,ans=INF64;
	cin>>n;
	vll a(n);
	rep(i,n)
		cin>>a[i];
	for(i=1;i<=100;i++)
	{
		ll temp=0;
		for(j=0;j<n;j++)
			temp+=(pow(abs(i-a[j]),2));
		ans=min(ans,temp);
	}
	cout<<ans;
}

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

int main() {
    int N;
    cin>>N;
    long long total=0;
    map<string,long long>m;
    string str;
    for(int i=0;i<N;i++){
        cin>>str;
        sort(str.begin(),str.end());
        if(m.find(str)==m.end())
            m[str]=1;
        else
            ++m[str];
    }
    map<string,long long>::iterator itr;
    for(itr=m.begin();itr!=m.end();itr++){
        if(itr->second>1){
            if(itr->second%2==0){
                long long x=(itr->second)/2LL;
                x=x*(itr->second-1);
                total+=x;
            }
            else{
                long long x=(itr->second-1)/2LL;
                x=x*(itr->second);
                total+=x;
            }
        }
    }
    cout<<total;
	return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

char s[3][20];
int main(){
	scanf("%s%s%s",s[0],s[1],s[2]);
	printf("%c%c%c",s[0][0]^32,s[1][0]^32,s[2][0]^32);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N;
	cin >> N;
	int A[N];
	for(int i = 0; i < N; i++) cin >> A[i];
	int even = 0;
	for(int i = 0; i < N; i++)
		if(A[i] % 2 == 0) even++;
	cout << pow(3, N) - pow(2, even) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int a[1001],b[1001];
int main()
{
 	int n,i,x,y,sum=0;
 	cin>>n>>x>>y;
 	for(i=1;i<=n;i++)
 	{
 		cin>>a[i]>>b[i];
	 }
	 for(i=1;i<=n;i++)
	 {
	 	if(a[i]>=x&&b[i]>=y) sum++;
	 }
	 cout<<sum;
	return 0;
}


Measured memory_bytes: 256
def make_divisors(n: int):
    lower_divs = []
    upper_divs = []
    i = 1
    while i**2 <= n:
        if n % i == 0:
            lower_divs.append(i)
            if i != n // i:
                upper_divs.append(n // i)
        i += 1
    return lower_divs + upper_divs[::-1]


n = int(input())
ans = len(make_divisors(n - 1)) - 1
for x in make_divisors(n)[1:]:
    if x == 1:
        continue
    z = n
    while z % x == 0:
        z = z // x
    z = z % x
    if z == 1:
        ans += 1

print(ans)


Measured memory_bytes: 66160
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

  int rmin=1001,lmin=1001,rnum=0,lnum=0;
  for(int i=0;i<n;++i){
    if(a[i]==0){
      if(rmin>w[i]) rmin = w[i];
      rnum++;
    }else{
      if(lmin>w[i]) lmin = w[i];
      lnum++;
    }
  }

  if(rnum==n||lnum==n){
    rmin=0;
    lmin=0;
  }

    cout << rmin + lmin << endl;
  
  return 0;
}




Measured memory_bytes: 3116
//Suplex
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int tot,n,start,s,prime[10000],vis[55555],tong[10][10000];
int main()
{
	scanf("%d",&n);
	for(int i=2;i<=55555;i++){
		if(!vis[i]) prime[++tot]=i;
		for(int j=1;j<=tot;j++){
			if(i*prime[j]>55555) break;
			vis[i*prime[j]]=1;
			if(i % prime[j]==0) break;
		}
	}
	for(int i=1;i<=tot;i++) tong[prime[i] % 5][++tong[prime[i] % 5][0]]=prime[i];
	for(int i=0;i<5;i++){
		if(tong[i][0]<n) continue;
		for(int j=1;j<=n;j++) printf("%d ",tong[i][j]);
		puts("");
		return 0;
	}
	return 0;
}

Measured memory_bytes: 512
from collections import deque
H, W = map(int, input().split())
s = []
for _ in range(H):
    s.append(input())

ans = H * W
for si in s:
    ans -= si.count("#")

visited = [[False] * W for _ in range(H)]
q = deque()
q.append((1, 0, 0))
visited[0][0] = True

while len(q):
    n, i, j = q.popleft()
    if (i, j) == (H - 1, W - 1):
        ans -= n
        break
    for x, y in ((i-1, j), (i+1, j), (i, j-1), (i, j+1)):
        if not 0 <= x < H or not 0 <= y < W:
            continue
        if visited[x][y] or s[x][y] == "#":
            continue
        q.append((n+1, x, y))
        visited[x][y] = True
else:
    print(-1)
    exit()

print(ans)


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

#define mp make_pair
#define pb push_back
#define f first
#define s second 
#define sz(s) (int)s.size()
#define int long long
#define all(s) s.begin(), s.end()
#define forn(i, x, y) for(int i = x; i <= y; i++)
#define forev(i, y, x) for(int i = y; i >= x; i--)

using namespace std;

const int maxn = (int)2e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int)1e6 + 7;
const int inf = (int)1e9 + 7;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef long double ld;

int s;
int triangle_area_2 (int x1, int y1, int x2, int y2, int x3, int y3) {
	return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1);
}

double area (int x1, int y1, int x2, int y2, int x3, int y3) {
	return abs (triangle_area_2 (x1, y1, x2, y2, x3, y3));
}
main () {
  int s;
  cin >> s;
  if(s <= 1000000000) cout << s << " " << 0 << " " << 0 << " " << 0 << " " << 123 << " " << 1;
  else{
    int y2 = 1000000000, x3 = (s - 1) / y2 + 1;
    int rem = y2 * x3 - s;
    cout << 0 << " " << 0 << " " << 1 << " " << y2 << " " << x3 << " " << rem;
  }
}

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

using namespace std;

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

#define X first
#define Y second

const int N = 2e3 + 10;
const long long linf = 1e16 + 10;

int n;
string s;
vector<int> adj[N];
int pa[N];
ll d[N][2], sub[N];

void DFS(int lv, int st) {
    if (s[st] == '1') sub[st]++;
    for(auto en : adj[st]) if (en != pa[st]) {
        pa[en] = st;
        DFS(lv + 1, en);
        d[st][1] += d[en][1] + sub[en];
        sub[st] += sub[en];
    }
    vector<pll> rem;
    for(auto en : adj[st]) if (en != pa[st]) {
        rem.push_back(pll(d[en][1] + sub[en], d[en][0] + sub[en]));
    }
    if (!rem.empty()) {
        sort(rem.begin(), rem.end());
        ll psum = 0;
        for(int i = 0; i < rem.size() - 1; i++) psum += rem[i].X;
        if (rem.back().Y > psum) {
            d[st][0] = rem.back().Y - psum;
        } else d[st][0] = (psum + rem.back().Y) % 2;
    }
    //cout << st << " " << d[st] << " " << sub[st] << '\n';
}
long long solve() {
    long long ans = linf;
    for(int i = 1; i <= n; i++) {
        pa[i] = 0;
        memset(d, 0, sizeof(d));
        memset(sub, 0, sizeof(sub));
        //cout << "Start " << i << '\n';
        DFS(0, i);
        if (d[i][0] == 0) 
            ans = min(ans, d[i][1]);
    }
    if (ans == linf) return -1;
    return ans / 2;
}
int main() {

    cin >> n >> s;
    s = "0" + s;
    for(int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    cout << solve();
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define ll long long
using namespace std;
ll mod=pow(10,9)+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    ll ans=0;
    for(ll i=1;i<=n;++i)
    {
        ll a;
        cin>>a;
        if(a%2==1 && i%2==1)
        {
            ++ans;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main()
{
	char S[100001];
	int ans = 0,i;
	scanf("%s", S);
	char flag;//0or1
	if (S[0] == '1')flag = '1';
	else flag = '0';
	for (i = 1;i < strlen(S);i++)
	{
		if (i % 2 == 0)
		{
			if (S[i] != flag)ans++;
		}
		else
		{
			if (S[i] == flag)ans++;
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
# 2019-11-15 14:12:24(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, *a = [int(x) for x in sys.stdin.read().split()]
    b = a.copy()
    b.sort()
    largest = b[-1]
    second_largest = None
    if b[-2] == largest:
        pass
    else:
        second_largest = b[-2]
    
    if not second_largest:
        for i in range(n):
            print(largest)
    else:
        for i in range(n):
            if a[i] == largest:
                print(second_largest)
            else:
                print(largest)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25036
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

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

vector<int> H;

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

    H.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    sort(H.begin(), H.end());

    ll acc = 0;
    for (int i = 0; i < N - K; i++) {
        acc += H[i];
    }

    cout << acc << endl;
    
    return 0;
}


Measured memory_bytes: 1024
// At Corder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <algorithm>
#include <iostream>
using namespace std;
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#include <math.h>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using p = pair<int, int>;//<key,value>

int main() {
string s,t;
int ans=0;

cin>>s>>t;
int m=s.size();

for ( int i= 0;  i< m; ++i){
if(s[i]==t[i])
	ans++;}


if(ans==m)
	cout<<"Yes"<<endl;
else cout<<"No"<<endl;
  return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント:
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 3624
# vim: fileencoding=utf-8


def main():
    n = int(input())
    bucket = [0] * ((10 ** 5) + 1)
    a = list(map(int, input().split()))
    for i in a:
        bucket[i] += 1
        if i > 0:
            bucket[i - 1] += 1
        if i < 10 ** 5:
            bucket[i + 1] += 1
    print(max(bucket))


if __name__ == "__main__":
    main()


Measured memory_bytes: 84792
S = input()

if S == ("SUN"):
    output = (7)
elif S == ("MON"):
    output = (6)
elif S == ("TUE"):
    output = (5)
elif S == ("WED"):
    output = (4)
elif S == ("THU"):
    output = (3)
elif S == ("FRI"):
    output = (2)
elif S == ("SAT"):
    output = (1)

print(output)

Measured memory_bytes: 8940
#!/usr/bin/env python3
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
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    A, B = map(int, input().split())
    a = str(A) * B
    b = str(B) * A
    print(min(a, b))
    

def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9976
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a, b;
	cin >> a >> b;
	string code;
	cin >> code;
	if(code[a]!='-'){
		cout << "No\n";
		return 0;
	}
	else{
		int i;
		bool flag = true;
		for(i=0; i<=(a+b); i++){
			if(i!=a){
				if(code[i]>='0' && code[i]<='9') continue;
				else{
					flag = false;
					break;
				}
			}
		}
		if(flag){
			cout << "Yes\n";
		}
		else{
			cout << "No\n";
		}
	}
	return 0;
}


Measured memory_bytes: 3616
<?php

fscanf(STDIN, '%d%d', $h, $w);

for ($i = 0; $i < $h; $i++) {
    fscanf(STDIN, '%s', $c);
    $array[] = $c;
}

foreach ($array as $value) {
for ($i = 0; $i < 2; $i++) {
    echo $value."\n";
 }   
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define F first
#define S second
#define pii pair<int,int>
#define int long long
typedef long long ll;
using namespace std;
const int N = 1e5 + 10 , mod = 1e9 + 7;
ll dp1[N] , dp2[N] , ps[N] , s[N];
main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n , x , y; cin >> n >> x >> y; if(x > y)swap(x , y);
    for(int i=0;i<n;i++)cin >> s[i];
    for(int i=1;i<n;i++)ps[i] = ps[i - 1] + (s[i] - s[i - 1] < x);
    dp1[0] = dp2[0] = 1;
    dp1[1] = dp2[1] = 1;
    for(int i=2;i<=n;i++){
        //dp1[i]:
        if(s[i - 1] - s[i - 2] >= x)dp1[i] += dp1[i - 1];
        if(i == 2 || s[i - 1] - s[i - 3] >= x)dp1[i] += dp2[i - 1];
        dp1[i] %= mod;
        if(i > 2 && s[i - 1] - s[i - 3] < x)return cout << 0 , 0;
        //dp2[i];
        if(s[i - 1] - s[i - 2] >= y)dp2[i] += dp2[i - 1];
        int indr = upper_bound(s , s + i - 1 , s[i - 1] - y) - s;
        //indr : i - 1;
        if(indr != i - 1 && ps[i - 2] - ps[indr] == 0)dp2[i] += dp1[indr + 1];
        else if(indr == i - 1)dp2[i] += dp1[indr];
        dp2[i] %= mod;
    }
    cout << (dp1[n] + dp2[n]) % mod;
}


Measured memory_bytes: 3456
#include<stdio.h>
#include<math.h>

int main(void)
{
	int count=0,x,rx,n,i,j,p;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		p=0;
		scanf("%d",&x);
		rx=sqrt(x);
		if(x==2) ;//2を除外
		else if(x<2||x%2==0) p=1;//偶数を除外
		else{
			j=3;
			while(j<=sqrt(x)){//xの平方根以下で約数をもてば除外(約数の組の中で平方根以外のものは平方根以上の値を必ず含むから)
				if(x%j==0){
					p=1;
					break;
				}
				j=j+2;
			}
		}
		if(p==0) count++;
	}
	
	printf("%d\n",count);
	return 0;
}


Measured memory_bytes: 2068
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <cstring>
using namespace std;
int n, k, num;
double res;
int calc1(int a,int b) {
    int count = 0;
    while (a < b) {
        a *= 2;
        count++;
    }
    return count;
}

double calc2(int t) {
    double r = 1;
    while (t--) r /= 2.0;
    return r;
}
int main() {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        num = calc1(i, k);
        res += calc2(num) / double(n);
    }
    printf("%.12lf", res);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N;
	cin>>N;
	vector<int> mt(N);
	for(int i=0; i<N; i++)
	{
		cin>>mt[i];
	}
	int answer=1;
	for(int i=1; i<N; i++)
	{
		bool ispossible=true;
		for(int j=i-1; j>=0; j--)
		{
			if(mt[i]<mt[j])
			{
				ispossible=false;
				break;
			}
		}
		if(ispossible)
		{
			answer++;
		}
	}
	cout<<answer<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int check(int x){
    int i;
    if(x==2)return 1;
    for(i=3; i<=sqrt(x); i+=2)if(x%i==0)return 0;
    return 1;
}
int main(){
    int n, i;
    scanf("%d", &n);
    printf("%d:", n);
    while(!(n%2)){
        n/=2;
        printf(" 2");
    }
    if(check(n) && n!=1){
        printf(" %d\n", n);
        return 0;
    }
    for(i=3; i<=n; i+=2)if(check(i))while(!(n%i)){
        n/=i;
        printf(" %d", i);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
 
 
using namespace std;
 
class H
{
public:
	H(int hp, int atk) :
		attack(atk),
		hp(hp)
	{}
	int attack;
	int hp;
 
	bool Attack(H* h_ref)
	{
		h_ref->hp -= attack;
		return(h_ref->hp <= 0);
			 
	}
};
 
int main()
{
	int a[4];
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	H* h1 = new H(a[0],a[1]);
	H* h2 = new H(a[2], a[3]);
	
	while (1)
	{
		if (h1->Attack(h2))
		{
			cout << "Yes";
			break;
		}
		if (h2->Attack(h1))
		{
			cout << "No";
			break;
		}
	}
 
 
	delete h1;
	delete h2;
 
 
	return 0;
}

Measured memory_bytes: 3636
N,K,C=map(int,input().split())
S=input()

l=[0]*N
la=[0]*N
i=0
c=0
while True:
    if S[i]=="o":
        l[i]=1
        i+=C
        c+=1
    i+=1
    if i>=N:
        break

if c>K:
    exit()

i=N-1
c=0

while True:
    if S[i]=="o":
        la[i]=1
        i-=C
        c+=1
    i-=1
    if c==K:
        break
    
for i in range(N):
    if l[i]==1 and la[i]==1:
        print(i+1)

Measured memory_bytes: 7872
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, MOD = 1e9 + 7;
int fac[N], inv[N];
int fpow(int a, int b) {
  int ans = 1;
  for(; b > 0; b >>= 1, a = 1ll * a * a % MOD) {
    if(b & 1) ans = 1ll * ans * a % MOD;
  }
  return ans;
}
// 快乐取模大法 会快一点点 全用long long取模也可以
void add(int &x, int y) {
  x += y;
  if(x >= MOD) x -= MOD;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  fac[0] = 1;
  for(int i = 1; i < N; i++) fac[i] = 1ll * fac[i - 1] * i % MOD;
  inv[N - 1] = fpow(fac[N - 1], MOD - 2);
  for(int i = N - 2; i >= 0; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % MOD;
  assert(inv[0] == 1);
  const int INV2 = 1ll * inv[2] * fac[1] % MOD; // 2^{-1} = (2!)^{-1} * (1!)
  // 上面是O(n)预处理阶乘和阶乘的逆元，当然这题也可以只计算某几个阶乘的逆元
  int n, m, k, ans = 0; cin >> n >> m >> k;
  for(int i = 0; i < n; i++) {
    add(ans, 1ll * i * (i + 1) % MOD * INV2 % MOD * m % MOD * m % MOD);
  }
  for(int i = 0; i < m; i++) {
    add(ans, 1ll * i * (i + 1) % MOD * INV2 % MOD * n % MOD * n % MOD);
  }
  cout << (1ll * ans * fac[n * m - 2] % MOD * inv[k - 2] % MOD * inv[n * m - k] % MOD) << "\n";
}

Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
    int X, f, x;
    scanf("%d", &X);
    x=X;
    f=0;
    while (x!=0) {
        f+=x%10;
        x/=10;
    }
    if (X%f==0) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
a,b,c,d = map(int, input().split())

def gcd(n, m):
    # 最大公約数
    a = max(n,m)
    b = min(n,m)
    while b:
        a, b = b, a % b
    return a


def num(l,r,n):
    nr = r//n
    nl = l//n
    if l%n == 0:
        return nr-nl+1
    else:
        return nr-nl
saishou = int(c*d/(gcd(c,d)))
n = b-a+1
n1 = num(a,b,c)
n2 = num(a,b,d)
n3 = num(a,b,saishou)
print(n-(n1+n2-n3))


Measured memory_bytes: 3064
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

constexpr ll mod = 998244353LL;

int main(void){
    int N, S; cin >> N >> S;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    vector<vector<ll>> dp(N + 1, vector<ll>(S + 1, 0));
    dp[0][0] = 1;
    for (int i = 0; i < N; ++i){
        for (int j = 0; j <= S; ++j){
            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
            if (j + A[i] <= S)
                dp[i + 1][j + A[i]] = (dp[i + 1][j + A[i]] + dp[i][j]) % mod;
            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
        }
    }
    cout << dp[N][S] << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  string s; cin >> s;
  vector<int> cnt(26);
  rep(i, s.size()) {
    cnt[s[i]-'a']++;
  }
  rep(i, 26) {
    if (cnt[i]&1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func solution(s string) string {
	l := len(s)

	if l < 2 {
		return "No"
	}
	if l%2 == 1 {
		return "No"
	}
	for i := 2; i <= l; i += 2 {
		if s[i-2:i] != "hi" {
			return "No"
		}
	}
	return "Yes"
}

func main() {
	var s string
	fmt.Scan(&s)
	fmt.Println(solution(s))
}


Measured memory_bytes: 512