akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,l;
    cin>>n>>l;
    vector<string>s;
    for(int i=0;i<n;i++)
    {
        string s1;
        cin>>s1;
        s.push_back(s1);
    }
    sort(s.begin(),s.end());
    for(int i=0;i<n;i++)
    {
        cout<<s[i];
    }
    return 0;
}







Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int a, b;
    cin >> a >> b;
    cout << (a + b + 1) / 2 << endl;
}


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

long long nCr(const long long n, long long r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }
	if(n<r)     { return 0;}
	if (r > n / 2) { r = n / 2; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return(result);
}


int main(){
	long long N; cin>>N;
  	map <long long,long long> mp;
  	int A[N];
  	for(int i=0; i<N; i++){
      int a;
      cin>>a;
      mp[a]++;
      A[i]=a;
    }
  	long long res=0;
  	for(auto itr=mp.begin(); itr!=mp.end(); itr++) res+=nCr(itr->second,2);
  		
    for(int i=0; i<N; i++){
      long long after=nCr(mp[A[i]]-1,2);
      long long before=nCr(mp[A[i]],2);   
      cout<<res-(before-after)<<endl;
      //cout<<before<<" "<<after<<endl;
      //cout<<mp[A[i]]-1<<endl;
     	//cout<<res<<" "<<before<< " "<<after<<endl;
    }
}
                  
  
  
  
  
  
  
  
  
  
  
   


Measured memory_bytes: 12256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

#ifdef WIN32
	#define LL "%I64d"
#else
	#define LL "%lld"
#endif

#ifdef CT
	#define debug(...) printf(__VA_ARGS__)
	#define setfile() 
#else
	#define debug(...)
	#define filename ""
	#define setfile() freopen(filename".in", "r", stdin); freopen(filename".out", "w", stdout)
#endif

#define R register
#define getc() (_S == _T && (_T = (_S = _B) + fread(_B, 1, 1 << 15, stdin), _S == _T) ? EOF : *_S++)
#define dmax(_a, _b) ((_a) > (_b) ? (_a) : (_b))
#define dmin(_a, _b) ((_a) < (_b) ? (_a) : (_b))
#define cmax(_a, _b) (_a < (_b) ? _a = (_b) : 0)
#define cmin(_a, _b) (_a > (_b) ? _a = (_b) : 0)
#define cabs(_x) ((_x) < 0 ? (- (_x)) : (_x))
char _B[1 << 15], *_S = _B, *_T = _B;
inline int F()
{
	R char ch; R int cnt = 0; R bool minus = 0;
	while (ch = getc(), (ch < '0' || ch > '9') && ch != '-') ;
	ch == '-' ? minus = 1 : cnt = ch - '0';
	while (ch = getc(), ch >= '0' && ch <= '9') cnt = cnt * 10 + ch - '0';
	return minus ? -cnt : cnt;
}
#define maxn 100010
typedef long long ll;
int p[maxn], q[maxn];
struct edge
{
	int w, type;
	inline bool operator < (const edge &that) const {return w < that.w;}
}e[maxn << 2];
int main()
{
//	setfile();
	R int W = F(), H = F(), ecnt = 0;
	R ll ans = 0;
	for (R int i = 1; i <= W; ++i) p[i] = F(), e[++ecnt] = (edge) {p[i], 0};
	for (R int i = 1; i <= H; ++i) q[i] = F(), e[++ecnt] = (edge) {q[i], 1};
	R int pcnt = 0, qcnt = 0;
	std::sort(e + 1, e + ecnt + 1);
	for (R int i = 1; i <= ecnt; ++i)
		if (e[i].type == 0) ++pcnt, ans += 1ll * e[i].w * (H - qcnt + 1);
		else ++qcnt, ans += 1ll * e[i].w * (W - pcnt + 1);
	printf("%lld\n", ans );
	return 0;
}


Measured memory_bytes: 2560
///////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
///////////////////////////////////////////////////////////
#define ll long long
#define ull unsigned long long
///////////////////////////////////////////////////////////
template <class T>
T absolute(const T& n);
template <class T>
void input(vector<T>& vec);
template <class T>
void output(const vector<T>& vec);
template <class T>
T sum(const vector<T>& vec);
template <class T>
void upsort(vector<T>& vec);
template <class T>
void downsort(vector<T>& vec);
template <class T>
T max(const vector<T>& vec);
template <class T>
T min(const vector<T>& vec);
template <class T>
vector<bool> isPrime(T max);
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int main()
{
    size_t r;
    cin >> r;
    cout<<r*r<<endl;
    return 0;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
template <class T>
T absolute(const T& n)
{
    if (n < 0) {
        return (-n);
    }
    return n;
}

template <class T>
void input(vector<T>& vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cin >> vec.at(i);
    }
}

