akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int main(){
    int n;cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i,n){
        a[i]=(i+1)*n;
        b[i]=(n-i)*n;
    }
    rep(i,n){
        int data;cin >> data;
        a[data-1]+=i;
    }
    for(auto &i:a) cout << i << " ";
    cout << endl;
    for(auto &i:b) cout << i << " ";
    cout << endl;

}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    double ans=0;
    for(int i=1;i<=n;i++)
    {
        if(i<k)
        {
            int cou=0;
            int s=i;
            while(s<k)
                cou++,s*=2;
            //printf("cou=%d\n",cou);
            ans+=(1/(n*1.0))*pow(0.5,cou*1.0);
        }
        else
            ans+=(1/(n*1.0));

    }
    printf("%.12lf\n",ans);
    return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())

a_b = ""
b_a = ""

for i in range(a):
    b_a = str(b_a) + str(b)  

for ii in range(b):
    a_b = str(a_b) + str(a)
    
if a==b:
    print(a_b)
elif a>b:
    print(b_a)
else:
    print(a_b)

Measured memory_bytes: 3060
def main():
  n, x, *ls = map(int, open(0).read().split())
  d=0
  cou=1
  for l in ls:
    d += l
    if d <= x:
      cou+=1
    else:
      return(cou)
  return n+1
if __name__ == '__main__':
  print(main())


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

bool kaibun(string s){
    int num;
    num = s.size();
    bool ans;
    ans = true;
    for(int i=0;i<num/2;i++){
        if(s[i]!=s[num-i-1]){
            ans = false;
        }
    }
    return ans;
}

int main() {

    string s;
    
    cin >> s;

    int num;
    num = s.size();

    int flag =0;
    if(kaibun(s)==false){
        flag++;
    }
    if(kaibun(s.substr(0,num/2))==false){
        flag++;
    }
    if(kaibun(s.substr(num/2+1))==false){
        flag++;
    }
    
    if(flag==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vii vector<int,int>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
const int mod=1e9+7;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
double pi=acos(-1);
int main(){
    fast;
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    h+=(m/60);
    double l=(pi/30)*m;
    double s=(pi/6)*h;
    double ang=l-s;
    double ans=sqrt((a*a)+(b*b)-(2*a*b*cos(ang)));
    cout<<fixed<<setprecision(20)<<ans;
}

Measured memory_bytes: 4148
N,Q = map(int,input().split())
slis = list(input()) + ['']
numbers = [0] * N
cur = 0
for i in range(1,N):
    if slis[i-1]=='A' and slis[i] == 'C':
        cur += 1
    numbers[i] = cur
        
for _ in range(Q):
    l,r = map(int,input().split())
    print(numbers[r-1]-numbers[l-1])
        

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


int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> memo(200000,0);
  set<int> s;
  rep(i,n){
    int size=s.size();
    cin >> a[i];
    s.insert(a[i]);
    if(size<s.size()){
      memo[a[i]]=199999;
    }
    else{
      memo[a[i]]--;
    }
  }
  if(s.size()<=k){
    cout << 0 << endl;
    return 0;
  }
  sort(memo.begin(),memo.end(),greater<int>());
  int ans=0;
  for(int i = 0;i!=s.size()-k;i++){
    ans+=200000-memo[i];
  }
  cout << ans << endl;
}


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

using namespace std;

void a(){
    int N,K; cin >> N >> K;
    string S; cin >> S;

    if (S[K -1] == 'A') S[K-1] = 'a';
    if (S[K -1] == 'B') S[K-1] = 'b';
    if (S[K -1] == 'C') S[K-1] = 'c';

    cout << S;

}

void b(){
    string S; cin >> S;
    int fast = stoi(S.substr(0,2));
    int last = stoi(S.substr(2,2));

    bool may_yymm = (0 <= fast && fast <= 99)&&(1<= last && last <=12);
    bool may_mmyy = (0 <=  last && last  <= 99)&&(1<= fast && fast  <=12);

    if (may_yymm && !may_mmyy) cout << "YYMM";
    else if (!may_yymm && may_mmyy) cout << "MMYY";
    else if (may_mmyy && may_yymm) cout <<"AMBIGUOUS";
    else if (!may_mmyy && !may_yymm) cout << "NA";


}

int pow(int x){
    if (x <=0) return 1;
    return 2*(pow (x -1));
}
void c(){

    int N,K; cin >> N >> K;
    vector<int> vec;
    vec.push_back(( N >=K )?(N -K +1):0 );
    int k = K;
    while (k > 1){
        vec.push_back( max(0, min(k, N + 1) - ( (k+1)/2) ) );
        k = (k+1)/2;
    }


    long long upper = 0;
    for(int i = 0; i < vec.size(); i++){
        upper += vec[i]*pow(vec.size() - 1 - i);
    }
    double p = static_cast<double>(upper) /(N*pow(vec.size() - 1));

    cout << fixed;
    cout << setprecision(12) << p;

}

char flip_color(char color){
    if (color == '0') return '1';
    else
        return '0';

}
void dfs_color(int node, int parent, char required_color,
               const vector<vector<pair<int,int>> >& adj,
               vector<char>& color_map){

    color_map[node] = required_color;
    for(auto child_weight: adj[node]){
        int child = child_weight.first;
        int weigh = child_weight.second;
        if (child != parent){
            if (weigh %2 == 0){
                dfs_color(child, node, required_color, adj, color_map);
            }else{
                dfs_color(child, node, flip_color(required_color), adj, color_map);
            }
        }
    }


}
void d(){
    int N; cin >> N;
    vector<vector<pair<int,int>> > adj(N+1, vector<pair<int,int>>());
    for(int i = 1; i<= N-1; i++){
        int u,v,w; cin >> u >> v >> w;
        adj[u].push_back(make_pair(v,w));
        adj[v].push_back(make_pair(u,w));
    }
    vector<char> color(N+1,'0');
    dfs_color(1, -1, '0', adj, color);

    for(int i = 1; i <= N; i++){
        cout << color[i] << endl;
    }

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

Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,i=1,j;
    cin >> a >> b;
    while(1)
    {
        if(floor (i*0.08)==a && floor (i*0.1)==b)
        {
            cout << i << endl;
            return 0;
        }
        if(i>b*20)
        {
            cout << "-1" << endl;
            return 0;
        }
        i++;
           
    }
    return 0;

}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, t[], m, p, x;
		n = sc.nextInt();
		t = new int[n];
		
		int ans = 0;
		
		for(int i = 0; i < n; ++i) {
			t[i] = sc.nextInt();
			ans += t[i];
		}
		
		m = sc.nextInt();
		
		for(int i = 0; i < m; ++i) {
			p = sc.nextInt();
			x = sc.nextInt();
			ans -= t[p - 1];
			ans += x;
			System.out.println(ans);
			ans -= x;
			ans += t[p - 1];
		}
		
		sc.close();
	}

}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int query(int x){
    cout << x << endl;
    cout.flush();
    string res; cin >> res;
    int ret = -1;
    if(res == "Male"){
        ret = 1;
    }
    else if(res == "Female"){
        ret = 0;
    }
    return ret;
}

