akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main() {


    zoom;
    ll i, a, b;
    vector<ll> A(4, 0);
    for(i = 0; i < 3; i += 1) {
        cin>>a>>b;
        A[a - 1] += 1;
        A[b - 1] += 1;
    }
    sort(A.begin(), A.end());
    if(A[0] == 1 && A[1] == 1 && A[2] == 2 && A[3] == 2)
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    while(true){
        ll n, x; cin >> n >> x;
        if(n == 0 && x == 0){
            break;
        }

        ll ans = 0;
        for(ll i = 1; i <= n; i++){
            for(ll j = i+1; j <= n; j++){
                for(ll k = j+1; k <= n; k++){
                    if(i + j + k == x){
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;

    }

}


Measured memory_bytes: 3076
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>

int main(){
  
  // read problem
  long long int N, tmp;
  std::vector<long long int> a;
  scanf("%lld", &N);
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    a.push_back(tmp);
  }
  
  // solve problem
  //dp_table[i][j] is the X-Y value if they start the game from the section from i-th element to j-th element
  std::vector<std::vector<long long int> > dp_table(N);
  for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      dp_table[i].push_back(0);
    }
  }
  
  for(long long int i = 0; i < N; i++){
    dp_table[i][i] = a[i];
  }
  for(long long int l = 1; l < N; l++){
    for(long long int i = 0; i < N-l; i++){
      dp_table[i][i+l] = std::max(a[i] - dp_table[i+1][i+l], a[i+l] - dp_table[i][i+l-1]);
    }
  }
  
  /*for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      std::cerr << dp_table[i][j] << " ";
    }std::cerr << std::endl;
  }*/
  
  std::cerr << "Answer:" << std::endl;
  std::cout << dp_table[0][N-1] << std::endl;
  
  return 0;
}


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

int main() {
 int A, B;
  cin >> A >> B ;
 
  if ( 13 <= A ) {
    cout << B << endl;
  }
 else if ( A <= 5 ) {
    cout << 0 << endl;
  }
  else if ( 6 <= A <= 12 ) {
    cout << B / 2 << endl;
}
 
  
 
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	bool equal=true;
	int sum=0;
	int min=1e10;
	rep(i,n) {
		int a,b;
		std::cin >> a >> b;
		sum+=b;
		if(a!=b) equal=false;
		if(a>b) min=std::min(min,b);
	}
	if(equal) print(0);
	else print(sum-min);
	return 0;
}


Measured memory_bytes: 256
while true
    line = gets.chomp
    break if line == "0 0 0"
    a, b, d = line.split.map(&:to_i)
    arr = []

    i = 0
    while true
        x = d - (i * a)
        break if x.negative?
        if x % b == 0
            arr << [i, x / b]
            break
        end
        i += 1
    end

    i = 0
    while true
        x = d - (i * b)
        break if x.negative?
        break if !arr.empty? && (x / a + i) > (arr[0][0] + arr[0][1])
        if x % a == 0
            arr << [x / a, i]
            break
        end
        i += 1
    end

    i = 0
    while true
        i += 1
        x = (i * a) + d
        break if !arr.empty? && (i + x / b) > (arr[0][0] + arr[0][1])
        if x % b == 0
            arr << [i, x / b]
            break
        end
    end
    arr.sort_by!{|x, y| [x + y, a * x + b * y]}

    i = 0
    while true
        i += 1
        x = (i * b) + d
        break if !arr.empty? && (x / a + i) > (arr[0][0] + arr[0][1])
        if x % a == 0
            arr << [x / a, i]
            break
        end
    end
    arr.sort_by!{|x, y| [x + y, a * x + b * y]}
    
    i = 0
    while true
        i += 1
        x = (i * a) - d
        next if x.negative?
        break if !arr.empty? && (i + x / b) > (arr[0][0] + arr[0][1])
        if x % b == 0
            arr << [i, x / b]
            break
        end
    end
    arr.sort_by!{|x, y| [x + y, a * x + b * y]}

    i = 0
    while true
        i += 1
        x = (i * b) - d
        next if x.negative?
        break if !arr.empty? && (x / a + i) > (arr[0][0] + arr[0][1])
        if x % a == 0
            arr << [x / a, i]
            break
        end
    end
    arr.sort_by!{|x, y| [x + y, a * x + b * y]}

    puts arr[0].join(" ")
end


Measured memory_bytes: 6912
# 2125
# 方針．f(n)を求めるのがlog(N)で終わりそうだから普通に素直に実装すればいいのでは？
# ただし最初だけは別に実装する必要がある
N = int(input())
X = list(input())

# i番目のビットを反転させて,
# やってることは似てるはずなのになんかうまく行かない
dic={}
bn00 = X.count('1')
x00 = int(''.join(X),2)
aa = x00 % (bn00+1)
if bn00-1==0:
    bb = 0
else:
    bb = x00 % (bn00-1)
for i in range(N):
    # ちゃんともとに戻してね，ということで本のビット
    b = int(X[i]) & 1
    bn = b ^ 1
    if bn:
        bn0 = bn00 + 1
        x0 = aa
    else:
        bn0 = bn00 - 1
        x0 = bb
    if bn0==0: # ビットが全く立っていないつまり0の時，0%0はエラーを起こすので，n%0もエラーを起こす
        print(0)
        continue
    if b: # もとのビットが立っている場合は減らす，ここの計算量が一番重いので計算量を削減してみる
        xi = x0 - b * pow(2,N-1-i,bn0)
    if bn:
        xi = x0 + bn * pow(2, N - 1 - i, bn0)
    xi %= bn0
    num = xi
    count = 1
    while num > 0:
        p = format(num,'b').count('1') # 10進数を２進数にかえるなら，これがいいのかも,int(str(i),2)を使うっていう手もあるけど周りくどい
        num = num % p
        count += 1
    print(count)


Measured memory_bytes: 10924
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include <assert.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
#include<set>
#include <climits>
using namespace std;
typedef unsigned long long ull;
#define ll long long int
ll mod = 1000000007;
//typedef vector<int> V;
//typedef vector<V> VV;
//typedef vector<VV> VVV;

long double y=0;

int main() {
	ll n;
	cin >> n;
	vector<ll> vec(n);
	for (int i = 0; i < n; i++) {
		cin >> vec[i];
	}
	sort(vec.begin(), vec.end());
	y = vec[0];
	for (int i = 1; i < n; i++) {
		y = (y + vec[i]) / 2;
	}
	cout << setprecision(8) << y << endl;
}




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

int main() {
    stack<int> S1;
    stack<pair<int, int> > S2;
    stack<pair<int, int> > ans;
    char c;
    int i = 0, popped_i;
    int area;

    while ( cin >> c ) {
        if (c == '\\') {
            S1.push(i);
        } else if (c == '/') {
            if (S1.empty()) continue;
            popped_i = S1.top(); S1.pop();
            area = i - popped_i;
            while (!S2.empty() && S2.top().first > popped_i) {
                area += S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(popped_i, area));
        }
        i++;
    }

    int count = 0;
    count = S2.size();
    int total_area = 0;
    while (!S2.empty()) {
        ans.push(S2.top());
        total_area += S2.top().second;
        S2.pop();
    }
    cout << total_area << endl << count;
    i = 0;
    while(!ans.empty()) {
        cout << " " << ans.top().second;
        ans.pop();
    }
    cout << endl;
}


Measured memory_bytes: 3236
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;
struct pp {ll fi;ll se;ll th;};
ll n,a,b,c,d[100000];
queue<pp>q;
vector<P>v[100000];
int main(void){
    cin>>n;
    d[0]=1;
    for(int i=0;i<n-1;i++){
        cin>>a>>b>>c;
        a--,b--;
        v[a].push_back({b,c});
        v[b].push_back({a,c});
    }
    for(auto x:v[0]){
        struct pp P1;
        P1.fi=x.first,P1.se=x.second,P1.th=0LL;
        q.push(P1);
    }
    while(!q.empty()){
        struct pp p=q.front();
        q.pop();
        if(d[p.fi]==0){
            if(p.se%2==0)d[p.fi]=d[p.th];
            else d[p.fi]=-d[p.th];
            for(auto y:v[p.fi]){
                struct pp P2;
                P2.fi=y.first,P2.se=y.second,P2.th=p.fi;
                q.push(P2);
            }
        }
    }
    for(int i=0;i<n;i++){
        cout<<(d[i]==1)<<endl;
    }
}


Measured memory_bytes: 8704
#include<stdio.h>

int main(void){

 int i,n;

 int number;

 long long int sum=0;

 int min=0;

 int max=0;

scanf("%d",&n);

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

 scanf("%d",&number);

if(i==0){

 min = number;  

max = number;  

}

 if(number<min){

 min = number;

}

 if(number>max){

 max = number;

}

sum += number;

 }

 printf("%d %d %lld\n",min,max,sum);

return 0;

 }