template <class T>
void output(const vector<T>& vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cout << vec.at(i) << " ";
    }
    cout << endl;
}

template <class T>
T sum(const vector<T>& vec)
{
    T initial = 0.0;
    T s = accumulate(vec.begin(), vec.end(), initial);
    return s;
}

template <class T>
void upsort(vector<T>& vec)
{
    sort(vec.begin(), vec.end());
}

template <class T>
void downsort(vector<T>& vec)
{
    sort(vec.begin(), vec.end(), greater<T>());
}

template <class T>
T max(const vector<T>& vec)
{
    T m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = max(m, vec.at(i));
    }
    return m;
}

template <class T>
T min(const vector<T>& vec)
{
    T m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = min(m, vec.at(i));
    }
    return m;
}

template <class T>
vector<bool> isPrime(T max)
{
    vector<bool> isPrime(max + 1, true);
    isPrime[0] = false;
    isPrime[1] = false;
    for (size_t i = 2; i * i <= max; ++i) {
        if (isPrime[i]) {
            for (size_t j = 2; i * j <= max; ++j) {
                isPrime[i * j] = false;
            }
        }
    }
    return isPrime;
}
///////////////////////////////////////////////////////////

Measured memory_bytes: 256
import numpy as np

n = int(input())
a = list(map(int,input().split()))
a = np.array(a,dtype=np.int64)
point = 0
mod = 10**9+7

for i in range(61):
    b = (a >> i)&1
    x = np.count_nonzero(b)
    y = n-x
    point += 2**i*(x*y)%mod

print(point%mod)

Measured memory_bytes: 50852
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(void){
    int N,M,ans;
    
    scanf("%d %d",&N,&M);
    
    ans = (N*(N-1) + M*(M-1))/2;
    
    printf("%d\n",ans);
    
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int ans=0;
  for(int i=0;i<S.size()/2;i++){
    if(S.at(i)!=S.at(S.size()-i-1)){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

const int MAX_V = 1000000;
int prime[MAX_V+1];

void init(){
    int i, k, v;
    for(i=2; i<=MAX_V; i++){
        prime[i] = 1;
    }
    for(i=2; i*i<=MAX_V; i++){
        if(prime[i]){
            for(k=2*i; k<=MAX_V; k+=i){
                prime[k]=0;
            }
        }
    }   
}

int isprime(int n){
    return prime[n];
}

int main(){
    init();
    int num;
    while(scanf("%d", &num) != EOF){
        int count=0;
        for(int i=2; i<=num; i++){
            if(isprime(i)==1)
                count++;
        }
    printf("%d\n", count);
    }
    return 0;
}

Measured memory_bytes: 6508
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));

int main() {
	ull x, y;
	cin >> x >> y;

	ull xx = 2 * x;
	if (x%y == 0) {
		cout << -1;
		return 0;
	}
	while (xx<=1e18) {
		if (xx%y != 0) {
			cout << xx;
			return 0;
		}
		xx += x;
	}
	cout << -1;
	return 0;
}





Measured memory_bytes: 256
local n = io.read("*n")
local t = {}
for i = 2, n do
  local sqi = math.floor(math.sqrt(i)) + 1
  local j, tmpi = 2, i
  while(j <= sqi) do
    if(tmpi % j == 0) then
      tmpi = tmpi / j
      if(t[j] == nil) then t[j] = 1 else t[j] = t[j] + 1 end
    else
      if(j == 2) then j = 3 else j = j + 2 end
    end
  end
  if(tmpi ~= 1) then
    if(t[tmpi] == nil) then t[tmpi] = 1 else t[tmpi] = t[tmpi] + 1 end
  end
end
local mod = 1000000007
local ret = 1
for k, v in pairs(t) do
  ret = (ret * (v + 1)) % mod
end
print(ret)


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define pii pair<ll, pair<int, char>>
ll n;
bool tr(ll a, ll b, ll c) {
	if(a+c <= b) return false;
	if(a+b <= c) return false;
	if(c+b <= a) return false;
	return true;
}
bool isd(ll a, ll b, ll c) {
	if(a == b || b == c || c == a) return false;
	return true;
}
ll solve() {
	cin>>n;
	vector<ll>a(n);
	ll ans = 0;
	for(int i = 0; i < n; i++) cin>>a[i];
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j < n; j++) {
			for(int k = j+1; k < n; k++) {
				
				if(isd(a[i], a[j], a[k]) && tr(a[i], a[j], a[k])) {
					ans++;
					//cout<<i<<' '<<j<<' '<<k<<endl;;
				}
			}
		}
	}
	return ans;
}
int main() {
	io
	ll t = 1;
	//cin>>t;
	while(t--) {
		cout<<solve()<<endl;
		//solve();
	}
}



Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define MAGIC cin.tie(NULL); ios_base::sync_with_stdio(false)
#define endl '\n'
//#define ll long long
#define mod (1000000007)
//#define NCONS 100001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
//#define MCONS 2001
//#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
#define int long long
//#define double long double
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;

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

