akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;

ll n, ans;

inline ll read(){                                       //快读 
    ll s = 0, w = 1;
    char ch = getchar();
    for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
    for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
    return s * w;
}

inline ll gcd(ll a, ll b){                              //求最大公约数 
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

inline void work(){
    n = read();                                         //输入n，同题目中的k 
    REP(i, 1, n)                                        //同题目中的a
        REP(j, 1, n)                                    //同题目中的b 
            REP(k, 1, n){                               //同题目中的c 
                if (min(i, min(j, k)) == 1) ans++;      //如果其中一个数为1则最大公约数为1 
                else if (i == j && j == k) ans += i;    //如果3个数相等最大公约数就是i 
                    else ans += gcd(i, gcd(j, k));      //同题目中的公式 
            }
    printf("%lld\n", ans);                              //输出答案 
}

int main(){
    work();
    return 0;
}

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

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

    int ans = A - B * 2;
    if (ans < 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N,M,C;
  cin >>N >>M>>C;
  vector<int> B(M);
  for(int i=0;i<M;i++){
 cin >>B.at(i);
  }
  
vector<vector<int>> A(N, vector<int> (M+1));
   
  for(int i=0;i<N;i++){
     
     for(int j=0;j<M;j++){
 cin >>A.at(i).at(j);
  }
   }
                int f=0;
            for(int i=0;i<N;i++){
              int sum=C;
     for(int j=0;j<M;j++){
 sum+=A.at(i).at(j)*B.at(j);
  }
              if(sum>0){f++;}
   }    
                
  cout <<f <<endl;
}

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

l = 0
r = N
s = (r * (r + 1)) // 2
while r - l > 1:
    m = (r + l) // 2
    x = (m * (m + 1)) // 2
    if x >= N:
        r = m
        s = x
    else:
        l = m

for i in range(1,r+1):
    if i != s - N:
        print(i)

Measured memory_bytes: 3316
#include<iostream>
#include<cmath>
#include<cstdio>
#define EPS (1e-7)
#define N 50
using namespace std;
int n,x[N],y[N],flag=1;
double gx,gy;

int main(){
  cin>>n;
  if(n%2)flag=0;
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i];
    gx+=x[i]; gy+=y[i];
  }
  gx/=n; gy/=n;
  for(int i=0;i<n;i++){
    double px=gx+(gx-x[i]),py=gy+(gy-y[i]);
    int f=0;
    for(int j=0;j<n;j++)
      if(min(abs(px-x[j]),abs(py-y[j]))<EPS)f=1;
    if(!f)flag=0;
  }
  if(flag)printf("%.8f %.8f\n",gx,gy);
  else cout<<"NA"<<endl;
  return 0;
}