Measured memory_bytes: 600
import numpy as np

N,M=map(int,input().split())
l=[]
for n in range(N):
    A,B=map(int,input().split())
    temp_l=[A,B]
    l.append(temp_l)
arr=np.array(l,dtype=np.int64)
# print(l)
# print(arr)

need=M
ans=0


col_num=0
# route=np.sort(arr,axis=0)  #numpyソートの仕方がおかしい
route=arr[np.argsort(arr[:,col_num])]
# print(route)
for i in range(N):
    if need >= route[i,1]:
        ans+=route[i,0]*route[i,1]
        need-=route[i,1]
        if need==0:
            break
        else:
            continue
    else:
        ans+=route[i,0]*need
        need=0
print(ans)

Measured memory_bytes: 45492
#include <bits/stdc++.h>
using namespace std;
int mypf(int k)
{
	int s=1,i;
	for(i=0;i<k;i++)
	{
		s*=2;
	}
	return s;
}
int main()
{
	int n,m,u,k;
	scanf("%d%d%d",&n,&m,&u);
	scanf("%d",&k);
	if(n>m)
		swap(n,m);
	if(m>u)
		swap(m,u);
	if(n>m)
		swap(n,m);
	printf("%d",n+m+u*mypf(k));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define N 1000005
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define int long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#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...);
}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}
ll lcm(ll a, ll b){
    int g = __gcd(a,b);
    return ((a*power(g,M-2,M))%M*b)%M;
}
int prime[N];
void seive() 
{
	prime[1] = 1;
	rep(i,1,N) prime[i] = i;
	for (int p=2; p<=N; p++) 
	{ 
		if (prime[p] == p) 
		{
			for (int i=p*p; i<=N; i += p) 
				if(prime[i] == i)
				prime[i] = p; 
		} 
	} 
} 
unordered_map<int, int> max_map;
int lcm(int* ar, int n) 
{ 

    for (int i = 0; i < n; i++) { 
        int num = ar[i]; 
        unordered_map<int, int> temp; 
        while (num > 1) { 
  			// trace(num);
            int factor = prime[num]; 
            temp[factor]++; 
            num /= factor; 
        } 
  		// for(auto j:temp) cout<<j.fr<<" "<<j.sc<<endl;
        for (auto it : temp) { 
            max_map[it.first] = max(max_map[it.first], it.second); 
        } 
    } 
    ll ans = 1; 
    for (auto it : max_map) { 
        ans = (ans * power(it.fr, it.sc,M)) % M; 
    }
    return ans; 
} 
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	seive();
	while(TESTS--)
	{   
		int n;
		cin >> n;
		int a[n];
		rep(i,0,n) cin >> a[i];
		int s = 0;
		// for(auto j:max_map) cout<<j.fr<<" "<<j.sc<<endl;
		rep(i,0,n){
			s = (s+power(a[i],M-2,M))%M;
		}
		s = (s*lcm(a,n))%M;
		cout<<s;
	}
}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vec(a) vector<int>a
using namespace std;
//fibonacci
int binet(int n)
{
	return (pow((1+sqrt(5)),n-1)-pow((1-sqrt(5)),n-1))/(pow(2,n-1)*sqrt(5));
}