int main(void){
    int n; cin >> n;
    int lb = 0, ub = n;
    int pre = query(lb); if(pre == -1) return 0;

    while(true){
        int mid = (lb + ub) / 2;
        int cur = query(mid); if(cur == -1) return 0;

        bool rev  = ((mid - lb) % 2 == 1);
        bool same = ((cur == pre) ^ rev);
        if(same){
            lb = mid;
            pre = cur;
        }
        else {
            ub = mid;
        }
    }

    return 0;
}


Measured memory_bytes: 852
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    cout.precision(18);

    long long N, M;
    vector<long long> H;

    cin >> N >> M;
    for (long long i = 0; i < N; i++)
    {
        long long t;
        cin >> t;
        H.push_back(t);
    }

    vector<vector<long long>> e(N, vector<long long>{});
    for (long long i = 0; i < M; i++)
    {
        long long a, b;
        cin >> a >> b;
        e[a - 1].push_back(b - 1);
        e[b - 1].push_back(a - 1);
    }

    vector<long long> f(N, false);
    long long c = 0;
    for (long long i = 0; i < N; i++)
    {
        if (f[i] == false)
        {
            bool t = false;
            for (auto x : e[i])
            {
                if (H[i] <= H[x])
                {
                    t = true;
                    break;
                }
            }

            if (t == false)
            {
                c++;
                for (auto x : e[i])
                {
                    f[x] = true;
                }
            }
        }
    }
    cout << c << endl;
}

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

using namespace std;

int n;
bool f[1000001];

void init()
{
    f[1]=1;
    for (int i=2;i*i<=1000000;++i)
    {
        if (!f[i])
        {
            for (int j=i*i;j<=1000000;j+=i)
                f[j]=1;
        }
    }
}

int main()
{
    cin>>n;
    init();
    while (f[n])
        n++;
    cout<<n;
    return 0;
}


Measured memory_bytes: 1280
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