Measured memory_bytes: 3200
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long V = sc.nextLong();
        long B = sc.nextLong();
        long W = sc.nextLong();
        long T = sc.nextLong();
        
        long ab = Math.abs(B-A);
        long speed =V-W;
      
        if(ab <= speed*T){
          System.out.println("YES");
        }else{
          System.out.println("NO");
        }
    
	}
}

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

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

    int sum = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= n; k++) {
                sum += __gcd(i, __gcd(j, k));
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/arc059/tasks/arc059_b

//参考：
//https://kmjp.hatenablog.jp/entry/2016/08/13/1000

//アンバランスな文字列は
//必ず以下のどちらかのアンバランスな部分文字列を含んでいることを利用
//(1) 同じ文字2文字から構成される、アンバランスな部分文字列(aa,xxなど)
//(2) 文字列長3で、サンドイッチみたいになってるやつ(axa,ijiなど)
//これのどちらかを検出すれば良い

//例えばvoodooにはooやodoが入っている

//条件を満たす文字列がさらに条件を満たす文字列を含んでいる場合がある

//条件を満たす必要最小限の長さの文字列が
//「結局これを満たしてればいいよね」
//みたいになってる場合がある

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

string S;

int ans1 = -1;
int ans2 = -1;

void solve(){
	//各アルファベットの出現位置を格納していく
	vector<vector<int>> alpha(26,vector<int>(0));
	for(int i=0;i<S.size();i++){
		alpha[S[i]-'a'].push_back(i);
	}

	//各アルファベットについてそれがアンバランスな
	//部分文字列を形成しうるか判定
	for(int i=0;i<26;i++){
		if(alpha[i].size()<=1) continue;
		for(int j=0;j<=alpha[i].size()-2;j++){
			if(alpha[i][j+1] - alpha[i][j] <= 2){
				ans1 = alpha[i][j]+1;
				ans2 = alpha[i][j+1]+1;
				return;
			}
		}
	}
}
 
int main(){
    cin >> S;
 
    solve();

	cout << ans1 << " " << ans2 << endl;
    return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

const int dx4[] = { 1, 0, -1, 0 }, dy4[] = { 0, 1, 0, -1 };
const int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy8[] = { 0, -1, -1, -1, 0, 1, 1, 1 };



template<typename T>
bool chmax(T& a, T b, bool equal = false) {
	if (a < b || equal && a == b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
bool chmin(T& a, T b, bool equal = false) {
	if (b < a || equal && a == b) {
		a = b;
		return true;
	}
	return false;
}



/******************************************************************************************/

ll dp[100000][5];

int main() {

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

	string s;
	cin >> s;
	
	dp[0][0] = 1;

	for (int i = 0; i < s.size(); i++)
	{
		for (int j = 0; j <= 3; j++)
		{
			if (s[i] == '?') {
				dp[i + 1][j] = dp[i][j] * 3;
				dp[i + 1][j] %= MOD;
			}
			else
			{
				dp[i + 1][j] = dp[i][j];
				dp[i + 1][j] %= MOD;
			}
		}


		if (s[i] == '?' || s[i] == 'A') {

			dp[i + 1][1] += dp[i][0];
			dp[i + 1][1] %= MOD;

		}
		if (s[i] == '?' || s[i] == 'B') {

			dp[i + 1][2] += dp[i][1];
			dp[i + 1][2] %= MOD;

		}
		if (s[i] == '?' || s[i] == 'C')
		{
			dp[i + 1][3] += dp[i][2];
			dp[i + 1][3] %= MOD;
		}
	}

	cout << dp[s.size()][3] << endl;

	return 0;
}


Measured memory_bytes: 4432
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

int main(){
    int n,k; cin>>n>>k;
    vector<int> h(n);
    rep(i,n) cin>>h[i];

    int cnt=0;
    rep(i,n){
        if(h[i]>=k) cnt++;
    }
    cout<<cnt<<endl;
}


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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var read = Console.ReadLine();
            switch (read)
            {
                case "7":
                case "5":
                case "3":
                    Console.WriteLine("YES");
                    break;
                default:
                    Console.WriteLine("NO");
                    break;
            }
;
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const char nl = '\n';

// INT VS LL

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


    ll a,b,k;
    cin>>a>>b>>k;
    if (k<=a){
    	cout<<a-k<<" "<<b<<nl;
    }
    else{
    	k-=a;
    	if (k<=b){
    		cout<<0<<" "<<b-k<<nl;
    	}
    	else cout<<0<<" "<<0<<nl;
    }
    return 0;
}

Measured memory_bytes: 3644
#%%
import math

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=(10**5) * 2):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

# 関数の呼び出し
l = callIsPrime((10**5) * 2)
#print(l)

x = int(input())
for i in range(len(l)):
    if l[i] >= x:
        print(l[i])
        break

# %%


Measured memory_bytes: 3844
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if((abs(a - c) <= d) || (abs(a - b) <= d && abs(b - c) <= d)) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N,Y,i,j,k;
	bool f = false;
	cin >> N;
	cin >> Y;
	for(i=0;i<=N;++i){
		for(j=0;j<=N-i;++j){
			for(k=0;k<=N-i-j;++k){
				if(Y==1000*i+5000*j+10000*k&&N==i+j+k){
					f = true;
					goto P;
				}
			}
		}
	}

P:
	if(f==false) cout << "-1 -1 -1" << endl;
	if(f==true) cout << k <<" "<< j <<" "<< i << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iomanip>
#define ll long long int
#define ld long double
#define f first
#define inf 100000000000000000
#define ii pair<ll,ll>
#define vi vector<ll>
#define vii vector<ii>
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define s second
#define pb push_back
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define Sort(a) sort(a.begin(),a.end());
#define debug(x) cerr << #x << " is " << x << endl;
using namespace std;
ll const mod=1000000007;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// ordered_set os.find_by_order os.order_of_key
// b/w l and r os.order_of_key(r+1)-order_of_key(l)

// ll arr1[1000009];
// //ll parent[1000009];
// set<ll> sieve;
// void sievefun(ll n){
//     for(ll i=2;i<=n;i++){
//         if(arr1[i]==0){
//  //              parent[i]=i;
//             for(ll j=i*i;j<=n;j+=i){
//    //         	if(arr1[j]==0)parent[j]=i;
//                 arr1[j]=1;
//             }
//         }
//     }
//     for(int i=2;i<=n;i++){
//     	if(arr1[i]==0)sieve.insert(i);
//     }
// }
ll power(ll x, ll y,ll m) {
	ll temp;
	if( y == 0)
		return 1;
	temp = power(x, y/2,m)%m;
	if (y%2 == 0)
		return ((temp)*(temp))%m;
	else
		return (((x)%m)*((temp*temp)%m))%m;
}

// ll fac[1000009];
// void factorial(){
// 	fac[0]=1;
// 	for(int i=1;i<=1000000;i++)fac[i]=(i*fac[i-1])%mod;
// }
// ll ncr(ll n,ll r){
// 	return (fac[n]*((power(fac[r],mod-2)*power(fac[n-r],mod-2))%mod))%mod;
// }

int main()
{	//sievefun(1000000);
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	string s;
	int n;
	cin>>n;
	cin>>s;
	set<ll> w,r;
	ll ans=0;
	forn(i,n){
		if(s[i]=='W'){
			w.insert(i);
		}else{
			r.insert(i);
		}
	}
	while(w.size()&&r.size()){
		if(*w.begin()<*r.rbegin()){
			ans++;
			w.erase(w.begin());
			r.erase(*r.rbegin());
		}else{
			break;
		}
	}
	cout<<ans<<"\n";


}

Measured memory_bytes: 13024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
const int MAX = 100000;

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

vector<int> par(MAX);
vector<int> rk(MAX);
vector<int> cnt(MAX);

void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        rk[i] = 0;
        cnt[i] = 1;
    }
}

