akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;

class Program{
	static void Main(string[] args){
    	string[] input = Console.ReadLine().Split(' ');
      	int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);
      
      	long[][] data = new long[N][];
      
      	for(int i = 0;i < N;i ++){
        	string[] In = Console.ReadLine().Split(' ');
          long[] test = new long[2];
          	test[0] = long.Parse(In[0]);
          	test[1] = long.Parse(In[1]);
          data[i] = test;
        }
      
      Array.Sort(data,StructuralComparisons.StructuralComparer);
      
      long count = 0;
      long shopnum = 0;
      long money = 0;
      while(count < M){
      	if(data[shopnum][1] > 0){
        	data[shopnum][1] --;
          	count++;
          	money = money + data[shopnum][0];
        }else{
        	shopnum++;
        }
      }
      
      Console.WriteLine(money);
    }
}

Measured memory_bytes: 24744
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC093A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 0;
            string S = Console.ReadLine();
            for(int i=0;i<=2;i++) 
            { 
                if(S[i]=='a') { a++; }
                if(S[i]=='b') { a += 2; }
                if(S[i]=='c') { a += 3; }
            }
            if(a==6)
            {
                 Console.WriteLine("Yes");
            }
            else 
            {
                 Console.WriteLine("No"); 
            }

            Console.ReadKey();
            
        }
    }
}

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

int main(){
    string s[3];
  cin >> s[0] >> s[1] >> s[2];

    int turn=0;
    while(!s[turn].empty()){
      char tmp=s[turn][0];
        s[turn].erase(0,1);
        if(tmp=='a'){
          turn=0;
        }else if(tmp=='b'){
          turn=1;
        }else{
          turn=2;
        }
    }
  
    if(turn==0){
      cout << 'A';
    }else if(turn==1){
      cout << 'B';
    }else{
      cout << 'C';
    }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
ll lcm(ll a,ll b)
{return a/gcd(a,b)*b;}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
ll INF=1e18;
//------------------------------------------------------------
int N;
ll ans=1;

void solve() {
  cin>>N;

  rep(i,0,N)
  {
    ll T;
    cin>>T;
    ans = lcm(ans, T);
  }

  print(ans);
  return;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  string S;
  cin >> S;
  int N=sz(S);

  map<int,int> MP;
  MP[0]++;
  int now=1;
  int key=0;
  int ans=0;
  for(int i=N-1;i>=0;i--){
    key=(key+now*(S.at(i)-'0'))%2019;
    now=now*10%2019;
    ans+=MP[key];
    MP[key]++;
  }
  //for(const auto& [a,b]:MP) cout << a << "," << b << endl;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
	int N;
	scanf("%d", &N);
	int cnt = 0;
	for(int i = 0; i < N; i++) {
		int a;
		scanf("%d", &a);
		if(a % 2 == 1) cnt++;
	}
	puts(cnt % 2 == 1 ? "NO" : "YES");
	return 0;
}


Measured memory_bytes: 764
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
//#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


int main()
{
	int n;
	scanf("%d", &n);
	while (n > 0) {
		int r = n % 10;
		if (r == 7) {
			printf("Yes\n");
			return 0;
		}
		n = n / 10;
	}
	
	printf("No\n");
	
	return 0;
}

Measured memory_bytes: 1620
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define mod 1000000007
int a[2000005],b[2000005];
int main()
{
    /*string s;
    cin >> s;
    int n = s.size();
    if(s[n-1]=='s')
        s+="es";
    else
        s+="s";
    cout <<s << endl;*/
    /*int n;
    cin >> n;
    for(int i=1;i<=n;i++)
        cin >> a[i] >> b[i];

    int f=0;
    for(int i=1;i<=n-2;i++)
    {
        if((a[i]==b[i])&&(a[i+1]==b[i+1])&&(a[i+2]==b[i+2]))
        {
            f=1;
            break;
        }
    }
    if(f) cout << "Yes\n";
    else
        cout << "No\n";*/;
    ll n;
    cin >> n;
    ll ans=0;
    for(ll i=1;i<n;i++)
        ans+= (n-1)/i;

    cout << ans << endl;
}


Measured memory_bytes: 3624
#import<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long LL;
LL i,j,k,m,n,a[200040],b[200040];
string s;
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout<<fixed<<setprecision(12);
	cin>>n>>m>>k;
	for(;i++<n;)
	{
		cin>>a[i];
		a[i]+=a[i-1];
	}
	for(i=0;i++<m;)
	{
		cin>>b[i];
		b[i]+=b[i-1];
	}
	b[i]=k+1;
	for(i=n;a[i]>k;)i--;
	for(m=i;~i;i--)
	{
		for(;a[i]+b[j+1]<=k;)j++;
		m=max(m,i+j);
	}
	cout<<m;
}

