akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int n;
    cin>>n;
    int hon[]={2,4,5,7,9};
    int pon[]={0,1,6,8};
    int v=n%10;
    rep(i,0,5){
        if(v==hon[i]){
            cout<<"hon"<<endl;
            return 0;
        }
    }
    rep(i,0,4){
        if(v==pon[i]){
        cout<<"pon"<<endl;
        return 0;

        }
   }
    cout<<"bon"<<endl;
    return 0;
}




Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		char c = sc.next().charAt(0);
		if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u') {
			System.out.println("vowel");
		} else {
			System.out.println("consonant");
		}
	}
}


Measured memory_bytes: 9556
n = gets
morning_price = 200
afternoon_price = 300
until n.nil?
    x = n.split(" ")
    morning = x[1].to_i
    afternoon = x[2].to_i
    sum_customer = morning + afternoon
    sum_price = (morning * morning_price) + (afternoon * afternoon_price)
    puts "#{x[0]} #{sum_customer} #{sum_price}"
    n = gets
end


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


A = list(input())
B = list(input())
C = list(input())

turn = A[0]

while True:
    if turn == 'a':
        if len(A) == 0:
            print('A')
            break
        turn = A[0]
        A.pop(0)

    if turn == 'b':
        if len(B) == 0:
            print('B')
            break
        turn = B[0]
        B.pop(0)

    if turn == 'c':
        if len(C) == 0:
            print('C')
            break
        turn = C[0]
        C.pop(0)


Measured memory_bytes: 3064
using System;

namespace ABC105B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            Boolean buy = false;
            for(int i = 0; i < (N/4)+1 ; i++){
                for(int j = 0; j < (N/7)+1 ; j++){
                    if(4*i + 7*j == N) buy = true;
                }   
            }
            if(buy){
                Console.WriteLine("Yes");
            } else {
                Console.WriteLine("No");
            }
        }
    }
}


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

#define st first
#define nd second
#define pb push_back
#define mp make_pair
typedef pair< int ,int > pii;
typedef vector< pii > vii;
typedef long long ll;
typedef map<int,int> mii;
typedef set<pii> sii;
typedef set<int> si;
typedef vector< int > vi;

const ll MOD = 119 << 23 | 1;

ll gcd(ll x, ll y){
    if(!y)
        return x;
    return gcd(y,x%y);
}

ll inv(ll x) {
    ll r = 1ll, t = x, k = MOD - 2ll;
    while (k) {
        if (k & 1ll) r = (long long) r * t % MOD;
        t = (long long) t * t % MOD;
        k >>= 1;
    }
    return r;
}

const int nax = 2e5+13;

void read(){

}

void solve(){
    
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5])
        cout << "Yes"<<endl;
    else
        cout << "No"<<endl;
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    int t=1;
    //cin >> t;
    while(t--){
        read();
        solve();
    }

    return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer

object Main{
  def main(args: Array[String]){
    StdIn.readLine()
    val line = StdIn.readLine().split(" ").toList.map(_.toInt)

    println(line.sorted.mkString(" "))
    println(sSort(List(), line, 0))
  }