int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y)
        return;

    if (rk[x] < rk[y]) {
        par[x] = y;
        cnt[x] += cnt[y];
    } else {
        par[y] = x;
        cnt[y] += cnt[x];
        if (rk[x] == rk[y])
            rk[x]++;
    }
}

bool same(int x, int y) { return find(x) == find(y); }

struct edge {
    int u, v, cost;
};

bool comp(const edge &e1, const edge &e2) { return e1.cost < e2.cost; }
vector<edge> es;
int kruskal(int V, int E) {
    sort(es.begin(), es.end(), comp);
    init(V);
    int res = 0;
    for (int i = 0; i < E; i++) {
        edge e = es[i];
        if (!same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}

int main(void) {
    int N;
    cin >> N;
    int E = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            int c;
            cin >> c;
            if (c >= 0) {
                es.push_back({i, j, c});
                E++;
            }
        }
    }
    cout << kruskal(N, E) << endl;
}


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

int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;
        if (h >= k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <cmath>

using PrimeFactorization = std::map<uint64_t, uint64_t>;

template <typename Map ,class T>
bool contains_map(const Map &c, const T &v)
{
  return c.find(v) != c.end();
}

template <typename Map>
void print_map(const Map &c, const std::string &name)
{
  std::cout << name << ": ";
  std::for_each(c.begin(), c.end(),
                [](auto &x) { std::cout << x.first << "->" << x.second << ", "; });
  std::cout << std::endl;
}

template <typename Map ,class T>
bool contains(const Map &c, const T &v)
{
  return c.find(v) != c.end();
}

PrimeFactorization prime_factorization(uint64_t v)
{
  PrimeFactorization ret;
  ret[1] = 1;
  uint64_t div = 2;
  uint64_t fin = std::sqrt(v) + 1;
  while(div<fin) {
    if(v % div != 0) {
      div++;
      continue;
    }
    ret[div]++;
    v /= div;
    if(v == 1) {
      break;
    }
  }
  if(v != 1) {
    ret[v]++;
  }

  return ret;
}

int main()
{
  uint64_t A, B;
  std::cin >> A >> B;

  auto pf_a = prime_factorization(A);
  auto pf_b = prime_factorization(B);
  // print_map(pf_a, "pf_a");
  // print_map(pf_b, "pf_b");

  uint64_t ret = 0;
  for(auto p: pf_a) {
    auto k = p.first;
    if(contains(pf_b, k)) {
      ret++;
    }
  }

  std::cout << ret << std::endl;
  return 0;
}



Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
const int N=2e6+10;
int q[N];
int main()
{
string s;
cin >>s;
for(int i=0;i<s.size();i++)
{
		if(s[i]=='?'&&s[i+1]=='?'){s[i]='P';s[i+1]='D';}
	if(s[i]=='P'&&s[i+1]=='?')s[i+1]='D';
	if(s[i]=='?'&&s[i+1]=='D')s[i]='P';
}
for(int i=0;i<s.size();i++)
	if(s[i]=='?')s[i]='D';
cout<<s;
}


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

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

#define INF 1 << 29
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int a,b,c;

int main(){
  cin >> a>>b>>c;
  if(b < c) swap(b,c);
  if(a < b) swap(a,b);
  if(b < c) swap(b,c);
  int cnt = a-b;
  c += a-b;
  if((a-c)%2==0) cnt += (a-c)/2;
  else{
    cnt += (a-c)/2 + 2;
  }
  cout << cnt << endl;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}


template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

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

    ll a,b,c;
    cin >> a >> b >> c;

    if(a%2==0 or b%2==0 or c%2==0){
        ppp(0);
        return 0;
    }
    else{
        ppp(min(a*b, min(b*c, c*a)));
        return 0;
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	char b, c[128];
	c['A'] = 'T';
	c['G'] = 'C';
	c['C'] = 'G';
	c['T'] = 'A';
	cin >> b;
	cout << c[b] << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

import sys

def main():
    input = sys.stdin.readline
    a,b = map(int, input().split())
    if a <= 8 and b <= 8:
        print("Yay!")
    else:
        print(":(")




if __name__=="__main__":
    main()


Measured memory_bytes: 2940
#include <stdio.h>

void swap(int *a, int *b)
{
    int temp = *a;
    *a = *b;
    *b = temp;
}

int partition(int A[], int p, int r)
{
    int x = A[r];
    int i = p - 1;
    for (int j = p; j < r; j++)
    {
        if (A[j] <= x)
        {
            i++;
            swap(&A[i], &A[j]);
        }
    }
    swap(&A[i + 1], &A[r]);
    return i + 1;
}

void quicksort(int A[], int p, int r)
{
    if (p < r)
    {
        int q = partition(A, p, r);
        quicksort(A, p, q - 1);
        quicksort(A, q + 1, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    int array[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &array[i]);
    }

    int mid = partition(array, 0, n - 1);

    if (mid == 0)
        printf("[%d]", array[0]);
    else
        printf("%d", array[0]);
    for (int i = 1; i < n; i++)
    {
        if (mid == i)
            printf(" [%d]", array[i]);
        else
            printf(" %d", array[i]);
    }
    puts("");
    return 0;
}


Measured memory_bytes: 2080
N, M = map(int, input().split())
S = []
C = []
for _ in range(M):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)

ans = -1
for i in range(1000):
    str_i = str(i)
    ok = True

    # str_i が N 桁かチェックする
    ok &= len(str_i) == N
    if not ok:
        continue

    for j in range(M):
        # str_i の S[j] 桁目が C[j] かチェックする
        ok &= str_i[S[j]-1] == str(C[j])

    # すべて OK 
    if ok:
        ans = i
        break
print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int p[101],ans;
int main()
{
	int n, a, b, c,d[101],q=0;
	scanf("%d", &n);
	scanf("%d%d", &a, &b);
	scanf("%d", &c);
	for (int i = 1; i <= n;i++)
		scanf("%d", &d[i]);
	for (int i = 1; i <=n ; i++)
	{
		for (int j = i+1; j <= n; j++)
		{
			if (d[i] < d[j])
			{
				ans = d[i];
				d[i] = d[j];
				d[j] = ans;
			}
		}
	}
	p[0] = c / a;
	for (int i = 1; i <= n; i++)
	{
		q += d[i];
		p[i] = max(p[i-1],(c + q) / (a + i*b));
	}

	printf("%d\n", p[n]);
}

Measured memory_bytes: 3228
n=int(input())
dic={}
for i in range(n):
  tmp="".join(sorted(list(input().strip())))
  dic[tmp]=dic.get(tmp,0)+1
ans=0
for k in dic.keys():
  if dic[k] >= 2:
    ans+=(dic[k]*(dic[k]-1))//2
print(ans)

Measured memory_bytes: 22160
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 1000006
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 998244353
#define PI acos(-1.0)
#define eps 1e-9

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;

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

    ll n, A, B;
    cin>>n>>A>>B;
    ll dif = B - A;
    if(dif%2LL)
    {
        ll dif1, dif2;
        ll l = A - 1LL;
        ll r = n - B;
        dif1 = l + (dif+1)/2LL;
        dif2 = r + (dif+1)/2LL;
        ll ans = min(dif1, dif2);
        cout<<ans<<endl;
    }
    else
    {
        cout<<dif/2LL<<endl;
    }

    //End();
    return 0;
}


Measured memory_bytes: 256
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


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

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define PI 3.141592654
#define deb1(x) cout << #x <<"="<< x <<endl;
#define deb2(x,y) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<endl;
#define deb3(x,y,z) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<<endl;
#define deb4(x,y,z,a) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<< ", "<<#a <<"="<<a << endl;
#define debarr(x) cout << #x<<"::"<<endl;for(int i : x){cout << i <<" ";} cout <<endl;

int n;
int dp[500][500];


void mymain(){
    cin >> n;
    vi arr(n),pre(n,0);
    for(int i=0;i<n;i++)
        cin >> arr[i];
    pre[0] = arr[0];
    for(int i=1;i<n;i++)
        pre[i] = pre[i-1] + arr[i];
    for(int i=0;i<n;i++)
        dp[i][i] = 0;

    for(int l=1;l<=n;l++){
        for(int i=0;i+l<n;i++){
            int L = i, R = i+l;
            int upd=LMAX;
            for(int m = L;m<R;m++){
                upd = min(upd,dp[L][m]+dp[m+1][R]);
            }

                dp[L][R] = upd+pre[R];
                if(L!=0)
                    dp[L][R] -= pre[L-1];
        }
    }

    /*for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout << dp[i][j] <<" ";
        }
        cout << endl;
    }*/

    cout << dp[0][n-1] <<endl;


}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
//cin>>t;

for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}
/*

*/


