akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <tuple>
#include <complex>
#include <stdio.h>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LD PI = acos(-1.0);
const LL mod = 1000000007;
const LL INF = 1e9;
const LL MAXN = 1000007;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n, m;
	cin >> n >> m;
	cout << (1 << m) * (100 * n + 1800 * m);
	return 0;
}

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

int main(void){
  int n;
  string s,t;
  cin >> n;
  cin >> s >> t;
  for(int i = 0;i < n;++i){
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin>>N;
  long long a[N+1]={};
  long long b[N+1]={};
  for  (int i=0; i<N; i++){
  a[i+1]=100000;
  cin>>b[i+1];}
  a[1]=0;
  a[2]=(abs(b[2]-b[1]));
   for (int i=3; i<N+1; i++){
  a[i]=min(abs(b[i]-b[i-1])+a[i-1],abs(b[i]-b[i-2])+a[i-2]);}
  
    cout<<a[N];}


Measured memory_bytes: 1792
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))

Measured memory_bytes: 5432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using dbl = long double;
#define int ll
#define all(x) x.begin(), x.end()
#define x first
#define y second
#define mp make_pair
#define mt make_tuple


const int N = 2e5 + 10;

int n;
int a[N];
int b[N];
int c[N];
dbl e[N];
int s[N];
int p = 0;

bool bad(int i, int j, int k) {
	dbl ax = j - i;
	dbl ay = a[j] - a[i];
	dbl bx = k - i;
	dbl by = a[k] - a[i];
	return ax * by - ay * bx >= 0;
}

signed main() {
#ifdef LC
	assert(freopen("input.txt", "r", stdin));
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < n; ++i) {
		cin >> b[i];
	}
	int mxpos = (int)(max_element(a, a + n) - a);
	rotate(a, a + mxpos, a + n);
	rotate(b, b + mxpos, b + n);
	a[n] = a[0];
	b[n] = b[0];
	for (int i = 2; i <= n; ++i) {
		c[i] = 2 * c[i - 1] + 2 * b[i - 1] - c[i - 2];
	}
	for (int i = 0; i <= n; ++i) {
		a[i] -= c[i];
	}
	s[p++] = 0;
	for (int i = 1; i <= n; ++i) {
		while (p >= 2 && bad(s[p - 2], s[p - 1], i)) {
			--p;
		}
		s[p++] = i;
	}
	assert(p >= 2);
	for (int ind = 0; ind + 1 < p; ++ind) {
		int l = s[ind];
		int r = s[ind + 1];
		for (int i = l; i < r; ++i) {
			e[i] = a[l] + dbl(a[r] - a[l]) * (i - l) / (r - l);
		}
	}
	dbl sum = 0;
	for (int i = 0; i < n; ++i) {
		sum += e[i] + c[i];
	}
	sum /= n;
	cout << fixed << setprecision(18) << sum << "\n";
	return 0;
}


Measured memory_bytes: 13068
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <deque>
#include <vector>

using namespace std;

int dx[12] = {2,2,2,1,0,-1,-2,-2,-2,-1,0,1};
int dy[12] = {1,0,-1,-2,-2,-2,-1,0,1,2,2,2};
class State{
	public:
	int x;
	int y;
	int time;
};