int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	fastio
	string str,str1,str2;
	ll n,i,j,k,l,m;
	cin>>n;
	cin>>str1>>str2;
	str="";
	for(i=0;i<n;i++)
	{
		str+=str1[i];
		str+=str2[i];
	}
	cout<<str<<"\n";
	return 0;
}
	

Measured memory_bytes: 3628
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void read(ll &x){
	char ch = getchar();x = 0;
	for (; ch < '0' || ch > '9'; ch = getchar());
	for (; ch >='0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}
const ll N = 1e5+100;
ll a[N];
int main(){
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++) cin>>a[i];
	ll ans=a[1];
	for(ll i=2;i<=n;i++) ans=__gcd(ans,a[i]);
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    ll X, Y;
    cin >> X >> Y;
    if(abs(X-Y)<=1) cout << "Brown" << endl;
    else cout << "Alice" << endl;
}

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

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

void solve() {
  int a, b;
  cin >> a >> b;
  cout << max(0, a - 2 * b) << endl;
}

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

  solve();
  return 0;
}


Measured memory_bytes: 256
n = input()
count = 0
for i in range(3):
    if i == 0:
        if n[i] == "R":
            count+=1
    else:
        if n[i] == "R" and count == 0:
            count+=1
        elif n[i] == "R" and n[i-1] == "R" and count > 0:
            count += 1
print(count)

Measured memory_bytes: 9096
#include<bits/stdc++.h>
        using namespace std;
        #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>
        #define ll long long
        #define int long long
        #define lb long double
        #define f(i,a,b) for(int i=(a);i<=(b);i++)
        #define fd(i,a,b) for(int i=a;i>=b;i--)
        #define vi vector<int>
        #define mii map<int,int>
        #define pii pair<int,int>
        #define si set<int>
        #define pb push_back
        #define mk make_pair
        #define fi first
        #define se second
        #define fv(i,v) for(auto i=v.begin();i!=v.end();++i)
        #define fdv(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
        #define print(a,n) f(i,1,n) cout<<a[i]<<" "; cout<<endl;
        #define printv(v) for(auto iv: v) cout<<iv<<" "; cout<<endl;
        #define all(v) v.begin(),v.end()
        #define r(a,n) ll a[n+1]; f(i,1,n) cin>>a[i];
        #define pi 3.141592653589793238
        const int mod=1e9+7;
        const int inf=1e18;
        int parent[26];
        int size[26];
        const int MAXN=2*1e5+1;
        int spf[MAXN];
        //vector<bool> vis(MAXN);

        ll power(ll x, unsigned ll y)
        {
            ll res = 1;
            while (y > 0)
            {
                if (y & 1)
                    res = res*x;
                y = y>>1;
                x = x*x;
            }
            return res;
        }

        bool isPrime(int n)
        {
            if (n <= 1)
                return false;
            if (n <= 3)
                return true;

            if (n % 2 == 0 || n % 3 == 0)
                return false;

            for (int i = 5; i * i <= n; i = i + 6)
                if (n % i == 0 || n % (i + 2) == 0)
                    return false;

            return true;
        }
        void sieve()
        {
            spf[1] = 1;
            for (int i=2; i<MAXN; i++)
                spf[i] = i;
            for (int i=4; i<MAXN; i+=2)
                spf[i] = 2;
            for (int i=3; i*i<MAXN; i++)
            {
                if (spf[i] == i)
                {
                    for (int j=i*i; j<MAXN; j+=i)
                        if (spf[j]==j)
                            spf[j] = i;
                }
            }
        }

        int lcm(int a, int b)
        {
            return (a*b)/__gcd(a,b);
        }
        bool sortcol( const vector<int>& v1,
                       const vector<int>& v2 ) {
         return v1.size() >= v2.size();
        }
        signed main()
        {
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            int t=1;
            //cin>>t;
            while(t--)
            {
               int n;
               cin>>n;
               if(n%1000==0) cout<<0<<endl;
               else cout<<1000-n%1000<<endl;
            }
        }