a,b = map(int, input().split())
x = set(factorize(a))
x = list(x)
y = set(factorize(b))
y = list(y)
z = x+y
z = [i for i in set(z) if z.count(i) > 1]
print(len(z)+1)

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

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& vec) {
    out << "[";
    for (int x : vec) out << x << ", ";
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file
    #define dbg_var(x) clog << #x << ": " << x << endl;
#endif

#ifndef M_PI
#define M_PI 3.14159265358979
#endif

struct point_t {
    LL x, y;
};
bool operator < (point_t a, point_t b) {
    if(a.x == b.x) {
        return a.y < b.y;
    }
    return a.x < b.x;
}
point_t operator - (point_t a, point_t b) {
    return point_t{a.x - b.x, a.y - b.y};
}
LL operator ^ (point_t a, point_t b) {
    return a.x * b.y - a.y * b.x;
}
int GetSign(LL x) {
    if(x < 0) {
        return -1;
    }
    return x > 0;
}
int RelativePosition(point_t O, point_t A, point_t B) {
    return GetSign((A - O) ^ (B - O));
}
double angle(point_t a) {
    return atan2(a.y, a.x);
}

vector<int> convex_hull(vector<point_t> points) {
    int N = points.size();
    vector<int> ord(N);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int i, int j) {return points[i] < points[j];});
    vector<int> aw, cw;
    aw.push_back(ord[0]);
    cw.push_back(ord[0]);
    for(int i = 1; i < N; ++i) {
        int index = ord[i];
        point_t V = points[index];
        while(aw.size() > 1 and RelativePosition(points[aw.rbegin()[1]], V, points[aw.back()]) != -1) {
            aw.pop_back();
        }
        aw.push_back(index);
        while(cw.size() > 1 and RelativePosition(points[cw.rbegin()[1]], V, points[cw.back()]) != 1) {
            cw.pop_back();
        }
        cw.push_back(index);
    }
    aw.pop_back();
    reverse(cw.begin(), cw.end());
    cw.pop_back();
    aw.insert(aw.end(), cw.begin(), cw.end());
    return aw;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N;
    cin >> N;
    vector<point_t> P(N);
    for(int n = 0; n < N; ++n) {
        cin >> P[n].x >> P[n].y;
    }
    auto H = convex_hull(P);
    vector<double> ans(N);
    H.insert(H.begin(), H.back());
    H.push_back(H[1]);
    for(int i = 1; i + 1 < int(H.size()); ++i) {
        double alpha = angle(P[H[i + 1]] - P[H[i]]) - angle(P[H[i]] - P[H[i - 1]]);
        if(alpha < 0) {
            alpha += 2 * M_PI;
        }
        ans[H[i]] = alpha / (2 * M_PI);
    }
    cout << fixed << setprecision(14);
    for(int n = 0; n < N; ++n) {
        cout << ans[n] << '\n';
    }
}


Measured memory_bytes: 384
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let _n = get!(usize);
    let ts = get!(String).split_whitespace().map(|t| t.parse::<i32>().unwrap()).collect::<Vec<_>>();
    let m = get!(usize);
    let pxs = get!(usize, i32; m);

    let s = ts.iter().fold(0, |s, t| s + t);
    for (p, x) in pxs {
        println!("{}", s - ts[p-1] + x);
    }
}

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

int N;
const int MAX_N = 1.0e5 + 100;
int d[MAX_N];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> d[i];

    sort(d, d+N);

    cout << d[N/2] - d[(N-1)/2] << endl;

    return 0;
}


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

int main(){
  int n, k; cin >> n >> k;
  set <int> S;
  
  for (int i = 0; i < k; i++){
    int d; cin >> d;
    for (int j = 0; j < d; j++){
      int res; cin >> res;
      S.insert(res);
    }
  }
  cout << n - S.size() << endl;
  return 0;
}

Measured memory_bytes: 3632
# 桁和最小の自然数は1
from collections import deque
k = int(input())
d = [k] * k
e = [[(0, i * 10 % k), (1, (i + 1) % k)] for i in range(k)]
dq = deque()
dq.append((1, 1))
while dq:
    c, v = dq.popleft()
    for v2nv, nv in e[v]:
        if v2nv == 0:
            if c < d[nv]:
                d[nv] = c
                dq.appendleft((d[nv], nv))
        else:
            if c + 1 < d[nv]:
                d[nv] = c + 1
                dq.append((d[nv], nv))
print(d[0])