int main(void){
	int visited[10][10];
	int posx, posy, num;
	int tmpx, tmpy;
	deque<State> q;
	vector<pair<int,int> > sp;
	
	while(cin >> posx >> posy){
		if((posx | posy) == 0) break;

		State s,t;
		bool end = false;

		cin >> num;
		q.clear(); sp.clear();
		s.x = posx;
		s.y = posy;
		s.time = 0;
		q.push_back(s);
		
		memset(visited,0,sizeof(visited));
		for(int i=0;i<num;i++){
			cin >> tmpx >> tmpy;
			sp.push_back(make_pair(tmpx, tmpy));
		}
		
		if(num == 0){
			cout << "NA" << endl;
			continue;
		}
		
		while(!q.empty()){
			s = q.front(); q.pop_front();
			
			//printf("[%d]x = %d, y = %d\n", s.time, s.x, s.y);
			//printf("next sprinkler = %d, %d\n", sp[s.time%num].first, sp[s.time%num].second);
			if(s.time == num){
				end = true;
				cout << "OK" << endl;
				break;
			}

			for(int i=0;i<12;i++){
				//òÑoµÄ¢È­Ä©ÂXvNàÈç
				//printf("try %d, %d\n", s.x+dx[i], s.y+dy[i]);
				if(0 <= s.x + dx[i] && s.x + dx[i] <= 9 &&
				0 <= s.y + dy[i] && s.y + dy[i] <= 9 &&
				abs(sp[s.time%num].first - (s.x+dx[i])) <= 1 &&
				abs(sp[s.time%num].second - (s.y+dy[i])) <= 1){
					t.x = s.x+dx[i];
					t.y = s.y+dy[i];
					t.time = s.time+1;
					q.push_back(t);
					//cout << "push " << t.x << " " << t.y << endl;
 				}
			}
		}
		if(!end){
			cout << "NA" << endl;
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1100000000;
constexpr long long LLINF = 1100000000000000000LL;
constexpr long long MOD = 1000000007;

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N;
  cin >> N;
  vector<int> A, B;
  REP(i, N) {
    int a;
    cin >> a;
    A.PB(a);
    B.PB(a);
  }
  for (int i = 0; i < N - 1; i++) A[i+1] = max(A[i], A[i+1]);
  for (int i = N-1; i > 0; i--) B[i-1] = max(B[i], B[i-1]);

  for (int i = 0; i < N; i++) {
    if (i == 0) cout << B[i+1] << endl;
    else if (i == N - 1) cout << A[i-1] << endl;
    else cout << max(A[i-1], B[i+1]) << endl;
  }
  return 0;
}


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

int main(void){
  ll n,m; cin >> n >> m;
  vector<ll> check(n+1,1);
  int a;
  rep(i,m){
    cin >> a;
    check.at(a) = 0;
  }
  vector<ll> dp(n+1,0);
  dp.at(0) = 1;
  if(check.at(1)){
    dp.at(1) = 1;
  }
  else dp.at(1) = 0;
  for(int i = 2; i <=n; i++){
    if(check.at(i)){
      dp.at(i) = dp.at(i-1) + dp.at(i-2);
    }
    else dp.at(i) = 0;
    dp.at(i) %= 1000000007;
  }
  cout << dp.at(n) % 1000000007 << endl;
  return 0;
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
ll N;
ll M;
llvec e[20];
ll cnt;

ll dfs(ll cur, set<ll> visited){
  if(visited.count(cur)!=0){
    return 0;
  }else{
    visited.insert(cur);
    if(visited.size()==N){
      return 1;
    }
    ll ans = 0;
    rep(i, e[cur].size()){
      ans += dfs(e[cur][i], visited);
    }
    return ans;
  }
}

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  cin >> N >> M;
  rep(i, M){
    ll a,b;
    cin >> a >> b;
    a--;b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }

  set<ll> v;
  cout << dfs(0, v);

  return 0;
}


Measured memory_bytes: 256
H, W = gets.split(' ').map(&:to_i)
coins = []
H.times do
  line = gets.split(' ').map(&:to_i)
  coins.push(line)
end

op = []
0.upto(H - 2) do |i|
  0.upto(W - 1) do |j|
    if coins[i][j] % 2 == 1
      op.push([i + 1, j + 1, i + 2, j + 1].map(&:to_s).join(' '))
      coins[i][j] -= 1
      coins[i + 1][j] += 1
    end
  end
end

0.upto(W - 2) do |j|
  if coins[H - 1][j] % 2 == 1
    op.push([H, j + 1, H, j + 2].map(&:to_s).join(' '))
    coins[H - 1][j] -= 1
    coins[H - 1][j + 1] += 1
  end
end

puts op.size
puts op

Measured memory_bytes: 37116
#include <cstdio>
#include <iostream>
#include <algorithm>
  
using namespace std;
  
int main(void){
  int n,array[3],i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&array[0],&array[1],&array[2]);
    sort(array,array+3);
    if(array[0]*array[0]+array[1]*array[1]==array[2]*array[2])  printf("YES\n");
    else  printf("NO\n");
  }
  
  return 0;
}

Measured memory_bytes: 1184
package main

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

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

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