#define YYYY cout << "YES" << endl
#define NNNN cout << "NO" << endl
#define yyyy cout << "Yes" << endl
#define nnnn cout << "No" << endl
int dx[]{0, 1, 0, -1};
int dy[]{1, 0, -1, 0};

const int NCONS = 5001;
//const int MCONS = 101;


void killme()
{
    cout << "No";
    exit(0);
}
int32_t main()
{
    MAGIC;
    string s; cin >> s;
    
    for(int i = 0; i < s.size(); i++)
    {
        if(i % 2 == 0)
        {
            if(s[i] == 'L')
                killme();
        }
        else
        {
            if(s[i] == 'R')
                killme();
        }
    }
    
    cout << "Yes";
   
    return 0;
}



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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int num = 0;
		
		for (int i = 0; i < Math.sqrt(Math.pow(100000, 2)) + 1; i++) {
			if (N == i * (i+1)/2) {
				System.out.println("Yes");
				num = i;
				System.out.println(num + 1);
				break;
			}
		}
		if (num == 0)
		System.out.println("No");
		else {
			int[][] s = new int [num+1][num];
			int count = 1;
			for (int i = 0; i < num;i++) {
				for (int j = 0; j< num-i; j++) {
					s[i][i + j] = count;
					s[i + j][i] = count;
					count++;
				}
				s[num][i] = s[i][i];
			}
			for (int i = 0; i < num + 1; i++) {
				System.out.print(num + " ");
				for (int j = 0; j < num; j++) {
					System.out.print(s[i][j] + " ");
				}
				System.out.println();
			}
			
		}
	}
}	


Measured memory_bytes: 46832
def main():
    class unionfind():
        # size:要素数,tree：unionfind木
        def __init__(self, size):  # self,要素数
            self.size = size
            self.tree_root = list(range(self.size))
            self.tree_depth = [1]*self.size

        # rootを探す
        def root(self, index):
            temp_list = []
            temp = self.tree_root[index]
            while index != temp:
                temp_list.append(index)
                index = temp
                temp = self.tree_root[index]
            for i in temp_list:
                self.tree_root[i] = index
            return index

        # 結合
        def unite(self, index1, index2):
            r1 = self.root(index1)
            r2 = self.root(index2)
            if r1 != r2:
                d1, d2 = self.tree_depth[r1], self.tree_depth[r2]
                if d1 <= d2:
                    self.tree_root[r1] = r2
                    self.tree_depth[r2] = max(d1+1, d2)
                else:
                    self.tree_root[r2] = r1
                    self.tree_depth[r1] = max(d2+1, d1)

        # 同じか判定
        def same(self, index1, index2):
            r1 = self.root(index1)
            r2 = self.root(index2)
            return r1 == r2

        # 連結成分の個数
        def component(self):
            return len({self.root(i) for i in range(self.size)})

    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in [0]*m]
    s = [0]*n
    uf = unionfind(n)

    for a, b in ab:
        uf.unite(a-1, b-1)

    for i in range(n):
        s[uf.root(i)] += 1
    print(max(s))


main()


Measured memory_bytes: 56300
n=int(input())
if n%2==0:
    print(-1)
else:
    c=1
    k=7
    while 1:
        if k%n==0:
            break
        if c>n:
            c=-1
            break
        k=(k%n)*10+7
        c+=1
        #print(k)
    print(c)