Measured memory_bytes: 41064
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define mod 998244353
#define mul(a,b) a=(a*b)%mod
#define N 100010
ll n;
vector<ll> x,y,z;
vector<ll> a,b,c;
int main(){
  cin>>n; string s; cin>>s;
  for(int i=0;i<3*n;i++){
      if(s[i]=='R')x.push_back(i);
      if(s[i]=='G')y.push_back(i);
      if(s[i]=='B')z.push_back(i);
  }
  for(int i=0;i<n;i++){
      vector<ll> v;
      v.push_back(x[i]);
      v.push_back(y[i]);
      v.push_back(z[i]);
      sort(v.begin(),v.end());
      a.push_back(v[0]);
      b.push_back(v[1]);
      c.push_back(v[2]);
  }
  ll ans=1;
  //for(int i=0;i<n;i++)cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;
  ll p=0;
  for(ll i=0;i<n;i++){
      for(;p<n&&a[p]<b[i];p++){}
      ans=ans*(p-i)%mod;
  }
  p=n-1;
  for(ll i=n-1;i>=0;i--){
      for(;p>=0&&c[p]>b[i];p--){}
      ans=ans*((n-1-p)-(n-1-i))%mod;
  }
  for(ll i=1;i<=n;i++)ans=ans*i%mod;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6012
#include <bits/stdc++.h>
#define N 100005
using namespace std;
struct edge{
	int k,next;
}e[N<<1];
int n,home[N],cnt=-1;
void add(int x,int y){
	cnt++;
	e[cnt].k=y;
	e[cnt].next=home[x];
	home[x]=cnt;
}
int f[N];
priority_queue<int,vector<int>,greater<int> >q;
void dfs(int k){
	for(int i=home[k];~i;i=e[i].next){
		dfs(e[i].k);
	}
	for(int i=home[k];~i;i=e[i].next){
		q.push(f[e[i].k]);
	}
	while(!q.empty()){
		f[k]=max(f[k],q.top())+1;
		q.pop();
	}
	//while(!q.empty()) q.pop();
}
int main(){
	memset(home,-1,sizeof(home));
	scanf("%d",&n);
	for(int i=2,x;i<=n;i++){
		scanf("%d",&x);
		add(x,i);
	}
	dfs(1);
	printf("%d",f[1]);
	return 0;
}

Measured memory_bytes: 4864
MODE = "stdio"
require 'matrix'
include Math
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '3
  1 2 3
  2 0 4'.split("\n")
  tmp.each{|s|
    line << s.strip
  }
end
 n = line[0].to_i
 

x = line[1].split(" ").map(&:to_i)
y = line[2].split(" ").map(&:to_i)

xy = x.zip(y).map{|x,y| (x-y).abs.to_f}
p2 = xy.map{|xy| xy**2}.inject(&:+)
p3 = xy.map{|xy| xy**3}.inject(&:+)

p1 = xy.inject(&:+)
p2 = p2**(1.0/2)
p3 = p3**(1.0/3)
pinf = xy.max

printf("%.10f\n%.10f\n%.10f\n%.10f\n",p1,p2,p3,pinf)

Measured memory_bytes: 9404
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
//struct edge { int to, cost; };

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

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; }

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

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

    string s;
    cin >> s;
    int n = s[s.size() - 1] - '0';
    if (n == 3) cout << "bon" << endl;
    else if (n == 0 || n == 1 || n == 6 || n == 8) cout << "pon" << endl;
    else cout << "hon" << endl;

    return 0;
}


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

int main() {
    string S;
    cin >> S;
    if (S[S.size()-1] == 's') {
        cout << S << "es" << endl;
    }
    else {
        cout << S << 's' << endl;
    }
}


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

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

int main(){
  int a,b;
  cin >> a >> b;
  
    cout << gcd(a,b) << endl;


  return 0;
}



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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {

            string input = Console.ReadLine();
            int N = int.Parse(input);

            List<Sample> sampleList = new List<Sample>();

            for (int i = 0; i < N; i++ )
            {
                input = Console.ReadLine();
                String[] temp = input.Split(' ');
                sampleList.Add(new Sample()
                {
                    city = temp[0],
                    point = int.Parse(temp[1]),
                    rate = sampleList.Count + 1,
                    raw = i + 1
                });

                for(int j = 0; j < i; j++)
                {
                    Sample smp = sampleList.Find(m => m.rate == j + 1);

                    if(string.Compare(temp[0], smp.city) < 0)
                    {
                        sampleList[i].rate = j + 1;
                        for(int k = 0; k < sampleList.Count - 1; k++ )
                        {
                            if(sampleList[k].rate >= sampleList[i].rate)
                            {
                                sampleList[k].rate++;
                            }
                        }
                        break;
                    } else if (string.Compare(temp[0], smp.city) == 0)
                    {
                        if(sampleList[i].point > smp.point)
                        {
                            sampleList[i].rate = j + 1;
                            for (int k = 0; k < sampleList.Count - 1; k++)
                            {
                                if (sampleList[k].rate >= sampleList[i].rate)
                                {
                                    sampleList[k].rate++;
                                }
                            }
                            break;
                        }
                    }
                }
            }

            sampleList.Sort((a, b) => a.rate - b.rate);

            foreach(Sample smp in sampleList)
            {
                Console.WriteLine(smp.raw);
            }

            return;
        }

        private class Sample
        {
            public String city { set; get; }
            public int point { set; get; }
            public int rate { set; get; }
            public int raw { set; get; }
        }
    }
}


Measured memory_bytes: 13408
#include <algorithm>
#include <iostream>
#include <cassert>
#include <vector>

using namespace std;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b) - 1; i >= (a); --i)
#define trav(x, v) for (auto &x : v)

#define sz(x) int((x).size())
#define eb(x...) emplace_back(x)
#define all(x) begin(x), end(x)
#define ff first
#define ss second

using ll = int64_t;

template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

using vi = vector<int>;

constexpr int N = 1 << 17;
int M;
int f[N], h[N];
vi g[N];

void down(int u, int p) {
	f[u] = 1;
	if (p != u) g[u].erase(find(all(g[u]), p));
	trav(v, g[u]) {
		down(v, u);
		f[u] = 1ll * f[u] * (1 + f[v]) % M;
	}
}