func main() {
	sc.Split(bufio.ScanWords)
	
	w,h,x,y := scanInt(),scanInt(),scanInt(),scanInt()

	cx,cy := float64(w)/2.0,float64(h)/2.0
	ans := float64(w*h)/2.0
	if cx == float64(x) && cy == float64(y) {
		fmt.Println(ans,1)
	} else {
		fmt.Println(ans,0)
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rem(i, m, n) for (int i = m; i < (n); i++)
#define eps (1e-7)
#define inf (1e9)
#define pi (acos(-1))
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

    int q, h, s, d;
    int n;
    cin >> q >> h >> s >> d >> n;
    ll dmin = min(min(q * 8, h * 4), min(s * 2, d));
    //cout << dmin << "\n";

    if (n % 2 == 0)
    {
        cout << dmin * n / 2 << "\n";
    }
    else
    {
        int m = n / 2;
        ll smin = min(min(q * 4, h * 2), s);
        cout << dmin * m + smin << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
priority_queue<double>q;
int main()
{
    ios::sync_with_stdio(false);
    ll n,cnt=0;
    cin>>n;
    string s;
    cin>>s;
    ll l,r;
    l=-1;r=n;
    while(l<r)
    {
        while(s[++l]!='W'&&l<=r);
        while(s[--r]!='R'&&l<=r);
        if(l>=r)
            break;
        cnt++;
    }
    cout<<cnt;

    return 0;
}


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

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

int main(){
  int S, W;
  cin >> S >> W;

  if(W>=S) cout << "unsafe";
  else cout << "safe";
}

Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
	int n, s;
	scanf("%d %d", &n, &s);
	int i, j;
	int a[3003];
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	long long int dp[3003];
	long long int p = 998244353;
	for (i = 0; i <= s; i++)
		dp[i] = 0;
	dp[0] = 1;
	for (i = 0; i < n; i++)
	{
		for (j = s - a[i]; j >= 0; j--)
			dp[j + a[i]] = (2 * dp[j + a[i]] + dp[j]) % p;
		for (j = a[i] - 1; j >= 0; j--)
			dp[j] = dp[j] * 2 % p;
	}
	printf("%lld\n", dp[s]);
	return 0;
}

Measured memory_bytes: 1740
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvll vector<vll>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define pii pair<int, int>
#define vpli vector<pair<long long, int>>
#define deb(x) cout << "deb " << #x << " " << x << endl
#define all(x) x.begin(), x.end()
#define endl "\n"
int cycle_len;
vi ord;

void dfs(int s,vi& vis,vvi &adj,int& tot)
{
    tot++;
    for(int x : adj[s])
    {
        if(!vis[x])
        {
            ord.pb(x);
            vis[x] = vis[s]+1;
            dfs(x,vis,adj,tot);
        }
        else
        {
            cycle_len = vis[s] - vis[x]+1;
            return;
        }
        
    }
}
void solve()
{
    int n;
    cin>>n;
    cout<<(n>=30?"Yes":"No")<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //pre();
    int t = 1;
    //cin >> t;
    //cout<<__gcd(-5,0)<<endl;
    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3588
string = raw_input()
for _ in xrange(input()):
    order = raw_input().split()
    a, b = map(int, order[1:3])
    if order[0] == 'print':
        print string[a:b+1]
    elif order[0] == 'reverse':
        # string = string[:a] + string[b:a-1:-1] + string[b+1:]
        string = string[:a] + string[a:b+1][::-1] + string[b+1:]
    elif order[0] == 'replace':
        string = string[:a] + order[3] + string[b+1:]

Measured memory_bytes: 4224
// Problem : C - Build Stairs
// Contest : AtCoder Beginner Contest 136
// URL : https://atcoder.jp/contests/abc136/tasks/abc136_c
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcount(x)
#define f first
#define se second
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}

void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
cin>>n;
vi v(n);
cin>>v;
v[0]-=1;
for(int i=1;i<n;i++)
{
	if(v[i-1]==v[i])
	continue;
	else if(v[i-1]<v[i])
	v[i]--;
	else if(v[i-1]>v[i])
	{
		cout<<"No";
		return;
	}
}
cout<<"Yes";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t;
//cin>>t;
t=1;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
"""
AB = b - a
AC = c - a
AD = d - a
AE = e - a
BC = c - b
BD = d - b
BE = e - b
CD = d - c
CE = e - c
DE = e - d
if AB <= k and AC <= k and AD <= k and AE <= k and BC <= k and BD <= k and BE <= k and CD <= k and CE <= k and DE <= k:
    print("Yay!")
else:
    print(":(s")
"""
if e - a > k:
    print(":(")
else:
    print("Yay!")


Measured memory_bytes: 3060
import collections
n = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a).most_common()
cnt = 1
for k, v in a:
    if k == 0 and v == 1 and n % 2 != 0:
        cnt *= 1
    elif k == 0 and v == 2 and n % 2 == 0:
        cnt *= 1
    elif k != 0 and v == 2:
        cnt *= 2
    else:
        print(0)
        exit()
    cnt %= (10 ** 9 + 7)
print(cnt)


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

typedef long long ll;

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

    map<int, int> m;
    for (int i = 0; i < K; i++)
    {
        int d;
        cin >> d;

        for (int j = 0; j < d; j++)
        {
            int a;
            cin >> a;
            m[a]++;
        }
    }

    cout << N - m.size() << endl;
}

Measured memory_bytes: 3600
import sys
import math
import fractions
import itertools
from collections import deque
import copy
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()

N, K = map(int, input().split())
a = list(map(int, input().split()))
Min = INF
for i in range(2 ** (N - 1)):
    if bin(i).count("1") == K - 1:
        temp = 0
        M = 0
        for l in range(N - 1):
            if i >> l & 1 == 1:
                if (max(max(a[:l+1]), M) - a[l+1]) < 0:
                    M = a[l+1]
                else:
                    temp += (max(max(a[:l + 2]), M) - a[l + 1]) + 1
                    M = max(max(a[:l + 2]), M) + 1
        if temp < Min:
            Min = temp
print(Min)


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

