akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.List;
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();
		List<Integer> ai = new ArrayList<>();

		for (int i=0; i<n; i++) {
			ai.add(sc.nextInt());
		}

		int count = 0;
		for(int j=0; j<n; j++) {
			int min = 1000000001;
			int tmp = 0;
			for (int i=0; i<ai.size(); i++) {
				if (ai.get(i) < min) {
					min = ai.get(i);
					tmp = i;
				}
			}
			x = x - min;
			if (x < 0) {
				break;
			} else if (x == 0) {
				count++;
				break;
			} else {
				count++;
				ai.remove(tmp);
			}
		}

		if (0 < x) {
			System.out.println(count-1);
		} else {
			System.out.println(count);
		}

		sc.close();
	}

}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int h1, h2;
  int k1, k2;
  int a, b, c, d;
  cin >> h1 >> h2;
  cin >> k1 >> k2;
  cin >> a >> b >> c >> d;
  int h = a * h1 + b * h2 + c * (h1 / 10) + d * (h2 / 20);
  int k = a * k1 + b * k2 + c * (k1 / 10) + d * (k2 / 20);
  cout << (h > k ? "hiroshi" : h < k ? "kenjiro" : "even") << endl;

  return 0;
}


Measured memory_bytes: 3144
#include<cstdio>
#include<iostream>
using namespace std;
long long int n,a,b,now=1;
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>a>>b;
	if(a+b>(n+1)||a*b<n) cout<<"-1";
	else{
		long long int k=n-a+1;
		for(int i=k;i<=n;++i){
			cout<<i<<" ";
			for(int j=now+b-2;j>=now;--j){
				if(j>=k) j=k-1;
				if(j<now) break;
				cout<<j<<" ";
			}
			now=now+b-1;
		}
	}
	return 0;
}

Measured memory_bytes: 2176
#include<stdio.h>
#include<math.h>
int main(){
int n,m;
int tn,tm,ts,x;
tn=100;
tm=1900;
scanf("%d %d",&n,&m);
ts=1900*m+100*(n-m);
x=ts*pow(2,m);
printf("%d\n",x);
}

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

#define ll long long
#define pb push_back

using namespace std;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;

const int mod = 1e9 + 7;

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

    string s, t;
    cin >> s >> t;

    int l = t.length();
    int n = s.length();
    int m = INT_MAX;

    for(int i = 0; i < (n-l+1); i++){
        string temp = s.substr(i, l);
        int c = 0;
        for(int j = 0; j < l; j++){
            if(temp[j] != t[j]) c++;
        }

        m = min(m, c);
    }

    cout << m;

    return 0;
}


Measured memory_bytes: 3636
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000009
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

// 参考 ↓の②（多分公式解説のやり方）
// https://drken1215.hatenablog.com/entry/2020/04/22/002100

func main() {
	N := nextInt()
	X := nextInt() - 1
	Y := nextInt() - 1
	ans := make([]int, N)
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			d := MinOf(abs(i-j), abs(i-X)+abs(j-Y)+1, abs(i-Y)+abs(j-X)+1)
			ans[d]++
		}
	}
	for i := 1; i < N; i++ {
		fmt.Println(ans[i])
	}
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}


Measured memory_bytes: 33432
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;


int main() {
	int a, b;
	int k;
	cin >> a >> b;
	int c = 0;
	k = b;
	while (b > 0) {
		c += 1;
		b /= 10;

	}
	k += a *pow(10,c);
	if (int(sqrt(k))== sqrt(k))cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MAXN 300005
#define MOD 1000000007
using namespace std;

typedef long long LL;
int N;
LL A[MAXN];

int main () {
  scanf("%d",&N);
  for (int i=0;i<N;++i) scanf("%lld",&A[i]);
  LL ans = 0;
  for (int z=0;z<60;++z) {
    LL t = 0;
    for (int i=0;i<N;++i) t += (A[i]&(1ll<<z)) > 0;
    t = (t * (N - t)) % MOD;
    LL v = (1ll<<z) % MOD;
    ans = (ans + t * v) % MOD;
  }
  printf("%lld\n",ans);
}


Measured memory_bytes: 2560
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int max = A + B;
    max = Math.max(max, A - B);
    max = Math.max(max, A * B);
    System.out.println(max);
  }
}

Measured memory_bytes: 21716
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;