void up(int u, int p) {
	int c = sz(g[u]);
	vi s(c, 1); int x = 1;
	per(i, 1, c) s[i - 1] = 1ll * s[i] * (1 + f[g[u][i]]) % M;
	rep(i, 0, c) {
		int v = g[u][i];
		h[v] = 1ll * x * s[i] % M * (1 + h[u]) % M;
		x = 1ll * x * (1 + f[v]) % M;
		up(v, u);
	}
}

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

	int n; cin >> n >> M;
	rep(i, 1, n) {
		int u, v; cin >> u >> v; --u; --v;
		g[u].eb(v); g[v].eb(u);
	}
	down(0, 0);
	up(0, 0);
	rep(u, 0, n) cout << 1ll * f[u] * (1 + h[u]) % M << '\n';
}

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

// why am I so weak

int n, m, k;
char mat[855][855];

int d[855][855];

typedef pair<int, int> P;

#define ft first
#define sd second

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

int main() {
	scanf("%d %d %d", &n, &m, &k);

	for (int i = 0; i < n; i++) {
		scanf("%s", mat[i]);
	}

	P t;

	for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
		if (mat[i][j] == 'S') {
			t = P(i, j);
		}
	}

	queue<P> que;

	memset(d, -1, sizeof(d));

	d[t.ft][t.sd] = 0;
	que.push(t);

	while (!que.empty()) {
		P p = que.front(); que.pop();

		if (d[p.ft][p.sd] == k) break;

		for (int i = 0; i < 4; i++) {
			int nx = p.ft + dx[i], ny = p.sd + dy[i];

			if (nx >= 0 && nx < n && ny >= 0 && ny < m && mat[nx][ny] == '.' && d[nx][ny] < 0) {
				d[nx][ny] = d[p.ft][p.sd] + 1;
				que.push(P(nx, ny));
			}
		}
	}

	int res = INT_MAX;

	for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (~d[i][j]) {
		res = min(res, (min(min(i, n - i - 1), min(j, m - j - 1)) + k - 1) / k + 1);
	}

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

	return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
 typedef long long ll;
 using namespace std;
 const int MAX=1e5+5;
 const int INF=1e9;
 int n,m;
 int edge[20][20];
 int total;
 int cost[1<<16][16],dp[1<<16][16];//dp[s][x]记录达到某点集s,最后“末端”（继续连接其余点的唯一点）为x时余下权值和最大的边的情况
 int inner[1<<16];//内部的边
 int main()
 {
     scanf("%d%d",&n,&m);
     for(int i=1;i<=m;i++)//读入数据
     {
        int x,y,price;
         scanf("%d%d%d",&x,&y,&price);
         --x;--y;
         edge[x][y]=edge[y][x]=price;
     }
     total=1<<n;
     for(int i=0;i<total;i++)//计算某点集内部所有边权值之和
         for(int a=0;a<n;a++)
             if(i&(1<<a))
                 for(int b=0;b<a;b++)
                     if(i&(1<<b))
                         if(edge[a][b])
                             inner[i]+=edge[a][b];
     for(int i=0;i<total;i++)//计算某点集到点集外某点所有边的权值之和
         for(int a=0;a<n;a++)
             if(!(i&(1<<a)))
                 for(int b=0;b<n;b++)
                     if((i&(1<<b))&&edge[a][b])
                         cost[i][a]+=edge[a][b];
     memset(dp,-1,sizeof(dp));
     dp[1][0]=0;//只有1个点的集合dp值显然为0
     for(int i=0;i<total;i++)
     {
 
         for(int a=0;a<n;a++)
         {
             if((i&(1<<a))&&dp[i][a]!=-1)
             {
                 for(int b=0;b<n;b++)
                     if(!(i&(1<<b)))/*只加入一个点*/
                         if(edge[a][b])
                             dp[i|(1<<b)][b]=max(dp[i|(1<<b)][b],dp[i][a]+edge[a][b]);
                 /*加入一个点集*/
                 int left=total-1-i;
                 for(int now=left;now!=0;now=(now-1)&left)//用此循环得到所有
                 {
                     int num=inner[now]+cost[now][a];
                     dp[i|now][a]=max(dp[i|now][a],dp[i][a]+num);
                 }
             }
         }
     }
     printf("%d\n",inner[total-1]-dp[total-1][n-1]);
     return 0;
 }

Measured memory_bytes: 8320
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import defaultdict
from bisect import *
mod = 10**9+7

N = int(input())
XL = [list(map(int, input().split())) for i in range(N)]
A = [(X+L, X-L) for X, L in XL]
A.sort()
cnt, last = 0, A[0][0]
for s, t in A[1:]:
    if t < last:
        cnt += 1
    else:
        last = s
print(N-cnt)


Measured memory_bytes: 42120
#include<bits/stdc++.h>
#define ll  long long
#define pp pair<int,int>
#define ppn pair<pp,int>
#define F first
#define S second
#define N 200005
#define mod 1000000007
#define pi 3.14159265358979323846

using namespace std;

int a[N];
int main()
{


    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

   int a, b, c;
   cin>>a>>b>>c;
   int k = a/c+(a%c?1:0);
   int ans = 0;
   for(int i = k*c; i<=b; i+=c)ans++;
   cout<<ans<<endl;
}


Measured memory_bytes: 3612
#include <algorithm>
#include <cstdio>
using namespace std;