int main()
{
        string s;
        cin >>s;
        bool ans=true;
        if(s.length() %2 == 0)
        {
                int kai = s.length()/2;
                string mozi ="hi";
                for(int i = 1; i< kai; i++)
                {
                        mozi += "hi";
                }
                if(s!= mozi)
                {       
                        ans = false;
                }
        }
        else if(s.length() % 2==1){
                ans = false;
        }
        if(ans== false)
        {
                cout << "No"<< endl;
        }
        else if(ans == true){
                cout << "Yes" << endl;
        }

        
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x,long long int y) 
{ 
    long long int res = 1;     // Initialize result 
  // x=x;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x); 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x);  // Change x to x^2 
    } 
    return res; 
}
long long int power(long long int x,long long int y,long long int m) 
{ 
    long long int res = 1;     // Initialize result 
   x=x%m;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x)%m; 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x)%m;  // Change x to x^2 
    } 
    return res; 
}

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
 long long int lcm(long long int a, long long int b)  
 { 
     long long int temp;
    
    return (a*b)/gcd(a, b);  
 }
 
int main() {
   
   long long int i,j;
 //long long int b[1000000];
 //set<long long int >s;
       long long int f=0,p=0,z,o=0;
       double pie=3.141592653589793238;
    long long int n,m,l=0,k,c,min1=10000000000000,max2=-100;
    cin>>n;
    long long int a[n+1];
    for(i=0;i<n;i++)
    {
        cin>>p;
        a[p]=i+1;
    }
      for(i=1;i<=n;i++)
      {
          cout<<a[i]<<" ";
      }
 return 0;
}

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

int main(){
  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;
  int water;
  int solt;
  int watermax;
  int soltmax;
  int count=0;
  double per=0;
  for(int i=0;100*a*i<=f;i++){
    for(int j=0;100*a*i+100*b*j<=f;j++){
      water=100*a*i+100*b*j;
      for(int k=0;100*a*i+100*b*j+c*k<=f;k++){
        for(int l=0;100*a*i+100*b*j+c*k+d*l<=f;l++){
          solt=c*k+d*l;
          /*塩が溶ける条件と濃度％*/
          if(water!=0){
           if(e*water>=100*solt and per<=solt*10000/(water+solt)){
             /*最大濃度、その時の水質量、食塩の更新*/
              per=solt*10000/(water+solt);
              watermax=water;
              soltmax=solt;
             count++;
             
           }
              
          }
        }
      }
    }
  }
  if(count=0){
    cout<<100*a<<endl;
    cout<<0<<endl;
  }else{
  /*濃度最大時の水質量と塩マックスを出力*/
  cout<<watermax+soltmax<<endl;
  cout<<soltmax<<endl;
  }
}
                 
           


  


Measured memory_bytes: 256
class Node():
   def __init__(self, parent = -1, left = -1, right = -1):
    self.parent = parent
    self.left = left
    self.right = right

def preorder(ns, i):
  print(" " + str(i), end = "")
  if ns[i].left != -1:
    preorder(ns, ns[i].left)
  if ns[i].right != -1:
    preorder(ns, ns[i].right)

def inorder(ns, i):
  if ns[i].left != -1:
    inorder(ns, ns[i].left)
  print(" " + str(i), end = "")
  if ns[i].right != -1:
    inorder(ns, ns[i].right)

def postorder(ns, i):
  if ns[i].left != -1:
    postorder(ns, ns[i].left)
  if ns[i].right != -1:
    postorder(ns, ns[i].right)
  print(" " + str(i), end = "")

n = int(input())
ns = [Node() for i in range(n)]
for i in range(n):
  p, l, r = map(int, input().split())
  if l != -1:
    ns[p].left = l
    ns[l].parent = p
  if r != -1:
    ns[p].right = r
    ns[r].parent = p #子と子の親を定義

for i in range(n):
  if ns[i].parent == -1:
    print("Preorder")
    preorder(ns, i)
    print()
    print("Inorder")
    inorder(ns, i)
    print()
    print("Postorder")
    postorder(ns, i)
    print()


Measured memory_bytes: 5616
// Zhupengfei 2018
// This program / source file is in public domain.

// Solution for problem: Integers on a Tree 3

#include <bits/stdc++.h>

using namespace std;

// Main segment

vector<int> g[100001];
int val[100001] = {};
int L[100001] = {}, R[100001] = {};
bool known_parity[100001][2] = {};
int par[100001] = {};
vector<int> order;
bool flag = false;

constexpr int INF = 1e9 + 7;

void dfs(int u, int fa = -1) {
    par[u] = fa;
    L[u] = -INF - 1, R[u] = INF + 1;
    for (int to : g[u]) {
        if (to == fa)
            continue;
        dfs(to, u);
        if (known_parity[to][0])
            known_parity[u][1] = 1;
        if (known_parity[to][1])
            known_parity[u][0] = 1;
        L[u] = max(L[u], L[to] - 1);
        R[u] = min(R[u], R[to] + 1);
    }
    if (val[u] != -1) {
        L[u] = max(L[u], val[u]);
        R[u] = min(R[u], val[u]);
        known_parity[u][val[u] % 2] = 1;
    }
    if (known_parity[u][0] && known_parity[u][1]) {
        flag = true;
    }
    if (L[u] > R[u]) {
        flag = true;
    }
    order.push_back(u);
}

