akhauriyash/Code-Regression huggingface dataset:
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

using Graph = vector< vector< pair<int, int> > >;

int main() {
    int N; cin >> N;
    Graph G(N);
    for(int i=0; i<N-1; i++) {
        int u, v; cin >> u >> v;
        u--; v--;
        G[u].emplace_back(v, i);
        G[v].emplace_back(u, i);
    }

    vector<int> ans(N-1);
    auto dfs = [&](auto&& f, int cur, int par, int color) -> void {
        int c = 0;
        for(auto e : G[cur]) {
            int to, id; tie(to, id) = e;
            if(to == par) continue;
            c += (color == c);
            ans[id] = c + 1;
            f(f, to, cur, c++);
        }
    };

    dfs(dfs, 0, -1, -1);
    int K = *max_element(ans.begin(), ans.end());
    cout << K << endl;
    for(int i=0; i<N-1; i++) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 6912
s = input()
k = int(input())

ans = 0
lens = len(s)
# n -> n//2

def tansaku(moji, n, m, k):
	# n以上 m未満を探索する.
	ansr = 0
	cntt = 1
	for i in range(n, m-1):
		if moji[i] == moji[i + 1]:
			cntt += 1
		else:
			ansr += (cntt // 2) * k
			cntt = 1
	ansr += (cntt // 2) * k
	return ansr

cnnt = 1
hentai = False
for i in range(lens-1):
	if s[i] == s[i+1]:
		cnnt += 1
if cnnt == lens:
	hentai = True

if not hentai:
	if k >= 2:
		zencnts = 0
		atocnts = 0
		if s[lens-1] == s[0]:
			for i in range(lens):
				if s[lens-1-i] == s[lens-1]:
					zencnts += 1
				else:
					break
			for i in range(lens):
				if s[i] == s[0]:
					atocnts += 1
				else:
					break
		news = s[atocnts:] + s[:atocnts]
		news1 = s[atocnts:]
		news2 = s[:atocnts]
		ans += tansaku(news, 0, lens, k-1)
		ans += tansaku(news1, 0, lens-atocnts, 1)
		ans += tansaku(news2, 0, atocnts, 1)
		print(ans)
	else:
		ans += tansaku(s, 0, lens, 1)
		print(ans)
else:
	print((lens*k)//2)

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

#define MAX 100 

using namespace std;

int Partition(int input[], int head, int end){
    int i, j, x, t;
    
    i = head-1;
    x = input[end];
    
    for(j=head; j<end; j++){
        if(input[j] <= x){
            i++;
            t=input[i]; 
            input[i]=input[j]; 
            input[j]=t;
        }
    }
    t = input[i+1];
    input[i+1] = input[end];
    input[end] = t;
    
    return i+1;
}

void QuickSort(int input[], int head, int end){
    int index;
    
    if(head < end){
        index = Partition(input, head, end);
        QuickSort(input, head, index-1);
        QuickSort(input, index+1, end);
    }
}

int main(void){
    int n, num[MAX], ans = 1;
    
    cin >> n;
    
    for(int i=0; i<n; i++)
        cin >> num[i];
    
    QuickSort(num, 0, n-1);
    
    for(int i = 1; i < n; i++){
        if(num[i] > num[i-1])
            ans++;
    }
    
    std::cout << ans << std::endl;
}

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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define FOR(i,l,r) for(long long i=l; i<r; i++)
#define FOR_REV(i,r,l) for(long long i=r; i>=l; i--)
#define pb push_back
#define mp make_pair

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

    int cnt=0;
    for (int i=0; i<3; i++)
    {
        if (s[i] == 'A')
        {
            cnt++;
        }
    }
    if (cnt == 0 || cnt == 3)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
}


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

int main(){

  int a,b=0;
  cin>>a>>b;
	
 
  if(a<=b)cout<<"unsafe"<<endl;
  else cout<<"safe"<<endl;

}


Measured memory_bytes: 3636
#include <stdio.h>
int main(void) {
	int n;
	int a[100000];
	int j[100000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		j[a[i]] = i + 1;
	}
	for (int i = 1; i < n+1; i++) {
		printf("%d ", j[i]);
	}
}


Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;


ll my_pow(ll m, ll n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return my_pow(m*m, n/2); }
    return my_pow(m, n-1) * m;
}

int main(){
    ll N;cin >> N;
    vector<ll> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    int ts[3]={-1,0,1};
    ll ans=0;
    for(int i=0;i<my_pow(3,N);i++){
        ll tmp=i;
        for(int i=0;i<N;i++){
            if((A[i]+ts[tmp%3])%2==0){
                ans++;
                break;
            }
            else{
                tmp/=3;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from sys import stdin

H = []
N = int(stdin.readline().rstrip())
H = [int(x) for x in stdin.readline().rstrip().split()]

count = 1
for i in range(1,N):
    flag = 0
    for j in range(0,i):
        if H[j] > H[i]:
            flag = 1
    if flag == 0:
        count +=1
    
print(count)

Measured memory_bytes: 3064
# coding: utf-8
# Here your code !
import sys
N = int(input())
ipt = list(input())
stR = ["S" for i in range(N)]

def sheep(stg):
     return stg
def wolf(stg):
    if stg == "S":
        return "W"
    else:
        return "S"
def modN (i):
    return i%N
def check ( num1,num2 ):
    stR[0]=num1
    stR[1]=num2
    for i in range(N+2):
        if stR[modN(i+1)] == "S" and ipt[modN(i+1)]=="o"  :
            stR[modN(i+2)]=sheep(stR[modN(i)])
        elif stR[modN(i+1)] == "W" and ipt[modN(i+1)]=="x":
            stR[modN(i+2)]=sheep(stR[modN(i)])
        else:
            stR[modN(i+2)]=wolf(stR[modN(i)])
    
    if stR[0]==num1 and stR[1]==num2:
        print("".join(stR))
        return True
    else:
        return False

if check("S","W"):
    sys.exit()
else:
    
    if check("W","W"):
        sys.exit()
    else:
        
        if check("W","S"):
            sys.exit()
        else:
            
            if check("S","S"):
                sys.exit()
            else:
                print(-1)



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

void solve(){
	cout << fixed << setprecision(6);
        int n;
        cin >> n;
        vector<double> a(n);
        for(int i=0;i<n;i++){
            cin >> a[i];
        }
        sort(a.begin(),a.end());
        double ans=(a[0]+a[1])/2;
        for(int i=2; i<n; i++){
            ans=(ans+a[i])/2;
        }
        cout << ans << endl;;

}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
		return 0;
}


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

using namespace std;

#define ll long long

string s;

string days[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

void solve() {
  cin >> s;
  for (int i = 0; i < 7; i++) {
    if (s.compare(days[i])==0) {
      cout << (7-i) << '\n';
    }
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int x, n, ans = 0;
	scanf("%d%d", &x, &n);
	vector<int> a(n);
	rep(i, n)scanf("%d", &a[i]);
	sort(all(a));
	rep(i, 110) {
		if (not binary_search(all(a), i)) {
			if (abs(x - ans) > abs(x - i))ans = i;
		}
	}
	printf("%d\n", ans);

	Please AC;
}

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

int main()
{
  int N, a, b, c, res = 0;
  cin >> N;
  vector<vector<int>> DP(3, vector<int>(N + 1));
  for (int i = 0; i < 3; i++)
  {
    DP.at(i).at(0) = 0;
  }
  for (int i = 1; i <= N; i++)
  {
    cin >> a >> b >> c;
    DP.at(0).at(i) = a + max(DP.at(1).at(i - 1), DP.at(2).at(i - 1));
    DP.at(1).at(i) = b + max(DP.at(0).at(i - 1), DP.at(2).at(i - 1));
    DP.at(2).at(i) = c + max(DP.at(0).at(i - 1), DP.at(1).at(i - 1));
  }
  for (int i = 0; i < 3; i++)
  {
    if (res < DP.at(i).at(N))
      res = DP.at(i).at(N);
  }
  cout << res << endl;
}


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


int par[1000000];


void init( int n ){


     for( int i = 1 ; i <= n ; i = i + 1 ){

          par[i] = i;

          }

     return;

     }


int root( int x ){

    
    if( par[x] == x ) return x;

    else return par[x] = root( par[x] );

    }


bool same( int x, int y ){


     return root(x) == root(y);

     }


void unite( int x, int y ){


     x = root(x);

     y = root(y);


     if( x == y ) return;


     par[x] = y;

     return;

     }
                                                                                   

int main(){


    int n, m, i, x, y;

    int k = 0;


    cin >> n >> m;


    vector<int> p(100001);


    for( i = 1 ; i <= n ; i = i + 1 ){

         cin >> p.at(i);

         }


    init(n);


    for( i = 1 ; i <= m ; i = i + 1 ){

         cin >> x >> y;

         unite( p.at(x), p.at(y) );

         }


    for( i = 1 ; i <= n ; i = i + 1 ){

         if( same( i , p.at(i) ) ) k += 1;

         }


    cout << k << endl;


    return 0;

    }

Measured memory_bytes: 1024
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

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

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
        ans=ans%1000000007;
    }

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}



int main()
{
	ll x;
	cin>>x;
	ll in=100,ans=0;
	while(in<x)
	{
		in=in+in/100;
		ans++;
	}
	cout<<ans;
}


Measured memory_bytes: 15384
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        s: String
    };
    println!(
        "{}{}",
        s,
        ["s", "es"][(s.chars().last().unwrap() == 's') as usize]
    );
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n, d, x; cin >> n >> d >> x;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = 0;
    rep(i,n){
        ans += (d - 1) / a[i] + 1;
    }
    ans += x;
    cout << ans << endl;
}


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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

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

int main(){
  int money=0;
  cin>>money;
  
  int count=money/1000;
  
  if(money==count*1000)cout<<0;
  else cout<<(1000*(count+1)-money);
  
  return 0;
}


Measured memory_bytes: 3628
x,y,a,b,c = map(int, input().split())
p =  sorted(list(map(int, input().split())), reverse=True)
q =  sorted(list(map(int, input().split())), reverse=True)
r =  sorted(list(map(int, input().split())), reverse=True)

ans = sorted(p[:x] + q[:y])

for i in range(len(r)):
    if ans[i]<r[i]:
        ans[i] = r[i]
    else:
        break
print(sum(ans))

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

using namespace std;

int v[10][10];
int a[10],b[10];
int main()
{
    for(int i=1;i<=3;i++)
        for(int j=1;j<=3;j++)
            cin>>v[i][j];
    for(a[1]=0;a[1]<=100;a[1]++)
    for(a[2]=0;a[2]<=100;a[2]++)
    for(a[3]=0;a[3]<=100;a[3]++)
    {
        b[1]=v[1][1]-a[1];
        b[2]=v[2][2]-a[2];
        b[3]=v[3][3]-a[3];
        if(b[1]<0 or b[2]<0 or b[3]<0)
            continue;
        bool ok=1;
        for(int i=1;i<=3;i++)
            for(int j=1;j<=3;j++)
                if(v[i][j]!=a[i]+b[j])
                    ok=0;
        if(ok)
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}
/**
**/


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>

using namespace std;

int cmpAll(int);
int count(int, int);

int main(){
  int N;
  scanf("%d", &N);
  int ans = cmpAll(N);
  printf("%d", ans);
  return 0;
}

int cmpAll(int N){
  if(N == 1)
    return 1;
  int tmpCnt, cnt = 0, ans;
  for(int i = 1; i <= N/2; i++){
    tmpCnt = 0;
    tmpCnt = count(i*2, tmpCnt);
    if(tmpCnt > cnt){
      cnt = tmpCnt;
      ans = i*2;
    }
  }
  return ans;
}

int count(int num, int tmpCnt){
  if(num%2 != 0)
    return tmpCnt;
  else
    return count(num /= 2, ++tmpCnt);
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }


// import here

int main(){
    LL a, b, c;
    cin >> a >> b >> c;
    LL ans = b + min(c, a + b + 1);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static final Scanner SCANNER = new Scanner(System.in);

    public static void main(String[] args) {
        final int count = Integer.parseInt(SCANNER.nextLine());
        int[] rabbits = new int[count];

        for (int i = 0; i < rabbits.length; i++) {
            rabbits[i] = SCANNER.nextInt();
        }

        int countPairs = 0;
        for (int i = 0; i < rabbits.length; i++) {
            if (rabbits[i] - 1 != i && rabbits[rabbits[i] - 1] == (i + 1)) {
                ++countPairs;
            }
        }
        System.out.println(countPairs / 2);
    }
}

Measured memory_bytes: 32220
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

bool compare(int a, int b){
    return a>b;
}
int main() {
    int count = 0;
    int N;
    int x;
    string y;
    vector<int> red_y;
    cin>>N;
    map<int,string> map1;
    for(int i=0;i<N;i++){
        cin>>x>>y;
        map1.insert(make_pair(x,"red"+y));
    }
    for(int j=0;j<N;j++){
        cin>>x>>y;
        map1.insert(make_pair(x,"blue"+y));
    }

    for(map<int,string>::iterator it = map1.begin();it!=map1.end();++it){
        if (it->second.find("red")!=string::npos){
            string temp_y = it->second;
            temp_y = temp_y.replace(0,3,"");
            int int_y = stoi(temp_y);
            red_y.push_back(int_y);
        }
        else{
            string temp_y = it->second;
            temp_y = temp_y.replace(0,4,"");
            int blue_y = stoi(temp_y);
            sort(red_y.begin(),red_y.end(),compare);
            for(vector<int>::iterator it_y = red_y.begin();it_y!=red_y.end();){
                if(*it_y<blue_y){
                    it_y = red_y.erase(it_y);
                    count++;
                    break;
                } else{
                    ++it_y;
                }
            }
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (n, k, q) = listOfInt()
    val won = IntArray(n){0}

    repeat(q) {
        val winner = nextInt() - 1
        won[winner] = won[winner] + 1
    }

    won.forEach {
        println(if (k - (q - it) > 0) "Yes" else "No")
    }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 42928
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    int nokori = n%100;
    int num = n/100;
    if (num*5 >= nokori) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 300005 

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;

int main() {

	int n, q;
	cin >> n >> q;
	int maxi = 0;
	vector<int> c(ARRAY_MAX,0);


	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		c[a] = a;
	}

	for (int i = 1; i < ARRAY_MAX; i++)
	{
		c[i] = max(c[i-1], c[i]);
	}

	for (int i = 0; i < q; i++)
	{
		int hoge, ans = 0;
		cin >> hoge;
		for (int j = hoge - 1; j < ARRAY_MAX; j += hoge)
		{
			ans = max(ans, c[j] % hoge);
		}
		cout << ans << endl;
	}


}


Measured memory_bytes: 3860
///////////////////// author : TrEbLeCleF /////////////////////
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define For(i, a) for (int i=0; i<(a); i++)
#define FORR(i,a,b) for (int i = (b)-1; i >= a; i--)
#define Forr(i,a) for (int i = (a)-1; i >= 0; i--)
/////////////////////////// ..... ///////////////////////////
#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__) 
void DBG() { cerr << "]\n";}
template<typename T, typename ...Args> void DBG(T first, Args... args){
cerr << first; if(sizeof...(args))cerr<<", "; DBG(args...); }
/////////////////////////// ..... ///////////////////////////
#define int ll
#define pb(x) push_back(x)
#define print(v,s,e) for(int i = s; i < e; i++)cout << v[i]<<" ";cout<<"\n";
#define INF 1e17
#define PI 3.14159265358979323846 
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
/////////////////////////// GLOBAL ///////////////////////////


/////////////////////////// GLOBAL ///////////////////////////
void solve(){
	int x; cin >> x;
	if(x>=30)cout <<"Yes\n";
	else cout <<"No\n";
}

int32_t main(){ 
	#ifndef ONLINE_JUDGE
		clock_t tStart = clock();
		freopen("TC", "r", stdin);
		//freopen("output.txt","w",stdout);
	#endif 
    ios_base:: sync_with_stdio(false); 
   	cin.tie(0); 
	int t=1;
	//cin >> t;
	for(int tt=1;tt<=t;tt++){
		//cout << "Case #"<<tt<<": ";
		solve();
	}
	#ifndef ONLINE_JUDGE
    	cerr << "\nRun Time -> "<<(double)(clock()-tStart)/CLOCKS_PER_SEC <<" sec\n";
    #endif
}

Measured memory_bytes: 3616
n, a, b = map(int, input().split())
mod = 10**9 + 7


def comb(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*(n-i+1) % mod
        res = res*pow(i, mod-2, mod) % mod
    return res


ans = pow(2, n, mod) - 1
ans = (ans - comb(n, a)) % mod
ans = (ans - comb(n, b)) % mod
print(ans)


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

int main()
{
	int number,count = 0;
	
	while(cin >> number)
	{
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<10;j++)
			{
				for(int k=0;k<10;k++)
				{
					for(int l=0;l<10;l++)
					{
						if(i+j+k+l == number) count++;
					}
				}
			}
		}
		cout << count << endl;
		count = 0;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 100

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, a[MAX], used[MAX] = {};
	int num = 1, con = 0;
	
	cin>>N;
	
	for(int i = 1; i <= N; i++){
		cin>>a[i];
		if(a[i] == 2 || a[i] == -2) used[i] = true, con++;
		if(a[i] == -2) num *= -1;
	}
	
	if(num == -1){
		bool flag = false;
		
		for(int i = 1; i <= N; i++){
			if(a[i] == -1){
				used[i] = true;
				flag = true;
				con++;
				break;
			}
		}
		
		if(flag == false){
			
			for(int i = N; i; i--){
				if(a[i] == -2){
					used[i] = false;
					con--;
					break;
				}
			}
			
		}
	}
	
	cout<<con<<endl;
	
	for(int i = 1; i <= N; i++){
		if(used[i])cout<<i<<endl;
	}
	
	return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  
  string s;//[.#]の入力
  vector<char> vec(2500);//vectorに1個ずついれる
  int num=0;//vecの番号指定
  for(int i=0; i<H; i++){
    cin >> s;
    for(int j=0; j<W; j++){//文字列sのj番目をvecに入力
      if(s.at(j)=='.'){
        vec.at(num)='0';
      }
      else if(s.at(j)=='#'){
        vec.at(num)='#';
      }
      num++;
    }
  }
  //数値化(数字から見て、周囲の爆弾をカウント）
  for(int i=0; i<H*W; i++){
    if(vec.at(i)!='#'){
      //1行目でない&&上に爆弾
      if(i>=W && vec.at(i-W)=='#'){
        vec.at(i)++;
      }
      //最終行でない&&下に爆弾
      if(i<=H*W-1-W){
        if(vec.at(i+W)=='#'){
          vec.at(i)++;
        }
      }
      //1列目でない&&左に爆弾
      if(i%W!=0 && vec.at(i-1)=='#'){
        vec.at(i)++;
      }
      //最終列でない&&右に爆弾
      if(i%W!=W-1){
        if(vec.at(i+1)=='#'){
          vec.at(i)++;
        }
      }
      //左上隅(1行1列)でない&&左上に爆弾
      if(i>=W && i%W!=0 && vec.at(i-W-1)=='#'){
        vec.at(i)++;
      }      
      //右上隅でない&&右上に爆弾
      if(i>=W && i%W!=W-1 && vec.at(i-W+1)=='#'){
        vec.at(i)++;
      }        
      //左下隅でない&&左下に爆弾
      if(i<=H*W-1-W && i%W!=0){
        if(vec.at(i+W-1)=='#'){
          vec.at(i)++;
        }
      }
      //右下隅でない&&右下に爆弾
      if(i<=H*W-1-W && i%W!=W-1){
        if(vec.at(i+W+1)=='#'){
          vec.at(i)++;
        }
      }      
    }
  }
  //出力
  for(int i=0; i<H*W; i++){
    if((i+1)%W==0){
      cout << vec.at(i) << endl;
    }
    else{
      cout << vec.at(i);
    }
  }
}


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

int main(){	
	while (1) {
		int m, f, r;
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		if (m == -1 || f == -1 || m + f < 30) {
			cout << "F" << endl;
		}else if(m + f < 50){
			if(r < 50){
				cout << "D" << endl;
			}else {
				cout << "C" << endl;
			}
		}

		else if (m + f < 65) {
			cout << "C" << endl;
		}else if (m + f < 80){
			cout << "B" << endl;
		}else {
			cout << "A" << endl;

		}

	}
}


Measured memory_bytes: 3076
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
	public static void main(String[] args) {
		try {
			int i;
			BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
			ArrayList<Integer> height = new ArrayList<Integer>();
			for(i=0;i<10;i++)height.add(Integer.parseInt(bf.readLine()));
			Collections.sort(height);
			Collections.reverse(height);
			for(i=0;i<3;i++)System.out.println(height.get(i));
		}catch(Exception e){
			System.out.println(e);
		}
	}
}

Measured memory_bytes: 9108
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))

sa=1000
for i in range(0,n):
  sasa=abs(a-(t-0.006*h[i]))
  if sasa<sa:
    sa=sasa
    keep=i
print(keep+1)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
int main(){
  long long N;
  cin >> N;
  vector<long long> b(N);
  long long cnt = 0;
  for(int i = 0; i < N; i++){
    cin >> b[i];
    if(b[i] != i + 1) cnt++;
  }
  if(cnt == 2 || cnt == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
def div(A):
    div_A = []
    for a in A:
        if a % 2 == 1:
            return 0
        else:
            div_A.append(a // 2)
    return div_A


N = int(input())
A = map(int, input().split())

cnt = 0
while True:
    A = div(A)
    if A == 0:
        break
    else:
        cnt += 1

print(cnt)

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

long long int dp[101][100001];

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

Measured memory_bytes: 79104
#include <iostream>
using namespace std;
int main(){
	int n,m,a,b,x=1,y=1;
	cin>>n>>m;
	a=m;
	b=n;
	for(int i=1;i<n;i++){
		x=x*10;
		a+=x*m;
	}
	for(int i=1;i<m;i++){
		y=y*10;
		b+=y*n;
	}
	cout<<max(a,b);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll ans = 0;
    int r = 0, g = 0, b = 0;
    int rg = 0, rb = 0;
    int bg = 0, br = 0;
    int gr = 0, gb = 0;
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (char c : s) {
        r += c == 'R';
        g += c == 'G';
        b += c == 'B';
        if (c == 'R') {
            gr += g;
            br += b;
            ans += bg;
            ans += gb;
        }
        if (c == 'G') {
            rg += r;
            bg += b;
            ans += rb;
            ans += br;
        }
        if (c == 'B') {
            gb += g;
            rb += r;
            ans += rg;
            ans += gr;
        }
    }
    fori (i, 0, s.size()) {
        fori (j, 1, s.size() + 1) {
            int p1 = i;
            int p2 = i + j;
            int p3 = i + j + j;
            if (p3 >= s.size()) break;
            if (s[p1] != s[p2] && s[p1] != s[p3] && s[p2] != s[p3]) {
                ans--;
            }
        }
    }
    cout << ans << endl;
    return 0;
}



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

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

        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] x = new int[N];
        for (int i = 0; i < x.length; ++i) {
            x[i] = sc.nextInt();
        }

        System.out.println(solve(x, X));

        sc.close();
    }

    static int solve(int[] x, int X) {
        return Arrays.stream(x).map(xi -> Math.abs(xi - X)).reduce(Main::gcd).getAsInt();
    }

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

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

bool search(vector<int> v,int a){
  int left=0,right=v.size()-1;
  if(v[right]==a)return true;
  while(left<right){
    int mid=(left+right)/2;
    if(v[mid]==a)return true;
    else if(v[mid]>a)right=mid;
    else left=mid+1;
  }
  return false;
}

int main() {
  int n,q,ans=0;
  cin >> n;
  vector<int> S(n);
  for(int i=0;i<n;i++){
    cin >> S[i];
  }
    cin>>q;
  for(int i=0;i<q;i++){
    int a;
    cin>>a;
    if(search(S,a))ans++;
  }
  cout<<ans<<endl;
    
  return 0;
}
    


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define maxn 100010
typedef long long ll;
typedef long double ld;
const int MAXI=INT_MAX;
const ll MAXL=LLONG_MAX;
int t;
double m,k;
int main(){
    /*freopen("TASK.inp","r",stdin);
      freopen("TASK.out","w",stdout);*/
    ios_base::sync_with_stdio(0);
    ll a,b;
    cin>> a >> b;
    cout << a*b << endl;
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int m = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			if (m == -1 && f == -1 && r == -1) {
				break;
			}
			if (m == -1 || f == -1) {
				System.out.println("F");
			} else if (m + f >= 80) {
				System.out.println("A");
			} else if (m + f >= 65) {
				System.out.println("B");
			} else if (m + f >= 50) {
				System.out.println("C");
			} else if (m + f >= 30) {
				if (r >= 50) {
					System.out.println("C");
				} else {
					System.out.println("D");
				}
			} else {
				System.out.println("F");
			}
		}
	}
}



Measured memory_bytes: 26152
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		int yen = 100000;
		int m;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		
		for(int i=0; i<n; i++){
			//利子計算
			yen *= 1.05;
			//金額を文字列に変換
			String s = Integer.toString(yen);
			//後ろ三桁を抜き出してint型に変換
			m	=	Integer.parseInt(s.substring(s.length()-3));
			//ゼロでなかったら切り上げ
			if(m!=0){
				yen += 1000-m;
			}
		}
		System.out.println(yen);
	}
}