int main(){
  int n, d;
  cin >> n >> d;
  int x = 1 + 2 * d;
  int ans = n / x;
  if (n % x == 0){
    cout << ans << "\n";
  }else {
    cout << ans + 1 << "\n";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int a[9], h;
int main(){
	for(int i = 1; i <= 5; i++){
		cin >> a[i];
	}
	for(int i = 1; i <= 4; i++){
		for(int u = 5; u > i; u--){
			if(a[u] > a[u-1]){
				h = a[u];
				a[u] = a[u-1];
				a[u-1] = h;
			}
		}
	}
	for(int i = 1; i <= 5; i++){
		if(i == 5)
			cout << a[i] << "\n";
		else
			cout << a[i] << " ";
	}
	return 0;
}

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

using namespace std;

int main() {
	int n, a, b, x = 0, y = 0, z = 0;
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		int p;
		cin >> p;
		if (p > b) x++;
		else if (p > a) y++;
		else z++;
	}
	cout << min(min(x, y), z) << endl;
	return 0;
}


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

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main(){
    ll n,m;
    cin >> n >> m;
    UnionFind tree(n);
    ll ans=n-1;
    for(ll i=0;i<m;i++){
        ll a,b;
        cin >> a >> b;
        a--; b--;
        if(!tree.issame(a,b)){
            tree.merge(a,b);
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}  


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

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

const int Maxn = 200005;

int n, H, W;
int R[Maxn], C[Maxn], A[Maxn];
int seq[Maxn];
int par[Maxn], siz[Maxn];
bool ful[Maxn];
ll res;

bool Less(const int &a, const int &b) { return A[a] > A[b]; }

int getPar(int x) { return par[x] == x? x: par[x] = getPar(par[x]); }

bool unionSet(int a, int b)
{
    a = getPar(a), b = getPar(b);
    if (a == b)
        if (ful[a]) return false;
        else { ful[a] = true; return true; }
    else {
        if (siz[a] < siz[b]) swap(a, b);
        siz[a] += siz[b]; par[b] = a;
        if (ful[a] && ful[b]) return false;
        ful[a] |= ful[b];
        return true;
    }
}

int main()
{
    scanf("%d %d %d", &n, &H, &W);
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d", &R[i], &C[i], &A[i]);
        seq[i] = i;
    }
    sort(seq, seq + n, Less);
    for (int i = 1; i <= H + W; i++) {
        par[i] = i, siz[i] = 1, ful[i] = false;
    }
    for (int i = 0; i < n; i++) {
        int ind = seq[i];
        if (unionSet(R[ind], H + C[ind]))
            res += A[ind];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4736
#include <iostream>

int main()
{
        double n, count = 0;

        std::cin >> n;

        for (int i = 1; i <= n; i++) {
                if (i % 2 == 1) {
                        count++;
                }
        }

        std::cout << count/n << std::endl;

        return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    char a[3];
    char b[3];
    scanf("%s",a);
    scanf("%s",b);
    if(a[0]==b[2] && a[1]==b[1] && a[2]==b[0]){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var n, x, t, res int
	fmt.Scanf("%d %d %d", &n, &x, &t)
	kai := n / x
	ama := n % x
	res = t * kai
	if ama > 0 {
		res = res + t
	}
	fmt.Println(res)
}

Measured memory_bytes: 1832
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> heights(N);
    rep(i,N) {
        cin >> heights[i];
    }
    vector<ll> G(N,0);
    rep(i,M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a] = max(G[a], heights[b]);
        G[b] = max(G[b], heights[a]);
    }
    int ans = 0;
    rep(i,N) {
        if (heights[i] > G[i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4444
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int a,b,h;
  cin >> a >> b >>h;
  co((a+b)*h/2);
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
using namespace std;
const int maxn = 1e6+10;
int save[maxn];
int main(){
    long long n;
    int m, a;
    cin>>n>>m;
    for(int i=0; i<m; i++){
        cin>>a;
        n -= a;
    }
    if(n<0){
        printf("-1\n");
    }else{
        printf("%lld\n", n);
    }
    return 0;
}


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

int main(){
    int n,m;
    cin >> n>> m;
    vector<int>l(m);
    vector<int>r(m);
    for(int i=0;i<m;i++){
        cin >> l[i] >> r[i];
    }
    int a=l[0],b=r[0];
    for(int i=1;i<m;i++){
        a = max(a,l[i]);
        b = min(b,r[i]);
    }
    int ans = min(b - a + 1,n);
    cout << max(ans,0) << endl;
}


Measured memory_bytes: 1152
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
h, w, k = map(int, input().split())

c = [input() for _ in range(h)]
ret = 0
for i_s in range(2 ** h):
    for j_s in range(2 ** w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (i_s >> i)&1 == 1:
                    continue
                if (j_s >> j)&1 == 1:
                    continue
                if c[i][j] == "#":
                    black += 1
        
        if black == k:
            ret += 1

print(ret)



Measured memory_bytes: 9136
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int main() {
  int n;
  S(n);
  int p = (n + 999) / 1000;
  P(p * 1000 - n);
  return 0;
}


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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;
#define int long long



const int INF = 1000000007;
const int MOD = 998244353;

int bit[200005];
int n, k;
void upd(int x, int val)
{
    for(; x <= n; x += x&-x)
    {
        bit[x] = (bit[x] + val) % MOD;
    }
}

int get(int x)
{
    int res = 0;
    for(; x>0; x -= x&-x)
    {
        res = (res + bit[x]) % MOD;
    }
    return res;
}
void solve_test()
{
    cin >> n >> k;
    upd(1, 1);
    vector<pair<int, int>> v;
    for(int i=0; i<k; i++)
    {
        int l, r;
        cin >> l >> r;
        v.PB({l, r});
    }
    sort(v.begin(), v.end());
    for(int i=2; i<=n; i++)
    {
        int lo = 0, hi = 0;
        for(int j=0; j<k; j++)
        {
            lo = v[j].f;
            hi = v[j].s;
            if(lo >= i)
                break;
//            what_is(lo);
//            what_is(hi);
            hi = min(i-1, hi);
            int res = (MOD + get(i - lo) - get(i - hi - 1)) % MOD;
            upd(i, res);
        }
       //cout << i << " " << get(i) << "\n";
    }
    cout << (MOD + get(n) - get(n-1)) % MOD << "\n";

}

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tests;
    tests = 1;
    //cin >> tests;
    while(tests--)
    {
        solve_test();
    }
    return 0;
}


Measured memory_bytes: 5176
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
map<int,int>mp;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,L,N,M,K,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> S;
  if(S=="ABC")Out("ARC");
  else Out("ABC");
}

Measured memory_bytes: 3652
#include<stdio.h>
int main(void)
{
	int x,y;
	scanf("%d %d",&x,&y);
	if(x==2 || y==2){
		printf("No\n");
	}
	else if((x==4 || x==6 || x==9 || x==11)&&(y==4 || y==6 || y==9 || y==11)){
		printf("Yes\n");
	}
	else if((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12)){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  cin>>a>>b;
  if(a>b){
    if(a-1>b)
      cout<<a*2-1<<endl;
    else
      cout<<a+b<<endl;
  }
    else{
    if(b-1>a)
      cout<<b*2-1<<endl;
    else
      cout<<a+b<<endl;
  }
}
    

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

#define IO std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL);
#define FIN freopen("entrada.in", "r", stdin);
#define FOUT freopen("saida.sol", "w", stdout);

#define ull unsigned long long
#define ll long long
#define pii pair<int, int>
#define pb push_back
#define MAX int(50000)+10

const int INF = 0x3f3f3f3f;
using namespace std;

int main() {

    IO

    ll a, v, b, w, k, x, y;
    cin >> a >> v >> b >> w >> k;
    x = abs(a - b), y = (v - w) * k;
    cout << (x <= y ? "YES\n" : "NO\n");

    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define eps 1.0e18
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define memset(x,y) memset(x,y,sizeof(x))
#define lson i << 1,l,m
#define rson i << 1 | 1,m + 1,r
#define ll long long
using namespace std;
int a[5][5];
int b[105]={0};
int main(){
	ios::sync_with_stdio(false);
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++)
			cin>>a[i][j];
	}
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		b[x]=1; 
	}
	int f=0;
	for(int i=1;i<=3;i++){
		if(b[a[i][1]]&&b[a[i][2]]&&b[a[i][3]])
			f=1;
	}
	for(int i=1;i<=3;i++){
		if(b[a[1][i]]&&b[a[2][i]]&&b[a[3][i]])
			f=1;
	}
	if(b[a[3][1]]&&b[a[2][2]]&&b[a[1][3]]){
		f=1;
	}
	if(b[a[1][1]]&&b[a[2][2]]&&b[a[3][3]]){
		f=1;
	}
	if(f) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);

#define nl "\n"
#define fr first
#define sc second
#define MP make_pair
#define pb push_back
#define VI vector<int>
#define VII vector<ll>
#define MAP map <int,int>
#define PI pair < int , int >
#define sz(v) (int)(v).size()
#define all(v) v.begin(),v.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define precise(n) fixed(cout);cout<<setprecision(n)

const int N = (int)4e7;
const int MOD = (int)1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

typedef long long ll;
typedef double db;

using namespace std;

int main()
{
    io;
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);

    ///Let the showdown begin


    string s;
    cin >> s;

    if(s[sz(s)-1]=='s')
        cout << s << "es" << nl;
    else
        cout << s << "s" << nl;

    ///Happily DONE

    return 0;
}

Measured memory_bytes: 3644
n = int(input())

d = 2
ans = 0

while d * d <= n:
    if n % d != 0:
        d += 1
        continue

    z = d
    
    while n % z == 0:
        n //= z
        z *= d
        ans += 1

    while n % d == 0:
        n //= d

if n != 1:
    ans += 1

print(ans)


Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  ll a;
  cin >> a;
  string s;
  cin >> s;
  if(a>=3200) cout << s << endl;
  else cout << "red" << endl;
  



  
  return 0;
    

}


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

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

  int a, b;
  cin >> a >> b;

  if (a * b % 2) cout << "Odd\n";
  else cout << "Even\n";

  return (0);
}


Measured memory_bytes: 3640
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi //cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
//#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define ins insert
#define aer(v) (v).erase((v).begin(),(v).end()) 

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int a,b,c,n,m,k;
string s;

main(){
	cin>>a>>b>>c;
	dump(min(c,b/a));
}





Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
int main(){
 int64_t N;
  cin>>N;
  map<int64_t,int64_t>M;
  for(int64_t i=1;i<=N;i++){
    int64_t a; cin>>a;
    M[a]=i;
  }set<int64_t>S;set<int64_t>S1;
  S.insert(0);S.insert(N+1);
  S1.insert(0);S1.insert(-N-1);
  int64_t ans=0;
  for(auto p:M){
  auto k=p.first;
    auto v=p.second;
    auto x=S.upper_bound(v);
    int64_t r=*x-v;
    S.insert(v);
    v*=-1;
    auto y=S1.upper_bound(v);
    int64_t l=*y-v;
    S1.insert(v);
    ans+=k*r*l;
  
  }cout<<ans<<endl;
 
  return 0;
}

Measured memory_bytes: 34832
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

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

typedef long long ll;

struct edge {
	int to;
	ll cost;
};

vector<edge> graph[100010];
int color[100010];

void Main()
{
	int N; cin >> N;
	rep(i,N - 1) {
		int u, v;
		ll w;
		cin >> u >> v >> w;
		--u, --v;
		graph[u].push_back({v,w});
		if (u != v) {
			graph[v].push_back({u,w});
		}
	}

	memset(color, -1, sizeof(color));
	color[0] = 0;
	queue<int> q;
	q.push(0);
	while (!q.empty()) {
		auto idx = q.front(); q.pop();
		for (auto e : graph[idx]) {
			if (color[e.to] != -1) continue;
			if (e.cost % 2 == 0) {
				color[e.to] = color[idx];
				q.push(e.to);
			} else {
				color[e.to] = (color[idx] + 1) % 2;
				q.push(e.to);
			}
		}
	}
	rep(i,N) {
		cout << color[i] << endl;
	}
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


Measured memory_bytes: 8320
#define _USE_MATH_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

int main() {
    int N;
    cin >> N;
    set<int>st;
    for (int i = 0; i < N; i++) {
        int d;
        cin >> d;
        st.insert(d);
    }

    cout << st.size()<< endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1e9 + 7;
const int oo = 2e9;
const ld PI = acos((ld) -1);
int Getbit(ll x, int k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
int a[N];

void Solve(){
    string s;
    cin >> s;
    for(int i = 0; i < Sz(s); i++) cout << 'x';
}


int main(){
    Speed;
    cout << fixed << setprecision(10);
    int query = 1;
//    cin >> query;
    while(query--) Solve();
}


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

void solve(){
    int a,b;
    cin >> a >> b;
    if(a<=b) print(a);
    else print(a-1);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int gcd(int, int);

int gcd(int i, int j){
    int x, y, z;
    if(i < j){y = i; x = j;}
    else{x = i; y =j;}
    
    while(x%y){
        z = x%y;
        x = y;
        y = z;
    }
    return y;
}

int main(void){
    long long a, b, c, d;
    cin >> a >> b >> c >>d;
    
    long long qc1 = (a+c-1)/c;
    long long qc2 = b/c;
    long long qd1 = (a+d-1)/d;
    long long qd2 = b/d;
    
    long long g = (d*c)/gcd(c,d);
    long long qg1 = (a+g-1)/g;
    long long qg2 = b/g;
    
    long long ans = b - a + 1 + qc1 - qc2 - 1 + qd1 - qd2 -1 - qg1 + qg2 +1;
    
    cout << ans << endl;
    return 0;
}

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

int main(){
    char ch;
    
    
    while(1){
        scanf("%c", &ch);
        if(isalpha(ch)) {
            if(islower(ch)) printf("%c", toupper(ch));
            else printf("%c", tolower(ch));
        }else printf("%c", ch);
        
        if (ch=='\n') break;
        }
    
    return 0;
}

Measured memory_bytes: 3088
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        int n = s.length();

        int mod = (int) 1e9 + 7;

        long[][] dp = new long[n + 1][13];
        dp[0][0] = 1;
        int f = 1;
        for (int i = 0; i < n; i++) {
            char c = s.charAt(n - i - 1);
            if (c == '?') {
                for (int j = 0; j < 13; j++) {
                    for (int d = 0; d < 10; d++) {
                        dp[i + 1][(j + f * d) % 13] += dp[i][j];
                        dp[i + 1][(j + f * d) % 13] %= mod;
                    }
                }
            } else {
                int d = c - '0';
                for (int j = 0; j < 13; j++) {
                    dp[i + 1][(j + f * d) % 13] += dp[i][j];
                    dp[i + 1][(j + f * d) % 13] %= mod;
                }
            }
            f *= 10;
            f %= 13;
        }
        System.out.println(dp[n][5]);
    }

}


Measured memory_bytes: 35132
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	long long k;
	cin >> s >> k;
	int num_of_1 = 0;
	while(s[num_of_1] == '1') num_of_1++;
	if(k<=num_of_1) cout << 1 << endl;
	else cout << s[num_of_1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define re register int
using namespace std;
int h,w;
char paint[105][105];
int main()
{
    cin>>h>>w;
    for(re i=1;i<=h;i++)
    {
        for(re j=1;j<=w;j++)
            cin>>paint[i][j];
        for(re times=1;times<=2;times++)
        { 
            for(re x=1;x<=w;x++)
                cout<<paint[i][x];
            cout<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static long mod = 1_000_000_007;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt(), K = in.nextInt();
		int a[] = new int[N + 1];
		for ( int i = 1; i <= N; i++ ) {
			a[i] = in.nextInt();
		}
		in.close();

		long dp[][] = new long[N + 1][K + 1];
		for ( int n = 0; n <= N; n++ ) {
			dp[n][0] = 1;
		}

		for ( int n = 1; n <= N; n++ ) {
			for ( int k = 1; k <= K; k++ ) {
				dp[n][k] = (dp[n][k - 1] + dp[n - 1][k]) % mod;

				if ( a[n] < k ) {
					dp[n][k] = (dp[n][k - 1] + dp[n - 1][k] - dp[n - 1][k - a[n] - 1]) % mod;

				}
			}
		}
		System.out.println((dp[N][K] + mod) % mod);
	}
}


Measured memory_bytes: 129108
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    string s;
    scanf("%d%d",&n,&k);
    cin >> s;
    vector<int> v;
    for (int i = 0; i <= n; i++){
        if (s[i] == '0'){
            v.push_back(i);
        }
    }
    int cur = n;
    vector<int> ans;
    while (cur){
        int newpos = *lower_bound(v.begin(),v.end(),cur-k);
        if (newpos == cur){
            printf("-1");
            return 0;
        }
        ans.push_back(cur-newpos);

        cur = newpos;
    }
    reverse(ans.begin(),ans.end());
    for (auto x : ans){
        printf("%d ",x);
    }

}


Measured memory_bytes: 1592
#include<bits/stdc++.h>
using namespace std;
typedef long long int ULL;
int main(){
	ULL n;cin>>n;
	ULL arr[n];
	for(int i = 0 ; i < n ; i++) cin>>arr[i];
	ULL ans = 0;
	for(int i = 0 ; i < n - 1; i++){
		for(int j = i + 1 ; j < n ; j++){
		    ans+= arr[i]*arr[j];
		}
	}
	cout<<ans;
	
}

Measured memory_bytes: 256
#include<iostream>
#include<limits.h>
using namespace std;

int main(){
    long min=1000000,max=-1000000,sum=0,n;
    int k;
    cin >> k;
    
    for(int i=0;i<k;i++){
        cin >> n;
        if(n<min){min=n;}
        if(n>max){max=n;}
        sum += n;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}


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

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

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

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? " " : "");
    outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

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

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? "\n" : "");
    outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
    cout << head;
    outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

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

    var(int, N);

    vector<pii> r;
    rep(i, N) {
        var(int, a, b);
        r.emplace_back(b, a);
    }

    vector<pii> b(N);
    rep(i, N) input(b[i].first, b[i].second);

    sort(all(r), greater<>());
    sort(all(b));

    i64 res = 0;
    map<pii, bool> checked;
    rep(i, N) rep(j, N) {
        if (!checked[r[j]] && r[j].second < b[i].first && r[j].first < b[i].second) {
            ++res;
            checked[r[j]] = true;
            break;
        }
    }

    outl(res);

    return 0;
}


Measured memory_bytes: 256
let n, m, s, t = Scanf.scanf "%d %d %s %s" @@ fun a b c d -> a, b, c, d
let rec f a b = if b = 0 then a else f b (a mod b)
let rec g a b = a / f a b * b
let l = g n m
let n', m' = l / n, l / m
let l', i = g n' m', ref 0
let _ = while !i * l'/n' < n && !i * l'/m' < m do if s.[!i * l'/n'] <> t.[!i * l'/m'] then (print_endline "-1"; exit 0); incr i done; Printf.printf "%d\n" l

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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)
// ----------------------------------------------------------------------

vector<int> zAlg(string s) {
  int n = s.size();
  vector<int> z(n);
  z.at(0) = n;
  int i = 1;
  int j = 0;
  while (i < n) {
    for ( ; i+j < n && s.at(j) == s.at(i+j); j++) {}
    z.at(i++) = j;
    if (j > 0) {
      for (int k = 1; i < n && z.at(k) < j-1; k++, j--, i++) z.at(i) = z.at(k);
      j--;
    }
  }
  return z;
}

// ----------------------------------------------------------------------
int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    string si = S.substr(i, N-i);
    auto vec = zAlg(si);
    for (int j = 1; j < N-i; j++) {
      ans = max(ans, min(j, vec.at(j)));
    }
  }
  cout << ans << endl;

  return 0;
}



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

