akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] arg)throws IOException{
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
         //br.readline(); = ??\??????????????????????????\??¬????????????????????????????????????
         String str = br.readLine();
 
         /*????????????(int??¨???String??¨???) [] ????????? = ???????????¨???
          *?????????strAry??£????????????str?????\????????????
          *str.split = split??£?????????String????????¨???????????????????????????
          *??????????????????????????¨???????????¨????????????????????§????????£?????£???????§?????????§
          *split(" ")??¨???????????????*/
         String[] strAry = str.split(" ");
 
         /*????????????????????????????????°??????????????????
          *???????????????????????????????????????????????£????¢¨????????£?????????*/
         int W = Integer.parseInt(strAry[0]);
         int H = Integer.parseInt(strAry[1]);
         int x = Integer.parseInt(strAry[2]);
         int y = Integer.parseInt(strAry[3]);
         int r = Integer.parseInt(strAry[4]);
 
         /*?????°?????¶????¨???°???if(?????¶ && ?????¶)????????????????????£?????????
          * if(?????¶ || ?????¶)??§???????????????????????¶???????????§??????????????????
          * ???????????????(r)?????????????????§?¨?(x,y????????????)???????????£??????????????¨??????
          * ?????????????????????????????§?????¶??§??????
          * ???????????????(r)??¨??????????????§?¨?(x,y????????????)???????¨???????????????§?¨?(W,H????????????)???
          * ???????????¨???????????????????????????????????§?????¶??????
          * ?????????????????????????????´????????????????????\????????????
          */
         if(x-r<0 || y-r<0 || x+r>W || y+r>H){
                System.out.println("No");
            }
            else{
                System.out.println("Yes");
            }
    }
}

Measured memory_bytes: 17084
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    S = input()
    r = 0
    l = len(S)-1

    counter = 0
    while (l - r) >= 1 :
        if S[r] == S[l]:
            r += 1
            l -= 1
        elif S[r] == "x":
            r += 1
            counter += 1
        elif S[l] == "x":
            l -= 1
            counter += 1
        else:
            counter = -1
            break
    print(counter)

if __name__ == "__main__":
    main()



Measured memory_bytes: 9128
// 2019/04/27 Tazoe