Measured memory_bytes: 9052
#include <bits/stdc++.h>
#pragma GCC optimize(3,"Ofast","inline")
using namespace std;
int n,dp[2003][2003],a[6003],ans,tg,MX[2003],cur;
int A[100004],B[100004],C[100004],t;
void add(int x,int y,int z){A[t]=x,B[t]=y,C[t++]=z;}
int main(){
	cin>>n;
	for(int i=1;i<=3*n;i++)scanf("%d",&a[i]);
	memset(dp,-1,sizeof(dp));
	memset(MX,-1,sizeof(MX));
	dp[a[1]][a[2]]=dp[a[2]][a[1]]=MX[a[1]]=MX[a[2]]=cur=0;
	for(int i=3;i<3*n;i+=3){
		if(a[i]==a[i+1]&&a[i]==a[i+2]){tg++;continue;}
		t=0;
		if(a[i]>a[i+1])swap(a[i],a[i+1]);
		if(a[i+1]>a[i+2])swap(a[i+1],a[i+2]);
		if(a[i]>a[i+1])swap(a[i],a[i+1]);
		for(int j=1;j<=n;++j){
			if(a[i]==a[i+1])if(dp[j][a[i]]>=0)add(j,a[i+2],dp[j][a[i]]+1);
			if(a[i+1]==a[i+2])if(dp[j][a[i+1]]>=0)add(j,a[i],dp[j][a[i+1]]+1);
		}
		if(dp[a[i]][a[i]]>=0)add(a[i+1],a[i+2],dp[a[i]][a[i]]+1);
		if(dp[a[i+1]][a[i+1]]>=0)add(a[i],a[i+2],dp[a[i+1]][a[i+1]]+1);
		if(dp[a[i+2]][a[i+2]]>=0)add(a[i],a[i+1],dp[a[i+2]][a[i+2]]+1);
		add(a[i],a[i+1],cur),add(a[i+1],a[i+2],cur),add(a[i],a[i+2],cur);
		for(int k=1;k<=n;++k)if(MX[k]>=0)add(a[i],k,MX[k]),add(a[i+1],k,MX[k]),add(a[i+2],k,MX[k]);
		for(int j=0;j<t;++j)if(dp[A[j]][B[j]]<C[j])
			dp[A[j]][B[j]]=dp[B[j]][A[j]]=C[j],MX[A[j]]=max(MX[A[j]],C[j]),MX[B[j]]=max(MX[B[j]],C[j]),cur=max(cur,C[j]);
	}
	for(int i=1;i<=n;++i){
		for(int j=i+1;j<=n;j++)if(dp[i][j]>=0)ans=max(ans,dp[i][j]);
		if(dp[i][i]>=0)if(i==a[3*n])ans=max(ans,dp[i][i]+1);
	}
	printf("%d",ans+tg);
}


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

int main() {
    string s;
    cin >> s;
    if((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]))
        puts("Yes");
    else
        puts("No");
    return 0;
}


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

typedef long long ll;
#define EPSILON 1e-9
using namespace std;


int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//    freopen("n.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int a;
    cin >> a;
    int a2 = a * a, a3 = a2 * a;

    cout << a + a2 + a3 << endl;

    return 0;
}

Measured memory_bytes: 3596
import java.util.*;

class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int d = sc.nextInt();
      	if(d == 22){
        	System.out.println("Christmas Eve Eve Eve");
        }else if(d == 23){
        	System.out.println("Christmas Eve Eve");
        }else if(d == 24){
        	System.out.println("Christmas Eve");
        }else if(d == 25){
        	System.out.println("Christmas");
        }
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>

using namespace std;


int N,ptr,res;
int A[100000];
int main()
{
    scanf("%d", &N);
    for(int i = 0; i < N; i++) scanf("%d", &A[i]);
    sort(A,A+N);
    while(ptr<N)
    {
        int cc = A[ptr], f = 0;
        while(ptr<N && A[ptr] == cc) f++, ptr++;
        res += f%2;
    }
    printf("%d\n", res);
}


Measured memory_bytes: 640
#include <iostream>

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

    std::cin >> a >> b >> c >> k;

    int ans;

    if (k <= a)
        ans = k;
    else if (k <= a + b)
        ans = a;
    else
        ans = a - (k - a - b);

    std::cout << ans << std::endl;

    return 0;
}

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