Measured memory_bytes: 6776
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_102
{
    class ABC_102_A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long val = 0;
            if (n % 2 == 0)
            {
                val = n;
            }
            else
            {
                val = n * 2;
            }
            Console.WriteLine(val);
        }
    }
}


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

#define mod (ll) (1e9)
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
//#define make_pair mp
#define pi acos(-1)

int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
//#endif

    int n;
    cin>>n;
    int ar[n];
    set<int>s;
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        s.insert(ar[i]);
    }
    if(s.size()==n)
    {
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;

}


Measured memory_bytes: 10368
#include<cstring>
#include<iostream>
#include<algorithm>
#include<string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;

int main() {
    int n,k,d;
    cin >> n >> k;
    ll cnt = 0;
    rep(i,n) {
        cin >> d;
        if (d >= k) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(" ", $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int)$this->next();
    }

    public function nextDouble()
    {
        return (double)$this->next();
    }
}

class out
{
    public static function printIn($str = "")
    {
        echo $str . PHP_EOL;
    }
}

$sc = new Scanner;

$trial = $sc->nextInt();
$arr = [];
for ($i = 0; $i < $trial; $i++) {
    $arr[] = $sc->nextInt();
}
$c = 0;
$s = true;
while($s){
    for ($i = 0; $i < $trial; $i++) {
        $num = $arr[$i];

        if(($num % 2) !== 0){
            break 2;
        }
        $arr[$i] = $num / 2;
    }
    $c++;
}


echo $c;



Measured memory_bytes: 4604
N = int(input())
red = [tuple(map(int, input().split())) for _ in range(N)]
blue = [tuple(map(int, input().split())) for _ in range(N)]

red.sort(reverse=True)

cnt = 0
track = [0] * N
for r in red:
    y = 2 * N + 1
    p = -1
    for i, b in enumerate(blue):
        if track[i] == 0:
            if b[0] > r[0] and b[1] > r[1] and b[1] < y:
                y = b[1]
                p = i
    if p >= 0:
        track[p] = 1
        cnt += 1

print(cnt)


Measured memory_bytes: 39152
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        if(n == 1){
            System.out.println(m);
            return;
        }
        else if(n == 2){
            if(m % 2 == 0) System.out.println(m / 2);
            else System.out.println(1);
            return;
        }
        int s = 1;
        for (int i = 1;i <= m / n;++i){
            if(m % i == 0){
                s = i;
            }
        }
        System.out.println(s);
    }




}




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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n;
	string s;
	cin>>n>>s;
	if(n%2!=0){
		cout<<"No"<<endl;
		return 0;
	}
	rep(i,n/2){
		if(s[i]!=s[i+n/2]){
			cout<<"No"<<endl;
			return 0;
		}
	}

	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 256
loop do
    g, y, m, d = gets.chomp.split
    break if g == ?#
    y = y.to_i
    m = m.to_i
    new = (y.to_i > 31 or y == 31 && m > 4)
    g  = ?? if new
    y -= 30 if new
    puts [g, y, m, d] * ' '
end


