akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int MX = 100010;
int p[MX];
int root(int x){
	if(x == p[x]) return x;
	return p[x] = root(p[x]);
}
void merge(int a, int b){
	a = root(a); b = root(b);
	if(a != b) p[b] = a;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, m; cin >> n >> m;
	rep(i, n) p[i] = i;
	rep(i, m){
		int a, b, c; cin >> a >> b >> c; a--; b--;
		if(root(a) == root(b)) continue;
		n--;
		merge(a, b);
	}
	cout << n << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main()
{
 string a,s;
 cin >> s;
 a=s.substr(0,2);
 s=s.substr(2,2);
 set<string> x;
 x.insert("01");
 x.insert("02");
 x.insert("03");
 x.insert("04");
 x.insert("05");
 x.insert("06");
 x.insert("07");
 x.insert("08");
 x.insert("09");
 x.insert("10");
 x.insert("11");
 x.insert("12");
 if(x.find(a)!=x.end() && x.find(s)!=x.end())
 cout << "AMBIGUOUS";
 else if(x.find(a)!=x.end())
 cout << "MMYY";
 else if(x.find(s)!=x.end())
 cout << "YYMM";
 else
 cout << "NA";
 return 0;
}

Measured memory_bytes: 256
gets
a = gets.split(" ").map(&:to_i)  

gets.to_i.times{
    b,m,e = gets.split(" ").map(&:to_i)
    a = a[0...b].push(a[b...e].rotate(m-e).push(*a[e..-1])).flatten
}
puts a.join(' ')


Measured memory_bytes: 25268
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#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 CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
double V = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string C;
string sA, strB;
vector<vector<char>> map;
vector<double> num;
vector<string> str;

int sum = 0;

vector<int> value;
vector<int> weight;

int dp[110][10010];

int data_[210][2] = { -2 };

void input(void) {
	
	return;
}


int main(void) {
	double x_;

	while (scanf("%lf", &x_) != EOF) {
		if (x_ <= 48.00) {
			CO "light fly" E
		}
		if (x_ > 48.00 && x_ <= 51.00) {
			CO "fly" E
		}
		if (x_ > 51.00 && x_ <= 54.00) {
			CO "bantam" E
		}
		if (x_ > 54.00 && x_ <= 57.00) {
			CO "feather" E
		}
		if (x_ > 57.00 && x_ <= 60.00) {
			CO "light" E
		}
		if (x_ > 60.00 && x_ <= 64.00) {
			CO "light welter" E
		}
		if (x_ > 64.00 && x_ <= 69.00) {
			CO "welter" E
		}
		if (x_ > 69.00 && x_ <= 75.00) {
			CO "light middle" E
		}
		if (x_ > 75.00 && x_ <= 81.00) {
			CO "middle" E
		}
		if (x_ > 81.00 && x_ <= 91.00) {
			CO "light heavy" E
		}
		if (x_ > 91.00) {
			CO "heavy" E
		}
	
	}



	return 0;
}

Measured memory_bytes: 3208
#include <stdio.h>
int arr[3][110];
int sum[3][110];
int main()
{
    int n,i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%d",&arr[1][i]);
    for(i=1;i<=n;i++)
        scanf("%d",&arr[2][i]);
    for(i=n;i>=1;i--)
            sum[2][i]=sum[2][i+1]+arr[2][i];
    for(i=n;i>=1;i--)
            sum[1][i]=(sum[2][i]>sum[1][i+1]?sum[2][i]:sum[1][i+1])+arr[1][i];
    printf("%d",sum[1][1]);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>

using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

#define MOD (1000000000+7)

int dp[100001][3];
int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        int a, b, c;
        cin >> a >> b >> c;
        if (i == 0) {
            dp[i][0] = a;
            dp[i][1] = b;
            dp[i][2] = c;
        } else {
            dp[i][0] = max(dp[i-1][1], dp[i-1][2])+a;
            dp[i][1] = max(dp[i-1][0], dp[i-1][2])+b;
            dp[i][2] = max(dp[i-1][0], dp[i-1][1])+c;
        }

    }
    cout << max(max(dp[N-1][0], dp[N-1][1]), dp[N-1][2]) << endl;
}