int main() {
    vector<vector<int>> c(3,vector<int>(3));
    for (int i = 0; i <= 2; i++) {
        cin >> c.at(i).at(0);
        cin >> c.at(i).at(1);
        cin >> c.at(i).at(2);
    }

    bool can = false;
    vector<int> a(3);
    vector<int> b(3);
    for (int i1 = 0; i1 <= 100; i1++) {
        for (int i2 = 0; i2 <= 100; i2++) {
            for (int i3 = 0; i3 <= 100; i3++) {
                a.at(0) = i1;
                a.at(1) = i2;
                a.at(2) = i3;
                b.at(0) = c.at(0).at(0) - i1;
                b.at(1) = c.at(1).at(1) - i2;
                b.at(2) = c.at(2).at(2) - i3;
                if (a.at(0) + b.at(1) == c.at(0).at(1)
                && a.at(0) + b.at(2) == c.at(0).at(2) 
                && a.at(1) + b.at(0) == c.at(1).at(0)
                && a.at(1) + b.at(2) == c.at(1).at(2) 
                && a.at(2) + b.at(0) == c.at(2).at(0)
                && a.at(2) + b.at(1) == c.at(2).at(1)) {
                    can = true;
                }
                if (can) break;
            }
            if (can) break;
        }
        if (can) break;
    }

    if(can) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n));

void fast() {
    cin.tie(0);
    cin.sync_with_stdio(0);
}



int main() {
    fast();
    double n;cin>>n;
    double pi=3.14159265358979323;
    cout<<fixed<<setprecision(9)<<2*pi*n;


}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    vector<vector<int>> grid(8, vector<int>(8, 0));
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        grid[a][b] = 1;
    }
    vector<int> p(8); 
    for(int i = 0; i < 8; i++) p[i] = i;
    vector<vector<int>> ans;

    do{
        bool ok = true;

        vector<vector<int>> now = grid;

        for(int i = 0; i < 8; i++) {
            now[i][p[i]] = 1;
        }

        for(int i = 0; i < 8; i++) {
            int sum = 0;
            for(int j = 0; j < 8; j++) {
                sum += now[i][j];
            }
            if(sum > 1) {
                ok = false;
                break;
            }
        }

        for(int i = 0; i < 15; i++) {
            int sum = 0;
            for(int j = 0; j < 8; j++) {
                if(i-j>=0 && i-j<8) {
                    sum += now[j][i-j];
                }
            }
            if(sum > 1) {
                ok = false;
                break;
            }
        }

        for(int i = -7; i < 8; i++) {
            int sum = 0;
            for(int j = 0; j < 8; j++) {
                int k = i+j;
                if(k >= 0 && k < 8) {
                    sum += now[j][k];
                }
            }
            if(sum > 1) {
                ok = false;
                break;
            }
        }

        if(ok) {
            ans = now;
            break;
        }

    }while(next_permutation(p.begin(), p.end()));

    if(ans.size() == 0) {
        cout << "pass" << endl;
        return 0;
    }

    for(int i = 0; i < 8; i++) {
        for(int j = 0; j < 8; j++) {
            cout << (ans[i][j]==1?'Q':'.');
        }
        cout << "\n";
    }
}



Measured memory_bytes: 3152
#include<bits/stdc++.h>
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define sz 233
}
using namespace my_std;

int n;
vector<int>v;
int ans[sz];