Measured memory_bytes: 12000
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int N;
int main(int argc, char const *argv[]) {
  cin >> N;
  vector<int> x(N);
  vector<int> y(N);
  vector<int> h(N);
  int idx = 0;
  for (size_t i = 0; i < x.size(); i++) {
    cin >> x[i] >> y[i] >> h[i];
    if (h[i] != 0) {
      idx = i;
    }
  }
  int ansx = 0;
  int ansy = 0;
  int ansh = 0;
  for (int c_x = 0; c_x <= 100; c_x++) {
    for (int c_y = 0; c_y <= 100; c_y++) {
      int v = h[idx] + abs(x[idx] - c_x) + abs(y[idx] - c_y);
      bool ok = true;
      for (int i = 0; i < x.size(); i++) {
        if (h[i] != max(v - abs(x[i] - c_x) - abs(y[i] - c_y), 0)) {
          ok = false;
        }
      }
      if (ok) {
        cout << c_x << " " << c_y << " " << v << endl;
        return 0;
      }
    }
  }
}


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

using namespace std;

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

#define F first
#define S second

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a, b;
	cin >> n >> a >> b;
	int dif = b-a;
	if (!(dif&1))
		cout << "Alice\n";
	else
		cout << "Borys\n";
	return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  cout << ceil((a+b)/2.0) << endl;
  
  return 0;
}


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