Measured memory_bytes: 1792
A = int(input())
B = int(input())
C= int(input())
D= int(input())
if A>=B:
	if C>=D:
		print("{}".format(B+D))
if A>=B:
	if D>C:
		print("{}".format(B+C))
if B>A:
	if C>=D:
		print("{}".format(A+D))		
if B>A:
	if D>C:
		print("{}".format(A+C))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
ll A, B, C, X, Y, ans;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> X >> Y >> A >> B >> C;
    vector<int> p(A), q(B), r(C);
    for(int i = 0; i < A; i++)
        cin >> p[i];
    for(int i = 0; i < B; i++)
        cin >> q[i];
    for(int i = 0; i < C; i++)
        cin >> r[i];
    sort(p.begin(),p.end(),greater<ll>());
    sort(q.begin(),q.end(),greater<ll>());
    sort(r.begin(),r.end(),greater<ll>());
    vector<int> v;
    for(int i = 0; i < X; i++)v.push_back(p[i]);
    for(int i = 0; i < Y; i++)v.push_back(q[i]);
    for(int i = 0; i < C; i++)v.push_back(r[i]);
    sort(v.begin(),v.end(),greater<ll>());
    for(int i = 0; i < X + Y; i++) ans += v[i];
    cout << ans;
    return 0;
}