int main()
{
	cin>>n;
	int x;
	rep(i,1,n) cin>>x,v.push_back(x);
	drep(i,n,1)
	{
		bool flg=0;
		drep(j,i-1,0) if (v[j]==j+1) {flg=1;ans[i]=j+1;v.erase(v.begin()+j);break;}
		if (!flg) return puts("-1"),0;
	}
	rep(i,1,n) printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 256
from functools import reduce

def gcd(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        r = x % y
        x = y
        y = r
    return y

def inv(x):
    return pow(x, MOD-2, MOD)

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

def lcm_list(l:list):
    return reduce(lcm, l, 1)
  
N = int(input())
a_list = list(map(int, input().split()))
MOD = 10 ** 9 + 7

num = lcm_list(a_list) % MOD
ans = 0
for a in a_list:
    ans += (num * pow(a, MOD-2, MOD)) % MOD

print(ans%MOD)

Measured memory_bytes: 85064
#include <stdio.h>

int main(void)
{
	int n,a,b,c;
	scanf("%d",&n);
	for(a=1;a<=n;a++){
	/*3????????°*/
	if(a%3==0){
	printf(" %d",a);
	}
	/*1?????????3*/
	else if(a%10==3){
	printf(" %d",a);
	}else if(a/10%10==3){
	printf(" %d",a);
	}else if(a/100%10==3){
	printf(" %d",a);
	}else if(a/1000%10==3){
	printf(" %d",a);
	}
	}
	printf("\n");
return 0;
}

Measured memory_bytes: 600
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int n, k;
    cin >> n >> k;

    n++;
    Int ansa = 0, ansb = 0;
    if (k % 2 == 0) {
        for (Int i = 1; i < n; i++) {
            if (i % k == 0) {
                ansa++;
            } else if (i % k == (k / 2)) {
                ansb++;
            }
        }
    } else {
        for (Int i = 1; i < n; i++) {
            if (i % k == 0) {
                ansa++;
            }
        }
    }

    Int ans = ansa * ansa * ansa + ansb * ansb * ansb;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        String n = sc.next();
        // int n = Integer.parseInt(sc.next());
        // int[] a = new int[n];

        // for (int i = 0; i < n; i++) {
        // a[i] = Integer.parseInt(sc.next());
        //
        // }

        if (n.charAt(2) == n.charAt(3) && n.charAt(4) == n.charAt(5)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        // System.out.println();

    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //10^19 < 9223372036854775807
typedef unsigned long long ull; //10^20 < 18446744073709551615

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

#define MOD 1000000007

int main(void)
{
    ll D, T, S;
    cin >> D >> T >> S;

    string ans = "No";
    if (S*T >= D) {
        ans = "Yes";
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define N 205
using namespace std;
int n,a;
vector<int> A,B;
bool used[N],useda[N],usedb[N];

int main(){
  while(1){
    cin>>n;
    if(!n)break;
    memset(used,0,sizeof(used));
    memset(useda,0,sizeof(useda));
    memset(usedb,0,sizeof(usedb));
    A.clear();
    B.clear();
    for(int i=0;i<n;i++){
      cin>>a,A.push_back(a);
      used[a]=true;
    }
    for(int i=1;i<=2*n;i++)
      if(!used[i])B.push_back(i);
    sort(A.begin(),A.end());
    int an=0,bn=0,x=0;
    bool turn=false;
    while(1){
      if(!turn){
	int f=0;
	for(int i=0;i<A.size();i++){
	  if(!useda[i]&&x<A[i]){
	    useda[i]=true;
	    x=A[i];
	    an++;
	    f=1;
	    break;
	  }
	}
	if(!f)x=0;
	if(an==n)break;
      }else{
	int f=0;
	for(int i=0;i<B.size();i++){
	  if(!usedb[i]&&x<B[i]){
	    usedb[i]=true;
	    x=B[i];
	    bn++;
	    f=1;
	    break;
	  }
	}
	if(!f)x=0;
	if(bn==n)break;
      }
      turn=!turn;
    }
    cout<<n-bn<<endl<<n-an<<endl;
  }
  return 0;
}

Measured memory_bytes: 3116
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	long long a[3],la;
	while(cin>>a[0])
	{
		cin>>a[1]>>a[2];
		sort(a,a+3);
		if(a[0]+a[1]==a[2])
		cout<<"Yes"<<endl;
		else
		cout<<"No"<<endl;
		
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort(v.rbegin(), v.rend())
typedef pair<int, int> pii;

ll exp(ll taban, ll us) {
    ll carpan = taban % mod;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
    }
    return res;
}
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}
ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int k; cin>>k;
	ll ans = 0;
	for(int i = 1; i <= k; i++){
		for(int j = 1; j <= k; j++){
			for(int u = 1; u <= k; u++){
				ans += ebob(ebob(i, j), u);
			}
		}
	}
	cout<<ans<<endl;
}


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

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x)	cout << #x << " " << x << endl;

typedef long long int ll;

int main() {

	IOS

	string ip;
	cin >> ip;
	ip[1] = ip[1] == 'B' ? 'R' : 'B';
	cout << ip << endl;

	return 0;
}

Measured memory_bytes: 3564
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

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

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, K;
std::string S;

int main() {
  std::cin >> N >> K >> S;

  S[K-1] -= 'A'-'a';

  std::cout << S << endl;

  return 0;
}

Measured memory_bytes: 3540
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
	



int main(){
   IOS

   ll n, a, b; cin>>n>>a>>b;

   ll q = n / (a+b);
   ll r = n % (a+b);

   ll ans = q * a + (min(a,r));

   cout<<ans<<"\n";


   














}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
	if(b&1)
		res = res * a % mod;
		a = a * a % mod;
	b >>= 1;
	}

	return res;
}



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

using namespace std;

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

#define pb push_back
#define ff first
#define ss second
#define SIZE 200005
#define INF int(2e9 + 9)
#define BIG_INF ll(1e18 + 9)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define _sz(v) int((v).size())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)



//#pragma GCC optimize("Ofast")



ll T = 1, n, m, k;

vector<ll> a, b;