void solve () {
    int n;
    cin >> n;
    map<string, int> mp;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for (auto p : mp) {
        mx = max (p.second, mx);
    }



    for (auto p : mp) {
        if (p.second == mx) {
            cout << p.first << "\n";
        }
    }

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


Measured memory_bytes: 19280
def f(y,x,c0):
  global A,M
  M.append([y,x])
  while M:
    y,x=M.pop()
    if A[y][x]==c0:
      A[y][x]='X'
      for dy,dx in [[0,-1],[0,1],[-1,0],[1,0]]:
        M.append([y+dy,x+dx])
  return 1

M=[]
while 1:
  H,W=map(int,raw_input().split())
  if H==W==0: break
  A=[['X' for _ in range(W+2)] for _ in range(H+2)]
  for i in range(H):
    A[i+1][1:W+1]=list(raw_input())
  c=0
  for i in range(1,H+1):
    for j in range(1,W+1):
      c0=A[i][j]
      if c0!='X': c+=f(i,j,c0)
  print c

Measured memory_bytes: 7136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long x = sc.nextLong();
		Long a500 = x / 500;
		Long aamari = x - a500 * 500;
		Long a5 = aamari / 5;
		Long kotae = (a500 * 1000) + (a5 * 5);

		System.out.println(kotae);

		sc.close();
	}

}