using namespace std;

int main(){
    string s;
    cin >> s;
    int ramen = 700;
    int egg = 100;
    int roasted = 100;
    int green_onions = 100;
    int result = 700;
    if(s[0] == 'o'){
        result = result + egg;
    }
    if(s[1] == 'o'){
         result = result + roasted;
    }
    if(s[2] == 'o'){
         result = result + green_onions;
    }
    cout << result << endl;
}

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

int main() {
  int a,b;
  cin>>a>>b;
  if((a+b)%2==1){
  cout <<(a+b)/2+1<< endl;
  }
  else{
    cout<<(a+b)/2<<endl;
  }
    
}


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

typedef long long LL;
const int MAXN = 200010;
int head[MAXN], nxt[MAXN << 1], to[MAXN << 1], tot;
void addedge(int b, int e) {
	nxt[++tot] = head[b]; to[head[b] = tot] = e;
	nxt[++tot] = head[e]; to[head[e] = tot] = b;
}
int n;
char buf[MAXN]; int hav[MAXN];
int L[MAXN];
struct node {
	int fir, sec;
	void ins(int x) {
		if (x >= fir) sec = fir, fir = x;
		else sec = std::max(sec, x);
	}
} val[MAXN];
void dfs1(int u, int fa = 0) {
	hav[u] = buf[u] == '1';
	L[u] = hav[u] ? 0 : std::numeric_limits<int>::max();
	for (int i = head[u]; i; i = nxt[i])
		if (to[i] != fa) {
			dfs1(to[i], u);
			hav[u] += hav[to[i]];
			val[u].ins(val[to[i]].fir + 1);
			if (hav[to[i]]) L[u] = std::min(L[u], val[to[i]].fir + 1);
		}
}
long long ans = 1;
void dfs2(int u, int fa = 0, int ma = -1) {
	node tv = val[u]; tv.ins(ma);
	int l = L[u];
	if (hav[1] - hav[u]) l = std::min(l, ma);
	int r = std::min(tv.fir - 1, tv.sec + 1);
	if (l <= r) ans += r - l + 1;
	for (int i = head[u]; i; i = nxt[i]) if (to[i] != fa)
		dfs2(to[i], u, (val[to[i]].fir + 1 == tv.fir ? tv.sec : tv.fir) + 1);
}