#include <iostream>
using namespace std;

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

	int V[20];
	int C[20];

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

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

	int VC = 0;

	for(int i=0; i<N; i++){
		if(V[i]-C[i]>0){
			VC += V[i]-C[i];
		}
	}

	cout << VC << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a;
    cin>>a;
    if(a<1200)
        cout<<"ABC"<<endl;
    else if(a<2800)
        cout<<"ARC"<<endl;
    else
        cout<<"AGC"<<endl;

    return 0;
}


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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	string s;
	cin >> n >> s;
	int cnt = 0;
	REP(i, s.size()) {
		if (s[i] == '(')cnt++;
		else {
			cnt--;
			if (cnt < 0) {
				s = '(' + s;
				++i;
				cnt++;
			}
		}
	}
	REP(i, cnt)s += ')';
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    double X = N/1.08;
    int A = (int)Math.ceil(X);
    String ans = ":(";
    if(N == (int)(A*1.08)){
      ans = A + "";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
import sys
import collections
input=sys.stdin.readline

n=int(input())
l=[input().rstrip() for i in range(n)]
l_num=[0]*5
m=0
for i in range(n):
    if l[i][0]=='M':
        l_num[0]+=1
    elif l[i][0]=='A':
        l_num[1]+=1
    elif l[i][0]=='R':
        l_num[2]+=1
    elif l[i][0]=='C':
        l_num[3]+=1
    elif l[i][0]=='H':
        l_num[4]+=1
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            m+=l_num[i]*l_num[j]*l_num[k]
print(m)

Measured memory_bytes: 10112
#include <iostream>
#include <string>

using namespace std;

int main(void){
    string a;
    string b;
    string c;
    int aLength=0;
    int bLength=0;

    cin >> a >> b >> c;

    aLength=a.length();
    bLength=b.length();

    if(a[aLength-1]==b[0]&&b[bLength-1]==c[0])cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
time=0
menu=[A,B,C,D,E]
count=0
order=[]
kauri=[]
for i in range(5):
  if menu[i]%10==0:
      order.append(menu[i])
      count+=1
for h in range(9):
  for g in range(5):
    if menu[g]%10==9-h:
      kauri.append(menu[g])
      order.append(menu[g]+(h+1))
if  count!=5:
  order[4]=kauri[4-count]      
print(sum(order))

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[202020];
int B[202020];

int ok(int cur) {
	if(cur>2*N-1) return 0;
	
	int i;
	FOR(i,2*N-1) B[i]=A[i]>=cur;
	int L=N-1,R=N-1;
	while(L>0 && B[L]!=B[L-1]) L--;
	while(R<2*N-1 && B[R]!=B[R+1]) R++;
	return ((N-1)-L<=R-(N-1))?B[L]:B[R];
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,2*N-1) cin>>A[i];
	int cur=1;
	for(i=20;i>=0;i--) if(ok(cur+(1<<i))) cur+=1<<i;
	cout<<cur<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

int main() {
  int N, P = 1, W = 1, G = 1, Y = 1;
  string S;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S;
    if (S == "P")
      P *= 0;
    else if (S == "W")
      W *= 0;
    else if (S == "G")
      G *= 0;
    else if (S == "Y")
      Y *= 0;
  }
  if (P + W + G + Y == 1)
    cout << "Three" << endl;
  else 
    cout << "Four" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    int a, b;
    cin >> a >> b;
    int c = a - b - b;
    if(c < 0) c = 0;
    cout << c << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstdint>

using namespace std;

// 各乗り物の {最初の人数, 輸送回数} を管理する
// 各乗り物は最後の 1 回以外はすべて同じ人数をのせる (最後の一回だけはあまりを乗せる)
struct TrafficLog {
	uint64_t first_num;
	uint64_t count;
};

TrafficLog transport(const TrafficLog& prev, uint64_t capacity, uint64_t n)
{
	if (prev.first_num <= capacity) {
		// 到着したまま乗せればよい
		return prev;
	}

	// 最初の到着以降滞留していくので今回のキャパシティー一杯に輸送する
	return { capacity, (n + capacity - 1) / capacity };
}

int main(int argc, char* aragv[])
{
	uint64_t n = 0;
	uint64_t traffic[5] = { 0 };

	cin >> n;

	for (int i = 0; i < 5; i++) {
		cin >> traffic[i];
	}

	// 初期状態を n 人を 1 回運んだ状態にしておく
	TrafficLog first{ n, 1 };
	TrafficLog cur = first;
	for (int i = 0; i < 5; i++) {
		cur = transport(cur, traffic[i], n);
	}

	cout << (4 + cur.count) << endl;

	return 0;
}

Measured memory_bytes: 256
/*  */

#include <iostream>
#include <string>
using namespace std;
int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;
    if (a > 8 || b >8) printf(":(");
    else printf("Yay!\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	long long int n,initial=100,year=0;
	cin>>n;
	while(1){
		initial=initial*1.01;
		year++;
		if(initial>=n){
			cout<<year;
			return 0;
		}
	}
    return 0;
}

Measured memory_bytes: 3624
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    vector<int>N(3);
    for(int i=0;i<3;i++){
        cin>>N[i];
    }

    sort(N.begin(),N.end(),greater<int>());

    cout<<N[0]*10+N[1]+N[2]<<endl;

    return 0;

}


Measured memory_bytes: 256
N,M = gets.chomp.split.map(&:to_i)

def matching(ary, n)
a = ary
b = ary.reverse
(0..n-1).each do |i|
puts "#{a[i]} #{b[i]}"
end
end

if M <= N/2/2
  matching([*1..N/2], M)
else
  if N%2 == 1
    matching([*1..N/2], N/2/2)
    matching([*N/2+1..N], M-N/2/2)
  else
    matching([*1..N/2], N/2/2)
    matching([*N/2+2..N], M-N/2/2)
  end
  
end
 







Measured memory_bytes: 17624
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

using ll =  long long;

constexpr ll LINF = 1LL << 60;

bool is_ok(ll mid, ll k, ll n, ll n_pos, ll n_neg, ll zero, vector<ll> &pos, vector<ll> &neg) {
    ll kk = 0;  // mid より小さい積をもつ組数
    // -2 -4
    if(k <= n_pos * n_neg) {
        for(int i=0;i<pos.size();++i) {
            ll d = n_neg - ll(lower_bound(neg.begin(), neg.end(), (-mid+pos[i]-1)/pos[i]) - neg.begin());
            kk += max(d, 0LL);
        }
    } else {
        kk = n_pos * n_neg + zero * (n-zero) + zero * (zero-1) / 2;
        for(int i=0;i<pos.size();++i) {
            ll d = ll(upper_bound(pos.begin()+i+1, pos.end(), mid/pos[i]) - pos.begin()) - (i+1);
            kk += d;
        }
        for(int i=0;i<neg.size();++i) {
            ll d = ll(upper_bound(neg.begin()+i+1, neg.end(), mid/neg[i]) - neg.begin()) - (i+1);
            kk += d;
        }
    }

    return kk >= k;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll n, k, a;
    cin >> n >> k;
    vector<ll> pos, neg;
    ll zero = 0;
    for(int i=0;i<n;++i) {
        cin >> a;
        if(a > 0) pos.push_back(a);
        else if(a < 0) neg.push_back(-a);
        else ++zero;
    }
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());
    ll n_pos = pos.size(), n_neg = neg.size();

    if(n_pos * n_neg < k && k <= n_pos * n_neg + zero * (n-zero) + zero * (zero-1) / 2) {
        cout << 0 << endl;
        return 0;
    }

    ll ng = -LINF, ok = LINF;
    while(ok-ng > 1LL) {
        ll mid = (ok + ng) / 2;
        if(is_ok(mid, k, n, n_pos, n_neg, zero, pos, neg)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok << endl;

    return 0;
}


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

int main(){
    string s,c;
    cin >> s;
    for(int i=0;i<s.length();i++){
        if(s[i]!='x') c.push_back(s[i]);
    }
    int j=c.length()-1;
    for(int i=0;i<c.length();i++){
        if(i>=j) break;
        if(c[i]==c[j]){
            j--;
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }
    int count=0;
    j=s.length()-1;
    for(int i=0;i<s.length();){
        if(i>=j) break;
        if(s[i]==s[j]){
            i++;
            j--;
        }
        else{
            count++;
            if(s[j]=='x') j--;
            if(s[i]=='x') i++;
        }
    }
    cout << count << endl;
    return 0;
}

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

int main() {
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	
	if(max(a-b,b-a)<=d||max(a-c, c-a)<=d){
		if(max(a-c, c-a)<=d){
			cout<<"Yes"<<endl;
		
		}
		else if(max(a-b,b-a)<=d){
			if(max(c-b,b-c)<=d)
			cout<<"Yes"<<endl;
			else{
				cout<<"No"<<endl;
			}
			
		}
		else{
			cout<<"No"<<endl;
		}
		
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define REP(i, a, n) for(int i = (a); i <= (n); i++)
using namespace std;
typedef pair<int, int> pii;

int P, Q, A, N;

int dfs(int p, int q, int n, int t) {
  if(P * q == p * Q) return 1;
  if(P * q <  p * Q) return 0;
  if(N == n) return 0;

  int ans = 0;
  REP(i, t, A / q) ans += dfs(p * i + q, q * i, n + 1, i);
  return ans;
}

int main(void) {
  while(cin >> P >> Q >> A >> N, P != 0) {
    cout << dfs(0, 1, 0, 1) << endl;
  }

  return 0;
}

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

 
using namespace std;
 
#define INF 1000000000
#define EPS 1e-9
#define PI acos(-1)
 
typedef long long ll;

#define MAX_N 100

int n;

vector<int> ans_list;


int main(){

  cin >> n;

  int sum1 = (20+19)*5;
  int sum2 = 20*10;

  while(n > 0){
    n--;

    int Y, M, D;
    cin >> Y >> M >> D;

    int ans = 0;

    while(Y < 1000){
      
      ans++;
      D++;

      if(Y%3 == 0 && D == 21){
	M++;
	D = 1;
	if(M == 11){
	  Y++;
	  M = 1;
	  D = 1;
	}
      }

      else if(Y%3 != 0){
	if(M%2 == 0){
	  if(D == 20){
	    M++;
	    D = 1;
	    if(M == 11){
	      Y++;
	      M = 1;
	      D = 1;
	    }
	  }
	}
	else{
	  if(D == 21){
	    M++;
	    D = 1;
	    if(M == 11){
	      Y++;
	      M = 1;
	      D = 1;
	    }
	  }
	}
      }

    }

    ans_list.push_back(ans);

  }

  for(int i = 0; i < ans_list.size(); i++){
    cout << ans_list[i] << endl;
  }

  return 0;

}

Measured memory_bytes: 1216
n,m = map(int,input().split())
uv = [tuple(map(int, input().split())) for _ in range(n-1)]
colors = [0 for _ in range(n+1)]
for i in range(m):
    p,x = map(int,input().split())
    colors[p] += x
edges = [dict() for _ in range(n+1)]
for u, v in uv:
    edges[u][v] = 0
plan = set((1,))
while len(plan) > 0:
    g = plan.pop()
    for n,w in edges[g].items():
            colors[n] = colors[g] +colors[n]
            plan.add(n)
print(*colors[1:])

Measured memory_bytes: 121952
#include  <stdio.h>

int main(void)
{
   int a,b;
    scanf("%d %d",&a,&b);
    
    if(((a == 1) && (b ==2))||((a == 2) && (b ==1)))
    {
        printf("3");
    }
     if(((a == 2) && (b ==3))||((a == 3) && (b ==2)))
    {
        printf("1");
    }
    if(((a == 1) && (b ==3))||((a == 3) && (b ==1)))
    {
        printf("2");
    }
    
    

   
    
    return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e12;
ll mod=1e9+7;
#define pb push_back
#define se second
#define fi first
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
vector<int> graph[205];
int color[205];
int nCk[100][100];
bool bipartite_jugding(int v, int c){
    color[v] = c;
    for(int i = 0; i < graph[v].size(); ++i){
        if(color[graph[v][i]] == c) return false;
        if(color[graph[v][i]] == 0 && !bipartite_jugding(graph[v][i], -c)){
            return false;
        }
    }
    return true;
}

 void combi() {
	for (int i = 0; i <= 99; ++i) nCk[i][0] = 1;
	for (int i = 1; i <= 99; ++i) for (int j = 1; j <= i; ++j) {
		nCk[i][j] = (nCk[i-1][j] + nCk[i-1][j-1]) % mod;
	}
}

long long expo(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*expo((x*x)%M,(n-1)/2,M))%M;

}


void solve(){
    char c;
    cin>>c;
    char ans='a'+(c-'a'+1);
    cout<<ans<<endl;
}

int main(){
    boost;
  solve();
}


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

W = [0]
E = [0]
for i in range(n):
    if S[i] == 'W':
        W.append(W[i]+1)
        E.append(E[i])
    else:
        W.append(W[i])
        E.append(E[i]+1)

#print(W)
#print(E)

ans = 3*10**5
for i in range(1, n+1):
    ans = min(ans, W[i-1]+E[-1]-E[i])
    #print(W[i-1]+E[-1]-E[i], W[i-1], E[-1]-E[i])
print(ans)


Measured memory_bytes: 17644
import itertools

def q47(a, b, c, d, e):
    f = [a, b, c, d, e]
    min = 0
    for i in itertools.permutations(f):
        t = 0
        for j in i:
            if t % 10 == 0:
                t += j
            else:
                t += 10 - t % 10
                t += j
        if min == 0:
            min = t
        elif t < min:
            min = t
    return min
        
            
    
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

print(q47(A, B, C, D, E))

Measured memory_bytes: 3064
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
a = iter([dx, dy, dx, dy+1, dx+1, dy+1, dx+1, dy+1,])
w = "R"*next(a) + "U"*next(a) + "L"*next(a) + "D"*next(a) + "R"*next(a) + "U"*next(a) + "L" + "U" + "L"*next(a) + "D"*next(a) + "R"
print(w)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <functional>
#include <list>
#include <utility>
#include <map>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))
const ll mod = 1000000007;
const double eps = 1e-10;
const int MAX = 200000;

int main() {
	int n;
  string s;
	cin >> n;
  cin >> s;
  if (n%2) {
    cout << "No" << endl;
    return 0;
  }
  rep(i,n/2) {
    if (s.at(i) != s.at(n/2+i)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())  
num_list = []
for i in range(n):
    num_list.append(list(map(int,input().split())))

ans = []
for i in range(n):
  a = num_list[i]
  a1= a[0]
  a2 = a[1]
  if a1 == a2:
    ans.append(1)
    if i > 1 and ans[i-2] == 1 and ans[i-1] == 1 and ans[i] == 1:
      print('Yes')
      break
  else:
    ans.append(0)
if 0 in ans and len(ans) == n :
  print('No')

Measured memory_bytes: 9140
/*input
4
expr
expr
*/
#include<bits/stdc++.h>
using namespace std;

#define int long long 
#define double long double

typedef pair<int,int> pi;

typedef vector<int> vi;
typedef vector<pi> vpi;

#define f first
#define s second
#define mp make_pair
#define pb push_back

#define gcd __gcd

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int fast_ex(int a,int n,int m){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= fast_ex(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

string s,t;
int n,i,j;

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  cin >> n >> s >> t;
  for(i = 0;i < n;i++){
  	bool ok = 1;
  	for(j = i;j < n;j++){
  		if(s[j] != t[j-i])ok = 0;
  	}
  	if(ok){
  		cout << i+n;
  		return 0;
  	}
  	if(i == n-1)cout << 2*n;
  }
  return 0;
}

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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      int A, B, C;
      cin >> A >> B >> C;
      cout << min(C,B/A) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define maxn 100005
#define ll long long

void DBG(){
    cerr << "]\n";
}
template <class H, class... T> void DBG(H h, T... t) {
    cerr << h;
    if (sizeof...(t)) {
        cerr << ", ";
    }
    DBG(t...);
}
#define _DEBUG
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else 
#define dbg(...) 0
#endif

int tt, n, k;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    cout<<(1000-n%1000)%1000;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;

const int SIZE = 500;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n;i++) {
		cin >> a[i];
	}

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

	int cnt = 0;
	for (int i = 1; i < n;i++) {
		if (a[i] == a[i - 1]) {
			cnt++;
		}
	}

	if (cnt % 2 != 0) {
		cnt++;
	}

	cout << n - cnt << endl;
}


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

int main(void){
    int x, y, z;
    cin >> x >> y >> z;

    int cnt = 1;
    x = x - y - 2 * z;

    while(x >= y + z){
        cnt++;
        x = x - y - z;
    }
    printf("%d",cnt);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<queue>
#define N 10001
using namespace std;
int main() {
	int V, E;
	scanf("%d %d", &V, &E);

	int s, t, L[N];
	vector <int> M[N];
	queue <int> S;

	for (int i = 0; i < N; i++) {
		L[i] = 0;
	}

	for (int i = 0; i < E; i++) {
		scanf("%d %d", &s, &t);
		M[s].push_back(t); 
		L[t]++; //tの持つ入力辺の数
	}

	for (int i = 0; i < V; i++) {
		if (L[i] == 0) {
			S.push(i); //入力辺を持たないノード
		}
	}

	int q;
	while (!S.empty()) {
		q = S.front();
		S.pop();
		printf("%d\n", q);
		for (int i = 0; i < M[q].size(); i++) {
			L[M[q][i]]--; //辺を消す
			if (L[M[q][i]] == 0) { //もし入力辺を持っていないならば
				S.push(M[q][i]);
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3944
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var X = cin.ReadInt();
            var x = X.ToString();
            if (X % x.ToCharArray().Select(a => (int)(a - '0')).Sum() == 0) WriteLine("Yes");
            else WriteLine("No");

        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

Measured memory_bytes: 13524
import math

def plot(x,y):
    print(f'{x:.8f} {y:.8f}')

def Koch(n, x1,y1, x2,y2):
    if n==0:
        plot(x1,y1)
        return
    
    sx=(2*x1+x2)/3
    sy=(2*y1+y2)/3
    tx=(x1+2*x2)/3
    ty=(y1+2*y2)/3
    ux=(tx-sx)*(1/2)-(ty-sy)*(math.sqrt(3)/2)+sx
    uy=(ty-sy)*(1/2)+(tx-sx)*(math.sqrt(3)/2)+sy
    
    Koch(n-1, x1,y1, sx,sy)
    Koch(n-1, sx,sy, ux,uy)
    Koch(n-1, ux,uy, tx,ty)
    Koch(n-1, tx,ty, x2,y2)

n=int(input())

Koch(n, 0,0, 100,0)
plot(100,0)



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

#define INF 2<<29;
#define F first
#define S second
  
int main(){
  int n,k;
  int d;
  int temp;
  int num[10]={};
  int flg=0;

  scanf("%d %d",&n,&k);
  for(int i=0;i<k;i++){
    scanf("%d",&d);
    num[d]=1;
  }
  
  for(int i=n;i<=100000&&flg==0;i++){
    temp=i;
    for(int j=1;j<=i;j*=10){
      if(num[temp%10]==1) break;
      temp/=10;
      if(j*10>i){
	printf("%d\n",i);
	flg=1;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <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;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int k,s;
	int ans=0;
	cin >>k>>s;
	for (int a = 0; a<= k;a++){
		for (int b = 0; b <= k;b++){
			if(a+b <=s and a+b+k >=s){
				ans++;
			}
		} }
	cout << ans << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int a, b;
    cin >> a >> b;
    string A, B;
    for (int i = 0; i < b; i++) {
        A.push_back((char)(a + '0'));
    }
    for (int i = 0; i < a; i++) {
        B.push_back((char)(b + '0'));
    }
    if (A < B) {
        cout << A << endl;
    } else {
        cout << B << endl;
    }
}


Measured memory_bytes: 256
kind_num = gets.chomp.to_i
eating_foods = gets.chomp.split(' ').map(&:to_i)
satisfy_rates = gets.chomp.split(' ').map(&:to_i)
adding_satisfy_rates = gets.chomp.split(' ').map(&:to_i)

ans = 0
before_eating_food_idx = nil

eating_foods.each do |food_idx|
  ans += satisfy_rates[food_idx-1]
  if before_eating_food_idx == food_idx - 1
    ans += adding_satisfy_rates[before_eating_food_idx-1]
  end
  before_eating_food_idx = food_idx
end

puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a % 2 != 0 && b % 2 != 0 && c % 2 != 0)
        cout << min(a * b, min(a * c, b * c));
    else
        cout << 0;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
#include <cstdlib>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b)
    {
        cout << c << endl;
    }
    else if (a == c)
    {
        cout << b << endl;
    }
    else
    {
        cout << a << endl;
    }

    return 0;
}

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

int main()
{
  int n;
  string s, t;
  cin >> n >> s >> t;
  rep(i, n) cout << s.at(i) << t.at(i);
  cout << endl;
}

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

constexpr int max_problem {1000000000};

int main(int argc, char** argv) {
  int N, K, S;
  std::cin >> N >> K >> S;
  std::vector<int> A(N, S);
  int path_cnt = N - K;
  int tmp_t = (S!=max_problem)?1:-1;
  int path_check {};
  for (auto i = 0;i < N;++i) {
    if (path_check < path_cnt) {
      A[i] += tmp_t;
      ++path_check;
    } else {
      break;
    }
  }
  for (auto i = 0;i < N;++i) {
    std::cout << A[i];
    if (i == N-1) std::cout << '\n';
    else std::cout << ' ';
  }
}


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

#define REP(i,n,m) for(int i=n;i<m;i++)
#define REPR(i,n,m) for(int i=n;i>m;i--)
#define ALL(v) v.begin(),v.end()
#define elif else if
using ll=long long;

int gcd(int x,int y){
    int a;
    while(y!=0){
        a=x%y;
        x=y;
        y=a;
    }
    return x;
}

int lcm(int a,int b){
    return a*b/gcd(a,b);
}

/*----------template----------*/

int main(){
    int n;
    string s,t;
    cin>>n>>s>>t;

    REP(i,0,n){
        cout<<s.at(i)<<t.at(i);
    }

    cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#define INF 1e+18
#define int long long
using namespace std;

signed main(){
	int n,m,p[100000],cnt[100000] = {},sum = 0;
	cin >> n >> m;
	for(int i = 0;i < m;i++) {
		cin >> p[i];
		p[i]--;
		if(i != 0){
			if(p[i] > p[i - 1]){
				cnt[p[i - 1]]++;
				cnt[p[i]]--;
			}else{
				cnt[p[i]]++;
				cnt[p[i - 1]]--;
			}
		}
	}
	for(int i = 1;i < n;i++) cnt[i] += cnt[i - 1];
	for(int i = 0;i < n - 1;i++){
		int a,b,c;
		cin >> a >> b >> c;
		sum += min(c + b * cnt[i],a * cnt[i]);
	}
	cout << sum << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int N, T;
    vector< pair<int, int> > route;
    cin >> N >> T;
    REP(i, N) {
        int c, t;
        cin >> c >> t;
        route.push_back({c, t});
    }
    SORT(route);
    REP(i, route.size()) {
        if(route[i].second <= T) {
            printf("%lld\n", route[i].first);
            return 0;
        }
    }
    printf("TLE\n");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int n, x, a, e;
char s[200001];
int d[2019];
int main() {
	scanf(" %s", s);
	while (s[n] != NULL)n++;
	e = 1;
	d[0]++;
	for (int i = n - 1; i >= 0; i--) {
		x += (s[i] - '0') * e;
		e *= 10;
		e %= 2019;
		x %= 2019;
		d[x]++;
	}
	for (int i = 0; i < 2019; i++) {
		a += d[i] * (d[i] - 1) / 2;
	}
	printf("%d\n", a);
}

Measured memory_bytes: 1936
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	int n; cin >> n;
	map<int, int> m;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		m[x]++;
	}

	int cnt = 0;

	for (auto i : m) {

		int x = i.second;

		if (x >= 3) {
			if (x % 2 == 1) {
				x = 1;
			}
			else {
				x = 2;
			}
		}

		if (x == 2) {
			cnt++;
		}
	}

	int ans = m.size() - cnt % 2;

	cout << ans << endl;

	return 0;
}

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

int main(){
  int n,k,q,tmp;
  cin>>n>>k>>q;
  vector<int> x(n,0);
  REP(i,q){
    cin>>tmp;
    x.at(tmp-1)++;
  }
  REP(i,n){
    if(k-q+x.at(i)>0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
 }

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
//l={1,2,3,4}
//greater<int>()
//sort(l,l+N)
//string 変数　　変数.size()で数字化


int main(void)
{
	string al, bl, cl;
	cin >> al >> bl >> cl;

	int a = 0, b = 0, c = 0;
	char now = 'a';

	for (int i = 0; i < 1000000; i++) {
		if (now == 'a') {
			if (al.size() == a) {
				cout << 'A' << endl;
				return 0;
			}
			now = al[a];
			a++;
		}
		if (now == 'b') {
			if (bl.size() == b) {
				cout << 'B' << endl;
				return 0;
			}
			now = bl[b];
			b++;
		}
		if (now == 'c') {
			if (cl.size() == c) {
				cout << 'C' << endl;
				return 0;
			}
			now = cl[c];
			c++;
		}
	}

	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_set>
#include <boost/format.hpp>
using namespace std;
int solve() {
	int N;
	string S;
	cin >> N >> S;
	unordered_set<int> option;
	for (int pin = 0; pin < 1000; pin++) {
		string pin_str = (boost::format("%03d") % pin).str();
		int index = 0;
		for (int i = 0; i < S.size(); i++) {
			if (pin_str[index] == S[i]) index++;
			if (index == 3) {
				option.insert(pin);
				break;
			}
		}
	}
	return option.size();
}
int main() {
	cout << solve() << endl;
}


Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
func main(){
    a := nextInt()
    b := nextInt()
    fmt.Println(a*b, 2*(a+b))

}

/* templates */

func Max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func Min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func Sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}

func Abs(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}

func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[j].b
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func nextString() string {
	return nextReader()
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}



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

int main() {
    double T, X;
    cin >> T >> X;

    cout << fixed;
    cout << setprecision(10);
    cout << T/X << endl;
    return 0;
}

Measured memory_bytes: 256
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N,K=two_int()
H = many_int()
count = 0
for i in H:
    if K<=i:
        count+=1
print(count)

Measured memory_bytes: 11904
def mod_inv(a, m):
    return pow(a, m-2, m)


X, Y = map(int, input().split())
MOD = 10 ** 9 + 7

if (X + Y) % 3:
    print(0)
    exit()

n = (X + Y) // 3
nx, ny = X - n, Y - n

if nx < 0 or ny < 0:
    print(0)
    exit()

ans = 1
for i in range(nx + 1, nx + ny + 1):
    ans = ans * i % MOD
for i in range(1, ny + 1):
    ans = ans * mod_inv(i, MOD) % MOD

print(ans)



Measured memory_bytes: 40044
def main():
    N, K, Q = map(int, input().split())
    A = list(int(input()) for _ in range(Q))

    people = [K - Q] * N

    for ans in A:
        people[ans - 1] += 1

    for i in people:
        if i > 0:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 10488
#include<bits/stdc++.h>
using namespace std;
int main(){
  	cin.tie(0);
  	ios::sync_with_stdio(false);
  	int n, m, x;
  	cin >> n >> m >> x;
  	int left = 0;
  	int right = 0;  
  	for (int i = 0; i < m; i++) {
      	int a;
      	cin >> a;
      	if (a < x) left++;
      	if (a > x) right++;
    }
  	cout << min(left, right) << endl;
  	return 0;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

ll dp[(1<<12)];
int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> a(m), b(m);
	vector<vector<int>> c(m,vector<int>(0));

	rep(i,m){
		cin >> a[i] >> b[i];
		rep(j,b[i]){
			int x;
			cin >> x;
			--x;
			c[i].push_back(x);
		}
	}
	rep(i, (1<<12)){
		dp[i] = 1e9;
	}
	dp[0] = 0;
	rep(mask,(1 << n)){
		rep(j,m){
			// 鍵 j を使う
			ll nextmask = mask;
			rep(i,c[j].size()){
				nextmask = nextmask | (1 << c[j][i]);
			}
			chmin(dp[nextmask], dp[mask] + a[j]);
		}
	}
	ll ans = dp[(1 << n)-1];
	cout << (ans == 1e9 ? -1: ans) << endl;
}


Measured memory_bytes: 3728
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    String line = sc.nextLine();
    int[] titles = new int[line.length()];
    int firstIs0ColoringCount = 0;
    int firstIs1ColoringCount = 0;
    for (int i = 0; i < line.length(); i++) {
      int current = Integer.parseInt(String.valueOf(line.charAt(i)));
      if (current == i % 2) {
        firstIs1ColoringCount++;
      } else {
        firstIs0ColoringCount++;
      }
    }
    pw.println(Math.min(firstIs0ColoringCount, firstIs1ColoringCount));
  }
}


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

int main(){
  int a,b,c,d,p;
  cin>>a>>b>>c>>d>>p;
  int x,y;
  x=a*p;
  y=b;
  if(p>c)y+=(p-c)*d;

  if(x>y)cout<<y<<endl;
  else cout<<x<<endl;
  return 0;
}

Measured memory_bytes: 3092
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		double D = sc.nextDouble();
		double T = sc.nextDouble();
		double S = sc.nextDouble();
		String ans = "No";
		if(T >= (D / S)){
			ans = "Yes";
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 28796
S = input()
target = []
split = 0
for i in range(1,len(S)):
    if  S[i-1] != S[i] and S[i] == 'L':
        continue
    if  S[i-1] != S[i] and S[i] == 'R':
        target.append(S[split:i])
        split = i
        continue
target.append(S[split:len(S)])
#print(target)

result = []
for t in target:
    ans = [0] * len(t)
    #ans[t.count('R')-1] = (t.count('R')//2 if t.count('R')//2 !=0 else 1 ) + (t.count('L')//2 if t.count('L')//2 !=0 else 0)
    #ans[t.count('R')] = (t.count('R')//2  if t.count('R') //2 !=0 else 0 )+ (t.count('L')//2 if t.count('L')//2 != 0 else 1)
    #ans[t.count('R')-1] = (t.count('R')//2 ) + (t.count('L')//2 )
    #print(t.count('R')//2)
    #ans[t.count('R')] = (t.count('R')//2 )+ (t.count('L')//2 )
    if t.count('R') == 1 and t.count('L') == 1:
        ans[t.count('R')-1] = 1
        ans[t.count('R')] = 1
    elif t.count('R') == 1 and t.count('L') != 1:
        ans[t.count('R')-1] = 1 +  t.count('L')//2
        ans[t.count('R')] = -(-(t.count('L'))//2)
    elif t.count('R') != 1 and t.count('L') == 1:
        ans[t.count('R')-1] =  -(-(t.count('R'))//2)
        ans[t.count('R')] = 1 + t.count('R')//2
    elif t.count('R') != 1 and t.count('L') != 1:
        ans[t.count('R')-1] =  -(-(t.count('R'))//2) + (t.count('L'))//2
        ans[t.count('R')] = t.count('R')//2 + -(-(t.count('L'))//2)
    #print(ans)
    result.extend(ans)
for r in result:
    print(r,end=' ')



'''
for i,s in enumerate(S):
    if pre == 'L':
        pre = 'L'
    if pre == 'R' and i !=0:
        pre = 'R'
        target.append(S[split:i-1])
        split = i-1
print(target)
'''



Measured memory_bytes: 7956
#include <bits/stdc++.h>
using namespace std;
int sum(int a){
    int res=0,divider=10000;
    for(int i=0;i<5;i++){
        res+=a/divider;
        a%=divider;
        divider/=10;
    }
    return res;
}

int main(){
    int n,a,b,count=0,tmp;
    cin >> n >> a >> b;
    for(int i=0;i<n;i++){
        tmp=sum(i+1);
        if(tmp>=a&&tmp<=b)count+=i+1;
    }
    cout << count << endl;
}

Measured memory_bytes: 256