Measured memory_bytes: 6892
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
char s[555];
int n,m,a[555][555],f[555][555];
int main(){
	cin>>n>>m;
	FOR(i,1,n){
		scanf("%s",s+1);
		FOR(j,1,m) a[i][j]=(s[j]!='.');
	}
	FOR(i,1,n)
		FOR(j,1,m)
			f[i][j]=n*m;
	f[1][1]=a[1][1];
	FOR(i,1,n)
		FOR(j,1,m){
			if (i<n){
				f[i+1][j]=min(f[i+1][j],f[i][j]+(a[i+1][j]==1)*(a[i][j]==0));
			}
			if (j<m){
				f[i][j+1]=min(f[i][j+1],f[i][j]+(a[i][j+1]==1)*(a[i][j]==0));
			}
		}
	cout<<f[n][m]<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;

using ll = long long;

int main()
{
    string s, t;

    cin >> s >> t;

    ll mlen = 0;
    ll len = 0;
    for (int i = 0; i < s.length() - t.length() + 1; i++)
    {
        len = 0;
        for (int j = 0; j < t.length(); j++)
        {
            if(s[i+j] == t[j])
            {
                len++;
            }
        }
        mlen = max(len, mlen);
    }
    cout << t.length() - mlen << endl;

    return 0;
}

Measured memory_bytes: 3172
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	input := sc.Text()
	inputs := strings.Split(input, " ")
	a, _ := strconv.Atoi(inputs[0])
	b, _ := strconv.Atoi(inputs[1])

	result := []int{}

	result = append(result, a+b)
	result = append(result, a+a-1)
	result = append(result, b+b-1)
	max := 0
	for _, r := range result {
		if max < r {
			max = r
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define RevRange(container) container.rbegin(), container.rend()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cin(int, a);
  	Cin(int, b);
    Cout((b % a == 0) ? a+b : b-a);
}



Measured memory_bytes: 256
L = int(input())

N, r = 0, 1

while r <= L:
    r *= 2
    N += 1

G = []
for i in range(1, N):
    G.append( [i, i+1, 0] )
    G.append( [i, i+1, int(2**(i-1))] )

remain = L - int(2**(N-1))

for i in range(N-1, 0, -1):
    if remain == 0:
        break

    if remain >= int(2**(i-1)): 
        G.append( [i, N, L-remain] )
        remain -= int(2**(i-1))

print (N, len(G))

for i in G:
    print (" ".join(map(str, i)))


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

int main(){
   int n;
   cin >> n;
   int ans = 0;
   vector<int> d(n);
   rep(i,n){
      int s;
      cin >> s;
      d.at(i) = s;
      ans += s;
   }
   int a,b;
   a = 0, b = 0;
   rep(i,n){
      a += (ans/n-d.at(i))*(ans/n-d.at(i));
      b += (ans/n+1-d.at(i))*(ans/n+1-d.at(i));
   }
   int output;
   output = min(a,b);
   cout << output;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include <stdlib.h>
#include <stdbool.h>
#define mod 1000000007
long long N;
static long long dp[110][100100];


long long
chmin2(long long  a, long long b) 
{
	 if (a > b){
		 //a = b; //	printf("%ld\n",*a);
		 return b; 
	 }
	 return a;
}

long long
chmax2(long long a, long long b) 
{
	 if (a < b){
		 //a = b; //	printf("%ld\n",*a);
		 return b; 
	 }
	 return a;
}

int 
main(){
	long long i,j,k,K;
	long long a[4000];
	scanf("%lld%lld",&N,&K);
	for(i=0;i<N;i++)
	{
		scanf("%lld",&a[i]);
		
		dp[i][0]=1;//init
	}
	
	#if 1
	long long len;
	for(i=1;i<=N;i++){
		for( j=0;j<= K;j++){
			dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
			if(j-a[i-1]-1>=0){
				dp[i][j] = (dp[i][j] + mod - dp[i-1][j-a[i-1]-1])%mod;
			}
		}
    }
    #endif
	
	printf("%lld\n",dp[N][K]);

	
 return 0;
}

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

int main()
{
    std::string S, T;
    std::cin >> S >> T;

    std::size_t count = 0;
    for(std::size_t i=0; i<S.size(); ++i)
    {
        if(S[i] != T[i])
        {
            count += 1;
        }
    }

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 3916
#include <iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
#include<iomanip>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
const long long INF = 1LL << 60;


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

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}

//約数求める //約数
void divisor(ll n,vector<ll> &ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
	
}
//階乗
long long factorial(long long n, long long mod) {
	long long ret = 1;
	for (long long i = 1; i <= n; i++) {
		ret = (ret * i) % mod;
	}
	return ret;
}
//モジュラ逆数
long long inv_mod(long long n, long long mod) {
	long long a = n % mod, b = mod - 2, ret = 1;
	while (b > 0) {
		if (b & 1) ret = (ret * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ret;
}

long long nPr(long long n, long long r, long long mod) {
	long long ret = 1;
	for (long long i = n; i >= n - r + 1; i--) {
		ret = ret * (i % mod) % mod;
	}
	return ret;
}

long long nCr(long long n, long long r, long long mod) {
	return nPr(n, r, mod) * inv_mod(factorial(r, mod), mod) % mod;
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {//降順second
	if (a.second != b.second) {
		return a.second > b.second;
	}
	else {
		return a.first > b.first;
	}
}

bool compare_by_a(pair<ll, ll> a, pair<ll, ll> b) {//降順first
	if (a.first != b.first) {
		return a.first > b.first;
	}
	else {
		return a.second > b.second;
	}
}

ll gcd(ll m, ll n){
	if (n == 0)return m;
	return gcd(n, m%n);
}//gcd


int main() {
	ll n;
	cin >> n;
	vector<ll> h(n);
	rep(i, n)cin >> h[i];
	ll max = 0;
	ll cnt = 0;
	rep(i, n) {
		if (max <= h[i]) {
			max = h[i];
			cnt++;
		}
	}
	cout << cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
 
int main() {

    int x,y;
    cin>>x>>y;
    int ans=0;

    if(x==1)    ans+=300000;
    if(x==2)    ans+=200000;
    if(x==3)    ans+=100000;
    if(y==1)    ans+=300000;
    if(y==2)    ans+=200000;
    if(y==3)    ans+=100000;
    if(x==1&&y==1)  ans+=400000;
    
    cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;

stack<ll> answer;

bool is_valid(const vector<ll>& in){
    ll in_size = in.size();
    if(in_size == 0) return true;
    else{
        vector<ll> possible;
        RANGE(i,in_size){
            if(in[i] == i+1) possible.push_back(i);
          	else if(in[i] > i+1) return false;
        }
        for(ll poss:possible){
            answer.push(poss+1);
            vector<ll> next_vec;
            RANGE(j,in_size){
                if(j==poss) continue;
                next_vec.push_back(in[j]);
            }
            if (is_valid(next_vec)) return true;
            else answer.pop();
        }
        return false;
    }
}

signed main() {
    int N;
    cin >> N;
    vector<ll> b;
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;
        b.push_back(a);
    }
    if(is_valid(b)){
        while(!answer.empty()){
            cout << answer.top() << endl;
            answer.pop();
        }
    }else {
        cout << -1 << endl;
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <math.h>
#define F(i,a,n) for(int i = (a); i < (n); ++i)
#define Fl(i,a,n) for(long long i = (a); i < (n); ++i)
using namespace std;
int main(){
  int N,D,X;
  cin >> N;
  cin >> D;
  cin >> X;
  int A[N];
  F(i,0,N) cin >> A[i];
  int ans = X;
  F(i,0,N){
    int num = D / A[i];
    int amari = D % A[i];
    if(amari > 0) num++;
    ans += num;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, A;
	cin >> N >> A;

	vector<Int> x(N);
	for (Int i = 0; i < N; i++) {
		cin>>x[i];
	}

	vector<vector<vector<Int>>> dp(N + 1, vector<vector<Int>>(N + 1, vector<Int>(N*50+1)));
	dp[0][0][0] = 1;

	for (Int i = 0; i < N; i++) {
		for (Int j = 0; j < N; j++) {
			for (Int k = 0; k < N * 50 + 1; k++) {
				//選ばない
				dp[i + 1][j][k] += dp[i][j][k];
				//選ぶ
				if (k - x[i] >= 0) {
					dp[i + 1][j + 1][k] += dp[i][j][k - x[i]];
				}
			}
		}
	}

	Int ans = 0;
	for (Int j = 1; j <= N; j++) {
		ans += dp[N][j][A * j];
	}
	cout << ans << "\n";
}

Measured memory_bytes: 52224
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  
  int64_t ans = 0;
  
  for(int i = 0; i < N+1; i++){
    if(i % 3 == 0 || i % 5 == 0){
      continue;
    }
    else{
      ans += i;
    }
  }
  
  cout << ans << endl;
}

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

int value(int x, int y){
  if(x < y){
    return y - x;
  }
  else{
    return x - y;
  }
}


int main() {
  
  int x, a, b;
  cin >> x >> a >> b;
  
  if(value(a, x) >= value(b, x)){
    cout << 'B' << endl;
  }
  else{
    cout << 'A' << endl;
  }
    
}



Measured memory_bytes: 256
N,X= map(int,input().split())
L_list = list(map(int,input().split()))
#N = int(input())
D = [0]*(N+1)
for i in range(N):
    D[i+1] = D[i]+L_list[i]
import bisect
n = bisect.bisect_right(D, X)
print(n)

Measured memory_bytes: 38608
#include<iostream>

template<typename T, int size>
struct PreCirclePond
{
    T ary[size + 1];
    static constexpr float pi = 3.141592;

    constexpr PreCirclePond() : ary() {
        for (int i = 0; i < size + 1; i++)
        {
            const int t = i * 2;
            ary[i] = t * pi;
        }
    }

    T take(int r) const {
        return ary[r];
    }
};

template<class R>
float ciclePondP(R r) {
    constexpr auto a = PreCirclePond<float, 100>();
    return a.take(r);
}

int main() {
    using namespace std;
    ios_base::sync_with_stdio(false);

    int R;
    cin >> R;

    cout << ciclePondP(R);
}

Measured memory_bytes: 3804
#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    string S; cin >> S;
    int N = S.size();
    int ans[100100];
    rep(i, N) {
        ans[i] = 0;
    }
    int cntr = 0, cntl = 0;
    int pt;
    rep(i, N) {
        if((S[i] == 'L' && S[i + 1] == 'R') || i == N - 1)  {
            cntl ++;
            int a = (cntr + 1) / 2, b = (cntl + 1) / 2;
            ans[pt] = a + cntl - b;
            ans[pt + 1] = b + cntr - a;
            cntr = 0; cntl = 0;
        }else if(S[i] == 'R' && S[i + 1] == 'R'){
            cntr ++;
        }else if(S[i] == 'L' && S[i + 1] == 'L') {
            cntl ++;
        } else if(S[i] == 'R' && S[i + 1] == 'L') {
            cntr ++;
            pt = i;
        }
    }
    rep(i, N) {
        cout << ans[i] << " ";
    }
    cout << endl;
	return 0;
}

Measured memory_bytes: 1104
n = int(input())
s = input()
count = 0
r = s.count('R')
g = s.count('G')
b = s.count('B')
for i in range(0,n-2):
    for j in range(i+1,n-1):
        if j < 2*j -i <= n-1 and sorted([s[i],s[j],s[2*j-i]]) == ['B','G','R']:
            count += 1
print(r*g*b - count)

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

#define int long long
#define double long double

int l;
double r;

int32_t main()
{	
	cin >> l;
	cout << setprecision(9) << fixed;
	r = (l/3.0)*(l/3.0)*(l/3.0);
	cout << r << '\n';
}

Measured memory_bytes: 256
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<ll, ll>;
 
#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  ll x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;
 
 
 
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  ll n;
  std::cin>>n;

  rep(i,1,10){
    if(n%i==0&&(1<=n/i&&n/i<=9)){
      std::cout<<"Yes\n";
      return 0;
    }
  }

  std::cout<<"No\n";
 
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int N;
int s[5010] = {};
ll A[5010] = {},dp1[5010][5010] = {},dp2[5010][5010] = {};
//1:その点を根とした部分木の各点の値がすべて正
//2:負が含まれる
const ll inf = 2e18;
vector<vector<int>> v(5010);

void dfs(int n,int m){
    s[n] = 1;
    if(A[n]>0) dp1[n][0] = A[n];
    dp2[n][0] = A[n];
    for(auto x:v[n]){
        if(x==m) continue;
        dfs(x,n);
        vector<ll> merge1(N+1,inf),merge2(N+1,inf);
        for(int i=0;i<s[n];i++){
            for(int j=0;j<s[x];j++){
                if(dp1[x][j]!=inf){
                    if(dp1[x][j]!=-1) merge1[i+j] = min(merge1[i+j],dp1[n][i]+dp1[x][j]);
                    merge1[i+j+1] = min(merge1[i+j+1],dp1[n][i]);
                    merge2[i+j+1] = min(merge2[i+j+1],dp2[n][i]);
                }
                if(dp2[x][j]!=inf){
                    merge2[i+j] = min(merge2[i+j],dp2[n][i]+dp2[x][j]);
                    if(dp2[x][j]<0){
                        merge2[i+j+1] = min(merge2[i+j+1],dp2[n][i]);
                        merge1[i+j+1] = min(merge1[i+j+1],dp1[n][i]);
                    }
                }
            }
        }
        for(int i=0;i<N;i++){dp1[n][i] = merge1[i]; dp2[n][i] = merge2[i];}
        s[n] += s[x];
    }
}

int main(){
    cin >> N;
    for(int i=1;i<=N;i++) cin >> A[i];
    int a,b;
    for(int i=1;i<=N-1;i++){
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(int i=1;i<=N;i++) for(int j=0;j<=N;j++) {dp1[i][j] = inf; dp2[i][j] = inf;}
    dfs(1,0);
/*    cerr << "dp1" << endl;
    for(int i=1;i<=N;i++){
        for(int j=0;j<N;j++) cerr << dp1[i][j] << " ";
        cerr << endl;
    }
    cerr << "dp2" << endl;
    for(int i=1;i<=N;i++){
        for(int j=0;j<N;j++) cerr << dp2[i][j] << " ";
        cerr << endl;
    }
*/    int ans = N;
    for(int i=N-1;i>=0;i--){
        if(dp1[1][i]!=inf) ans = i;
        if(dp2[1][i]<0) ans = i;
    }
    cout << ans << endl;
}

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

#define range 100005
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	int K,X;
	cin>>K>>X;
	for(int i=X - K +1;i<=X + K - 1;i++)
		cout<<i<<" ";
	
	return 0;
}

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

bool comp(pair<int,int> a, pair<int,int> b){
	return a.second<b.second;
}

int main(){
	
	//fastio
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin>>n;
	pair<int,int> arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i].first;
		cin>>arr[i].second;
	}
	sort(arr,arr+n,comp);
	int time=0;
	for(int i=0;i<n;i++){
		time += arr[i].first;
		if(time > arr[i].second){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1792
s = int(input())
if s //10**9 == 0:
  print(0, 0, 1, 0, 1, s)
elif s % 10**9 == 0:
    print(0, 0, 10**9, 0, 0, s//10**9)
else:
    r = s % (10**9)
    print(0, 0, 10**9, 1, 10**9 - r, s//10**9 + 1)

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef set<pii> pset;

int neighbor_search(const pset& bs, int y, int x) {
    int r = 0;
    for(int i=y-1; i<=y+1; i++) for(int j=x-1; j<=x+1; j++) {
        if(bs.find(pii(i, j)) != bs.end()) {
            r++;
        }
    }
    return r;
}

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

    int h, w, n;
    cin >> h >> w >> n;
    pset blacks;
    for(int i=0; i<n; i++) {
        int a, b;
        cin >> a >> b;
        blacks.insert(pii(a, b));
    }
    pset visited;
    ll count[10] = {};
    for(auto itr=blacks.begin(); itr!=blacks.end(); ++itr) {
        int a = itr->first, b = itr->second;
        for(int i=max(a-1, 2); i<=min(a+1, h-1); i++) {
            for(int j=max(b-1, 2); j<=min(b+1, w-1); j++) {
                auto pib = visited.insert(pii(i, j));
                if(pib.second) {
                    int r = neighbor_search(blacks, i, j);
                    count[r]++;
                }
            }
        }
    }
    ll s = 0;
    for(int i=1; i<=9; i++) {
        s += count[i];
    }
    count[0] = long(h-2) * long(w-2) - s;
    for(int i=0; i<=9; i++) {
        cout << count[i]<< endl;
    }

}

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

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int nyuryoku=sc.nextInt();
		int[] sort=new int[nyuryoku];
		for(int i=0; i<nyuryoku; i++) {
			sort[i]=sc.nextInt();
		}
		int[] seikei=new int[nyuryoku];
		for(int i=0; i<nyuryoku; i++) {
			seikei[i]=sort[i];
		}
		int[] copuy=new int[nyuryoku];
		copuy=seikei;

		Arrays.sort(copuy);

		int a=copuy[nyuryoku/2-1];
		int b=copuy[nyuryoku/2];
		for(int i=0; i<nyuryoku; i++) {
			if(sort[i]>a) {
				System.out.println(a);
			}
			else {
				System.out.println(b);
			}
		}
	}
}

Measured memory_bytes: 115676
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(var) (var).begin(), (var).end()
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> > 
#define vvpi vector<vector<pair<int,int> > >

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

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n,i,a[100005],pre[100005],suf[100005];
	cin >> n;
	for(i=0;i<n;i++)
	{
		cin >> a[i];
	}

	pre[0] = a[0];
	for(i=1;i<n;i++)
	{
		pre[i] = gcd(pre[i-1], a[i]);
	}

	int ans = pre[n-2];

	suf[n-1] = a[n-1];

	for(i=n-2;i>=0;i--)
	{
		suf[i] = gcd(suf[i+1], a[i]);
	}

	ans = max(ans, suf[1]);
	
	for(i=1;i<n-1;i++)
	{
		int x = gcd(pre[i-1], suf[i+1]);
		ans = max(ans, x);
	}

	cout << ans;
	
	return 0;
}

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

using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;



int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall


    ini(n);
    multiset<float> a;
    FOR(i,0,n){
        float x;
        in(x);
        a.insert(x);
    }
    while(a.size()!=1){
        float x = *a.begin();
        a.erase(a.begin());
        float x1 = *a.begin();
        a.erase(a.begin());
        a.insert((x+x1)/2);
    }
    
    
    
    out(*a.begin());
    
    
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
abcd=input()

for i in range(8):
    op=['-']*3
    for j in range(3):
        if (i>>j)&1:
            op[j]='+'
    if eval(abcd[0]+op[0]+abcd[1]+op[1]+abcd[2]+op[2]+abcd[3]) ==7:
        print(abcd[0]+op[0]+abcd[1]+op[1]+abcd[2]+op[2]+abcd[3]+'=7')
        break

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;


#define pb push_back
#define ff first
#define ss second
#define INF int(3e9)
#define BIG_INF ll(9e18)
#define SIZE 100001
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define len(v) int((v).size())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout);


ll binpow(ll a, ll b, ll MOD = BIG_INF)
{
    ll res = 1;

    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
        a %= MOD;
        res %= MOD;
    }

    return res % MOD;
}

const ll mod = 1e9 + 7;

int T = 1;
int n, m, k;

vector<int> g[SIZE], b[SIZE];

int p[SIZE];
int cnt[SIZE];
bool used[SIZE];


void dfs(int u, int P, int &kol)
{
    used[u] = 1;
    p[u] = P;

    for(int v: g[u])
    {
        if(!used[v])
        {
            kol++;
            dfs(v, P, kol);
        }
    }
}



void solve()
{

    cin >> n >> k;


    vector<ll> pref(n + 1, 0);


    for(ll i = 1; i <= n; i++)
    {
        pref[i] = pref[i - 1] + i;
    }
    ll ans = 0;
    for(int i = k; i <= n; i++)
    {
        ll x = pref[i - 1];
        ll y = pref[n] - pref[n - i];
//        cout << x << ' ' << y << "\n";
        ans += y - x + 1;
        ans %= mod;
    }
    cout << ans + 1;

    return;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//    filein;fileout;

//    cin >> T;

    while(T--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, T t){return v2<T>(r, vector<T>(c, t));}

void solve(){
    int n;
    cin >> n;
    vector<pair<int, int>> r(n);
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        r[i] = {a+b, a-b};
    }
    sort(r.begin(), r.end());

    int ans = 0;
    int b;
    for(int i = 0; i < n; i++){
        if(!ans || r[i].second >= b){
            ans++;
            b = r[i].first;
        }
    }
    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3952
while True:
    a, op, b = map(str, input().split())
    if op == '?':
        break

    a_num = int(a)
    b_num = int(b)

    if op == '+':
        print(a_num + b_num)
    elif op == '-':
        print(a_num - b_num)
    elif op == '*':
        print(a_num * b_num)
    else:
        print(int(a_num / b_num))



Measured memory_bytes: 5596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
  int n;
  scanf("%d",&n);
  if(n==25){
    printf("Christmas\n");
  }else if(n==24){
    printf("Christmas Eve\n");
  }else if(n==23){
    printf("Christmas Eve Eve\n");
  }else if(n==22){
    printf("Christmas Eve Eve Eve\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
   int i,a,b,c,d,t,e;
   while(1){
   scanf("%d",&t);
   if(t==0)  break;
   scanf("%d",&a);
   for(i=0;i<a;i++){
   scanf("%d %d",&b,&c);
   t-=c-b;
   }
   if(t<=0){
   printf("OK\n");
   }
   else{
   printf("%d\n",t);
   }
   }
   return 0;
   }

Measured memory_bytes: 1040
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    string S;
    cin >> S;
    int ans = 1000;
    for(int i = 0; i < S.length() - 2; ++i)
    {
        int n = abs(753 - ((S[i]-'0') * 100 + (S[i+1]-'0') * 10 + (S[i+2]-'0')));
        if(n < ans) ans = n;
    }

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

Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef vector<pii>vip;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 200005;

int h,w,k;
vector<string>grid;

bool chek(int r, int c){
     int cnt = 0;
     for(int i = 0; i<h; i++){
          for(int j = 0; j<w; j++){
               if(r & (1<<i) or c& (1<<j))continue;
               if(grid[i][j]=='#')cnt++;
          }
     }
     return cnt==k;
}

void task(){
    cin >> h >> w >> k;
    grid.resize(h);

    for(int i = 0; i<h; i++){
     cin >> grid[i];
    }

    int ans = 0;
    for(int r = 0; r<(1<<h); r++){
     for(int c = 0; c<(1<<w); c++){
          if(chek(r,c))ans++;
     }
    }

    cout << ans << endl;
}

int main(){
        _
        int T = 1; //cin >> T;
        while(T--){
            task();
        }
return 0;
}



Measured memory_bytes: 3568
// g++ -std=gnu++1y -O2 main.cpp

#include <cstdio>
#include <vector>
#include <set>

#include <map>
#include <unordered_map>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

using namespace std;

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

int main() {
	int L;
	cin >> L;
	double l = static_cast<double>(L) / 3.0;
	printf("%f\n", l * l * l);
	return 0;
}

Measured memory_bytes: 256
from collections import deque
s = list(input())
n = len(s)

if s[0] == '0' or s[n-1] == '1' or any(s[i-1] != s[n-1-i] for i in range(1,n-1)):
    print(-1)
    exit()

s[n-1] = '1'

one =deque([])

for i in range(n):
    if s[i] == '1':
        one.append(i)

for i in range(n-1):
    if s[i] == '0':
        print(i+1,one[0]+1)
    else:
        a = one.popleft()
        print(a+1,one[0]+1)

Measured memory_bytes: 54904
from itertools import accumulate
from operator import add


h, w, k = map(int, input().split())

white_count = [0] * (w+1)
prev = [0] * (w+1)
for _ in range(h):
    line = iter('0'+input())
    cumsum_1d = accumulate(map(int, line))
    cumsum_2d = list(map(add, prev, cumsum_1d))
    prev = cumsum_2d
    white_count += cumsum_2d


def get_white(sy, sx, ny, nx):
    a = sy*(w+1) + sx
    b = sy*(w+1) + nx
    c = ny*(w+1) + sx
    d = ny*(w+1) + nx
    return white_count[d] - white_count[c] - white_count[b] + white_count[a]


ans = []
for pattern in range(2**(h-1)):
    dived = [0] + [y+1 for y in range(h-1) if (pattern>>y) & 1] + [h]
    slash_count = len(dived) - 2

    prev_x = 0
    for div_x in range(1, w + 1):
        for idx in range(len(dived)-1):
            prev_y = dived[idx]
            div_y = dived[idx+1]
            white = get_white(prev_y, prev_x, div_y, div_x)
            if white > k:
                break
        else:
            continue

        slash_count += 1
        if prev_x == div_x - 1:
            break
        prev_x = div_x - 1

    else:
        ans.append(slash_count)

print(min(ans))

Measured memory_bytes: 43868
N = int(input())
A_list = [int(x) for x in input().split(" ")]
ans = 0
for i in range(N):
    num = 0
    while ans == 0:
        ans = A_list[i] % 2
        A_list[i] = A_list[i] / 2
        num += 1
    A_list[i] = num - 1
    ans = 0
print(min(A_list))

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

using namespace std;

main() {
#ifdef HOME
    //freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) cout << "bust";
    else cout << "win";
    return 0;
}


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

#define ll   long long int
#define rep(i,n)    for(int i=0;i<(int)n;i++)
#define show(s)     cout<<s<<endl

int main() {

    int N;
    cin >> N;

    vector<int> A(N,0);
    vector<int> B(N-1);
    rep(i,N-1)  cin >> B[i];

    A[N-1] = B[N-2];
    A[0] = B[0];
    for(int i=N-2; i>=1; i--){
        if(B[i-1] <= B[i]){
            A[i] = B[i-1];
        }else{
            A[i] = B[i];
        }
    }

    int sum = accumulate(A.begin(),A.end(),0);
    show(sum);


    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var h = p[0];
		var w = p[1];
		var k = p[2];
		var map = new string[h];
		for(int i = 0; i < h; i++)
			map[i] = Console.ReadLine();
		
		long r = 0;
		for(int y = 0; y < (1 << h); y++)
		{
			for(int x = 0; x < (1 << w); x++)
			{
				var m = new int[h,w];
				for(int i = 0; i < h; i++)
				{
					if((y&(1<<i)) == (1<<i))
					{
						for(int j = 0; j < w; j++)
							m[i, j] = 2;
					}
				
				}
				for(int i = 0; i < w; i++)
				{
					if((x&(1<<i)) == (1<<i))
					{
						for(int j = 0; j < h; j++)
							m[j, i] = 2;
					
					}
				}
				
				long wa = 0;
				for(int i = 0; i < h; i++)
				{
					for(int j = 0; j < w; j++)
					{
						if(map[i][j] == '#' && m[i, j] != 2)
							wa++;
					}
				}
				if(wa == k)
				{
					r++;
				}
				
			}
		}
		Console.WriteLine(r);
		
	}
	
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 28216
a,b,c = (int(x) for x in input().split())
tmp = 0
if a > b:
    tmp = a
    a = b
    b = tmp
if b > c:    
    tmp = b
    b = c 
    c = tmp
if a > b:
    tmp = a
    a = b
    b = tmp
print(a,b,c)



Measured memory_bytes: 5604