int solve_val(int u, int fa = -1) {
    if (fa == -1) {
        return L[u];
    }
    L[u] = max(L[u], val[fa] - 1);
    R[u] = min(R[u], val[fa] + 1);
    while (L[u] % 2 == val[fa] % 2)
        L[u]++;
    return L[u];
}

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

    int n;
    cin >> n;
    for (int i = 1; i < n; i++) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    fill(val + 1, val + n + 1, -1);
    int k;
    cin >> k;
    while (k--) {
        int p, v;
        cin >> p >> v;
        val[p] = v;
    }
    dfs(1);
    if (flag) {
        cout << "No" << endl;
        return 0;
    }
    reverse(order.begin(), order.end());
    for (int i = 0; i < order.size(); i++) {
        int to = order[i];
        val[to] = solve_val(to, par[to]);
    }
    cout << "Yes" << endl;
    for (int i = 1; i <= n; i++) {
        cout << val[i] << endl;
    }

#ifdef LOCAL
    system("pause");
#endif
    return 0;
}


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

if N == 3:
    print(2)
    print(1,3)
    print(2,3)
else:
    s = N%2
    N = N//2*2
    ans = 0
    for i in range(2,N//2+1):
        ans += 4*i - 4
    if s == 0:
        print(ans)
    else:
        print(ans+N)
    print(1, N-1)
    print(1,2)
    print(2,N)
    print(N-1,N)
    for i in range(2,N//2):
        for j in range(1,i+1):
            print(j, i+1)
            print(j, N-i)
            print(N+1-j, i+1)
            print(N+1-j, N-i)
    if s == 1 and N != 2:
        for i in range(1,N+1):
            print(i, N+1)

Measured memory_bytes: 3632
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

def f(length, ls):
    cur = 0
    for a in ls:
        if a%length == 0:
            cur += a//length - 1
        else:
            cur += a//length
    if cur <= K:
        return True
    else:
        return False

ok, ng = max(A), 0
while abs(ok - ng) > 1:
    z = (ok+ng)//2
    if f(z, A) == True:
        ok = z
    else:
        ng = z
print(ok)

Measured memory_bytes: 30864
using System;

namespace A___Addition
{
    class Program
    {
        static void Main (string[] args)
        {
            var n = int.Parse (Console.ReadLine ());
            var input = Console.ReadLine ().Split (' ');
            var a = 0;
            for (var i = 0; i < n; i++)
            {
                a += int.Parse (input[i]);
            }
            if (a % 2 == 0)
                Console.WriteLine ("YES");

            else
                Console.WriteLine ("NO");
        }
    }
}

Measured memory_bytes: 20064
a = [0 for i in range(26)]
while True:
    try:
        s = str(input())
        s = s.lower()
        for i in range(len(s)):
            n = ord(s[i])
            if n > 96 and n < 123:
                a[n-97] += 1
    except:
        break
for i in range(97,123):
    print(chr(i),":",a[i-97])


Measured memory_bytes: 5564
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) int((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;
typedef vector<vector<int>> VV;
typedef pair<int, int> P;
typedef map<string, int> M;
typedef unordered_map<int, int> HM;
typedef set<int> S;
typedef queue<int> Q;

int main(){
    int n; cin>>n;
    OUT(180*(n-2));
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
        int t, h, s;
        int tmp;
        int rest, rest3;

        while ( scanf( "%d %d %d", &t, &h, &s ) && t*h*s != -1 ) {
                // すべて秒単位で計算する
                rest = 7200 - t*3600 - h * 60 - s;
                rest3 = rest * 3;

                //通常録画モードの場合
                t = rest / 3600;
                tmp = rest % 3600;
                h = tmp / 60;
                s = tmp % 60;
                printf( "%02d:%02d:%02d\n", t, h, s );

                //3倍録画モードの場合
                t = rest3 / 3600;
                tmp = rest3 % 3600;
                h = tmp / 60;
                s = tmp % 60;
                printf( "%02d:%02d:%02d\n", t, h, s );
        }

        return 0;
}



Measured memory_bytes: 2028
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	ar := make([]int, n)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	sum := 0
	for _, v := range ar {
		sum += v - 1
	}
	fmt.Println(sum)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    long long r, d, ans = 0, n, sum = 0;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> x[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            sum = 0;
            for (int k = 0; k < d; k++) {
                sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            for (int l = 1; l < 100000; l++) {
                if ((long long)l * l == sum) {
                    ans++;
                 //   cout << i << " " << j << " " << l << endl;
                }
            }
        }
    }
    cout << ans / 2 << endl;
}

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

int main(void) {
  string s[3];
  int len[3];
  int idx[3];
  for (int i = 0; i < 3; ++i) {
    cin >> s[i];
    len[i] = s[i].size();
    idx[i] = 0;
  }

  int turn = 0;
  while (1) {
    if (idx[turn] == len[turn]) {
      cout << char('A' + turn) << endl;
      return 0;
    }
    turn = s[turn][idx[turn]++] - 'a';
  }
  return 0;
}


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

const int N = 100005;

int i, n, x, y, rs;
bool viz[N];
vector<int> lda[N], v, drum;

void dfs(int x) {
  viz[x] = 1;
  v.push_back(x);
  if(x == n) drum = v;
  for(auto to : lda[x]) {
    if(viz[to]) continue;
    dfs(to);
  }

  v.pop_back();
}

void solveDfs(int x) {
  viz[x] = 1; ++rs;

  for(auto to : lda[x]) if(!viz[to] && to != drum[(drum.size() + 1) / 2]) solveDfs(to);
}

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

  cin >> n;
  for(i = 1; i < n; ++i) {
    cin >> x >> y;
    lda[x].push_back(y);
    lda[y].push_back(x);
  }

  dfs(1);

  memset(viz, 0, sizeof(viz));

  solveDfs(1);

  if(rs > n - rs) cout << "Fennec\n";
  else cout << "Snuke\n";

  return 0;
}

Measured memory_bytes: 13048
#include<iostream>
 using namespace std ;
 int main()
{
 int A, B, C, D, x, y, z, k;
 cin>>A;
 cin>>B;
 cin>>C;
 cin>>D;
x=(A+C);
y=(A+D);
z=(B+C);
k=(B+D);
if (x<=y&&x<=z&&x<=k)
{
  cout<<x<<endl;
}
if  (y<=k&&y<x&&y<=z)
{
  cout<<y<<endl;
}
if (z<y&&z<x&&z<=k)
{
  cout<<z<<endl;
}
if (k<y&&k<z&&k<x)
{
  cout<<k<<endl;
}
}

Measured memory_bytes: 3580
N, K = map(int, input().split())
A = list(map(int, input().split()))
sA = [list('{0:040b}'.format(i)) for i in A]
B = list(zip(*sA))
C = [0]*40
for i in range(40):
  if B[i].count('0') > len(B[i])/2:
    C[i] = 1
  else:
    C[i] = 0

ans = 0
for i in range(40):
  if ans + C[i] * 2**(39-i) <= K:
    ans += C[i] * 2**(39-i)
  else:
    ans += ((C[i]+1)%2)*2**(39-i)
s = 0
for i in range(N):
  s += ans ^ A[i]
print(s)

Measured memory_bytes: 93112
/*input
4 12 20
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int a[maxn];

int main(){
	IOS;
	int a,b,c;
	int ans=0;
	cin>>a>>b>>c;
	while(ans<100){
		if(a%2||b%2||c%2) break;
		int aa=(b+c)/2;
		int bb=(a+c)/2;
		int cc=(a+b)/2;
		a=aa;
		b=bb;
		c=cc;
		ans++;
	}
	if(ans==100) ans=-1;
	cout<<ans<<'\n';
	return 0;
}


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

int main(){
  int n, m; cin >> n >> m;
  int a[n],b[n],c[m],d[m];
  for(int i=0; i<n; i++) cin >> a[i] >> b[i];
  for(int j=0; j<m; j++) cin >> c[j] >> d[j];

  for(int i=0; i<n; i++) {
    int point, min_dist = INT_MAX;
    for(int j=0; j<m; j++) {
      int dist = abs(a[i]-c[j]) + abs(b[i]-d[j]);
      if(min_dist>dist) {
        min_dist = dist;
        point = j+1;      
      }
    }  
    cout << point << endl;
  }
  return 0;
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int l,r,d,c=0;
  cin >> l >> r >> d;
  while(l <= r)
  {
    if(l%d == 0)
    {
      c++;
    }
    l++;
  }
  cout << c;
  return 0;
}


Measured memory_bytes: 3600
# Title: close to 753
# Link: https://abc114.contest.atcoder.jp/tasks/abc114_b

import sys


sys.setrecursionlimit(10 ** 6)

read_single_str = lambda: sys.stdin.readline().strip()


def solution(s):
    return min(map(lambda x: abs(x-753), map(int, [s[i:i+3] for i in range(len(s)-2)])))


def main():
    s = read_single_str()
    print(solution(s))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int main(){
    Hello
    int a, p;
    cin >> a >> p;
    cout << (a * 3 + p)/2;
    return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

int main() {
	string s;
	ll K;
	cin >> s >> K;

	int la = -1;
	int cnt = 0;
	vector<pii> vec;

	rep(i, s.size()) {
		if (la == -1) {
			la = s[i];
			cnt = 1;
		} else {
			if (la  == s[i]) {
				++cnt;
			} else {
				vec.eb(la, cnt);
				cnt = 1;
				la = s[i];
			}
		}
	}
	vec.eb(la, cnt);

	ll ans = 0;
	if (vec.size() == 1) {
		ll l = s.size() * K;
		ans = l / 2;
	} else if (vec[0].fi == vec.back().fi) {
		for (int i = 1; i + 1 < vec.size(); ++i) {
			ll t = (vec[i].se / 2) * K;
			ans += t;
		}
		ll l = vec[0].se, r = vec.back().se;
		ans += l / 2;
		ans += r / 2;
		ans += ((l + r) / 2) * (K - 1);
	} else {
		for (auto p : vec) {
			ll t = (p.se / 2) * K;
			ans += t;
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int main(){
  int num_student;
  int num_min_pass;
  int num_max_pass;
  while(~scanf("%d %d %d", &num_student, &num_min_pass, &num_max_pass)) {
    if (num_student == 0) break;

    int score[10000];
    for (int student_i = 0; student_i < num_student; student_i++) {
      scanf("%d", &score[student_i]);
    }
    sort(score,score + num_student, greater<int>());
    int diff = -1;
    int res = 0;
    for (int pass_i = num_min_pass - 1; pass_i < num_max_pass; pass_i++) {
      int min_pass_score = score[pass_i];
      int max_fail_score = score[pass_i + 1];
      if (diff <= min_pass_score - max_fail_score) {
	diff = min_pass_score - max_fail_score;
	res = pass_i + 1;
      }
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(false),cin.tie(nullptr);
#define task "TASK"
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))

const int N=100010;

int pw(int a,int i){
    int b=1;
    for(;i;i>>=1,a=a*a%998244353) if(i&1) b=b*a%998244353;
    return b;
}

main(){
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    int n; n=in; vector<int> cnt(n),a(n+1),g(n);
    forinc(i,1,n) cnt[a[i]=in]++;
    int mx=*max_element(all(a));
    if(a[1] || cnt[0]>1) return cout<<0,0;
    forinc(i,1,mx) if(!cnt[i]) return cout<<0,0;
    long long ret=1;
    forinc(i,1,mx){
        ret=ret*pw(cnt[i-1],cnt[i])%998244353;
    }
    cout<<ret;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int A, B;
        cin >> A >> B;
        if (1 <= A && A <= 9 && 1 <= B && B <= 9) {
            cout << A * B << endl;
        } else {
            cout << -1 << endl;
        }
    }
};


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

    Solve().solve();


    return 0;
}


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


//桁数　d
// long long val (現在見ている値)
// all 見てきた値のリスト
void rec(int d,long long val, vector<long long> &all){
    
    //格納
    all.push_back(val);
    
    //10桁の場合打ち切り
    if(d == 10) return;
    
    // 次の桁へ進む処理(ex.87,88,89みたいに調べていく)
    for (int j = -1; j <= 1; ++j) {
        
        //次の1桁を算出する
        int add = (val % 10) + j;
        
        //0-9であれば再帰処理（10とかだとダメ）
        if(add >= 0 && add <= 9) rec(d+1, val*10 + add , all);
        
    }
    
}

/*
ルンルン数：隣り合うどの2つの桁の値についても、差の絶対値が1以下

小さいからK番目のルンルン数を求める
*/
int main(){
    
    //Input
    int K;//求めるルンルン数の番号
    
    //Inputを取得する
    cin >> K;
    
    //
    vector<long long> all;
    
    for(int v = 1; v < 10; v++)rec(1, v,all);
    
    //小さい順に並び替える
    sort(all.begin(), all.end());
    
    //K番目
    cout << all[K-1]<<endl;
    
}





Measured memory_bytes: 2420
n = int(input())
h = list(map(int,input().split()))
h.append(10**10)
i = 0
ans = [0]
while i < n:
  count = 0
  while h[i] >= h[i+1]:
    count +=1
    i += 1
  if count != 0:
    ans.append(count)
  i += 1
print(max(ans))

Measured memory_bytes: 63856
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
int n;
ll a,b,c,d;
ll gcd(ll x,ll y){
    if(y==0)
        return x;
    return gcd(y,x%y);
}
int main(){
    cin>>n;
    while(n--){
        cin>>a>>b>>c>>d;
        if(a<b){
            cout<<"No"<<endl;
            continue;
        }
        if(b>d){
            cout<<"No"<<endl;
            continue;
        }
        // if(c+1>=b){
        //     cout<<"Yes"<<endl;
        //     continue;
        // }
        ll g=gcd(b,d);
        if((a-c-1ll)/g-(a-b)/g>0)
            cout<<"No"<<endl;
        else
            cout<<"Yes"<<endl;
    }
} 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
    int a,b,k;
    cin>>a>>b>>k;
    if(b-a+1<=2*k){
        for (int i = a;i <= b; i++){
            cout<<i<<endl;
        }
    }
    else{
        for (int i = a;i <a+k;i++){
            cout<<i<<endl;
        }
        for (int i = b-k+1;i<=b;i++){
            cout<<i<<endl;
        }
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
    int n;
    cin>>n;
    if(n==1){
        cout<<"Hello World"<<endl;
    }else{
        int a, b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }
}

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

class Ev
{
public:
	int m,t;
	Ev(int m, int t)
		:m(m),t(t)
	{}

	bool operator<(const Ev& e) const
	{
		if(t!=e.t) return t < e.t;
		return m<e.m;
	}
};

int main()
{
	int N;
	while(cin >> N, N)
	{
		vector<Ev> Events;
		for(int i=0; i<N; i++)
		{
			int m,a,b;
			cin >> m >> a >> b;
			Events.push_back(Ev( m,a));
			Events.push_back(Ev(-m,b));
		}

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

		int wei=0;
		bool flag=true;

		for(int i=0; i<Events.size(); i++)
		{
			wei+=Events[i].m;
			if(wei > 150) flag=false;
		}

		cout << (flag?"OK":"NG") << endl;
	}
}

Measured memory_bytes: 0
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

fn main() {
    let n: usize = read!();
    let mut a = Vec::with_capacity(n);

    for _ in 0..n {
        let ai: usize = read!();
        a.push(ai);
    }

    let m = a.iter().fold(0, |a, &b| a ^ b);

    println!(
        "{}",
        a.iter()
            .map(|&ai| (m ^ ai).to_string())
            .collect::<Vec<String>>()
            .join(" ")
    );
}


Measured memory_bytes: 17284
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;cin >> a >> b >> c;
    for(int i=0;i<=b;i++){
        if(a*i%b==c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  ll L;
  cin>>n>>L;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  rep(i,n-1) {
    if(a[i]+a[i+1]>=L) {
      // ans
      cout << "Possible" << endl;
      rep(j,i) {
        cout << j+1 << endl;
      }
      for(int j=n-2; j>=i+1; j--) 
        cout << j+1 << endl;
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>

int main(){
  int n;
  std::string s;
  std::cin>>n;
  std::cin>>s;
  std::vector<char> ss(100);
  int m = 0;
  std::vector<int> cal(100);
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      if(s[i] == ss[j]){
        cal[j] += 1;
        break;
      }
      if(j == m-1){
        ss[m] = s[i];
        cal[m] = 1;
        m ++;
        break;
      }
    }
    if(m == 0){
      ss[m] = s[i];
      cal[m] = 1;
      m ++;
    }



  }
  long long z = 1000*1000*1000 + 7;
  long long res = 1;
  for(int i = 0; i < m; i++){
    res *= cal[i]+1;
    res = res % z;
  }

  std::cout<<(res-1)%z<<std::endl;
  return 0;

}


Measured memory_bytes: 512
#submitができない、おそらく<<かsortのオーダーが大きい
def make_table(time)
  splitedTime = time.split(":").map(&:to_i)
  secondTime = 60*60*splitedTime[0] + 60*splitedTime[1] + splitedTime[2]
  return secondTime
end

oneDaySecond = 60*60*24
loop do
  n = gets.chomp.to_i
  break if n == 0
  
  startTable = []
  finishTable = []
  s = Array.new(oneDaySecond,0)
  (0..n-1).each do |i|
    start, finish = gets.chomp.split(" ").map(&:to_s)
    startTable << make_table(start)
    #startTable = startTable.sort
    finishTable << make_table(finish)
    #finishTable = finishTable.sort

    s[startTable[i]] += 1
    s[finishTable[i]] += -1
  end 
  (0...oneDaySecond-1).each do |j|
    s[j+1] += s[j]
  end
  p s.max
end




Measured memory_bytes: 15640
using System;

namespace abc127_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array = Console.ReadLine().Split(' ');
            int a = int.Parse(array[0]);
            int b = int.Parse(array[1]);
            if (a>=13)
            {
                Console.WriteLine(b);
            }
            else if (a <= 5)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine(b / 2);
            }
        }
    }
}


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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000010)
#define MOD (1000000007)
#define PI (acos(-1))

ll ans;
void rec(ll x,ll y){
  if(y%x==0){
    ans += 2*y-x;
  }else{
    ans += 2*x*(y/x);
    rec(y%x,x);
  }
}

int main(){
  ll n,x;
  cin >> n >> x;
  ans = n;
  rec(min(x,n-x),max(x,n-x));
  cout << ans << endl;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  int s = a + b;
  if(s%2 == 0) cout << s/2 << endl; else cout << "IMPOSSIBLE";
  return 0;
}



Measured memory_bytes: 256