Measured memory_bytes: 3604
N, M = map(int, input().split())
A_list = list(map(int, input().split()))

A_list = sorted(A_list, reverse=True)

sum_A = sum(A_list)

if A_list[M-1] < (sum_A * (1 / (4 * M))):
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3060
N = list(map(int, input()))
# 最初が0のとき
if N[0] == 0:
    seikai = [0] * int(len(N))
    for i in range(1, len(N), 2):
        seikai[i] = 1
else:
    seikai = [1] * int(len(N))
    for i in range(1, len(N), 2):
        seikai[i] = 0

ans = 0
for m in range(len(N)):
    if not N[m] == seikai[m]:
        ans += 1

print(ans)

Measured memory_bytes: 4640
#include<iostream>
using namespace std;
int main()
{
  int H, W;
  cin >> H >> W;
  while(H!=0 && W!=0)
  {
  for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
        if(i == 0 || i == H-1 || j == 0 || j == W-1)
        cout << "#";
        else cout << ".";
        }
        cout << endl;
  }
  cout << endl;
  cin >> H >> W;
  }
   return 0;
  }



Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    double sum;
    cin >> N;
    vector<double> S(N);
    for (int i = 0; i < N; i++) {
        cin >> S.at(i);
    }
    for (int i = 0; i < N - 1; i++) {
        sort(S.begin(), S.end());
        sum = (S.at(i) + S.at(i + 1)) / 2;
      S.at(i) = sum;
      S.at(i + 1) = 0;
    }
    cout << sum << endl;
}

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

points = []

defer = []

for i in range(n):
  (x, y) = map(int, input().split())
  points.append((x,y))

points.sort()

for i in range(n):
  for j in range(i+1, n):
    defer.append((points[j][0] - points[i][0], points[j][1] - points[i][1]))

maxi = 0

for d in set(defer):
  maxi = max(defer.count(d), maxi)

print(n - maxi)

Measured memory_bytes: 39664
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

LL dp[2][2019];


int main(){
    string s;cin >> s;
    int n = s.length();
    LL ans = 0;
    for (int i = 0; i < n; i++) {
        int p = i % 2;
        dp[p][0]++;
        for (int j = 0; j < 2019; j++) {
            int nj = (j * 10 + s[i] - '0') % 2019;
            dp[p^1][nj] = dp[p][j];
        }
        ans += dp[p^1][0];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3720
#create date: 2020-07-01 11:48

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    k = ni()
    s = ns()
    n = len(s)
    if n <= k:
        print(s)
    else:
        print(s[:k] + "...")

if __name__ == "__main__":
    main()

Measured memory_bytes: 9064
#include<bits/stdc++.h>
#include<algorithm>
#define int long long
#define double long double
using namespace std;
signed main(){
	int n,k;
	cin>>n>>k;
	double sum=0;
	for(int i=1;i<n+1;i++){
		int i2=i;
		for(int j=0;j<20;j++){
			if(k<=i){
				sum+=pow(2,20-j);
				j+=114514;
			}
			i=i*2;
		}
		i=i2;
	}
	double ans=sum/(1048576*n);
	printf("%.45Lf\n",ans);
}			


Measured memory_bytes: 256
H=W=100
WHITE=?.
BLACK=?#
a,b=gets.split.map(&:to_i)
ans=[]
(H/2).times{ans<<(BLACK*W)}
(H/2).times{ans<<(WHITE*W)}
a-=1
b-=1
x=1
y=1

a.times{
  ans[x][y]=WHITE
  y+=2
  if y>W
    x+=2
    y=1
  end
}

x=(H/2)+1
y=1
b.times{
  ans[x][y]=BLACK
  y+=2
  if y>W
    x+=2
    y=1
  end 
}

puts [H,W].join(" ")
puts ans

Measured memory_bytes: 1788
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

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

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	x := make([]int, 5)
	ans := 0
	for i := 0; i < 5; i++ {
		x[i] = getInt()
		if x[i] == 0 {
			ans = i
		}
	}
	out(ans + 1)
}


Measured memory_bytes: 1752
#include<iostream>
#include<string>
using namespace std;
int main() {
	int ans[111], an,out, n,iti,ni,san;
	string a;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		ans[i] = 0;
		iti = 0;
		out = 0;
		ni = 0;
		san = 0;
		while (1) {
			cin >> a;
			if (a == "HIT") {
				if (san == 1) {
					ans[i] = ans[i] + 1;
					san = 0;
				}
				if (ni == 1) {
					san = 1;
					ni = 0;
				}
				if (iti == 1) {
					ni = 1;
					iti = 0;
				}
				iti = 1;
			}
			if (a == "HOMERUN") {
				if (san == 1) {
					ans[i] = ans[i] + 1;
					san = 0;
				}
				if (ni == 1) {
					ans[i] = ans[i] + 1;
					ni = 0;
				}
				if (iti == 1) {
					ans[i] = ans[i] + 1;
					iti = 0;
				}
				ans[i] = ans[i] + 1;
			}
			if (a == "OUT") {
				out = out + 1;
				if (out == 3) {
					goto a;
				}
			}
		}
	a:;
	}
	for (int i = 1; i <= n; i++) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; typedef long double ld;
const int INF32 = 1e9+10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X, Y; cin >> X >> Y;
  cout << X + Y/2 << endl;
}