void solve()
{
    cin >> n >> m >> k;
    a.resize(n);
    b.resize(m);
    for(int i = 0; i < n; i++)
        cin >> a[i];

    for(int i = 0; i < m; i++)
        cin >> b[i];


    vector<ll> prefA(n, 0);
    prefA[0] = a[0];
    vector<ll> prefB(m, 0);
    prefB[0] = b[0];
    int ans = 0;
    if(a[0] <= k) ans = 1;
    if(b[0] <= k) ans = 1;
    for(int i = 1; i < n; i++)
    {
        prefA[i] = prefA[i - 1] + a[i];
        if(prefA[i] <= k) ans = max(ans, i + 1);
    }
    for(int i = 1; i < m; i++)
    {
        prefB[i] = prefB[i - 1] + b[i];
        if(prefB[i] <= k) ans = max(ans, i + 1);
    }



    for(int i = 0; i < n; i++)
    {
        ll curT = prefA[i];
        if(curT > k) break;
        curT = k - curT;
        auto it = lower_bound(all(prefB), curT);

        int id = 0;
        if(it == prefB.end())
            id = _sz(prefB) - 1;
        else
            id = it - prefB.begin();

        if(prefB[id] > curT) --id;

        if(id < 0) continue;

        ans = max(ans, i + 1 + id + 1);

    }

    cout << ans;
    return;

}


int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

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




    return 0;
}