Measured memory_bytes: 3572
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc114_a.cpp
 * time   : Fri May  1 02:18:07 2020
 * quest  : A - 753
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int x;
  cin >> x;
  cout << (((x == 7) || (x == 5) || (x == 3)) ? "YES" : "NO") << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pll>
#define vpii vector<pii>
#define umap unordered_map
#define uset unordered_set
#define PQ priority_queue
#define printa(a, L, R)         \
    for (int i = L; i < R; i++) \
    cout << a[i] << (i == R - 1 ? '\n' : ' ')
#define printv(a) printa(a, 0, a.size())
#define print2d(a, r, c)            \
    for (int i = 0; i < r; i++)     \
        for (int j = 0; j < c; j++) \
    cout << a[i][j] << (j == c - 1 ? '\n' : ' ')
#define pb push_back
#define eb emplace_back
#define UB upper_bound
#define LB lower_bound
#define F first
#define S second
#define mem(a, x) memset(a, x, sizeof(a))
#define inf 1e18
#define E 2.71828182845904523536
#define gamma 0.5772156649
#define nl "\n"
#define lg(r, n) (int)(log2(n) / log2(r))
#define rev(v) reverse(v.begin(), v.end())
#define srt(v) sort(v.begin(), v.end())
#define grtsrt(v) sort(v.begin(), v.end(), greater<ll>())
#define all(v) v.begin(), v.end()
#define mnv(v) *min_element(v.begin(), v.end())
#define mxv(v) *max_element(v.begin(), v.end())
#define toint(a) atoi(a.c_str())
#define BeatMeScanf ios_base::sync_with_stdio(false)
#define one(x) __builtin_popcount(x)
#define Unique(v) v.erase(unique(all(v)), v.end())
#define fout(x) fixed << setprecision(x)
#define debug(args...)                           \
    {                                            \
        string _s = #args;                       \
        replace(_s.begin(), _s.end(), ',', ' '); \
        stringstream _ss(_s);                    \
        istream_iterator<string> _it(_ss);       \
        deb(_it, args);                          \
    }
void deb(istream_iterator<string> it)
{
}
template <typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args)
{
    cout << *it << " = " << a << endl;
    deb(++it, args...);
}
const int mod = 1e9 + 7;
const int N = 3e5 + 9;
const ld eps = 1e-9;
const ld PI = acos(-1.0);
ll gc(ll a, ll b)
{
    while (b)
    {
        ll x = a % b;
        a = b;
        b = x;
    }
    return a;
}
ll lc(ll a, ll b) { return a / gc(a, b) * b; }
ll qpow(ll n, ll k)
{
    ll ans = 1;
    assert(k >= 0);
    n %= mod;
    while (k > 0)
    {
        if (k & 1)
            ans = (ans * n) % mod;
        n = (n * n) % mod;
        k >>= 1;
    }
    return ans % mod;
}