Measured memory_bytes: 256
def gcd(a,b):
	if b == 0 :
		return a
	else :
		return gcd(b,a%b)
 
def lcm(a,b):
	return a*b/gcd(a,b)
 
n = int(input())
arr = []
for i in range(n):
 
	arr.append(int(input()))
 
 
def mlcm():
 	if n == 1:
 		return arr[0]

	ans = lcm(arr[0],arr[1])
 
	i = 2
	while i<n:
		ans = lcm(ans,arr[i])
		i+=1
 
	return ans
 
print mlcm()

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

bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  ll n,m;
    cin>>n>>m;
  vector<pair<ll,ll>> p(n);
  for(int i =0; i<n ;i++){
    ll a,b;
    cin>>a>>b;
    p[i] = make_pair(a,b);
  }
  sort(p.begin() , p.end());
  ll ans =0,num=0;
  for(int i =0; i<n ;i++){
    num += p[i].second;
    if(num < m){
      ans += p[i].first * p[i].second;
    }
    else{
      ans += p[i].first * (m-num+p[i].second);
      break;
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b){
        a+=b;
        b=a-b;
        a=a-b;
    }
    if(a<c&&c<b) cout<<"Yes\n";
    else cout<<"No\n";
}

Measured memory_bytes: 256
while True:
    n,m=map(int,input().split())
    if n==0 and m==0:
        break
    pd=[list(map(int,input().split()))[::-1] for i in range(n)]
    pd.sort()
    pd.reverse()
    ans=0
    for i in pd:
        if m>i[1]:
            m-=i[1]
        elif m>0:
            ans+=i[0]*(i[1]-m)
            m=0
        else:
            ans+=i[0]*i[1]
    print(ans)


Measured memory_bytes: 6748
#include <iostream>
using namespace std;
int main() {
    int N,max=0,sum=0;
    cin >> N;
    int L[N];
    for (int i=0; i<N; i++) {
        cin >> L[i];
        if (max < L[i]) max = L[i];
    }
    bool flg = true;
    for (int i=0; i<N; i++) {
        if (max == L[i]) {
            if (flg == true) {
                flg = false;
            } else {
                sum += L[i];
            }
        } else {
            sum += L[i];
        }
    }
    if (max < sum)
        cout << "Yes" << endl;
    else
        cout << "No"  << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [str(input()) for i in range(n)]

a = s.count(('AC'))
b = s.count(('WA'))
c = s.count(('TLE'))
d = s.count(('RE'))

print("AC x {}".format(a))
print("WA x {}".format(b))
print("TLE x {}".format(c))
print("RE x {}".format(d))


Measured memory_bytes: 82640
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let mut r: Vec<(i16, i16)> = (0..n).map(|_| (s.next().unwrap().parse().unwrap(), s.next().unwrap().parse().unwrap())).collect();
	let mut b: Vec<(i16, i16)> = (0..n).map(|_| (s.next().unwrap().parse().unwrap(), s.next().unwrap().parse().unwrap())).collect();
	r.sort();
	b.sort();
	let mut ans = 0;
	for (x, y) in b {
		let mut maxy = -1;
		let mut j = 0;
		for (i, r) in r.iter().take_while(|r| r.0 < x).enumerate() {
			if r.1 < y && r.1 > maxy {
				maxy = r.1;
				j = i;
			}
		}
		if maxy >= 0 {
			r[j].1 = std::i16::MAX;
			ans += 1;
		}
	}
	println!("{}", ans);
}