Measured memory_bytes: 1408
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  int dx[8] = {1,0,-1,0,1,1,-1,-1};
  int dy[8] = {0,-1,0,1,1,-1,-1,1};

  int H,W;
  cin >> H >> W;
  string board[H];
  for(int i = 0; i < H; i++) cin >> board[i];
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(board[i][j] == '#') continue;
      int cnt = 0;
      for(int k = 0; k < 8; k++){
        int nx = j + dx[k];
        int ny = i + dy[k];

        if(nx < W && nx >= 0 && ny < H && ny >= 0 && board[ny][nx] == '#'){
          cnt++;
        }
      }
      board[i][j] = (char)(cnt + '0');

    }
  }
  for(int i = 0; i < H; i++) cout <<  board[i] << endl;
  return 0;
}


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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

template<typename F> long long discrete_binary_search(long long ok, long long ng, F is_ok) {
    while (abs(ok - ng) > 1) {
        long long mid = (ok + ng) / 2;
        (is_ok(mid) ? ok : ng) = mid;
    }
    return ok;
}

int X;
signed main() {
    cin >> X;
    int cur = 1, prod;
    vpint v = {{0, 0}};
    while ((prod = cur * cur * cur * cur * cur) - v.back().first <= X) {
        v.push_back({prod, cur});
        cur++;
    }
    vpint u;
    for (int i = v.size() - 1; i >= 0; i--) { u.push_back({-v[i].first, -v[i].second}); }
    for (int i = 1; i < v.size(); i++) { u.push_back(v[i]); }
    rep(i, u.size()) {
        auto c = [&](int k) {
            return u[i].first - u[k].first <= X;
        };
        int j = discrete_binary_search((int) u.size(), -1, c);
        if (u[i].first - u[j].first == X) { fin(to_string(u[i].second) + " " + to_string(u[j].second)); }
    }
}


Measured memory_bytes: 3708
K,N = [int(i.strip()) for i in input().split(' ')]
A = list(input().split(' '))
A = [int(i) for i in A]

maxx = 0
for i,v in enumerate(A):
    if i == 0:
        right = A[i+1]
        a ,b = K-A[-1]+A[0], abs(v-right)
    elif i == len(A)-1:
        left = A[i-1]
        a, b = abs(v-left) , K-v+A[0]
    else:
        left,right = A[i-1],A[i+1]
        a, b = abs(v-left) , abs(v-right)


    if maxx < a:
        T = i
        turn = 'right'
        maxx = a
    
    if maxx < b:
        T = i
        turn = 'left'
        maxx = b

print(K - maxx)
    

Measured memory_bytes: 24948
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    string S;
    cin >>S;
    sort(all(S));
    if(S=="abc"){
        cout<<"Yes"<<endl;
    }else{
        cout << "No" << endl;
    }
    
    


    return 0;
    

}

Measured memory_bytes: 3588
#include <stdio.h>

int main(){
 char s[5];
  int a,b,c,d;
scanf ("%s",s);
  a=s[0]-'0';
  b=s[1]-'0';
  c=s[2]-'0';
  d=s[3]-'0';
  if(a+b+c+d==7) {printf("%d+%d+%d+%d=7",a,b,c,d);}
  else if(a+b+c-d==7){printf("%d+%d+%d-%d=7", a,b,c,d);}
  else if(a+b-c+d==7){printf("%d+%d-%d+%d=7",a,b,c,d);}
  else if(a+b-c-d==7){printf("%d+%d-%d-%d=7",a,b,c,d);}
  else if(a-b+c+d==7){printf("%d-%d+%d+%d=7",a,b,c,d);}
  else if(a-b+c-d==7){printf("%d-%d+%d-%d=7",a,b,c,d);}
  else if(a-b-c+d==7){printf ("%d-%d-%d+%d=7",a,b,c,d);}
  else if(a-b-c-d==7){printf ("%d-%d-%d-%d=7",a,b,c,d);}
}

Measured memory_bytes: 128
#encoding:utf-8 No.0004 2014.9.29
coefficients = []

while gets
 data = $_.split
 data.length.times do |i|
  data[i] = data[i].to_f
 end

 coefficients.push data
end

coefficients.length.times do |i|
 x = (coefficients[i][2]*coefficients[i][4] - coefficients[i][1]*coefficients[i][5])/(coefficients[i][0]*coefficients[i][4] - coefficients[i][3]*coefficients[i][1])
 y = (coefficients[i][2]*coefficients[i][3] - coefficients[i][0]*coefficients[i][5])/(coefficients[i][1]*coefficients[i][3] - coefficients[i][0]*coefficients[i][4])

 printf("%.3f %.3f\n",x+0.0,y+0.0)