Measured memory_bytes: 9512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int K, S;
  cin >> K >> S;
  int count = 0;
  for (int X = 0; X <= K; X++) {
    for (int Y = 0; Y <= K; Y++) {
      if (0 <= S - X - Y && S - X - Y <= K){
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}

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

using namespace std;

int main(int argc, char* argv[]) {
  int N, Q;
  cin >> N >> Q;

  string s;
  cin >> s;

  int l[Q];
  int r[Q];
  for (int i = 0; i < Q; ++i) {
    cin >> l[i];
    cin >> r[i];
    --l[i];
    --r[i];
  }

  vector<int> indices;
  for (int i = 0; i < N - 1; ++i) {
    if (s[i] == 'A' && s[i + 1] == 'C') {
      indices.push_back(i);
    }
  }

  for (int i = 0; i < Q; ++i) {
    int x = l[i];
    int y = r[i];
    vector<int>::iterator head = lower_bound(indices.begin(), indices.end(), x);
    vector<int>::iterator tail = lower_bound(indices.begin(), indices.end(), y);
    if (head == indices.end() || *head + 1 > y) {
      cout << 0 << endl;
    } else if (tail == indices.end()) {
      cout << distance(head, indices.end()) << endl;
    } else if (*tail > y - 1){
      cout << distance(head, tail) << endl;
    } else {
      cout << distance(head, tail) + 1 << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 2044
#include <iostream>
#include <vector>
#include<algorithm>
#include<map>
#include<cmath>
#include<set>
using namespace std;
#define rep(i,n) for(int i =0;i < n;i++)
int main() {
	int n, a, b, ans = 0;cin >> n;
	vector<pair<int, int>> v(n);
	rep(i, n) {
		cin >> a >> b;
		v[i] = make_pair(a, b);
	}
	sort(v.begin(), v.end());
	cout << v[n - 1].first + v[n - 1].second << endl;
 }

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

int main()
{
    // input
    int N;
    scanf( "%d", &N );

    // process

    // output
    switch ( N % 10 ) {
        case 3:
            printf( "bon\n" );
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            printf( "pon\n" );
            break;
        default:
            printf( "hon\n" );
            break;
    }

    return 0;
}


Measured memory_bytes: 1664
blist = []
def createBitline(N, p, bl):
	if(N == p and len(bl) == N):
		blist.append(bl)
	else:
		createBitline(N, p + 1, bl + "0")
		createBitline(N, p + 1, bl + "1")
 
def checkClear(X, list):
	for i in range(1, len(list)):
		if int(list[i]) < X:
			return False
	return True
 
listCA = []
N,M,X = map(int, input().split())
for i in range(N):
	listCA.append(input().split())
createBitline(N, 0, "")
cost = []
for x in range(len(blist)):
	sumCA = [0] * (M + 1)
	for i in range(N):
		if blist[x][i] == "1":
			for j in range(len(listCA[i])):
				sumCA[j] += int(listCA[i][j])
	if checkClear(X, sumCA):
		cost.append(sumCA[0])
if cost:
	print(min(cost))
else:
	print('-1')

Measured memory_bytes: 9440
#include <bits/stdc++.h>
 
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}
 
void solve() {
	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200) {
		cout << s << endl;
	} else {
		cout << "red" << endl;
	}
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 256
H,W,K = map(int,input().split())
from itertools import accumulate
S = [list(accumulate(map(int,input()))) for _ in range(H)]

def divide(pattern):
    lenP = len(pattern)
    divided = [0]*lenP
    count = lenP - 1
    for i in range(lenP):
        if K < pattern[i][0]:
            return H+W
    for i in range(1,W):
        for j in range(lenP):
            if K < pattern[j][i] - divided[j]:
                for l in range(lenP):
                    divided[l] = pattern[l][i-1]
                count += 1
                break
    return count

ans = H+W
for i in range(2**H):
    pattern = []
    line = [0] * W
    for j in range(H):
        for k in range(W):
            line[k] += S[j][k]
        if 2**j & i:
            pattern.append(line)
            line = [0] * W
    pattern.append(line)
    ans = min(divide(pattern),ans)
print(ans)



Measured memory_bytes: 47708
using System;
using System.Collections.Generic;
using System.Linq;

namespace kakomon
{
    class Program
    {
        static void Main(string[] args)
        {
            abc148_a();
        }

        static void abc148_a()
        {
            // A - Round One
            // 1,2,3 のうち2つが与えられるときに残り1つを求める
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int ans = 6 - a - b;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

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

    int n,y; cin >> n>> y;
    for(int i=0; i*10000<=y; i++){
        for(int j=0; j*5000<=y-i*10000; j++){
            if(n-i-j<0) continue;
            if(i*10000+j*5000+(n-i-j)*1000==y){
                cout<<i<<' '<<j<<' '<<n-i-j<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();

    int ans = INF;
    for (int i = 0; i <= n-m; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            if (s[i+j] != t[j]) cnt++;
        }
        chmin(ans, cnt);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3580
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

a,b = (int(x) for x in input().split())
print(a*b)


Measured memory_bytes: 85096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n;
    cin>>n;
    ll meow=n%10;
    if (meow==2 || meow==4 || meow==5 || meow==7 || meow==9){
    	cout<<"hon";
    }
    else if (meow==3){
    	cout<<"bon";
    }
    else{
    	cout<<"pon";
    }
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

int n, m, c[10] = { -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
array<int, 10> dp[10007];

int main() {
	cin >> n >> m;
	vector<int> v(m);
	inc(i, m) { cin >> v[i]; }
	sort(RALL(v));
	
	dp[0][0] = 1;
	inc(i, n) {
		if(dp[i][0] == 0) { continue; }
		auto x = dp[i];
		x[0]++;
		inc(j, m) {
			x[10 - v[j]]++;
			setmax(dp[i + c[v[j]]], x);
			x[10 - v[j]]--;
		}
	}
	assert(dp[n][0] != 0);
	
	inc1(j, 9) {
		inc(k, dp[n][j]) { cout << 10 - j; }
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    ll ans = 0;
    for (ll i = 0; i < 3; i++)
    {
        if(s[i]=='1')
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ll n;
    cin >> n;

    ll t = 1, s = 0;
    int k = 0;
    while (1) {
        k++;
        s += t;
        t *= 26;
        if (n < s + t) break;
    }

    n -= s;

    string r(k, 'a');

    for (int i = k - 1; i >= 0; i--) {
        r[i] += n % 26;
        n /= 26;
    }

    cout << r << endl;

    return 0;
}

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

int main(){
    int k,s;
    int ans = 0;
    cin >> k >> s;
    for(int x=0;x<=k;x++){
        for(int y=0;y<=k&&y<=s-x;y++){
            if(s-x-y<=k) ans++;
        }
    }
    cout << ans << endl;
}

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

int main() {
  int n;
  cin>>n;
  int a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  sort(a, a + n);
  int ans = 0;
  for (int i=0; i<n; i++) {
    if (i > 0 && a[i] == a[i-1]) {
      continue;
    }
    if (i < n - 1 && a[i] == a[i+1]) {
      continue;
    }
    vector<int> ds;
    for (int j=1; j<=sqrt(a[i]); j++) {
      if (a[i] % j == 0) {
        ds.push_back(j);
        if (j != a[i] / j) {
          ds.push_back(a[i]/j);
        }
      }
    }
    bool found = false;
    for (int d: ds) {
      if (d == a[i]) {
        continue;
      }
      if (binary_search(a, a + n, d)) {
        found = true;
        break;
      }
    }
    if (!found) {
      ++ans;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4388