Measured memory_bytes: 4352
package main

import "fmt"

func main() {
	var n, m, x, l, h, t int
	fmt.Scan(&n, &m, &x)
	for i := 0; i < m; i++ {
		fmt.Scan(&t)
		if t < x {
			l++
			continue
		}
		h++
	}
	if l < h {
		fmt.Println(l)
		return
	}
	fmt.Println(h)
}


Measured memory_bytes: 512
#include <iostream>
#include<string>
#include<algorithm>
#include<stdio.h>

using namespace std;

int main(){
    int r,g,b;
    scanf("%d %d %d",&r,&g,&b);//caution!
    if((100*r + 10*g + b) % 4 == 0){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n, m;
  cin >> n >> m;
  vector<vector<ll>> to(n);
  vector<ll> deg(n, 0);
  REP(i, n + m - 1) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    to[b].push_back(a);
    deg[a]++;
  }

  stack<ll> st;
  REP(i, n) if (deg[i] == 0) st.push(i);
  // dp[i] = 頂点iを始点とするパス長の最大値
  vector<ll> topo, dp(n, 0);
  while (!st.empty()) {
    ll cv = st.top();
    st.pop();
    topo.push_back(cv);
    FOREACH(nv, to[cv]) {
      deg[nv]--;
      dp[nv] = max(dp[nv], dp[cv] + 1);
      if (deg[nv] == 0) st.push(nv);
    }
  }
  vector<ll> inv(n);
  REP(i, n) { inv[topo[i]] = i; }

  auto comp = [&inv](ll i, ll j) { return inv[i] < inv[j]; };

  REP(i, n) {
    if (SZ(to[i]) > 0) sort(ALL(to[i]), comp);
  }

  REP(i, n) {
    if (SZ(to[i]) == 0) {
      cout << 0 << endl;
      continue;
    }
    cout << to[i][0] + 1 << endl;
  }
}

Measured memory_bytes: 10288
#include<bits/stdc++.h>
    using namespace std;
    int n, dp[10000000], c = 0, cnt = 0;
    int main()
    {
      cin >> n;
      for(int i = 1; i <= n; i ++)
      {
            cin >> dp[i];
            if(dp[i] % 4 == 0)
                  c ++;
            else
            if(dp[i] % 2 == 0)
                  cnt ++;
      }

      if((c + cnt / 2) >= n / 2)
            cout << "Yes";
      else
            cout << "No";
     }


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#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 ll long long
#define pb(a) push_back(a)

int main(){
  int a, b;
  cin >> a >> b;
  if((a * b) % 2 == 1) cout << "Yes";
  else cout << "No";
}


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

using namespace std;

#define TRACE(x) cerr << #x << " " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<

#define fst first
#define snd second

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

const int B = 27397, MOD = 1e9 + 7;
const int B1 = 33941, MOD1 = 1e9 + 9;

int x;

int main(void) {
  scanf("%d", &x);

  int lo = 0, hi = x;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    if ((llint) mid * (mid + 1) - (llint) 2*x >= 0)
      hi = mid;
    else
      lo = mid + 1;
  }

  printf("%d\n", lo);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
 
#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)
 
inline ll score( const vector<ll>& s, ll a, ll b, ll n )
{
	ll cur = 0;
	ll ret = 0;
	while( cur < n )
	{
		cur += a;
		ret += s[cur];
		if( cur == n - 1 ) break;
		cur -= b;
		ret += s[cur];
	}
	return ret;
}
 
template <typename T>
inline vector<T> divisor( T n )
{
	vector<T> res;
	for( T i = 1; i * i <= n; ++i )
	{
		if( n % i == 0 )
		{
			res.push_back( i );
			if( i != n / i ) res.push_back( n / i );
		}
	}
	sort( ALL( res ) );
	return res;
}
 
template <typename T>
inline T gcd(T a, T b)
{
	if (a < b)
		swap(a, b);
	return b ? gcd(b, a % b) : a;
}
 
int main()
{
	ll n; cin >> n;
	vector<ll> s( n, 0 );
	REP(i,n) cin>>s[i];

	vector<vector<ll>> dp(n, vector<ll>());
	REP(i,n) if( i >= 1 )
	{
		dp[i].push_back( 0 );
		for( ll j = 1; j * i < n; ++j )
		{
			auto sum = s[i*j] + s[n-1-i*j] + dp[i][j-1];
			dp[i].push_back( sum );
		}
	}
 
	ll ans = 0;
	REP( a, n )
	{
		if( a <= 2 || a == n - 1 ) continue;
		auto div = divisor<ll>( n - 1 - a );
		for( auto m : div )
		{
			ll b = a - ( n - 1 - a ) / m;
			//cout << a << " " << b << " " << m << " " << endl;
			if( a <= b || b <= 0 ) continue;
 
			// どぼん
			ll g = gcd<ll>( a, b );
			ll a_ = a / g;
			ll b_ = b / g;
			if( a_ == b_ + 1 && b_ < m ) continue;
 
			ll sc = dp[a-b][m];
			//cout << a << " " << b << " " << sc << endl;
			ans = max( ans, sc );
		}
	}
	cout << ans << endl;
 
	return 0;
}