int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n;
	for (int i = 1, t1, t2; i < n; ++i)
		std::cin >> t1 >> t2, addedge(t1, t2);
	std::cin >> buf + 1;
	dfs1(1); dfs2(1);
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 17024
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var XY = Sarray();
            var X = XY[0];
            var Y = XY[1];
            if ((X + Y) % 3 != 0)
            {
                WriteLine(0);
                return;
            }
            var n = (X + Y) / 3;
            var i = 2 * n - X;
            var cmb = new Combination(n, Mod);
            var ans = cmb.com((int)n, (int)i);
            WriteLine(ans);
            //Out.Flush();
        }

        public class Combination
        {
            readonly long mod;
            readonly long[] fac, finv, inv;
            public Combination(long n, long mod = 1000000007)
            {
                long max = n + 1;
                this.mod = mod;
                fac = new long[max];
                finv = new long[max];
                inv = new long[max];
                fac[0] = fac[1] = 1;
                finv[0] = finv[1] = 1;
                inv[1] = 1;
                for (int i = 2; i < max; ++i)
                {
                    fac[i] = fac[i - 1] * i % mod;
                    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                    finv[i] = finv[i - 1] * inv[i] % mod;
                }
            }
            public long com(int n, int k)
            {
                if (n < k) return 0;
                if (n < 0 | k < 0) return 0;
                return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
            }
        }
    }
}

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