Measured memory_bytes: 19796
#include <queue>
#include <iostream>
#include <algorithm>
#define ll long long
#define INF 100000000000000
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  ll V, E, r;
  cin >> V >> E >> r;
  vector< vector< pair<ll, ll> > > edges(V);
  vector<ll> dist(V, INF);
  for(ll i = 0; i < E; i++){
    ll s, t, d;
    cin >> s >> t >> d;
    edges[s].push_back(make_pair(t,d));
  }
  dist[r] = 0;
  priority_queue< pair<ll, ll>, vector< pair<ll,ll> >, greater< pair<ll,ll> > > pq;
  pq.push(make_pair(0, r));
  while(!pq.empty()){
    ll source = pq.top().second;
    pq.pop();
    for(auto i : edges[source]){
      if(dist[i.first] == INF || dist[source] + i.second < dist[i.first]){
	dist[i.first] = dist[source] + i.second;
	pq.push(make_pair(dist[i.first], i.first));
      }
    }
  }
  for(ll i = 0; i < V; i++){
    if(dist[i] == INF)
      cout << "INF" <<endl;
    else
      cout << dist[i] << endl;
  }
} 

Measured memory_bytes: 19308
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int A[] = new int[N];
        int B[] = new int[N-1];
        for (int i=0; i<N; i++)
            A[i] = 100_000;
        for (int i=0; i<N-1; i++) {
            B[i] = Integer.parseInt(sc.next());
            if (B[i]<A[i])
                A[i] = B[i];
            if (B[i]<A[i+1])
                A[i+1] = B[i];
        }
        sc.close();

        int sum = Arrays.stream(A).sum();

        PrintWriter out = new PrintWriter(System.out);
        out.println(sum);
        out.flush();
    }
}