Measured memory_bytes: 20016
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, K;

  std::cin >> N >> K;

  if (K == 1) {
    std::cout << 0 << std::endl;
  }
  else {
    int n = N - (K - 1);

    std::cout << n - 1 << std::endl;
  }

  return 0;
}


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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

while(len(make_divisors(N)) != 2):
    if N % 2 == 0:
        N += 1
    else:
        N += 2

print(N)

Measured memory_bytes: 2940
X = int(input())
powers = [1] + [2**i for i in range(2,10)] + [3**i for i in range(2,7)] + [5**i for i in range(2,5)] + [6**i for i in range(2,4)] + [7**i for i in range(2,4)] + [10**i for i in range(2,4)] + [a**2 for a in range(11,32)]
Y =filter(lambda n:n<=X, powers)
print(max(Y))

Measured memory_bytes: 3188
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;

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

    vector<int> a(n), b(n), c(n-1);
    rep(i, n) {
        cin >> a[i];
        --a[i];
    }
    rep(i, n) {
        cin >> b[i];
    }
    rep(i, n - 1) {
        cin >> c[i];
    }

    int sum = 0;
    rep(i, n) {
        //cout << a[i];
        sum += b[a[i]];
        if(i >= 1 && a[i]-1 == a[i-1]) sum += c[a[i-1]];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
str = gets.chomp
str_len = str.length
str = str.split("")

for i in 0 ..str_len - 1
	if (str[i].ord > 64) && (str[i].ord < 91)
		str[i] = str[i].downcase
	elsif (str[i].ord > 96) && (str[i].ord < 123)
		str[i] = str[i].upcase
	end
end

puts str.join

Measured memory_bytes: 6120
using System;
using System.Linq;

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var n = decimal.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split(" ").Select(decimal.Parse).ToArray();

            var max = array[0];
            decimal result = 0;
            foreach (var element in array)
            {
                if (max > element)
                {
                    result += max - element;
                }
                else if (max < element)
                {
                    max = element;
                }
            }

            Console.WriteLine(result);
        }
    }
}

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

int main(){
    int n,k;
    cin>> n;
    string s;
    cin >> s;
    cin >> k;
    for(int i = 0; i < n; i++)
    {
        if(s[i]!=s[k-1]){
            s[i]='*';
        }
    }
    cout << s <<endl;
    return(0);
}

Measured memory_bytes: 256
from collections import deque, defaultdict
N, X, Y = map(int, input().split())  # N個の頂点, XとYが繋がっている

graph = [[] for _ in range(N)]
for i in range(N-1):
    graph[i].append(i+1)
    graph[i+1].append(i)
X -= 1
Y -= 1
graph[X].append(Y)
graph[Y].append(X)
# print(graph)

# 最後に//2すれば良い
ans = defaultdict(int)
for i in range(N):
    q = deque()
    # 開始のノード
    q.append(i)
    visited = [False]*N
    visited[i] = True
    distant = [100000] * N
    distant[i] = 0
    while len(q):
        v = q.popleft()
        for e in graph[v]:
            if visited[e]:
                continue
            distant[e] = distant[v] + 1
            ans[distant[e]] += 1
            visited[e] = True
            q.append(e)
    # 始点iからの幅優先探索完了