  @tailrec
  def sSort(sorted: List[Int], unsorted: List[Int], n: Int): Int={
    if(unsorted.length == 0) n
    else if(unsorted.sorted == unsorted) n
    else {
      val pos = unsorted.indexWhere(_ == unsorted.min)
      val swapped = unsorted.updated(0, unsorted(pos)).updated(pos, unsorted(0))

      if(pos == 0) sSort(sorted :+ unsorted.min, swapped.tail, n)
      else sSort(sorted :+ unsorted.min, swapped.tail, n+1)
    }
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

int T[2100];
int V[2100];
#define TIME 200*100+100000
int A[2100][TIME];

int main(){
    ll N;
    cin >> N;
    T[0] = 0;
    REP(i,N){
        ll t;
        cin >> t;
        //T[i] = 2*t;
        T[i+1] = 2*t;
        T[i+1] += T[i];
    }
    T[N+1] = T[N];

    V[0] = 0;
    REP(i,N){
        ll v;
        cin >> v;
        V[i+1] = 2*v;
    }
    V[N+1] = 0;

    ll last = 0;
    REP(i,N+2){
        ll t = T[i];
        ll v = V[i];
        REP(s,TIME){
            if(s < last)
                A[i][s] = v + (last-s);
            else if(s <= t)
                A[i][s] = v;
            //else
            //    A[i][s] = v + (s - t);
            else
                A[i][s] = 3000000;
        }
        last = t;
    }

    ll v = 0;
    //ll S = 0;
    long double S = 0;
    for(int t = 1; t <= T[N+1]; t++){
        int lim = 3000000;
        for(int i = 0; i < N+2; i++){
            lim = min(lim, A[i][t]);
        }
        ll vv = v;
        if(v+1 <= lim) v++;
        else if(v > lim) v--;
        //S += min(vv, v) + 0.5*abs(vv-v);
        //S += min(vv, v);
        //if(v > vv) S += v-vv;
        S += 0.5*(vv+v);
    }

    printf("%Lf\n", S/4.0);
    return 0;
}


Measured memory_bytes: 49408
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n" << flush; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define For1(i, n) for(int i = 1; i <= (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)
#define Return(x) { Cout(x); return 0; }

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    
    pair<int, string> lb, ub;
    {
        Cout(0);
        Cin(string, s);
        if(s == "Vacant") return 0;
        
        lb.first = 0, ub.first = n;
        lb.second = ub.second = s;
    }

    while(true){
        int m = (lb.first + ub.first) / 2;
        Cout(m);
        Cin(string, s);
        if(s == "Vacant") return 0;
        // 差が偶数 & 異性 または 差が奇数 & 同性
        if(((m - lb.first) % 2 == 0) ^ (s == lb.second)) ub.first = m, ub.second = s;
        else lb.first = m, lb.second = s;
    }
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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

ll p(ll n)
{
  ll ans = 1;
  REP1(i, n) {
    ans = (ans * i) % MOD;
  }
  return ans;
}


void solve()
{
  ll n, k; cin >> n >> k;
  ll ans = 0;

  ans = (p(n) * p(k)) % MOD;
  if(n == k) {
    ans = (ans * 2) % MOD;
  } else if(n == k + 1 || n + 1 == k) {
  } else {
    ans = 0;
  }

  cout << ans << endl;
}


int main(void)
{
  // ll t; cin >> t; REP(i, t)
  solve();
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
T Read(T)() { return readln.chomp.to!(T); }
T[] Reads(T)() { return readln.split.to!(T[]); }
alias read = Read!(int);
alias reads = Reads!(int);

struct Query {
    int x, y, h;
}

void main() {
    int n = read();
    auto qs = new Query[n];
    foreach (ref q ; qs)
        readf("%d %d %d\n", &q.x, &q.y, &q.h);

    Query[] rqs = qs.filter!(q => q.h >= 1).array;
    foreach (cx; 0..101) foreach (cy; 0..101) {
        int H = max(0, rqs[0].h + abs(rqs[0].x - cx) + abs(rqs[0].y - cy));
        if (qs.all!(q => q.h == max(0, H - abs(q.x - cx) - abs(q.y - cy)))) {
            writeln(cx, " ", cy, " ", H);
            return;
        }
    }
    assert(false);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

int main()
{
    int A,B;
    cin >> A >> B;
    int cnt = 0;
    for(int i = A; i <= B; ++i){
        ostringstream oss;
        oss << i;
        string tmp = oss.str();
        string tmp2(tmp.rbegin(), tmp.rend());
        if(tmp == tmp2)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int A = scan.nextInt();
		int B = scan.nextInt();

		boolean flg = false;
		for(int i = 1; i < 1010; i ++) {
			if(Math.floor(i * 0.08) == A && Math.floor(i * 0.10) == B) {
				System.out.println(i);
				flg = true;
				break;
			}
		}
		if(flg == false) {
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 23252
#include<stdio.h>

int main() {
	int n, m, l, i, j, k;
	long a[101][101] = { 0 };
	long b[101][101] = { 0 };
	long long c[101][101] = { 0 };

	scanf("%d %d %d", &n, &m, &l);

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

	for (i = 0; i < m; i++) {
		for (j = 0; j < l; j++) {
			scanf("%d", &b[i][j]);
		}
	}

	for (i = 0; i < n; i++) {
		for (j = 0; j <l; j++) {
			for (k = 0; k < m; k++)
				c[i][j] +=(long long) a[i][k] * b[k][j];
		}
	}

	for (i = 0; i < n; i++) {
		for (j = 0; j < l; j++) {
			if (j > 0)printf(" ");
			printf("%lld", c[i][j]);
		}
		printf("\n");
	}

	return 0;
}


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

int main(){
    int N, sum = 0; cin >> N;
    vector<int> W(N);
    for( int i = 0; i < N; i++ ){
        cin >> W[i];
        sum += W[i];
    }

    int S = 0,ans = 200000;
    for( int i = 0; i < N-1; i++ ){
    	S += W[i];
    	sum -= W[i];
    	ans = min(ans, abs(S-sum));
    }


    cout << ans << endl;
}

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

using namespace std;
#define lint long long
#define P pair<int, int>

int main() {
    int N;
    cin >> N;
    
    string M = "MARCH";
    int cnt[5] = {0, 0, 0, 0, 0};
    
    for(int i = 0; i < N; ++i){
        string s;
        cin >> s;
        
        for(int j = 0; j < 5; ++j){
            if(s[0] == M[j]){
                ++cnt[j];
            }
        }
    }
    
    lint ans = 0;
    for(int i = 0; i < 5; ++i){
        for(int j = i + 1; j < 5; ++j){
            for(int k = j + 1; k < 5; ++k){
                ans += (lint)cnt[i] * cnt[j] * cnt[k];
            }
        }
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  cin >> n;
  vecint ans(4, 0);
  REP(i,n){
    string s;
    cin >> s;
    if(s == "AC"){
      ans[0]++;
    }else if(s == "WA"){
      ans[1]++;
    }else if(s == "TLE"){
      ans[2] ++ ;
    }else{
      ans[3]++;
    }
  }
  cout << "AC x " << ans[0] << endl;
  cout << "WA x " << ans[1] << endl;
  cout << "TLE x " << ans[2] << endl;
  cout << "RE x " << ans[3] << endl;
}


Measured memory_bytes: 3640
N = int(input())
A = list(map(int,input().split(" ")))
flag = True
for i in A:
    if i % 2 == 0:
        if i%3==0 or i%5==0:
            pass
        else:
            flag = False
    else:
        flag == False
if flag==True:
    print("APPROVED")
if flag == False:
    print("DENIED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 1;
    int d[26] = {};
    rep(i, 0, n){
        d[s[i] - 'a']++;
    }
    rep(i, 0, 26){
        ans *= d[i] + 1;
        ans %= mod;
    }
    ans = (ans - 1 + mod) % mod;
    cout << ans << endl;
}

Measured memory_bytes: 1100
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>=0&&a<=100&&b%2==0&&b>=2&&b<=1000)
    {
        if(a>=6&&a<=12)
    {
        printf("%d",b/2);
    }
    else if(a<6)
    {
        printf("0");
    }
    else
    {
        printf("%d",b);
    }
    }

}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
		var n = int.Parse(ReadLine());
		var a = ReadLine().Split().Select(int.Parse).ToArray();
		var b = new List<int>();
		for(int i = 0; i < n; i++)
		{
			if(i % 2 == 0)
				b.Add(a[i]);
			else
				b.Insert(0, a[i]);
		}
		if(n % 2 == 1)
			b.Reverse();
		var sb = new StringBuilder();
		for(int i = 0; i < n; i++)
		{
			sb.Append(b[i]);
			if(i != n - 1)
				sb.Append(' ');
		}
		Write(sb.ToString());
	}
}


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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

const int mod = 998244353;
int n, s, a[3005], f[3005];

int main() {
	scanf("%d %d", &n, &s);
	f[0] = 1;
	rep(i, n) {
		scanf("%d", &a[i]);
		for (int j = s; ~j; -- j) {
			f[j] = 2LL * f[j] % mod;
			if (j >= a[i]) (f[j] += f[j - a[i]]) %= mod;
		}
	}
	printf("%d\n", f[s]);
	return 0;
}


Measured memory_bytes: 3848
while 1:
 m,f,r=map(int,input().split());s=m+f
 if m==f==r<0:break
 if m*f<0 or s<30:print('F')
 elif s<50 and r<50:print('D')
 elif s<65:print('C')
 elif s<80:print('B')
 else:print('A')


Measured memory_bytes: 5592
import scala.io.StdIn.readLine

object Main{
  def main(args : Array[String]): Unit ={
    val n : Int = readLine().toInt
    val A : Array[Long] = readLine().split(' ').map(_.toLong)
    def solve(): Long ={
      val sum = A.sum
      var beforeSum : Long = 0
      var res : Long = Long.MaxValue
      for(i <- 0 until n - 1){
        beforeSum += A(i)
        val tmp = math.abs(sum - 2 * beforeSum)
        if(tmp < res) res = tmp
      }
      res
    }
    println(solve())
  }
}

Measured memory_bytes: 52604
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DOWN(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) UP(I,0,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) UP(I,0,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using namespace std;
using namespace __gnu_pbds;
long i,j,k;
string S;
long K;
long N;
inline void solve(){
  IN2(S,K);
  N=S.size();
  UP(i,0,K-1){
    if(S[i]!='1'){
      OUT(S[i]);
      return;
    }
  }
  OUT(1);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

int main()
{
  int a, b, c, cnt = 0, k;
  cin >> a >> b >> c >> k;
  while (b <= a)
  {
    b *= 2;
    cnt++;
  }
  while (c <= b)
  {
    c *= 2;
    cnt++;
  }
  if (cnt <= k)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define arep(i, x, n) for (int i = int(x); i < (int)(n); i++)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9 + 7
using ll = long long;

int main(){
    int A;
    int B;
    cin >> A >> B;


    int sum = 0;
    int tap = 1;
    while(tap < B){
        sum++;
        tap = tap - 1 + A;
    }

    cout << sum << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>
#include <math.h>
#include <numeric>
#include <stack>

using namespace std;
 
#define rep(i,m,n) for(int i=m;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    if(a>9||b>9)cout<<-1;
    else cout<<a*b;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x[1000010],y[1000010];
#define int long long
signed main(){
  
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a;
  cin>>a;
  if(a<1200) cout<<"ABC"<<'\n';
  else cout<<"ARC"<<'\n';
}


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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int>A(N);
  int sum=0;
  for(int i=0;i<M;i++){
    cin>>A.at(i);
    sum+=A.at(i);
  }
  if(sum>N){
    cout<<-1<<endl;
  }else{
    cout<<N-sum<<endl;
  }
}

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

int main(){
    int A,B,C;
    cin >>A>>B>>C;
    int sum=0;
    bool flag=false;
    for(int i=0;i<B;i++){
        if(A*i%B==C){
            flag = true;
            break;
        }
    }
    if(flag){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 256
import qualified Data.Vector as V

po :: (Integral a) => a
po = 10^9 + 7

main :: IO ()
main = do
  [h, w, a, b] <- map read . words <$> getLine
  let
    fact = V.fromList $ take (w+h+1) $ 1:scanl1 (\x y -> x*y `mod` po) [1..]
    invfact = fmap (`invertModp` po) fact
    combi n m = (fact V.! n) * (invfact V.! m) * (invfact V.! (n-m)) `mod` po
  print $ sum [combi (h-a-1+i) i * combi (w-1-i+a-1) (a-1) | i <- [b..(w-1)]] `mod` po

invertModp :: Integer -> Integer -> Integer
invertModp a prm = if a `mod` prm == 0 then 0 else powMod' a (prm-2) prm

powMod' :: (Integral a) => Integer -> a -> Integer -> Integer
powMod' base expo md
  | md <= 0   = error "non-positive modulus"
  | md == 1   = 0
  | expo == 0 = 1
  | bsmd == 1 = 1
  | expo < 0  = error "negative exponent"
  | bsmd == 0 = 0
  | otherwise = powMod' base (expo `div` 2) md ^ 2 * (if expo `mod` 2 == 1 then base else 1) `mod` md
    where
      bsmd = if base < 0 || md <= base then base `mod` md else base


Measured memory_bytes: 40316
#include<stdio.h>
#include<string.h>

int main()
{
    int len,i,j,d;
    char s1[99];
    scanf("%s",&s1);
    len = strlen(s1);
    char s2[len+1];
    for(i=0,j=len-1;j>=0;i++,j--)
    {
        s2[i] = s1[j];
    }
    s2[i]='\0';

    d=strcmp(s1,s2);
    if(d==0)
    {
        char s3[(len/2)+1],s[(len/2)+1];
        for(i=0,j=0;j<=(len/2)-1;i++,j++)
        {
           s3[i] = s1[j];
        }
        s3[i]='\0';

        for(i=0,j=(len/2)-1;j>=0;i++,j--)
        {
            s[i]=s3[j];
        }
        s[i]='\0';

        int e = strcmp(s,s3);

        if(e==0)
        {
            for(i=0,j=(len/2)+1;j<=len-1;i++,j++)
            {
                s3[i]=s1[j];
            }
            s3[i]='\0';

            for(i=0,j=(len/2)-1;j>=0;i++,j--)
            {
            s[i]=s3[j];
            }
            s[i]='\0';

            e = strcmp(s,s3);

            if(e==0)
            {
                printf("Yes");

            }
            else
                printf("No");

        }
        else{
            printf("No");
        }

    }
    else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 1704
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader inp = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(inp, out);
        out.close();
    }

    private static class Solver {
        private void solve(InputReader inp, PrintWriter out) {
            char[] k = inp.next().toCharArray();
            for (int i = 0; i < k.length; i++) k[i] -= '0';
            int d = inp.nextInt();

            long[][] dp = new long[k.length][d];
            long sum = k[0] % d;
            long MOD = 1000000007;
            for (int i = 0; i <= k[0]; i++) dp[0][i % d]++;
            for (int i = 1; i < k.length; i++) {
                for (int j = 0; j < d; j++) {
                    for (int m = 0; m <= k[i]; m++) {
                        int index = (((j - m) % d) + d) % d;
                        dp[i][j] += dp[i-1][index];
                    }
                    for (int m = k[i] + 1; m <= 9; m++) {
                        int index = (((j - m) % d) + d) % d;
                        dp[i][j] += dp[i-1][index];
                        if (index == sum && dp[i-1][index] > 0) dp[i][j]--;
                    }
                    dp[i][j] %= MOD;
                }
                sum = (sum + k[i]) % d;
            }
            out.print(((dp[k.length-1][0] - 1) + MOD) % MOD);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}




Measured memory_bytes: 30892
n, m = gets.chomp.split(" ").map(&:to_i)
a = []
b = []
n.times do
    a << gets.chomp.split("")
end
m.times do
    b << gets.chomp.split("")
end

for i in 0..(n-m)
    for j in 0..(n-m)
        flag = true
        for k in 0..(m-1)
            break if flag == false
            for l in 0..(m-1)
#                printf "%d %d %d %d\n", i, j, k, l
                if a[i+k][j+l] != b[k][l]
 #                   puts "false"
                    flag = false
                    break
                end
            end
        end
        if flag == true
            puts "Yes"
            exit
        end
    end
end

puts "No"

Measured memory_bytes: 1916
def solve():
    n=int(input())
    a=list(map(int,input().split()))
    a.sort()
    mina=a[0]
    maxa=a[-1]
    if (a[-1]+1) // 2 != mina:
        return False

    b=[0]*n
    for v in a:
        b[v] += 1
    if (maxa & 1) > 0:
        if b[mina] != 2:
            return False
    elif b[mina] != 1:
        return False

    for v in range(mina+1, maxa+1):
        if b[v] < 2:
            return False
    return True

print('Possible' if solve() else 'Impossible')


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

using namespace std;
static const int MAX = 200000;

int main(){
	int R[MAX],n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>R[i];
	}
	
	int maxv = -2000000000;
	int minv = R[0];
	
	for(int i=1;i<n;i++){
		maxv = max(maxv,R[i]-minv);
		minv = min(minv,R[i]);
	}
	cout<< maxv<<endl;
	return 0;
} 

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


const int GEN = 1000000007;

int DATA[10000] = {};

int main(){
  int n,m;
  cin >> n >> m;// 入力

  int k = 2;
  int len = 0;
  int maxD = 0;
  // 素因数分解(数だけで十分)
  while(k <= m){
    while(m % k == 0){
      m /= k;
      DATA[len]++;
    }
    if(DATA[len] > 0){
      if(DATA[len] > maxD){
        maxD = DATA[len];
      }
      len++;
    }
    k++;
  }



  // Distrubute[p][q] := p人に対して, 区別のつかない q 個数のものを配る通りの 10^9 + 7での余り
  vector< vector<long long int> > Distribute(n + 1);
  for(int i = 0;i <= n;i++){
    (Distribute.at(i)).resize(maxD + 1,0);
  }
  Distribute.at(0).at(0) = 1;
  for(int i = 1;i <= n;i++){
    (Distribute.at(i)).at(0) = 1;
    for(int j = 1;j <= maxD;j++){
      (Distribute.at(i)).at(j) = ((Distribute.at(i)).at(j - 1) + (Distribute.at(i - 1)).at(j)) % GEN;
    }
  }

  // 答えの出力
  long long int ans = 1;
  for(int i = 0; i < len;i++){
    int tmp = DATA[i];
    ans = (ans * Distribute[n][tmp]) % GEN;
  }
  cout << ans << endl;
  return 0;
}

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

#define trav(a, A) for (auto & a : A)
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+5+7;

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	ll i, j, n, v1 = 0, v2 = 0, v3 = 0, v4 = 0;
	cin >> n;
	for (i = 0; i < n; ++i)
	{
		string s;
		cin >> s;
		if (s == "AC") ++v1;
		if (s == "WA") ++ v2;
		if (s == "TLE") ++v3;
		if (s == "RE") ++v4;
	}
	cout << "AC x " << v1 << "\nWA x " << v2;
	cout << "\nTLE x " << v3 << "\nRE x " << v4 << '\n';

	return 0;
}



Measured memory_bytes: 3600
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
static int imin = std::numeric_limits<int>::min();
static int imax = std::numeric_limits<int>::max();

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  return os;
}

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  int N;
  int sum = 0;
  std::cin >> N;
  for(int i = 0; i<N; ++i){
    int x;
    std::cin >> x;
    int count = 0;
    while(x % 2 == 0){
      count++;
      x /= 2;
    }
    sum = count + sum;
    // std::cout << " count=" << count << "\n";
  }
  std::cout << sum << std::endl;

}
#endif


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#define lson (k<<1)
#define rson ((k<<1)|1)
#define LL long long
using namespace std;
int n,q,a,b;
LL tmp;
const LL N=200010,inf=0x3f3f3f3f3f3f3f3f;
int x[N];
LL min1[N<<2],min2[N<<2],lz[N<<2];
int jue(int x){return x>0?x:-x;}
void pushdown(int k)
{
	if(!lz[k])return;
	min1[lson]+=lz[k];min2[lson]+=lz[k];lz[lson]+=lz[k];
	min1[rson]+=lz[k];min2[rson]+=lz[k];lz[rson]+=lz[k];
	lz[k]=0;
}
void updata(int k)
{
	min1[k]=min(min1[lson],min1[rson]);
	min2[k]=min(min2[lson],min2[rson]);
}
void change(int k,int l,int r,int pos,LL v)
{
	if(l==r)
	{
		min1[k]=min(min1[k],v-l);min2[k]=min(min2[k],v+l);
		return;
	}
	int mid=(l+r)>>1;
	pushdown(k);
	if(pos<=mid)change(lson,l,mid,pos,v);
	else change(rson,mid+1,r,pos,v);
	updata(k);
}
LL ask(int k,int l,int r,int x,int y,int opt)
{
	if(x<=l&&r<=y)return opt==1?min1[k]:min2[k];
	pushdown(k);
	int mid=(l+r)>>1;LL res=inf;
	if(x<=mid)res=min(res,ask(lson,l,mid,x,y,opt));
	if(mid+1<=y)res=min(res,ask(rson,mid+1,r,x,y,opt));
	return res;
}
LL query(int k,int l,int r)
{
	if(l==r)return min1[k]+l;
	pushdown(k);
	int mid=(l+r)>>1;
	return min(query(lson,l,mid),query(rson,mid+1,r));
}
int main()
{
	cin>>n>>q>>a>>b;x[0]=a;
	memset(min1,0x3f,sizeof(min1));memset(min2,0x3f,sizeof(min2));
	change(1,1,n,b,0);
	for(int i=1;i<=q;++i)
	{
		scanf("%d",&x[i]);
		LL tmp=min(ask(1,1,n,1,x[i],1)+x[i],ask(1,1,n,x[i],n,2)-x[i]);
		lz[1]+=jue(x[i]-x[i-1]);min1[1]+=jue(x[i]-x[i-1]);min2[1]+=jue(x[i]-x[i-1]);
		change(1,1,n,x[i-1],tmp);
	}
	cout<<query(1,1,n);
	return 0;
}

Measured memory_bytes: 19840
#include<stdio.h>
#define NIL -1
struct node{int p,l,r;};
node T[26];
int n;

void preorder(int u){
    if(u==NIL)return;
    printf(" %d",u);
    preorder(T[u].l);
    preorder(T[u].r);
}

void inparse(int u)
{
    if(u==NIL)return ;
    inparse(T[u].l);
    printf(" %d",u);
    inparse(T[u].r);
}

void postorder(int u)
{
    if(u==NIL)return ;
    postorder(T[u].l);
    postorder(T[u].r);
    printf(" %d",u);
}

int main()
{
    int v,l,r,root=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){T[i].p=NIL;}
    for(int i=0;i<n;i++){
        scanf("%d%d%d",&v,&l,&r);
        T[v].l=l;
        T[v].r=r;
        if(l!=NIL)T[l].p=v;
        if(r!=NIL)T[r].p=v;
    }
    for(int i=0;i<n;i++)
        if(T[i].p==NIL)root=i;
    printf("Preorder\n");
    preorder(root);
    printf("\n");
    printf("Inorder\n");
    inparse(root);
    printf("\n");
    printf("Postorder\n");
    postorder(root);
    printf("\n");
    return 0;
}

Measured memory_bytes: 2720
def main():
    N = int(input())
    lst = [input().split()for i in range(N)]
    Y = 0

    for i in range(0, N):
        if lst[i][1] == "JPY":
            Y += float(lst[i][0])
        else:
            Y += float(lst[i][0])*380000.0
    print(Y)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
na = [0]*n
for i in range(n):
    na[i] = a[i]-(i+1)
na.sort()
med = n//2-1
med1 = med+1
ans = 0
ans1 = 0
for i in range(n):
    ans += abs(na[i]-na[med])
    ans1 += abs(na[i]-na[med1])
print(min(ans, ans1))

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

#define int long long int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"

int32_t main()
{
 IOS;
  int a,b,c;
  cin>>a>>b>>c;
  set<int>s;
  s.insert(a);
  s.insert(b);
  s.insert(c);
  cout<<s.size()<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = in.nextInt();
        in.nextLine();
        int[] members = new int[n];
        for (int i = 1; i < n; i++) {
            members[in.nextInt()-1]++;
        }
        for (int i = 0; i < n; i++) {
            System.out.println(members[i]);
        }
    }
}


Measured memory_bytes: 62236
#include<bits/stdc++.h>
using ll = long long;
#define int ll
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
using vi =vector<int>;
struct Edge{int to,cap,rev;};//ikisaki youryou gyakuhen
struct edge{int to,cap,rev;};//ikisaki youryou gyakuhen
#define inf INF
class MF{//max flow
public:
    int n;
    vector<vector<edge> >G;//[MAX];;
    vi level,iter;//[MAX];
    MF(int size){
        n=size;
        G=vector<vector<edge> >(n);
    }
    void add_edge(int from, int to, int cap){
        edge q={to,cap,int(G[to].size())};
        G[from].push_back(q);
        q={from,0,int(G[from].size()-1)};
        G[to].push_back(q);
    }
    void bfs(int s){
        level=vi(n,-1);
        queue<int>q;
        level[s]=0;
        q.push(s);
        while(!q.empty()){
            int v=q.front();q.pop();
            for(int i=0;i<G[v].size();i++){
                edge &e=G[v][i];
                if(e.cap>0&&level[e.to]<0){
                    level[e.to]=level[v]+1;
                    q.push(e.to);
                }
            }
        }
    }
    int dfs(int v,int t, int f) {
        if(v==t)return f;
        for(int &i=iter[v];i<G[v].size();i++){
            edge &e=G[v][i];
            if(level[v]>=level[e.to]||e.cap<=0) continue;
            int d =dfs(e.to,t,min(f,e.cap));
            if(d>0){
                e.cap-=d;
                G[e.to][e.rev].cap+=d;
                return d;
            }
        }
        return 0;
    }
    int mf(int s,int t) {//from s to t,ford_fulkerson
        int flow=0;
        while(1){
            bfs(s);
            if(level[t]<0)return flow;
            iter=vi(n);
            int f;
            while((f=dfs(s,t,INF))>0)flow+=f;
        }
    }
};


signed main(){
    int N,M,s,t;
    cin >> N >> M >> s >> t;
    --s;--t;
    int wf[210][210];
    int cost[210][210];
    MF fl(N);
    vector<vector<bool>>valid(N,vector<bool>(N,false));
    rep(i,N)rep(j,N){
        wf[i][j] = INF; cost[i][j] = INF;
    }
    int dis[201][201];
    rep(i,N)wf[i][i] = 0;
    rep(i,M){
        int u,v,d,c; cin >> u >> v >> d >> c;
        --u;--v;
        valid[u][v] = true;
        cost[u][v] = c;
        wf[u][v] = dis[u][v] = d;
    }
    rep(k,N)rep(i,N)rep(j,N){
        cmin(wf[i][j],wf[i][k]+wf[k][j]);
    }
    rep(i,N)rep(j,N){
        if(dis[i][j] != wf[i][j])continue;
            if(wf[s][i]+wf[i][j]+wf[j][t] == wf[s][t] && valid[i][j]){
                fl.add_edge(i, j, cost[i][j]);
        }
    }
    cout<< fl.mf(s, t) << endl;
}



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

int main() {
    string s;
    long long k;
    cin >> s >> k;
    int memo = -1;
    for (int i=0; i<k && i<s.size(); ++i) {
        if (s[i] == '1') continue;
        else if (memo == -1) memo = s[i];
    }
    cout << (memo == -1 ? '1' : (char)memo) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll a; string b;
    cin >> a >> b;
    int b1,b2,b3;
    b1=b[0]-'0';
    b2=b[2]-'0';
    b3=b[3]-'0';
    ll ans=a*b3;
    ans/=10;
    ans+=a*b2;
    ans/=10;
    ans+=a*b1;
    print(ans);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(0);
    solve();
    return 0;
}

Measured memory_bytes: 3656
import sys

n,m = map(int, input().split())

a = list(map(int, input().split()))
a.sort(reverse=True)

th = sum(a)/(4*m)
flag = True

for i in range(m):
    if a[i] >= th:
        flag = True
    else:
        flag = False

if flag == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
package main

import(
    "fmt"
)



func main() {
    var a,b,h int
    fmt.Scan(&a,&b,&h)
    fmt.Println((a+b)*h/2)
}





func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}


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

int main() {
	int a,b,c;cin>>a>>b>>c;
	set<int> st;
	st.insert(a);
	st.insert(b);
	st.insert(c);
	if(st.size()==2){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
// C++11
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <cmath>
#include <iostream>
#include <numeric>
#include <random>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>

using namespace std;

#define LOCAL 1

#if LOCAL
#define pv(val) cerr << #val << '=' << (val) << endl
#define pvn(name, val) cerr << name << '=' << (val) << endl
#define pl cerr << '@' << __LINE__ << endl
#else
#define pv(val)
#define pvn(name, val)
#define pl
#endif

template <class T>
ostream& operator<<(ostream& os, vector<T> const& vec) {
  if (vec.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < vec.size() - 1; i++) os << vec[i] << ", ";
    os << vec.back() << '}';
  }
  return os;
}

template <class T, size_t S>
ostream& operator<<(ostream& os, array<T, S> const& arr) {
  if (arr.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < arr.size() - 1; i++) os << arr[i] << ", ";
    os << arr.back() << '}';
  }
  return os;
}


int main(void)
{
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> A(M + 1);
  for(int i = 0; i < M; i++) cin >> A[i + 1];
  A.push_back(N);

  int ans0 = 0, ans1 = 0;
  int i = 1;
  while(A[i] < X) ans0++, i++;
  while(A[i] < N) ans1++, i++;
  pv(ans0);
  pv(ans1);
  cout << min(ans0, ans1) << endl;



  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
	for (int i=1;i<=1000000;i++)
	if (((int)(i*(0.08))==a) && (int(i/10)==b)) {printf("%d\n",i); return 0;}
	printf("-1\n");
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mkp make_pair
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 100005
#define lg 18
//<<fixed << setprecision(9)

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

    cin>>n;
    pair<ll,ll> arr[n];
    rep(i,0,n)
    {
        cin>>arr[i].S>>arr[i].F;
    }

    sort(arr,arr+n);
    ll tim=0;
    int flag=1;
    rep(i,0,n)
    {
        tim+=arr[i].S;
        if(tim>arr[i].F) 
        {
            flag=0;
        }
    }
    if(flag)cout<<"Yes";
    else cout<<"No";



    return 0;
}

	

Measured memory_bytes: 3328
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if max(e-d,d-c,c-b,b-a,e-c,d-b,c-a,e-b,d-a,e-a) <= k:
  print("Yay!")
else:
  print(":(")

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

int main(){

  int N,A,B,x;
  
cin >> N >> A >> B; 
  
  x=N*A;
  
  if(x<B){
   
	cout << x << endl; 
  }
  else{
    cout << B << endl; 
  }

}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int N;
	cin>> N;
	int lg[100000]={};
	//0:unknown 1:Male 2:Female
	int l=0,r=N-1;
	string s;
	cout<< 0<< endl;
	cin>> s;
	if(s=="Vacant")return 0;
	if(s=="Male")lg[0]=1;
	else lg[0]=2;
	cout<< N-1 << endl;
	cin>> s;
	if(s=="Vacant")return 0;
	if(s=="Male")lg[N-1]=1;
	else lg[N-1]=2;
	while(r-l>1)
	{
		int i=(l+r)/2;
		cout<< i<< endl;
		cin>> s;
		if(s=="Vacant")return 0;
		if(s=="Male")lg[i]=1;
		else lg[i]=2;
		if((((l+i)%2==0)&&lg[l]==lg[i])||((l+i)%2==1 && lg[l]!=lg[i]))
		{
			l=i;
		}
		else r=i;
	}

	return 0;
}


Measured memory_bytes: 1236
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i = 0 ; i <= VMAX ; i++){
    C[i] = 0;
  }
  for(i = 0 ; i < n ; i++){
    scanf("%hu",&A[i + 1]);
    C[A[i + 1]]++;
  }
  for(i = 1 ; i <= VMAX ; i++){
    C[i] = C[i] + C[i - 1];
  }
  for(j = 1 ; j <= n ; j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  for(i = 1 ; i <= n ; i++){
    if(i > 1)printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");



  return 0;
}



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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)
#define Float(x) cout << fixed << setprecision(x);

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template<class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template<class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

//IN
void IN() {}
template<class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

//OUTS
template<size_t> struct int_{};
template<class Tuple, size_t Pos>
ostream& print_tuple(ostream& out, const Tuple& t, int_<Pos>) {
  out << get<tuple_size<Tuple>::value-Pos>(t) << " ";
  return print_tuple(out, t, int_<Pos-1>());
}

template <class Tuple>
ostream& print_tuple(ostream& out, const Tuple& t, int_<1>) {
  return out << get<tuple_size<Tuple>::value-1>(t);
}

template<class... Args>
ostream& operator<<(ostream& out, const tuple<Args...>& t) {
  return print_tuple(out, t, int_<sizeof...(Args)>());
}

#define OUTS(...) cout << make_tuple(__VA_ARGS__) << "\n";

//OUTL
void OUTL() {}
template<class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

//OUTN
void OUTN() {}
template<class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}
// }}} End

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

  string s;
  cin >> s;

  string sback = "";
  i64 res = 0;
  for (int i = 0; i < s.length(); ++i) {

    if (!i) {
      sback.push_back(s[i]);
      ++res;
    }

    else {
      if (s[i] == s[i-1]) {
        string t = "";
        for (int j = i; j < s.length(); ++j) {
          t += s[j];
          if (t != sback) {
            sback.clear();
            sback = t;
            ++res;
            i += (int)t.length() - 1;
            break;
          }
        }
      }

      else if (s[i] != s[i-1]) {
        sback.clear();
        sback.push_back(s[i]);
        ++res;
      }
    }

  }

  OUTL(res);

  return 0;
}


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

int n, m;
stack<int> s;
bool dp[200001] = { false };

int main(){
	int tmp;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> tmp;
		s.push(tmp);
	}
	while (!s.empty()) {
		tmp = s.top(); s.pop();
		if (!dp[tmp]) {
			dp[tmp] = true;
			cout << tmp << endl;
		}
	}
	for (int i = 1; i <= n; i++) {
		if (!dp[i]) {
			cout << i << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3512
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#define re register
using namespace std;
#define gc getchar
#define int long long
inline int read(){
	int t=0,f=0;
	char v=gc();
	while(v<'0')f|=(v=='-'),v=gc();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=gc();
	return f?-t:t;
}
int n,a[200002],b[200002],ans,m,v[1000002],cnt;
inline int ksm(re int x,re int y){
	re int ans=1;
	while(y){
		if(y&1)ans=ans*x%n;
		x=x*x%n;y>>=1;
	}
	return ans;
}
signed main(){
	n=read();
	if(n%7==0)n/=7;
	ans=1;
	while((ans%n)&&(!v[ans]))v[ans]=1,ans+=ksm(10,++cnt),ans%=n;
	if(ans%n)puts("-1");
	else printf("%d",cnt+1);}

Measured memory_bytes: 11380