Measured memory_bytes: 26580
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <algorithm>
#include <queue>
#include <tuple>

using namespace std;

#define INT_MAX 2147483647
typedef long long ll;

ll gcd(ll m, ll n);
ll lcm(ll m, ll n);

int main(void) {

	int ans = 0;

	int a, b;
	cin >> a >> b;

	ans = max({ (a - b), (a + b), (a*b) });

	cout << ans << endl;	

	return 0;

}

// 2番目から3要素だけ抜き出した部分文字列を取得する
//std::string result = s.substr(2, 3);  
#if 1
//最大公倍数
ll gcd(ll m, ll n)
{
	ll temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
#endif

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int> >;
using vii = vector<pair<int, int> >;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

	int cnt2 = 0;
	int cnt4 = 0;
	int cnt6 = 0;
	rep(i, n) {
		cin >> a[i];
		if (a[i] % 4 == 0) ++cnt4;
		else if (a[i] % 2 == 0) ++cnt2;
	}

	int len = a.size();

	if (cnt2 >= 2) {
		len -= (cnt2 / 2) * 2;
		if (len <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	if (len / 2 <= cnt4) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#define lli long long int

using namespace std;

int main()
{
  lli n, m, s, t, v;

  while(cin>>n && n){
    lli a[1000001];
    for(lli i = 0; i < n; i++){
      cin >> a[i];
    }
    sort(a, a+n);
    v = a[0];
    m = 1;
    for(lli i = 1; i < n; i++){
      if(v == a[i]){
	m++;
	if(m > n/2){
	  break;
	}
      } else {
	m = 1;
	v = a[i];
      }
    }

    if(m > n/2){
      cout << v << endl;
    } else {
      cout << "NO COLOR" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 8680
#include<stdio.h>
int main(){
   int x[5];
   for(int i=0;i<5;i++){
      scanf("%d",&x[i]);

  
   }




      for(int i=0;i<5;i++){


      if(x[i]==0){
         printf("%d",i+1);
      }
      }

   
   return 0;
}


Measured memory_bytes: 1728
n = int(input())
al = list(map(int,input().split()))

from collections import defaultdict
dic = defaultdict(int)  

for a in al:
    dic[a] += 1

ans = 0
for n,m in dic.items():
    if n > m:
        ans += m
    else:
        ans += m - n

print(ans)

Measured memory_bytes: 68904
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define pb push_back
#define vi vector<int >
#define vii vector < pair<int ,int > >
#define IO ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define IOfiles freopen("input.txt","r+",stdin) ; freopen("output.txt","w+",stdout)
#define PI 3.14159265
const long long mod = 1e9 + 7LL;
typedef long long ll;
typedef pair<int, int> ii;
typedef double db;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;}
ll pwr(ll x , ll n) { ll ans = 1; while (n) {ans *= x; n--;} return ans;}

void solve(){
    
}

int main()
{
    IO;
    ll x;
    cin>>x;
    ll tmp=100LL;
    ll cpt=0;
    while(tmp<x){
        cpt++;
        tmp+=(tmp/100);
    }  
    cout<<cpt<<endl;  
}

Measured memory_bytes: 3648
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():

    class BinaryIndexedTree():
        def __init__(self, n):
            self.n = n
            self.bit = [0]*(n+1)

        def add(self, item, pos):
            index = pos
            while index < self.n+1:
                self.bit[index] += item
                index += index & (-index)

        def sum(self, pos):
            ret = 0
            index = pos
            while index > 0:
                ret += self.bit[index]
                index -= index & -index
            return ret

    N = int(input())
    S = list(input())
    Q = int(input())
    Query = [input().split() for _ in range(Q)] 

    pos_bit_list = [BinaryIndexedTree(len(S)) for _ in range(26)]

    for i, c in enumerate(S):
        pos_bit_list[ord(c)-ord('a')].add(1, i+1)

    for q in Query:
        if q[0] == '1':
            pos_bit_list[ord(S[int(q[1])-1])-ord('a')].add(-1, int(q[1]))
            pos_bit_list[ord(q[2])-ord('a')].add(1, int(q[1]))
            S[int(q[1])-1] = q[2]
        else:
            print(len([p for p in pos_bit_list if p.sum(int(q[2])) - p.sum(int(q[1])-1) > 0]))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 169756
#include <iostream>
#include <string.h>

using namespace std;



int main(){
    int n,dp[100000],m=0;
    int a[100000];
    memset(dp,0, sizeof(dp));
    scanf("%d",&n);
    for (int i=0; i<n; i++) scanf("%d",&a[i]);
    for (int i=1; i<n; i++) {
        if (a[i-1] >= a[i])
            dp[i] = dp[i-1] + 1;
        m = max(m, dp[i]);
    }

    printf("%d",m);


    return 0;

}

Measured memory_bytes: 1024
import  java.util.*;
class Main{
    int c1;
    int c5;
    int c10;
    int c50;
    int c100;
    int c500;
    int sum;
    Main(){
	Scanner sc=new Scanner(System.in);
	c1=sc.nextInt();
	c5=sc.nextInt();
	c10=sc.nextInt();
	c50=sc.nextInt();
	c100=sc.nextInt();
	c500=sc.nextInt();
		
	c1=1*c1;
	c5=5*c5;
	c10=10*c10;
	c50=50*c50;
	c100=100*c100;
	c500=500*c500;
	sum=c1+c5+c10+c50+c100+c500;

	if(sum>=1000){
	    System.out.println("1");
        }else{
	    System.out.println("0");
	}
    }




    public static void main(String[] args){
	new Main();
    }
}

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

using ll =long long;

//最大公約数
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 * b / gcd(a, b);
}

//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//数字判定　isdigit(a)
//pair宣言　pair<int,int> p(5,7);
//ソート　sort(vec.begin(),vec.end());



int main(){
cout<<fixed<<setprecision(10);
  
int N;cin>>N;
  vector<string> str(N);
  for(int i=0;i<N;i++){
    cin>>str[i];
  }
  bool safe=true;
  for(int i=0;i<N-1;i++){
    //cout<<str[i].at(str[i].size()-1);
    if(str[i].at(str[i].size()-1)!=str[i+1].at(0)){
    safe=false;break;
    }
  }
  
  sort(str.begin(),str.end());
  string A="wwww";
  for(int i=0;i<N;i++){
    if(A==str[i]){
      safe=false;break;}
    A=str[i];
  }
    
  if(safe){
    cout<<"Yes"<<endl;
  }else{cout<<"No"<<endl;}
  
    

  



}


Measured memory_bytes: 256
#include <iostream>

int main() {
  std::string str;

  std::cin >> str;
  
  int max_length = 0;
  int cur_length = 0;
  for(int i=0; i<str.size(); i++) {
    char c = str[i];
    if(c != 'A' && c != 'T' && c != 'C' && c != 'G') {
      if(max_length < cur_length) max_length = cur_length;
      cur_length = 0;
    }
    else {
      cur_length++;
    }
  }

  if(max_length < cur_length) max_length = cur_length;
  
  std::cout << max_length;
  
  return 0;
}


Measured memory_bytes: 256