end

Measured memory_bytes: 6156
//package atcoder.ABC;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int w = sc.nextInt();
		
		if(s<=w) {
			System.out.println("unsafe");
		}
		else {
			System.out.println("safe");
		}
	}

}


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

const int MAXN = 2010;
int N;
int K;
int Q;
int A[MAXN];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> K >> Q;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	int ans = 2e9;
	for (int z = 0; z < N; z++) {
		int mi = A[z];
		vector<int> buf;
		vector<int> cnds;
		for (int i = 0; i <= N; i++) {
			if (i == N || A[i] < mi) {
				if (int(buf.size()) >= K) {
					int cnt = int(buf.size()) - K + 1;
					nth_element(buf.begin(), buf.begin() + cnt, buf.end());
					cnds.insert(cnds.end(), buf.begin(), buf.begin() + cnt); 
				}
				buf.clear();
			} else {
				buf.push_back(A[i]);
			}
		}
		
		if (int(cnds.size()) >= Q) {
			nth_element(cnds.begin(), cnds.begin() + Q-1, cnds.end());
			ans = min(ans, cnds[Q-1] - mi);
		}
	}
	cout << ans << '\n';

	return 0;
}


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

int count(int n, int x){
    int cnt = 0;
    for ( int i = 1; i <= n-2; i++){
        for (int j = i+1; j<= n-1; j++){
            for (int k = j+1; k<=n; k++){
                if (i+j+k == x)cnt++;
            }
        }
    }
    return cnt;
}

int main(){
    int n, x;
    while(1){
        cin >> n >> x;
        if (n == 0 && x == 0) break;
        cout << count(n,x) << endl;
    }
    return 0;
}


Measured memory_bytes: 3080
#include <iostream>

using namespace std;

const int STUDENT_MAX = 50;

int main() {
  int m[STUDENT_MAX], f[STUDENT_MAX], r[STUDENT_MAX];
  int s = 0;
  do {
    cin >> m[s] >> f[s] >> r[s];
    if ((m[s] == -1) && (f[s] == -1) && (r[s] == -1)) break;
  } while (++s < STUDENT_MAX);
  for (int i = 0; i < s; ++i) {
    char grade;
    if ((m[i] == -1) || (f[i] == -1)) grade = 'F';
    else {
      int t = m[i] + f[i];
      if      (80 <= t) grade = 'A';
      else if (65 <= t) grade = 'B';
      else if (50 <= t) grade = 'C';
      else if (30 <= t) {
        if (50 <= r[i]) grade = 'C';
        else            grade = 'D';
      } else            grade = 'F';
    }
    cout << grade << endl;
  }
  return 0;
} 



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

int32_t main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	int a[n];
	for(int i=0;i<n;i++)
		cin >> a[i];
	int r=1,sum=0;
	for(int i=0;i<62;i++){
		int o=0,e=0;
		for(int j=0;j<n;j++){
			if(a[j]%2)e++;
			else o++;
			a[j]/=2;
		}
		int x=(o*e)%md;
		sum=(sum+(x*r)%md)%md;
		r=(r*2)%md;
	}
	cout << sum << endl;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k, x;
  cin >> k >> x;
  for(int i = x - k + 1; i < x - k + 1 + (2*k) - 1; i++){
    cout << i << ' ';
  }
  cout << endl;
}


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

using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define sz(s) (int)s.size()

int main() {
    string s, res = "";
    cin >> s;
    for (int i = 0; i < (int)s.length(); i += 2) res.push_back(s[i]);
    cout << res;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char a[105];
char b[105];
char c[105];

int  main()
{
    scanf("%s",a);
    int len=strlen(a);
    if(len%2==0)
    {
        return !printf("No\n");

    }
    int t=(len-1)/2;
    int d=(len+3)/2;
    for(int i=0; i<len/2; i++)
    {
        if(a[i]!=a[len-i-1])
        {
            
            return !printf("No\n");

        }
    }
    for(int i=0; i<t/2; i++)
    {
        if(a[i]!=a[t-i-1])
        {
            
            return !printf("No\n");

        }
    }
    for(int i=d; i<len/2; i++)
    {
        if(a[i]!=a[len-i-1])
        {
            return !printf("No\n");

        }
    }

    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define floop(i,a,b) for (int i=(a);i<(b);i++)
#define rloop(i,a,b) for (int i=(a);i>=(b);i--)
#define floopeq(i,a,b) for (int i=(a);i<(b);i++)
#define pa pair<int,int>
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)  
{  
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)  
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;  
}