void solve()
{
    ll k;
    cin>>k;
    string s;
    while(k--)
        s+="ACL";
    cout<<s<<nl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 3496
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll arr[10000001];
int main()
{   
  //ignore
  #ifndef ONLINE_JUDGE 
  freopen ("input.txt", "r", stdin);
  freopen ("output.txt", "w", stdout);
  #endif
  //ignore

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,i,j;
  cin>>n;
  // unordered_map<ll,ll>arr;

  for(i=1; i<=n; i++)
  {
    for(j=i; j<=n; j+=i)
      arr[j]+=1;
  }
  ll sum=0;
  for(i=1; i<=n; i++)
    sum+=i*arr[i];
  cout<<sum;
  return 0;
}

Measured memory_bytes: 81720
#include<stdio.h>
int main()
{

    int A,B,X;
    scanf("%d%d",&A,&B);

    if(A>B){

     X=A+A;
     X--;

    printf("%d\n",X);

    }
    else if(A<B){
         X=B+B;
     X--;
        printf("%d\n",X);

    }else if(A==B){

        printf("%d\n",A+B);

    }
    return 0;



}


Measured memory_bytes: 128
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
int n;
int a[100009];
int l[100009];
int r[100009];
int ll[100009];
int rr[100009];
stack < int > st1;
stack < int > st2;
struct NODE{
	int mx1,mx2;
}tree[400009];
NODE merge(NODE a,NODE b){
	NODE ret;
	if(a.mx1 > b.mx1){
		ret.mx1 = a.mx1;
		ret.mx2 = max(a.mx2,max(b.mx1,b.mx2));
	}
	else{
		ret.mx1 = b.mx1;
		ret.mx2 = max(b.mx2,max(a.mx1,a.mx2));
	}
	return ret;
}
void build(int node,int l,int r){
	if(l == r) return void(tree[node]={a[l],0});
	build(node*2,l,(l+r)/2),build(node*2+1,(l+r)/2+1,r);
	tree[node] = merge(tree[node*2],tree[node*2+1]);
}
NODE query(int node,int l,int r,int s,int e){
    if(s <= l && e >= r) return tree[node];
    if(s <= (l+r)/2 && e >= (l+r)/2+1){
        return merge(query(node*2,l,(l+r)/2,s,e),query(node*2+1,(l+r)/2+1,r,s,e));
    }
    if(s <= (l+r)/2) return query(node*2,l,(l+r)/2,s,e);
    return query(node*2+1,(l+r)/2+1,r,s,e);
}
int main(){
	fast,cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	build(1,0,n-1);
	for(int i=0;i<n;i++){
		while(!st1.empty() && a[st1.top()] < a[i]){
			st1.pop();
		}
		if(st1.empty()) l[i] = -1;
		else l[i] = st1.top();
		st1.push(i);
	}
	for(int i=n-1;i>=0;i--){
		while(!st2.empty() && a[st2.top()] < a[i]){
			st2.pop();
		}
		if(st2.empty()) r[i] = n;
		else r[i] = st2.top();
		st2.push(i);
	}
	long long sum = 0;
	for(int i=0;i<n;i++){
		if(l[i] != -1){
			int ll = -1,rr = l[i];
			while(rr-ll > 1){
				int m = (ll+rr)/2;
				NODE x = query(1,0,n-1,m,i);
				if(x.mx2 == a[i]) rr = m;
				else ll = m;
			}
			long long x = l[i]-rr+1;
			long long y = r[i]-i;
			sum += a[i] * x * y;
		}
		if(r[i] != n){
			int ll = r[i],rr = n;
			while(rr-ll > 1){
				int m = (ll+rr)/2;
				NODE x = query(1,0,n-1,i,m);
				if(x.mx2 == a[i]) ll = m;
				else rr = m;
			}
			long long x = i-l[i];
			long long y = ll-r[i]+1;
			sum += a[i] * x * y;
		}
	}
	cout<<sum<<endl;
}


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

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

   int n,a,b;
   while (cin >> n >> a >> b)
   {
      int64_t ans = 0;
      if (a == b)
      {
         ans = 1;
      }
      else if (a < b && 2 <= n)
      {
         int64_t delta = b - a;
         ans = delta *(n-2) + 1;
      }
      cout << ans << "\n";
   }
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
vector<vector<ll>> com(2010,vector<ll>(2010));
void comb(int n){
  for(int i = 0;i <n; i++){
    com[i][0]=1;
    com[i][i]=1;
  }
  for(int k = 1;k <n;k++){
    for(int j = 1;j<k;j++){
      com[k][j]=(com[k-1][j-1]+com[k-1][j])%mod;
    }
  }
}
int main(){
    int n,k;
    cin>>n>>k;
    //r=n-k,b=k
    //回収するのはb
    int r=n-k,b=k;
    vector<ll> ans;
    comb(n+10);

    for(int i=1;i<=k;i++){
        ll tmp=(com[r+1][i]*com[b-1][i-1])%mod;
        ans.push_back(tmp);
    }
    rep(i,k)    cout<<ans[i]<<endl;
    return 0;
}


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

int main() {
    int N;
    int P;
    int cnt = 0;
    int minP = 1000000;

    cin >> N;
    rep(i, N) {
        cin >> P;
        if (P < minP) {
            cnt++;
            minP = P;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for(int i=0;i<(int)(n);++i)
#define FOR(i, b, n)  for(int i=b;i<(n);++i)
#define ALL(c) (c).begin(),(c).end()
#define SS size()
#define PB push_back
#define ST first
#define ND second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef pair<int,pii> piii;

template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }

int main(){
//  ios::sync_with_stdio(0);
  ll a, b, c, na, nb; cin >> a >> b >> c >> na >> nb;

  ll ans = 1e15;
  for(ll nc=0; nc <= 2 * max(na, nb); nc++) {
    ll haveA = nc/2;
    ll haveB = nc/2;
    ll cost = nc * c;

    ll needA = na - haveA, needB = nb - haveB;
    amax(needA,0); amax(needB,0);
    cost += needA * a + needB * b;
    amin(ans, cost);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j] = 0

ans = "No"
for i in range(3):
    if sum(a[i]) == 0:
        ans = "Yes"

for i in range(3):
    if a[0][i] + a[1][i] + a[2][i] == 0:
        ans = "Yes"

if a[0][0] + a[1][1] + a[2][2] == 0:
    ans = "Yes"

if a[0][2] + a[1][1] + a[2][0] == 0:
    ans = "Yes"

print(ans)


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

int a, b;

int main(){
	while(scanf("%d %d", &a, &b)!=EOF){
		if(a<=0 && b>=0){
			printf("Zero\n");
		}
		else if(a>0){
			printf("Positive\n");
		}
		else if((b-a+1)%2==0){
			printf("Positive\n");
		}
		else{
			printf("Negative\n");
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
const int sz = 2e5 + 10, mo = 1e9 + 7;
int a;
int b[sz], sum[sz];
inline int cal(int a, int b, int c, int d)
{
    return max({a, b, c, d}) - min({a, b, c, d});
}
void solve()
{
    cin >> a;
    for (int i = 1; i <= a; i++)
        cin >> b[i];
    for (int i = 1; i <= a; i++)
        sum[i] = sum[i - 1] + b[i];
    int p, q;
    p = 1;
    q = 3;
    for (int i = 3; i <= a - 1; i++)
    {
        if (abs(sum[a] - sum[i] - (sum[i] - sum[2])) <= abs(sum[a] - sum[q] - (sum[q] - sum[2])))
            q = i;
    }
    long long res = cal(b[1], b[2], sum[q] - sum[2], sum[a] - sum[q]);
    for (int i = 3; i <= a - 2; i++)
    {
        while (p < i - 1)
        {
            if (abs(sum[i] - sum[p + 1] - (sum[p + 1] - sum[0])) <= abs(sum[i] - sum[p] - (sum[p] - sum[0])))
                p++;
            else
                break;
        }
        while (q < a - 1)
        {
            if (abs(sum[a] - sum[q + 1] - (sum[q + 1] - sum[i])) <= abs(sum[a] - sum[q] - (sum[q] - sum[i])))
                q++;
            else
                break;
        }
        res = min(cal(sum[p], sum[i] - sum[p], sum[q] - sum[i], sum[a] - sum[q]), res);
    }
    cout << res << endl;
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

Measured memory_bytes: 3328
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int sum_dig(ll n) {
    int ret = 0;
    while (n > 0) {
        ret += n % 10;
        n /= 10;
    }
    return ret;
}

ll pow_int(ll a, int n) {
    if (n < 0) return 0;
    if (n == 0) return 1;
    return a * pow_int(a, n-1);
}

ll LIM = 1000000000000001LL;

vector<ll> snukes;

void init() {
    for (int i = 1; i < 10; ++i) snukes.push_back(i);

    int idx = 2;

    while (pow(10, idx) <= LIM) {
        vector<ll> vs;

        for (int h = 1; h < 10; ++h) {
            for (int j = 0; j < idx-1; ++j) {
                for (int k = 1; k < 10; ++k) {
                    ll val = h * pow_int(10, idx-1) + k * pow_int(10, j) + (pow_int(10, j)-1);
                    vs.push_back(val);
                }
            }
        }


        if (vs.size() != 0) {
            for (int i = 0; i < vs.size()-1; ++i) {
                if (vs[i] / (double)sum_dig(vs[i]) <= vs[i+1] / (double)sum_dig(vs[i+1])) {
                    snukes.push_back(vs[i]);
                }
            }
            snukes.push_back(vs.back());
        }
        ++idx;
    }
}

ll K;

int main() {
    init();
    cin >> K;

    for (int i = 0; i < snukes.size(); ++i) {
        for (int j = i+1; j < snukes.size(); ++j) {
            assert(snukes[i] / (double)sum_dig(snukes[i]) <= snukes[j] / (double)sum_dig(snukes[j]));
        }
    }
    
    for (int i = 0; i < K; ++i) {
        cout << snukes[i] << endl;
    }
    
    return 0;
}


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

using namespace std;

#define N 1200

int n,sum,ans,l[N],c[N];
char s[N][N];

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%s",s[i]+1);
		for (int j=1;j<=n;j++) sum+=s[i][j]=='#';
	}
	if (!sum){puts("-1"); return 0;}
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			l[i]+=s[i][j]=='#',c[j]+=s[i][j]=='#';
	ans=n*n; sum=0;
	for (int i=1;i<=n;i++) if (c[i]!=n) sum++;
	for (int i=1;i<=n;i++){
		int tmp=n-l[i]+(c[i]?0:1);
		ans=min(ans,tmp+sum);
	}
	printf("%d\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 896
X=int(input())


a = X // 500
b = (X - a * 500) // 5
#c = (X - a * 500 - b * 100) // 50
#d = (X - a*500 - b*100 - c*50) // 10
#e = (X - a*500 - b*100 - c*50 - d*10) // 5

#print(a,b,c,d,e)

total = a * 1000 + b * 5

 
print(total)

Measured memory_bytes: 2940
#include<iostream>
#include<cmath>
#include<string>
#include<cstring>
using namespace std;


int main()
{
	int a;
	cin >> a;
	
	if (a % 111 != 0)a = (a / 111 + 1) * 111;

	
	cout<<a<<endl;
    return 0;
}

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

int main(void) {
  int A, B, C;
  cin >> A >> B >> C;
  set<int> s;
  s.insert(A);
  s.insert(B);
  s.insert(C);
  cout << (s.size() == 2 ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=160;
int a[maxn],b[maxn],c[maxn],d[maxn];
bool used[maxn];
int girl[maxn],line[maxn][maxn];
int n;

bool Find(int x)
{
    for(int j=1; j<=n; j++)
    {
        if(line[x][j]&&!used[j])
        {
            used[j]=1;
            if(girl[j]==0||Find(girl[j]))
            {
                girl[j]=x;
                return true;
            }
        }
    }
    return false;
}

int main()
{
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>a[i]>>b[i];
    for(int i=1; i<=n; i++)
        cin>>c[i]>>d[i];
    memset(line,0,sizeof(line));
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n; j++)
        {
            if((a[i]<c[j])&&(b[i]<d[j]))
            {
                line[i][j]=1;
            }
        }
    }
    memset(girl,0,sizeof(girl));
    int ans=0;
    for(int i=1; i<=n; i++)
    {
        memset(used,0,sizeof(used));
        if(Find(i))
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

typedef long long ll;

void divisor(ll num, vector<ll> &d) {
    ll i, j;
    j = 0;
    for (i = 1; i <= sqrt(num); i++) {
        if (num % i == 0) {
            d[j++] = i;
            d[j++] = num / i;
        }
    }
    d[j] = 0;
}

int main() {
    ll N, M;
    cin >> N >> M;
    vector <ll> d(2 * sqrt(M));
    ll ans;

    divisor(M, d);
    ans = 0;
    for (ll x : d) {
        if (x == 0) {
            break;
        }
        else if (x * N > M) {
            continue;
        }
        else if ((M - x * N) % x == 0) {
            ans = max(ans, x);   
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 768
from fractions import gcd


def main():
    s_length, t_length = map(int, input().split())
    s = input()
    t = input()
    lcm = s_length * t_length // gcd(s_length, t_length)
    answer = True
    for i in range(s_length):
        if (i * t_length) % s_length == 0 and s[i] != t[(i * t_length) // s_length]:
            answer = False
            break
    print(lcm if answer else -1)


if __name__ == '__main__':
    main()




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

int main(){
  int N;
  cin >> N;
  
  vector<int> takoyaki(N);
  for(int i = 0; i < takoyaki.size(); i++){
    cin >> takoyaki.at(i);
   }
  
  int power = 0; 
  
  for(int i = 0; i < takoyaki.size(); i++){
    for(int j = i+1; j < takoyaki.size(); j++){
      power += takoyaki.at(i)*takoyaki.at(j);
    }
  }
  
  cout << power << endl;
}
  

Measured memory_bytes: 256
object Main extends App {
  val n = readInt
  val as = readLine.split(" ").map(_.toInt)
  val bs = readLine.split(" ").map(_.toInt)
  val cs = readLine.split(" ").map(_.toInt)
  println(bs.sum + (0 to n-2).map(i => if(as(i+1)-as(i)==1) cs(as(i)-1) else 0).sum )
}

Measured memory_bytes: 25532
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,x,l;
    pair<int,int>itv[100000];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>l;
        itv[i]=make_pair(x+l,x-l);
    }
    sort(itv,itv+n);
    int ans=0,t=-1e9;
    for(int i=0;i<n;i++){
        if(t<=itv[i].second){
            ans++;
            t=itv[i].first;
        }
    }
    cout<<ans<<endl;
}


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

int main() {
  uint32_t N = 0;
  std::cin >> N;

  N %= 10;
  if (N == 0 || N == 1 || N == 6 || N == 8) {
    std::cout << "pon" << std::endl;
  } else if (N == 3) {
    std::cout << "bon" << std::endl;
  } else {
    std::cout << "hon" << std::endl;
  }

  return 0;
}

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

int main() {
  int n, m; cin >> n >> m;
  
  vector<int> a(m);
  rep(i, m){
    cin >> a[i];
  }

  int sum;
  sum = accumulate(a.begin(), a.end(), 0);
  int temp = n - sum;
  if (temp == 0){
    cout << 0 << endl;
  }else if(temp < 0){
    cout << -1 << endl;
  }else{
    cout << temp << endl;
  }
  
}

Measured memory_bytes: 3640
S = input()

n = len(S)
s_0 = S[0]
s_sum = 0
left = 0
right = 0
for s in S:
    if '>' == s:
        right += 1
    else:
        break

for i in range(n+1):
    # print(f'{left=} {right=}')
    if right >= left:
        s_sum += right
    else:
        s_sum += left
    if right == 0:
        left += 1
        while right + i + 1 < n:
            if '>' == S[right + i + 1]:
                right += 1
            else:
                break
    else:
        right -= 1
        left = 0
print(s_sum)


Measured memory_bytes: 4116