using namespace std;
using ll = long long;
using ld = long double;

void solve() {
  int n, a, b;
  cin >> n >> a >> b;

  cout << min(n * a, b) << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 3588
# C
N, M = map(int, input().split())
lst = [list(input().split()) for i in range(M)]
ans = [[0,0] for i in range(N)]
for i in lst:
  if (i[1] == 'WA'):
    if (ans[int(i[0])-1][1] != 1):
      ans[int(i[0])-1][0] += 1
  else:
    if (ans[int(i[0])-1][1] == 0):
      ans[int(i[0])-1][1] += 1
ac = 0
wa = 0
for i in ans:
  if (i[1] == 1):
    ac += 1
    wa += i[0]
print(ac, wa)

Measured memory_bytes: 80344
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <utility>

#include <cassert>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define FOR(i,a,b) for(ll i=(a); i < (b); i++)
#define RFOR(i,a,b) for(ll i=(b)-1; i >= (a); i--)
#define rep(i,n) FOR(i,0,(n))
#define rrep(i,n) RFOR(i,0,(n))

int main() {
	string a, b = "1974";
	rep(i,4) {
		int c; cin >> c;
		a += '0'+c;
	}
	sort(all(a));
	sort(all(b));
	if(a == b)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}


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

int main(void)
{
	int n;
	
	while (scanf("%d", &n), n != -1){
		double x, y;
		double angle;
		
		for (x = y = angle = 0; n > 0; n--){
			x += cos(angle);
			y += sin(angle);
			angle = atan2(y, x) + M_PI / 2;
		}
		printf("%.2f\n%.2f\n", x, y);
	}
	return 0;
}

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

int main()
{
    int n, d, x;
    cin >> n >> d >> x;
    vector<int> a(n);
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    for (int i = 0; i <= 101; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (1 + a.at(j) * i <= d)
            {
                count++;
            }
        }
    }
    cout<<count+x<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;

int main() {
	int x;
	cin >> x;
	if (x == 3 || x == 5 || x == 7) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
using namespace std;
int main() {
	string s;
	int n = 0;
	cin >> s;
	for (int i = 0; i < 3;i++) {
		if (s[i] == '1') {
			n++;
		}
	}
	cout << n;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5+7;



int R[MAXN];
int valid[MAXN];

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


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

    set< int >endPoints;
    multiset< int >options;
    for (int i = 1; i <= W+1; i++) {
        endPoints.insert(i);
        R[i] = i;
        valid[i] = 1;
        options.insert(i-R[i]);
    }

    for (int i = 1; i <= H; i++) {
        int A, B;
        cin >> A >> B;

        vector< int >inside;
        {
            auto it = endPoints.lower_bound(A);
            while (*it <= B) {
                inside.push_back(*it);
                it = endPoints.erase(it);
            }
        }

//        cout << "inside :";
        for (int x : inside) {
//            cout << " " << x;
            assert(valid[x]);
            options.erase(options.find(x-R[x]));
            valid[x] = 0;
        }
//        cout << endl;

        if (!inside.empty() && valid[B+1] == 0) {
            valid[B+1] = 1;
            R[B+1] = R[inside.back()];
            options.insert(B+1-R[B+1]);
            endPoints.insert(B+1);
        }

//        cout << "endPoints :";
//        for (int x : endPoints) cout << " " << x;
//        cout << endl;

//        cout << "options :";
//        for (int x : options) cout << " " << x;
//        cout << endl;

        int ans = -1;
        if (options.size() > 1) {
            ans = i+*next(options.begin());
        }

        cout << ans << "\n";
    }


    return 0;
}


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n;
    cin >> n;

    vector<int> v(n);
    priority_queue<double, vector<double> , greater<>> pq;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        pq.push(v[i]);
    }
    while (pq.size() >= 2) {
        double a = pq.top();
        pq.pop();

        double b = pq.top();
        pq.pop();

        pq.push((a + b) / 2.0);
    }

    cout << setprecision(6) << fixed << pq.top() << endl;
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

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

#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

ll gcd(ll x,ll y)
{
	if(x==0) return y;
	return gcd(y%x,x);
}
int a,b;
signed main(){
    cin.tie(0);
	ios::sync_with_stdio(false);
    cin>>a>>b;
    cout<<gcd(a,b)<<endl;
    
    
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 3164
import java.util.*

open class MainKt {
    companion object Static {
        @JvmStatic
        fun main(args: Array<String> = arrayOf()) {
            MainKt().solve()
        }
    }

    val scanner = Scanner(System.`in`)

    fun printf(pattern: String, vararg args: Any): Unit {
        println(String.format(pattern, *args))
    }

    open fun println(line: String) {
        kotlin.io.println(line)
    }

    fun println(line: Int) {
        println(line.toString())
    }

    fun println(line: Long) {
        println(line.toString())
    }

    open fun readLine(): String {
        return scanner.nextLine()
    }

    fun readArg(): String {
        return readLine()
    }

    fun readInt(): Int {
        return readArg().toInt()
    }

    fun readLong(): Long {
        return readArg().toLong()
    }

    fun readIntList(): List<Int> {
        return readArgList().map { it.toInt() }
    }

    fun readLongList(): List<Long> {
        return readArgList().map { it.toLong() }
    }

    fun readArgList(): List<String> {
        return readLine().split(" ")
    }

    fun solve(): Unit {
        var s = readArg()
        outer@ for (i in (s.length - 1) / 2 downTo 1)  {
            inner@ for (j in 0..(i - 1)) {
                if (s[j] != s[j + i])
                    continue@outer
            }
            println(i * 2)
            return
        }
    }
}

Measured memory_bytes: 31388
a=list(input())
b=list(input())
c=list(input())
#print(a,b,c)


card=a.pop(0)
#print(card)
flag=0
for i in range(301):
    if card=='a' and len(a)==0 and flag==0:
        ans='A'
        flag=1
    elif card=='b' and len(b)==0 and flag==0:
        ans='B'
        flag=1
    elif card=='c' and len(c)==0 and flag==0:
        ans='C'
        flag=1
    elif flag==0:
        if card=='a':
            card=a.pop(0)
        elif card=='b':
            card=b.pop(0)
        elif card=='c':
            card=c.pop(0)
    
print(ans)

Measured memory_bytes: 3064