void solve()
{
	int x,y;
	cin>>x>>y;
	if(y<=x*4 && y>=x*2 && y%2==0)
	{
		cout<<"Yes";
		return;
	}
	else
	{
		cout<<"No\n";
		return;
	}
}
int main() 
{ 
    
    int t;
    t=1;
    while(t--){
    	solve();
    }
    return 0; 

} 


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

int main(void) {
    string os, rs, s_os, s_rs;
    cin >> os;
    rs = os;
    s_os = os.substr(0, os.length() / 2);
    s_rs = s_os;

    reverse(rs.begin(), rs.end());
    reverse(s_rs.begin(), s_rs.end());

    if(os == rs) {
        if(s_os == s_rs) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

int main(void){
    int S,W;
    cin >> S >> W;
    if(W>=S) cout<<"unsafe"<<endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>

using namespace std;

int abs(int n){
    if (n < 0){
        n *= -1;
    }
    return n;
}

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

    vector <int> A(N);
    long long sum = 0;
    int minus = 0, zero = 0;
    for (int i = 0; i < N; i++){
        cin >> A[i];

        if (A[i] < 0){
            minus ++;
        }
        if (A[i] == 0){
            zero ++;
        }
        sum += abs(A[i]);
    }
    long long ans;
    if (minus % 2 != 0 && zero == 0){
        int min = abs(A[0]);
        for (int i = 0; i < N; i++){
            if (abs(A[i]) < min){
                min = abs(A[i]);
            }            
        }
        ans = sum - 2 * min;
    }else{
        ans = sum;
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  string s,t;
  cin >> s>>t;
  int n=s.size();
  map<char,char>memo,memo2;
  bool ex=true;
  rep(i,n){
    if(memo.count(s.at(i))){
      if(memo[s.at(i)]!=t.at(i)){
        ex=false;
        break;
      }
    }
    else{
      memo[s.at(i)]=t.at(i);
      
    }
  }
  rep(i,n){
    if(memo2.count(t.at(i))){
      if(memo2[t.at(i)]!=s.at(i)){
        ex=false;
        break;
      }
    }
    else{
      memo2[t.at(i)]=s.at(i);
      
    }
  } 
   
  if(ex){
      cout<<"Yes"<<endl;
  }
  else{    
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 776
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;


bool belong(ll x, const vector<ll>& a) {
    //cerr << "op\n";
    int m = 64;
    vector<ll> b(a);
    b.push_back(x);
    int n = b.size();
    int r = 0;
    while (r < n) {
        //cerr << r << endl;
        int k = r;
        while (k < m) {
            if (((b[r] >> k) & 1) == 0)
                ++k;
            else
                break;
        }
        if (k == m)
            return 1;
        for (int i = 0; i < n; ++i) {
            if (((b[i] >> k) ^ (b[i] >> r)) & 1) {
                b[i] ^= (1LL << k) + (1LL << r);
            }
        }
        for (int j = 0; j < n; ++j) {
            if (j == r)
                continue;
            if (((b[j] >> r) & 1) == 0)
                continue;
            b[j] ^= b[r];
        }
        ++r;
    }
    return 0;

}


void solve() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    string s;
    cin >> s;
    vector<ll> b;
    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == '0') {
            if (!belong(a[i], b))
                b.push_back(a[i]);
        }
        else {
            if (!belong(a[i], b)) {
                cout << 1 << "\n";
                return;
            }
        }
    }
    cout << 0 << "\n";

}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i)
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


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

string s;
int main() {
	cin >> s;
	for(int i=0; i<s.size()-1; i++) {
		if(s[i]=='A' && s[i+1]=='C') return puts("Yes")*0;
	}
	puts("No");
	return 0;
}


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

class UnionFind {
private:
	// 各ノードの親と、属する連結成分の大きさ（ただしsizeは根のみ正しいことが保証されている）
	std::vector<int> parent_, size_;
public:
// sizeに要素数
	UnionFind(const int size);
	// indexの属する木の根を計算する
	int calcRoot(const int index);
	// index1とindex2が同じ連結成分に属しているかを判定する
	bool areConnected(const int index1, const int index2);
	// index1とindex2を連結する
	void unite(const int index1, const int index2);
	// indexの属する連結成分の大きさを計算
	int calcSize(const int index);
};

UnionFind::UnionFind(const int size)
	:parent_(size),
	size_(size, 1)
{
	for (int i{}; i < size; i++) parent_[i] = i;
};

int UnionFind::calcRoot(const int index)
{
	if (parent_[index] == index) return index;
	const int p{calcRoot(parent_[index])};
	parent_[index] = p;
	return p;
}

bool UnionFind::areConnected(const int index1, const int index2)
{
	return calcRoot(index1) == calcRoot(index2);
}

void UnionFind::unite(const int index1, const int index2)
{
	const int root1{calcRoot(index1)}, root2{calcRoot(index2)};
	if (root1 == root2) return;
	if (size_[root1] <= size_[root2])
	{
		size_[root2] += size_[root1];
		parent_[root1] = root2;
	}
	else
	{
		size_[root1] += size_[root2];
		parent_[root2] = root1;
	}
	return;
}

int UnionFind::calcSize(const int index)
{
	return size_[calcRoot(index)];
}

int main()
{
	long long n, m;
	scanf("%lld%lld", &n, &m);
	std::vector<std::pair<int, int>> bridge;
	bridge.resize(m);
	for (auto& e: bridge)
	{
		scanf("%d%d", &e.first, &e.second);
		e.first--;
		e.second--;
	}
	UnionFind uf(n);
	std::vector<long long> ans(m);
	ans.back() = n * (n - 1) / 2;
	for (long long i{m - 2}; i >= 0; i--)
	{
		auto& b{bridge[i + 1]};
		if (uf.areConnected(b.first, b.second))
			ans[i] = ans[i + 1];
		else
		{
			ans[i] = ans[i + 1] - (long long)uf.calcSize(b.first) * uf.calcSize(b.second);
			uf.unite(b.first, b.second);
		}
	}
	for (int i{}; i < m; i++)
		printf("%lld\n", ans[i]);
 
	return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<algorithm>

using namespace std;

typedef struct process{
  string name;
  int time;
} process;

int n, head, tail;
process arr[100000];

void enqueue(process x){
  arr[tail] = x;

  if(tail + 1 == 100000) tail = 0;
  else tail++;
}

process dequeue(){
  process x = arr[head];

  if(head + 1 == 100000) head = 0;
  else head++;

  return x;
}

int main(){

  int q, t, total = 0;
  process x;

  cin >> n >> q;
  for(int i = 0;i < n;i++) cin >> arr[i].name >> arr[i].time;

  head = 0;
  tail = n;

  while(head != tail){
    x = dequeue();
    t = min(x.time, q);
    x.time -= t;
    total += t;
    if(x.time != 0) enqueue(x);
    else cout << x.name << " " << total << endl;
  }

  return 0;
}




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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define fin(x) cout << x << endl;

using namespace std;
using ll = long long;

int main(void) {
  int n;
  cin >> n;
  rep(i, 10) {
    rep(j, 10) {
      if (i * j == n) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

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

void solve() {
  int l, r;
  cin >> l >> r;
  if (l + 2019 <= r) cout << 0 << '\n';
  else {
    int ans = 2019;
    rep3(i, l, r + 1) rep3(j, i + 1, r + 1) {
      chmin(ans, i * 1LL * j % 2019);
    }
    cout << ans << '\n';
  }
}


Measured memory_bytes: 256
for i in range(1,int(input())+1):
    x=i
    if x % 3 == 0:
        print(" "+str(i), end="")
    else:
        while x != 0:
            if x % 10 == 3:
                print(" "+str(i), end="")
                break
            else:
                x = x//10
print("")

Measured memory_bytes: 6736
#include <cstdio>
#include <cstring>
using namespace std;
int dp[1001][1001];
bool g[1000][1000];
int main(){
	int H,W,N;
	while(scanf("%d%d%d",&H,&W,&N),H){
		memset(dp,0,sizeof(dp));
		memset(g,0,sizeof(g));
		for(int i=0;i<H;i++)for(int j=0;j<W;j++)scanf("%d",g[i]+j);
		dp[0][0]=N-1;
		for(int i=0;i<H;i++)for(int j=0;j<W;j++)dp[i][j+1]+=(dp[i][j]+g[i][j])/2,dp[i+1][j]+=(dp[i][j]+!g[i][j])/2;
		for(int i=0;i<H;i++)for(int j=0;j<W;j++)if(dp[i][j]%2)g[i][j]=(g[i][j]?0:1);
		int y=0,x=0;
		while(y<H&&x<W){
			if(g[y][x])x++;
			else y++;
		}
		printf("%d %d\n",y+1,x+1);
	}
	return 0;
}


Measured memory_bytes: 5924
N = int(input())  # 花の数

h = list(map(int, input().split()))  # それぞれの花の高さのリスト

ans = 0

i = 0

while (True):
    if (max(h) == 0):
        break
    i = 0
    while(i < N):
        if(h[i] == 0):
            i += 1  # 0なら何もせずに次に進む
        else:
            ans += 1
            while((i < N) and (h[i] > 0)):
                h[i] -= 1
                i += 1

print(ans)


Measured memory_bytes: 3060
from sys import stdin
from collections import OrderedDict
reference_data = OrderedDict()

S = stdin.readline().rstrip()
T = stdin.readline().rstrip()
s = OrderedDict()
t = OrderedDict()
for a,b in zip(S,T):
    s[a] = set()
    t[b] = set()
for ind,i in enumerate(S):
    s[i].add(ind)
for ind,j in enumerate(T):
    t[j].add(ind)
if list(s.values()) == list(t.values()):
    print("Yes")
else:
    print("No")

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

int main(){
  int64_t N;
  cin >> N;
  int search=1;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    if(a==search){
      search++;
    }
  }
  search--;
  if(search==0){
    cout << -1 << endl;
  }else{
    cout << N-search << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n, c, k = map(int, input().split())
t = [ int(input()) for _ in range(n) ]
t.sort()

now = 0
past = t[0]
num = 0
ans = 1

for i in range(n):
    now = t[i]
    num += 1

    if now-past > k or num > c:
        ans += 1
        num = 1
        past = t[i]

print(ans)



Measured memory_bytes: 7384
#include <bits/stdc++.h>
/**
 *    author:  dattrinh
 *    created:    Problemset
**/
#define pb push_back
#define fi first
#define ss second
#define tp(x) fixed<<setprecision(x)
using namespace std;
using ll = int64_t;
const int N = 1000003;
ll t;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;cin>>s;
    int a,b;
    if(s=="AAA"||s=="BBB")cout<<"No";
    else cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n;
    cin >> n;
    VI a(n);
    int x = 0;
    REP(i,n){
        a[i] = in();
        x ^= a[i];
    }
    REP(i,n) printf("%d ", x ^ a[i]);
    cout << endl;

    return 0;
}


Measured memory_bytes: 4048
#include <stdio.h>
#include <stdlib.h>

int main(){
  int n,x,i;
  int id=1;
  int *heap;

  scanf("%d", &n);
  heap = (int *)malloc(sizeof(int)*(n+1));
  for(i=0; i<n; i++){
    scanf("%d", &x);
    heap[i+1] = x;
  }
  for(; id<=n; id++){
    printf("node %d: ", id);
    printf("key = %d, ", heap[id]);
    if(id/2 > 0)
      printf("parent key = %d, ", heap[id/2]);
    if(id*2 <= n)
      printf("left key = %d, ", heap[id*2]);
    if(id*2+1 <= n)
      printf("right key = %d, ", heap[id*2+1]);
    putchar('\n');
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)


using namespace std;
using ll = long long;

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;
}
char num(char a,int n){
    int k = a - 'A';
    k += n;
    if(k < 26){
        return a+n;
    }else return 'A'+k-26;
}

int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int k;
    string s;
    cin >> k >> s;
    string ans="";
    if(s.size() <= k){
        cout << s << endl;
        return 0;
    }else{
        rep(i,k){
            ans += s[i]; 
        }
        ans += "...";
    }
    cout << ans << endl;

   

    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define ll long long
#define MAX 500005
using namespace std;

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n;
ll a[MAX];
map<ll, ll> mp;

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        read(a[i]);
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += mp[a[i]-i];
        mp[-a[i]-i]++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 27748
n=int(input())
a=list(map(int,input().split()))
ans=1000
t=0
if a[0]<a[1]:
  d=1
  k=ans//a[0]
  ans=ans-k*a[0]
else:
  d=0
  k=0
for i in range(1,n-1):
  if d==1 and a[i]>=a[i+1]:
    ans=ans+k*a[i]
    k=0
    d=0
  elif d==0 and a[i]<a[i+1]:
    k=ans//a[i]
    ans=ans-k*a[i]
    d=1
    t=i
if d==0 or a[n-1]>=a[n-2]:
  print(ans+k*a[n-1])
else:
  print(ans+k*a[t])

Measured memory_bytes: 9236
#include<iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
    double r,s,c;
    
    cin >> r;
    c = 2 * r * M_PI;
    s = r * r * M_PI;
  
    printf("%f %f\n", s,c);

    return 0;
}

Measured memory_bytes: 3280
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstring>
#include<cmath>
#include <numeric>
#include<queue>
#include<climits>
#include<cstdio>
#include<map>


#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)
//#define INF ((LLONG_MAX) / (2))
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;
typedef pair<ll,ll> LL_LLP;
#define MOD 1000000007
#define MAX_H 100005

int main(){

    string s;
    cin >> s;
    bool ans = false;
    int first = 0,last = 0;
    if(s.length() == 2 && s[0] == s[1]){
        /* aa のようなケースの判定*/
        cout << "1 2" << endl;
        return 0;
    }

    for(int i = 0;i < s.length()-3+1;i++){

        string t = s.substr(i,3);/*s[i]から3文字の部分文字列を取り出す*/
        map<char,int> mp;
        REP(j,t.length()){
            mp[t[j]]++;
        }
        map<char,int>::iterator itr;
        for(itr = mp.begin();itr != mp.end();itr++){
            if(itr-> second >= 2){/*2回以上出現する文字があるならアンバランスである*/
                first = i+1;
                last = i+1+2;
                ans = true;
            }
        }
        if(ans){
            break;
        }
    }

    if(ans){
        cout << first << " " << last << endl;
    }else{
        cout << "-1 -1" << endl;
    }

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


int main() {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;
    ll ans=0;
    rep(i,s.size()-1) {
        if (s[i+1]!=s[i]) ++ans;
    }
    cout << ans << endl;

    return 0;   
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}
bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}

ll test[1234567];
signed main() {
	ll n, k, cnt = 0, ans = 0; cin >> k >> n;
	if (k % 2 == 0) {
		cout << k / 2;
		for (int h = 1; h < n; h++) { cout << ' ' << k; }
		cout << endl; return 0;
	}
	rep(i, n) { test[i] = k / 2 + 1; }
	cnt = n - 2;
	rep(i, n / 2) {
		if (test[cnt] == 0) { cnt--; }
		if (test[cnt + 1] == 0) {
			if (test[cnt] == 1) { test[cnt]--; }
			else {
				test[cnt]--;
				for (int h = cnt + 1; h < n; h++) { test[h] = k; }
				cnt = n - 2;
			}
		}
		else {
			test[cnt + 1]--;
		}
		/*cout << test[0];
		rep(i, n) {
			if (test[i] != 0 && i != 0) { cout << ' ' << test[i]; }
		}
		cout << endl;*/
	}
	cout << test[0]; test[0] = 0;
	rep(i, n) {
		if (test[i] != 0) { cout << ' ' << test[i]; }
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 5940
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9+7, INF = 1e18;
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;}


int A,B,C;

signed main(){
	cin>>A>>B>>C;
	int t = A%2 + B%2 + C%2;
	if(t>=2)cout<<"Hom"<<endl;
	else cout<<"Tem"<<endl;
}


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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    string s; cin >> s;
    reverse(all(s));
    int n = s.size();
    ll mod = 1;
    ll num = 0;
    map<int,int> mp;
    mp[0]++;
    rep(i,n){
        num = num + (s[i] - '0')*mod;
        num %= 2019;
        mp[num]++;
        mod = mod*10 % 2019;
    }
    ll res = 0;
    for(auto m:mp){
        res += m.second * (m.second - 1)/2;
    }
    out(res);
}

Measured memory_bytes: 3736
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
flag=False
if n>=3:
  flag=True
if flag:  
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(i+2,n):
        if l[i]<l[j]<l[k] and (l[i]+l[j])>l[k]:
          ans+=1
print(ans) 

Measured memory_bytes: 9188
import math
k=int(input())
A=[int(i) for i in input().split()]
A=A[::-1]
u_lim,l_lim=2,2
ans=0
for i in range(k):
  a=A[i]
  if math.ceil(l_lim/a)>math.floor(u_lim/a):
    ans=-1
  l_lim=math.ceil(l_lim/a)*a
  u_lim=math.floor(u_lim/a)*a+a-1
if ans==-1:
  print(-1)
else:
  print(l_lim,u_lim)

Measured memory_bytes: 14408
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, K;
    cin >> N >> K;
    ll ans = K;

    for (int i = 0; i < N-1; i++) {
        ans *= K-1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

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

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin>>n;
	int a=n/2;
	int b=n/2+n%2;
	cout<<(double)b/(a+b)<<"\n";
	return 0;
}





























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

#define LOCAL 0

#define lli long long int
#define llu unsigned long long int
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const long double EPS = 1e-10;
const lli MOD = 1000000007ll;
const lli mod1 = 1000000009ll;
const lli mod2 = 1100000009ll;
int INF = (int)1e9;
lli INFINF = (lli)1e18;
int debug = 0;

using namespace std;

void print(int a[],int s,int e){for(int i=s;i<=e;i++)cout<<a[i]<<" ";cout<<"\n";}
void print(vector<int> &v,int s,int e){for(int i=s;i<=e;i++)cout<<v[i]<<" ";cout<<"\n";}
void print(vector<int> &v){for(int x:v)cout<<x<<" ";cout<<"\n";}

lli bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
lli bit(lli _mask,lli _i){return (_mask&(1<<_i))==0?0:1;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli add(lli a,lli b,lli m=MOD){lli x=a+b;while(x>=m)x-=m;return x;}
lli sub(lli a,lli b,lli m=MOD){lli x=a-b;while(x<0)x+=m;return x;}
lli mul(lli a,lli b,lli m=MOD){lli x=a*b;x%=m;return x;}

int n;
string s;
lli ans = 0;

void solve(lli x,lli y){
    if(x==n+1){
        //cout<<y<<"\n";
        ans += y;
        return;
    }
    lli cur = 0;
    for(lli i=x;i<=n;i++){
        cur = (10*cur) + (s[i]-'0');
        solve(i+1,y+cur);
    }
}

int main()
{
if(LOCAL){
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
}
    srand (time(NULL));

    cin>>s;
    n = s.size();
    s = ' ' + s;
    solve(1,0);
    cout<<ans;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int a[10]={1,3,5,7,8,10,12};
int b[5]={4,6,9,11};
int c=2;
int main()
{
    int x,y;
    int i;
    int t1=0,t2=0;
    scanf("%d%d",&x,&y);
    for(i=0;i<=6;i++)
    {
        if(x==a[i])
            t1=1;
        if(y==a[i])
            t2=1;
    }
    for(i=0;i<=3;i++)
    {
        if(x==b[i])
            t1=2;
        if(y==b[i])
            t2=2;
    }
    if(x==2)
        t1=3;
    if(y==2)
        t2=3;
    if(t1==t2)
        printf("Yes");
    else
    {
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 128
use proconio::{input, fastout};
use proconio::marker::{Chars};
// use std::thread::*;
#[fastout]
fn main() {
    input!{
        n: Chars,
    }

    let mut sum = 0;
    for i in n {
        sum += i.to_digit(10).unwrap();
    }

    if sum%9==0 {
        println!("Yes");
    } else {
        println!("No");
    }

}


Measured memory_bytes: 3056
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int n,m;
string s;
int main(void){
  while(1){
    cin >> n;
    if(!n) break;
    cin >> m >> s;

    int ret = 0;
    int c = 0;
    for(int i = 0; i < m; i++){
      if(!c){
	if(s[i] == 'I'){
	  c = 1;
	}
      }else{
	if(s[i] == 'O' && s[i+1] == 'I'){
	  i++;
	  c++;
	}else{
	  ret += max(0,c - n);
	  c = 0;
	  i--;
	}
      }
    }
    cout << ret << endl;
  }
}

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

int main(){

  string str;
  cin >> str;

  const int ZERO_CODE = 48;

  int s1,s2,s3;
  s1 = str[0] - ZERO_CODE;
  s2 = str[1] - ZERO_CODE;
  s3 = str[2] - ZERO_CODE;

  cout << s1+s2+s3 << endl;

  return 0;
}


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

const int N = 100005;

int n;

int main() {

	FAST;

	cin >> n;
	if (n == 1) {
		cout << "Hello World\n";
	}
	else {
		int a, b;
		cin >> a >> b;
		cout << a + b << '\n';
	}
	return 0;
}

Measured memory_bytes: 256