# print(ans)
for i in range(1, N):
    print(ans[i]//2)


Measured memory_bytes: 51036
N, M = map(int, input().split())
nums = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    nums[a - 1] += 1
    nums[b - 1] += 1

for num in nums:
    if num % 2:
        print('NO')
        break
else:
    print('YES')


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

int main() {
  int num;
  int tmp;
  cin >> num;
  
  vector<int> vec(100001,0);
  for(int i = 0; i < num; i++){
    cin >> tmp;
    if(tmp > 0)vec.at(tmp-1) += 1;
    vec.at(tmp) += 1;
    vec.at(tmp+1) += 1;
  }
  
  sort(vec.begin(), vec.end(), greater<int>());
  
  cout << vec.at(0);
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(int, k);
	int x = 0, i = 0;
	do {
		x = (10 * x + 7) % k;
		i++;
		if(i > 2 * k) { OUT(-1); exit(0); }
	} until(x == 0);
	OUT(i);
}


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

#define ll                 long long
#define lcm(a,b)           (a*b)/__gcd(a,b) 
#define pb                 push_back
#define vecll              vector<ll>
#define F                  first
#define S                  second
#define all(v)             v.begin(),v.end()
#define mp(a,b)            make_pair(a,b)
#define MOD                1000000007
#define forn(i,n)          for(ll i=0;i<n;i++)
#define fori(i,a,n)        for(int i=a; i<n; i++)
using namespace std;
int n;
ll gcd(ll a,ll b)
{
  if(b==0)
    return a;
  else
    return gcd(b,a%b);
}
void solve()
{
  string s;
  cin>>s;
  if(s=="ABC")
  {
    cout<<"ARC"<<endl;
  }
  else
  {
    cout<<"ABC"<<endl;
  }
  return;
}
int main()
{
  int t;
  // cin>>t;
  t=1;
  while(t--)
  {
    solve();
  }
  return 0;
}


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

using namespace std;

int main()
{

    int n, k, min = 0;
    cin >> n >> k;

    vector<int> p;

    for (size_t i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        p.push_back(x);
    }

    sort(p.begin(), p.end());

    for (size_t i = 0; i < k; i++)
    {
        min += p[i];
    }
    
    cout << min;

    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll N;

int main() {
	std::cout << std::setprecision(10);
	cin >> N;
	if (N % 2 == 0) {
		cout << 0.5000000000 << endl;
	}
	else {
		cout << (lldo)(N + 1) / 2 / N << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 200000 + 5
#define M 4000 + 5
#define Mod 1000000007
#define rep(i, l, r) for(int i = l; i <= r; ++i)
int n, del, ans, a[N], b[N], f[N], inv[N], dp[M][M];
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int c(int x){ return x + del;}
int Inc(int a, int b){ return (a += b) >= Mod ? a - Mod : a;}
int Dec(int a, int b){ return (a -= b) < 0 ? a + Mod : a;}
int Mul(int a, int b){ return 1ll * a * b % Mod;}
int Qpow(int a, int b){
    int ans = 1;
    while(b){
        if(b & 1) ans = Mul(ans, a);
        a = Mul(a, a), b >>= 1;
    }
    return ans;
}
int C(int n, int m){
    if(m > n) return 0;
    return Mul(f[n], Mul(inv[m], inv[n - m]));
}
int main(){
    f[0] = inv[0] = 1;
    rep(i, 1, N - 5) f[i] = Mul(f[i - 1], i), inv[i] = Qpow(f[i], Mod - 2);
    n = read(), del = 2000;
    rep(i, 1, n) a[i] = read(), b[i] = read(), dp[c(-a[i])][c(-b[i])] += 1;
    rep(i, -del, del) rep(j, -del, del){
        if(i > -del) dp[c(i)][c(j)] = Inc(dp[c(i)][c(j)], dp[c(i - 1)][c(j)]);
        if(j > -del) dp[c(i)][c(j)] = Inc(dp[c(i)][c(j)], dp[c(i)][c(j - 1)]);
    }
    rep(i, 1, n) ans = Inc(ans, dp[c(a[i])][c(b[i])]);
    rep(i, 1, n) ans = Dec(ans, C(a[i] + a[i] + b[i] + b[i], a[i] + a[i]));
    ans = Mul(ans, Qpow(2, Mod - 2));
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 66048
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  string s1, s2, t1, t2; cin >> s1 >> s2 >> t1 >> t2;
  if(t2 == "1"){
    cout << 1 << endl;
  }else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
main(){
    int N,L[200],sum = 0;
    cin >> N;
    for(int i = 0;i < N*2;i++)cin >> L[i];
    sort(L,L+N*2);
    for(int i = 0;i < N;i++)sum += L[i*2];
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
// template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define Mod 1000000007
#define MAX 100100

ll n,k;
vector<ll> adj[MAX];

ll f(ll start,ll parent,ll dist){
	ll ans = 1;
	ll children = 0;
	for(ll x:adj[start]) if(x!=parent){
		ll t = f(x,start,dist+1);
		ans = (ans*t)%Mod;
		children++;
	}

	//Case 1
	ll index = k-1;
	//Case 2
	if(dist>=1) index = k-2;

	while(children>0){
		if(index<0) return 0;
		ans = (ans*index)%Mod;
		children--;
		index--;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cin>>n>>k;
	For(i,0,n-1){
		ll x,y;cin>>x>>y;x--;y--;
		adj[x].pb(y);
		adj[y].pb(x);
	}

	cout<<(k*f(0,-1,0))%Mod<<endl;





























	
}

Measured memory_bytes: 11648
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
int main() {
    string a, b, c;
    cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0] << endl;
    return 0;
}

Measured memory_bytes: 3628
h, w, k = map(int, input().split())
a = [0]*(w-1) + [0,1]
for i in range(w-1):
    a[i] = a[i-1] + a[i-2]
dp = [0]*(w+1)
tmp = [0]*(w+1)
dp[0] = 1
for _ in range(1, h+1):
    for i in range(w):
        tmp[i] = (dp[i]*a[i-1]*a[w-i-2]
            + dp[i+1]*a[i-1]*a[w-i-3]
            + dp[i-1]*a[i-2]*a[w-i-2]) % (10**9+7)
    dp, tmp = tmp, dp
print(dp[k-1])


Measured memory_bytes: 38384