int main() {
  int dp[20010], h, n, a[1000], b[1000], ans = 500000000;
  scanf("%d%d", &h, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
  }
  for (int i = 0; i <= 20000; i++) {
    dp[i] = 500000000;
  }
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= 20000 - a[i]; j++) {
      dp[j + a[i]] = min(dp[j + a[i]], dp[j] + b[i]);
    }
  }
  for (int i = h; i <= 20000; i++) {
    ans = min(ans, dp[i]);
  }
  printf("%d\n", ans);
}

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

typedef long long int llint;

int a[100001];

int main()
{
  int n, x;
  int d = 1000000000;
  
  cin>> n >> x;
  
  for(int i = 0; i < n; i++) {
    int tmp;
    cin>> tmp;
    a[i] = abs(tmp - x);
  }

  for(int i = 0; i < n; i++) {
    d = min(d, a[i]);
  }

  for(int i = d; i > 0; i--) {

    bool flg = true;
    
    for(int j = 0; j < n; j++) {
      
      if(a[j] % i != 0) {
	flg = false;
	break;
      }
    }
    
    if(flg) {
      d = i;
      break;
    }
  }

  cout<< d <<endl;
  
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
#define SIZE 8

struct point{
  int x;
  int y;
};

int main(void){
  int n;
  cin>>n;
  for(int data=1;data<=n;data++){
    int plane[SIZE+6][SIZE+6];
    int X,Y;
    vector<point> bombs;
    point p;
    for(int i=3;i<SIZE+3;i++){
      string input;
      cin>>input;
      for(int j=0;j<SIZE;j++){
        plane[i][j+3]=input[j]-'0';
      }
    }
    for(int i=0;i<SIZE+6;i++){
      for(int j=0;j<3;j++){
        plane[j][i]=0;
        plane[i][j]=0;
        plane[SIZE-j-1+6][i]=0;
        plane[i][SIZE-j-1+6]=0;
      }
    }
    cin>>X>>Y;
    X--;
    Y--;
    X+=3;
    Y+=3;
    p.x=X;
    p.y=Y;
    bombs.push_back(p);

    while(bombs.size()>0){
      vector<point> _bombs;
      _bombs.clear();
      for(int i=0;i<bombs.size();i++){
        point bomb=bombs[i];
        plane[bomb.y][bomb.x]=0;
        for(int j=-3;j<=3;j++){
          if(plane[bomb.y+j][bomb.x]==1){
            plane[bomb.y+j][bomb.x]=0;
            point _p;
            _p.x=bomb.x;
            _p.y=bomb.y+j;
            _bombs.push_back(_p);
          }
          if(plane[bomb.y][bomb.x+j]==1){
            plane[bomb.y][bomb.x+j]=0;
            point _p;
            _p.x=bomb.x+j;
            _p.y=bomb.y;
            _bombs.push_back(_p);
          }
        }
      }
      bombs.clear();
      copy(_bombs.begin(),_bombs.end(),back_inserter(bombs));
      /*
      for(int j=0;j<bombs.size();j++){
        cout<<bombs[j].x<<" "<<bombs[j].y<<endl;
      }
      for(int i=0;i<SIZE+6;i++){
        for(int j=0;j<SIZE+6;j++){
          cout<<plane[i][j];
        }
        cout<<endl;
      }
      */
    }
    cout<<"Data "<<data<<":"<<endl;
    for(int i=3;i<SIZE+3;i++){
      for(int j=3;j<SIZE+3;j++){
        cout<<plane[i][j];
      }
      cout<<endl;
    }

  }
  return 0;
}



Measured memory_bytes: 3156
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>

using namespace std;

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

int h, w;
string s[100];
int mn = 1000000;


int main(){

    cin >> h >> w;

    rep(i, h) cin >> s[i];

    // h = 100;
    // w = 100;
    // rep(i, h){
    //     string t = "";
    //     rep(j, w){
    //         if(j % 2 == 0){
    //             t += "#";
    //         }else{
    //             t += ".";
    //         }
    //     }
    //     s[i] = t;
    // }

    int dp[h][w];
    if(s[0][0] == '#'){
        dp[0][0] = 1;
    }else{
        dp[0][0] = 0;
    }
    rep(i, w - 1){
        if(s[0][i] == '.'){
            if(s[0][i+1] == '.'){
                dp[0][i+1] = dp[0][i];
            }else{
                dp[0][i+1] = dp[0][i] + 1;
            }
        }else{    
            dp[0][i+1] = dp[0][i];
        }
    }
    rep(i, h - 1){
        if(s[i][0] == '.'){
            if(s[i+1][0] == '.'){
                dp[i+1][0] = dp[i][0];
            }else{
                dp[i+1][0] = dp[i][0] + 1;
            }
        }else{    
            dp[i+1][0] = dp[i][0];
        }
    }
    for(int i = 1; i < h; i++){
        for(int j = 1; j < w; j++){
            if(s[i][j] == '.'){
                dp[i][j] = min(dp[i-1][j], dp[i][j-1]);
            }else{
                if(s[i-1][j] == '.' && s[i][j-1] == '.'){
                    dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1] + 1);
                }else if(s[i-1][j] == '.'){
                    dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1]);
                }else if(s[i][j-1] == '.'){
                    dp[i][j] = min(dp[i-1][j], dp[i][j-1] + 1);
                }else{
                    dp[i][j] = min(dp[i-1][j], dp[i][j-1]);
                }
            }
        }
    }
    cout << dp[h-1][w-1] << endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, k) = (v[0], v[1]);
    let v = read_vec::<i64>();

    // get k stone
    let mut ans = 0;
    for gi in 0..k + 1 {
        if gi > n {
            break;
        }
        // get ri from right. residual is from left.

        for ri in 0..gi + 1 {
            let li = gi - ri;
            let mut stones = vec![];
            for i in 0..ri {
                stones.push(v[i]);
            }
            for i in 0..li {
                stones.push(v[n - 1 - i]);
            }
            stones.sort();
            let mut temp_ans = 0;
            for i in 0..k - gi {
                if i >= stones.len() {
                    break;
                }
                if stones[i] < 0 {
                    temp_ans -= stones[i];
                }
            }
            temp_ans += stones.iter().sum::<i64>();
            ans = max(ans, temp_ans);
        }
    }
    println!("{:?}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
int main()
{
	int n,turn;
	char str[2][(1<<20)+1];
	
	turn = 0;
	while(std::cin>>n,n){
		std::cin>>str[turn];
		int len = strlen(str[turn]);

		while(n--){
			int s = 0;
			for(int i=0; i<len; ){
				int j;
				char c = str[turn][i];
				for(j=1,i++; i<len && str[turn][i]==c; i++,j++);
				//printf("i:%d , j:%d , len:%d , c:%c\n",i,j,len,c);
				char tmp[101];
				int k = 0;
				while(j>0){
					tmp[k++] = (j%10) + '0';
					j/=10;
				}
				tmp[k] = 0;
				//printf("___tmp:%s    k:%d\n",tmp,k);
				while(k>0){
					str[turn^1][s++] = tmp[--k];
				}
				str[turn^1][s++] = c;
				//for(int u=0; u<s; u++)printf("%c",str[turn^1][u]);
				//printf("\n________s_%d______%c\n",s,str[turn^1][s-1]);
			}
			len = s;
			str[turn^1][len] = 0;
			turn ^= 1;
			//printf("n:%d s:%d __%s\n\n",n,len,str[turn]);
		}
		printf("%s\n",str[turn]);
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
v_i = list(map(int,input().split()))

for i in range(N-1):
    v_i = sorted(v_i)
    temp = (v_i[0] + v_i[1]) / 2
    del v_i[0]
    del v_i[0]
    v_i.append(temp)

print(v_i[0])

Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){  
  int n;
  string s;
  cin >> n;

  int v[n][30] = {};

  
  REP(i, n){
    cin >> s;
    REP(j, s.size()){
      int itmp = (int)s[j]-97;
      v[i][itmp]++;
    }
  }
  
  /*
  REP(i, n){    
    REP(j, 26) cout << "v :i,j " << v[i][j] << endl;
  }
  */

  int res[30] = {};
  REP(i, 30) res[i] = INT_MAX;
  
  REP(i, n) REP(j, 26) if(v[i][j] < res[j]) res[j] = v[i][j];

  REP(i, 26) {
    while(res[i] > 0) {
      cout << (char)('a'+ i);
      res[i]--;
    }
  }

  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
N, X, Y = map(int, input().split())
A = [N - i for i in range(1, N)]
for i in range(N-1):
  for j in range(i+1, N):
    c = min(abs(X-i-1)+abs(Y-j-1)+1, abs(X-j-1)+abs(Y-i-1)+1)
    if c < j-i:
      A[j-i-1] -= 1
      A[c-1] += 1
for a in A:
  print(a)

Measured memory_bytes: 9348
#include <stdio.h>

int main(){
    int a[1000];
    int n;

    scanf("%d", &n);
    int i;
    for(i=0; n>i; i++)scanf("%d", &a[i]);
    if(n>0)printf("%d", a[n-1]);
    while(n>1){
        printf(" %d", a[n-2]);
        n--;
    }putchar('\n');
    return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main(){
	while(1){
		string s;
		int m;
		
		cin >> s;
		if(s == "-") break;
		cin >> m;
		for(int i=0; i<m; ++i){
			int a;
			cin >> a;
			
			string add = s.substr(0,a);
			s = s+add;
			s = s.substr(a, s.size());
		}
		
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#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>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
    os << p.first << ":" << p.second;
    return os;
}

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

// edit

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


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


Measured memory_bytes: 3196
use std::collections::VecDeque;
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
  let (h, w) = {
    let tmp: Vec<usize> = read_vec();
    (tmp[0], tmp[1])
  };
  let mut s: Vec<Vec<char>> = Vec::new();
  for _ in 0..h {
    let tmp: Vec<char> = read::<String>().chars().collect();
    s.push(tmp);
  }

  let mut deque: VecDeque<(usize, usize, usize)> = VecDeque::new();
  let mut max = 0;
  let mut tmp_max = 0;

  for i in 0..h {
    for j in 0..w {
      if s[i][j] == '#' { continue; }

      let mut dist: Vec<Vec<bool>> = vec![vec![false; w]; h];
      for i2 in 0..h {
        for j2 in 0..w {
          if s[i2][j2] == '#' {
            dist[i2][j2] = true;
          }
        }
      }

      deque.push_back((i, j, 0));
      dist[i][j] = true;

      loop {
        match deque.pop_front() {
          None => { break; }
          Some((x, y, d)) => {
            dist[x][y] = true;
            if x>0 && !dist[x-1][y] {
              dist[x-1][y] = true;
              deque.push_back((x-1, y, d+1));
              tmp_max = d+1;
            }
            if x<h-1 && !dist[x+1][y] {
              dist[x+1][y] = true;
              deque.push_back((x+1, y, d+1));
              tmp_max = d+1;
            }
            if y>0 && !dist[x][y-1] {
              dist[x][y-1] = true;
              deque.push_back((x, y-1, d+1));
              tmp_max = d+1;
            }
            if y<w-1 && !dist[x][y+1] {
              dist[x][y+1] = true;
              deque.push_back((x, y+1, d+1));
              tmp_max = d+1;
            }
          }
        }
      }
      if tmp_max > max { max = tmp_max; }
      tmp_max = 0;
    }
  }
  println!("{}", max);
}



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

int main(){
  int n;
  int a[1000000];
  cin>>n;
  for(int i=1;i<=n;i++) cin>>a[i];
  int ans=0;
  for(int i=1;i<=n;i++){
    if(i==a[a[i]]) ans++;
    a[i]=0;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
  cin.tie(0); 
  ios::sync_with_stdio(false);
  
  int D,T,S;
  cin >> D >> T >> S;
  if( double(D)/S <= T ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        sc.close();

        int ans = n / (2 * d + 1);
        if (n % (2 * d + 1) != 0) {
            ans++;
        }
        System.out.println(ans);

    }

}


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

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

int main() {
   int n;
   cin >> n;
   vector<int> d;
   rep(i, n) {
      int w;
      cin >> w;
      d.push_back(w);
   }
   sort(d.begin(), d.end(), greater<int>());
   int a[] = {0, 0};
   rep(i, n) {
      a[i % 2] += d[i];
   }
   cout << a[0] - a[1] << endl;
}


Measured memory_bytes: 256
'use strict';

const input = require("fs").readFileSync("/dev/stdin", "utf8");
const list = input.trim().split(' ').map(Number);

let sum = 0;
for (let i = 0; i < list.length; i++) {
    sum += list[i];
}

const result = sum > 21 ? 'bust' : 'win';
console.log(result);


Measured memory_bytes: 22080
#include<cstdio>

int main(){
  int data[10],order[10];

  for(int i=0;i<10;i++){
    scanf("%d",&data[i]);
    order[i]=1;
  }

  for(int i=1;i<10;i++)
    for(int j=0;j<i;j++){
      if(data[j]<data[i]) order[j]++;
      if(data[j]>=data[i]) order[i]++;
    }

  for(int i=1;i<=3;i++)
    for(int j=0;j<10;j++)
      if(order[j]==i)
	printf("%d\n",data[j]);
   
  return 0;
}

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

int main()
{
    vector<double> heights;
    double in_data;
    while(cin >> in_data)
    {
        heights.push_back(in_data);
    }
    sort(heights.begin(), heights.end());
    cout << heights.back() - heights.front() << endl;
    return 0;
}



Measured memory_bytes: 3200
#include <iostream>
using namespace std;
int A[100], N, times = 0;
void selectionSort(int A[], int N);
void print(int A[], int N);
int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> A[i];
	selectionSort(A, N);
	print(A, N);

}
void selectionSort(int A[], int N)
{
	int temp = 0;
	int minj;//?????????????????????????¬¬i?????°?¬¬N-1???????´????????°?????????????
	for (int i = 0; i < N; i++)//????????????i??¨??????????????¨???????????´????´?????????°????????´???????°??§???¨
	{
		minj = i;
		for (int j = i; j < N; j++)
		{
			if (A[j] < A[minj])
				minj = j;
		}
		temp = A[i];
		A[i] = A[minj];
		A[minj] = temp;
		if (minj != i)
			times++;
	}
	//print(A, N);
}
void print(int A[], int N)
{
	for (int i = 0; i < N; i++)
	{
		cout << A[i];
		if (i != N - 1)cout << " ";
	}
	cout << endl << times<<endl;
}

Measured memory_bytes: 3096
import queue

N,K=map(int,input().split())
A=list(map(int,input().split()))

A_expect=[a+1 for a in A]
q = queue.Queue()
S=0
ans=0
for a_e in A_expect:
    S+=a_e
    q.put(a_e)
    if q.qsize()>K:
        S-=q.get()
    if q.qsize()==K:
       ans=max(ans,S)
ans/=2
print(ans)

Measured memory_bytes: 26328