akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int jxo, ll int jyo){
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){
  return (toxbig-0x20);
}
char tolow(char toxlow){
  return (toxlow+0x20);
}
  


int main(){
int R,G;
  cin>>R>>G;
  cout<<2*G-R;
  
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


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

int main(){

	int n;cin>>n;
	vector<int> arr(n);
	for(int i = 0; i < n; i++) cin>>arr[i];
	int res = 0;
	int prev = 0;
	for(int i = 1; i < n; i++){
		if(arr[i]>arr[i-1]){
			res = max(i - prev,res);
			prev = i;
		}
	}
	//cout<<"prev"<<prev<<endl;
	//res = max(res,n - prev);
	cout<<max(res-1,n-prev-1);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define pb emplace_back
#define mp make_pair

using namespace std;

bool eq(int i, string s, string t)
{
	int siz= s.size();
	for (int j = 0; j < siz; ++j)
		if(s[j] != t[(i+j)%siz])
			return false;
	return true;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.precision(10);
	#ifdef PIYUSH_HOME
		I_O;
	#else
	#define print(...) 0
	#endif
	string s, t;
	cin >> s >> t;
	bool res = false;
	for (int i = 0; i < s.size(); ++i)
		if(eq(i, s, t))
			res = true;
	if(res)
		cout << "Yes";
	else
		cout << "No";
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

vector<ll> dp1(10, 0);
vector<ll> dp2(100, 0);
vector<ll> dp3(1000, 0);

vector<ll> dp1_old(10, 0);
vector<ll> dp2_old(100, 0);
vector<ll> dp3_old(1000, 0);


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    REP(i, 10) dp1[i] = 0;
    REP(i, 100) dp2[i] = 0;
    REP(i, 1000) dp3[i] = 0;

    ll N;
    string S;
    cin >> N >> S;

    REP(i, N){
    	REP(i, 10) dp1_old[i] = dp1[i];
    	REP(i, 100) dp2_old[i] = dp2[i];
    	//REP(i, 1000) dp3_old[i] = dp3[i];
    	dp1[S[i]-'0'] = 1;
    	REP(j, 10){
    		if(dp1_old[j] == 1){
    			dp2[j + 10 * (S[i]-'0')] = 1;
    		}
    	}
    	REP(j, 100){
    		if(dp2_old[j] == 1){
    			dp3[j + 100 * (S[i]-'0')] = 1;
    		}
    	}
    }

    /*
    REP(i, 10) cout << dp1[i] << " ";
    cout << endl;

    REP(i, 100) cout << dp2[i] << " ";
    cout << endl;

    */

    ll res = 0;
    REP(i, 1000) res += dp3[i];
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 384
# -*- coding: utf-8 -*-

n = int(input())
Sn = [input() for i in range(n)]

# 各文字列が含むアルファベットを集計
az_list = []
for i in range(n):
    s_list = list(Sn[i])
    az_dict = {}
    for c in s_list:
        if c not in az_dict:
            az_dict[c] = 1
        else:
            az_dict[c] += 1
    az_list.append(az_dict)

# 集計結果から、全ての文字列が共通で持っているアルファベットとその数を出す
sum_dict = {}
for i in range(97, 97+26):
    c = chr(i)
    sum_dict[c] = float("inf")
    for j in range(len(az_list)):  
        if c not in az_list[j]:
            sum_dict[c] = 0
            break
        else:
            sum_dict[c] = min(sum_dict[c], az_list[j][c])

# 辞書順で解答となる文字列を作っていく
ans = ""
for i in range(97, 97+26):
    c = chr(i)
    if c in sum_dict:
        for j in range(sum_dict[c]):
            ans += c

print(ans)

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

#define NMAX 200010
#define MMAX 200010

int parent[NMAX],rankoftree[NMAX];
int groupsize[NMAX];

void init(int n){
    for(int i=0; i<n; i++){
        parent[i] = i;
        rankoftree[i] = 0;
        groupsize[i] = 0;
    }
} 

int findroot(int x ,int n = NMAX){
    int ancestor = x;
    for(int i=0; i<n; i++){
        ancestor = parent[ancestor];
        if(ancestor==parent[ancestor]){
            return ancestor;
        }
    }
    return -1;
}

void unite(int x,int y){
    int xroot = findroot(x);
    int yroot = findroot(y);
    if(xroot == yroot){
        return;
    }else if(rankoftree[xroot] < rankoftree[yroot]){
        parent[xroot] = yroot;
    }else{
        parent[yroot] = xroot;
        if(rankoftree[xroot] == rankoftree[yroot]){
            rankoftree[xroot]++;
        }
    }
}

int main(){
    int n, m;
    int answer = 0;
    
    cin >> n >> m;
    init(n);
    
    int input1,input2;
    for(int i=0; i<m; i++){
        cin >> input1 >> input2;
        unite(input1-1, input2-1);
    }
    
    for(int i=0; i<n; i++){
       groupsize[findroot(i)]++;
    }
    
    for(int i=0; i<n; i++){
       answer = max(answer,groupsize[i]);
    }   

    ////テスト
    // for(int i=0; i<n; i++){
    //    cout << groupsize[i] << " ";
    // }

    cout << answer;
}

Measured memory_bytes: 5980
N = int(input())
A = [int(input()) for i in range(N)]
B = []
if A[0] != 0:
  p = -1
else:
  p = 0
for i in range(1, N):
  if A[i] - A[i-1] >= 2:
    p = -1
  elif A[i] - A[i-1] <= 0:
    B.append(i-1)
if p == -1:
  print(p)
else:
  print(sum(A[B[i]] for i in range(len(B))) + A[N-1])

Measured memory_bytes: 18320
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

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

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N, K := sc.nextInt(), sc.nextInt()
	V := sc.nextIntSlice(N)
	ans := 0
	for a := 0; a <= K; a++ {
		for b := 0; b <= K-a; b++ {
			if a+b > N {
				continue
			}
			total := 0
			A := []int{}
			for i := 0; i < a; i++ {
				total += V[i]
				A = append(A, V[i])
			}
			for i := N - b; i < N; i++ {
				total += V[i]
				A = append(A, V[i])
			}
			sort.Ints(A)
			rest := K - (a + b)
			for k := 0; k < len(A) && k < rest; k++ {
				if A[k] < 0 {
					total -= A[k]
				} else {
					break
				}
			}
			ans = max(ans, total)
		}
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
bool so[2000];
vector<int>s;
int n,k;
int dp[3000][20];

int main(){
  for(int i=2;i*i<2000;i++)
    if(!so[i])for(int j=2;i*j<2000;j++)so[i*j]=1;
  for(int i=2;i<=1120;i++)
    if(!so[i])s.push_back(i);
  while(cin>>n>>k&&n&&k){
 
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=0;i<s.size();i++){
      for(int j=k-1;j>=0;j--)
	for(int l=n;l>=0;l--)
	  dp[l+s[i]][j+1]+=dp[l][j];
	
    }
    cout<<dp[n][k]<<endl;
  }
  return 0;
}

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

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

            var Input = Convert.ToInt32(Console.ReadLine());
            var Coins = new int[] { 500, 5 };
            var Points = new int[] { 1000, 5 };

            int point = 0;
            for (int i = 0; i < Coins.Length; i++)
            {
                point += Input / Coins[i] * Points[i];
                Input = Input % Coins[i];
            }
            /*foreach (var coin in Enumerable.Zip(Coins, Points))
            {
                point += Input / coin.First * coin.Second;
                Input = Input % coin.First;
            }*/

            Console.WriteLine(point);
        }
    }

}

Measured memory_bytes: 11348
import math

a, b, x = map(int, input().split())
h = x / (a * a)

if h > (1/2) * b:
    ans = math.degrees(math.atan(2*(b-h)/a))
else:
    ans = 90 - math.degrees(math.atan(2*a*h/(b*b)))

print(ans)

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**7)

n = int(input())
T = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  T[a].append(b)
  T[b].append(a)
L = [-1]*n
dist = [-1]*n
dist[0] = 0
F_1 = [i for i in range(1, n+1) if i%3==1]
F_2 = [i for i in range(1, n+1) if i%3==2]
F_0 = [i for i in range(1, n+1) if i%3==0]
def dfs(v):
  for nv in T[v]:
    if dist[nv] == -1:
      dist[nv] = dist[v] ^ 1
      dfs(nv)
dfs(0)
l0 = dist.count(0)
l1 = n - l0
if l0 <= n//3:
  for i in range(n):
    if dist[i] == 0:
      L[i] = F_0.pop()
    else:
      if F_1:
        L[i] = F_1.pop()
      elif F_2:
        L[i] = F_2.pop()
      else:
        L[i] = F_0.pop()
elif l1 <= n//3:
  for i in range(n):
    if dist[i]:
      L[i] = F_0.pop()
    else:
      if F_1:
        L[i] = F_1.pop()
      elif F_2:
        L[i] = F_2.pop()
      else:
        L[i] = F_0.pop()
else:
  for i in range(n):
    if dist[i]:
      if F_1:
        L[i] = F_1.pop()
      else:
        L[i] = F_0.pop()
    else:
      if F_2:
        L[i] = F_2.pop()
      else:
        L[i] = F_0.pop()
print(*L)

Measured memory_bytes: 174436
#include <cstdio>
const int N = 200;
int n, l, r, m;
char L, R, M;
char ans[5], s[N];

void read_ans()
{
	printf("\n");
	fflush(stdout);
	scanf("%s", ans);
}

char ask(int x)
{
	printf("?");
	for (int i = 1; i <= n; ++i)
		printf(" %d", x + i - 1);
	read_ans();
	return ans[0];
}

char ask(int x, int y)
{
	printf("?");
	if (x < y || y + n < x)
	{
		printf(" %d", x);
		for (int i = 1; i <= n - 1; ++i)
			printf(" %d", y + i);
		read_ans();
		return ans[0];
	} 
	else 
	{
		for (int i = 0; i <= n; ++i)
			if (y + i != x)
				printf(" %d", y + i);
		read_ans();
		return ans[0] ^ 'R' ^ 'B';
	}
}

int main()
{
	scanf("%d", &n);
	l = 1, L = ask(l);
	r = n + 1, R = ask(r);
	while (l + 1 < r)
	{
		m = (l + r) / 2;
		M = ask(m);
		if (L == M)
			l = m;
		if (R == M)
			r = m;
	}
	for (int i = 1; i <= 2 * n; ++i)
		s[i - 1] = ask(i, l);
	printf("! %s\n", s);
	fflush(stdout);
}

Measured memory_bytes: 628
import java.util.Scanner;


public class Main {
    Scanner sc = new Scanner(System.in);

    void run() {
        for (;;) {
            int n = ni();
            int m = ni();
            int a = ni();
            if (n == 0) {
                break;
            }
            boolean[][][] link = new boolean[1000 + 1][n + 1][n + 1];
            for (int i = 0; i < m; ++i) {
                int h = ni();
                int p = ni();
                int q = ni();
                link[h][p][q] = true;
                link[h][q][p] = true;
            }
            for (int h = 1000; 1 <= h; --h) {
                for (int i = 1; i <= n; ++i) {
                    if (link[h][a][i]) {
                        a = i;
                        break;
                    }
                }
            }
            System.out.println(a);
        }
    }

    int ni() {
        return sc.nextInt();
    }
    static public void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 193148
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

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

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

template<typename T, typename S>
istream& operator>> (istream& in, pair<S, T>& p) {
    in >> p.fs >> p.sn;
    return in;
}
template<typename T, typename S>
ostream& operator<< (ostream& out, pair<S, T>& p) {
    out << p.fs << ' ' << p.sn << ' ';
    return out;
}

template<typename T>
istream& operator>> (istream& in, vector<T>& v) {
    for (T& x : v) in >> x;
    return in;
}
template<typename T>
ostream& operator<< (ostream& out, vector<T>& v) {
    for (T& x : v) out << x << ' ';
    return out;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

vector<char> ans;

void rec(string s, vector<int> pos, int& k) {
    if (k == 0) {
        for (char c : ans) cout << c;
        cout << '\n';
        exit(0);
    }
    --k;
    vector<vector<int>> nxt(26);
    for (int i : pos) {
        if (i + 1 == (int)s.size()) continue;
        nxt[int(s[i + 1] - 'a')].eb(i + 1);
    }
    forn(i, 0, 26)
        if (!nxt[i].empty()) {
            ans.eb('a' + i);
            rec(s, nxt[i], k);
            ans.pop_back();
        }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    string s;
    cin >> s;
    int n = s.size();
    int k;
    cin >> k;
    vector<int> pos(n);
    forn(i, 0, n) pos[i] = i - 1;
    rec(s, pos, k);
}


Measured memory_bytes: 512
n = int(input())
a = [[-1 for i in range(n)] for j in range(n)]
x = 0
max = 0
flag = 0
for i in range(n):
    x = int(input())
    for j in range(x):
        y,z = map(int, input().split())
        a[i][y-1] = z
for i in range(2**n):
    flag = 0
    for j in range(n):
        if (i >> j) & 1 == 1:
            for k in range(n):
                if a[j][k] != -1:
                    if a[j][k] != (i >> k) & 1:
                        flag = 1
                        break
            if flag == 1:
                break
    if flag == 1:
        continue
    elif j == n-1:
        count = 0
        for j in range(n):
            if (i >> j) & 1 == 1:
                count+=1
        if count > max:
            max = count
print(max)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int main(void){

  char S[10];
  scanf("%s",S);
  int i,j,count=0,max=0;
  for(i=0;i<strlen(S);i++){
    count=0;
    for(j=i;j<strlen(S);j++){
        if(S[j]=='A'||S[j]=='C'||S[j]=='G'||S[j]=='T')
	count++;
      else
	break;
    }
     if(max<count)
      max=count;
    
  }
    printf("%d",max);

  
  

  return 0;
}


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

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


  int res = 0;
  for(int i = 29; i >= 0 ; i--){
    long long summ = 0;
    int mini = 1 << i;
    int maxi = 1 << (i+1);
    for(int mod = 0 ; mod < n ; mod++) a[mod] %= maxi, b[mod] %= maxi;
    sort(b.begin(),b.end()); //ソートしておく事で領域で分けられる
    for(int j = 0 ; j < n; j++){
      int add = 0;
      if(mini-a[j] >= 0) add += lower_bound(b.begin(), b.end(), maxi-a[j]) - lower_bound(b.begin(), b.end(), mini-a[j]);
      else {
        add += lower_bound(b.begin(), b.end(), maxi-a[j]) - b.begin();
        add += lower_bound(b.begin(), b.end(), maxi) - lower_bound(b.begin(), b.end(), maxi+mini-a[j]);
      }
      summ += add;
    }
    if(summ & 1) res += mini;  //1とのXOR
  }
  cout << res << endl;
}


Measured memory_bytes: 1792
input()
a = list(map(int, input().split()))
if 0 in a:
	print(0)
else:
	if 1 in a:
		a.sort(reverse=True)
		del a[-a.count(1):]
	product = 1
	limit = 10 ** 18
	for x in a:
		product *= x
		if product > limit:
			print(-1)
			break
	else:
		print(product)

Measured memory_bytes: 21472
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {

    static int getValue(char c) {
        switch (c) {
        case 'M':
            return 1000;
        case 'D':
            return 500;
        case 'C':
            return 100;
        case 'L':
            return 50;
        case 'X':
            return 10;
        case 'V':
            return 5;
        case 'I':
            return 1;
        default:
            return -1; // unreachable
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line;
        
        while ((line = br.readLine()) != null) {
            int result = 0;
            int before = Integer.MAX_VALUE;
            int next;

                for (int i = 0; i < line.length(); i++) {
                    next = getValue(line.charAt(i));

                    if (before >= next)
                        result += next;
                    else
                        result = result - before + (next - before);

                    before = next;
                }
                System.out.println(result);
        }

    }
}


Measured memory_bytes: 24244
#include<string>
using namespace std;
#include <stdio.h>
#include <limits.h>
#include "bits/stdc++.h"
int n, x, xx, y, m[105], ans1;
int main()
{
	cin >> n >> x;
	for (int i = 1;i <= n;i++)
	{
		cin >> xx;
		m[i] = xx;
	}
	for (int j = 1;j <= n;j++) {
		x = x - m[j];
	}
	y = 10000;
	for (int k = 1;k <= n;k++) {
		if (m[k] < y) {
			y = m[k];
		}
	}
	int l = 0;
	l = x / y;
	ans1 = n + l;
	cout << ans1;
	return 0;
}

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

int main(){
    long long n, k;
    cin >> n >> k;

    long double p = 0;

    for(long long i = 1; i <= n; i++){
        if(i >= k){
            p += (long double) 1/(long double) n;
            continue;
        }

        long double cnt = 1;

        long long start = i;

        while(start < k){
            start *= 2;
            cnt *= 2;
        }

        p += ((long double) 1/(long double) n) / cnt;
    }

    printf("%.10Lf\n", p);
    return 0;
}

Measured memory_bytes: 3724
#include<iostream>

using namespace std;

int main(){
  int n,m;

  cin >> n >> m;

  unsigned long long A[101][101],B[101][1];

  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> A[i][j];
    }
  }

  for(int i=0;i<m;i++){
    cin >> B[i][1];
  }

  unsigned long long C[101][1]={{}};

  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      C[i][1] += A[i][j]*B[j][1];
    }
  }

  for(int i=0;i<n;i++){
    cout << C[i][1] << endl;
  }

  return 0;
}

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

int main(){
    int n;
    cin >> n;
    string s[n];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
  
    int m;
    cin >> m;
    string t[m];
    for(int i=0;i<m;i++){
        cin >> t[i];
    }
  
    int result[n];
    for(int i=0;i<n;i++){
        result[i] = 1;
    }
  
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(s[i] == s[j] && i != j){
                result[i]++;
            }
        }
        for(int j=0;j<m;j++){
            if(s[i] == t[j]){
                result[i]--;
            }
        }
    }
    sort(result, result+n);
  	if(result[n-1] < 0){
      	cout << 0 << endl;
      	return 0;
    }
    cout << result[n-1] << endl;
  	return 0;
}

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

int main(void){

  string s , t;
  cin >> s >> t;
  int count = 0;

  if(s[0] == t[0]){
    count ++ ;
  }
  if(s[1] == t[1]){
    count ++;
  }
  if(s[2] == t[2]){
    count ++ ;
  }
  cout << count << endl;
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <map>
#include<queue>
#include <sstream>
#include <set>
typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}
using namespace std;
int main(){
    int N,ans=1;
    cin >> N;
    vector<int> vec(N);

    REP(i,N){
        cin >> vec[i];
    }
    int s = vec[0];
    for(int i=1;i<N;i++){
        if(s <= vec[i]){
            s = vec[i];
            ans++;
        }
    }

    cout << ans <<endl;
}

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 all(x) (x).begin(), (x).end()
#define F first
#define S second
typedef vector<long long> V;
typedef vector<V> VV;
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;
}
const long long INFLL = 1LL << 60;
const int INF = 1 << 28;
void solve(int a) { cout << (a ? "Yes" : "No") << endl; }
int main()
{
    int n, m;
    int ans = 0;
    cin >> n >> m;
    int a, b;
    vector<int> c(n+1,10);
    int d = 1;
  
    rep(i, m)
    {
        cin >> a >> b;
        if (c[a] == b or c[a] == 10)
        {
            c[a] = b;
        }
        else
        {
            ans = -1;
        }
    }
    if(n!=1 and c[1]==0){
        ans=-1;
    }
    if (ans != -1)
    {

        for(int i=n;i>=1;i--)
        {

            if (c[i] != 10)
            {
                ans += c[i] * d;
            }
            if(i==1 and c[1]==10){
                if(n!=1){
                ans+=1*d;
                }
            }
            d *= 10;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
using namespace std;
#define LL long long

int find(vector<int> &tab, int a){
    if(tab[a]==-1)return a;
    tab[a]=find(tab, tab[a]);
    return tab[a];
}

void merge(vector<int> &tab, int a, int b){
    auto pa=find(tab, a);
    auto pb=find(tab, b);
    if(pa!=pb)tab[pb]=pa;
}

void solve(long long N, std::vector<long long> x, std::vector<long long> y){
    vector<int> tab(N, -1);
    vector<pair<LL, LL>> arr(N);
    vector<pair<LL, pair<LL, LL>>> pairs;

    for(int i=0; i<N; i++)arr[i] = make_pair(x[i], i);
    sort(arr.begin(), arr.end());
    for(int i=1; i<N; i++)
        pairs.emplace_back(make_pair(arr[i].first-arr[i-1].first, make_pair(arr[i].second, arr[i-1].second)));

    for(int i=0; i<N; i++)arr[i] = make_pair(y[i], i);
    sort(arr.begin(), arr.end());
    for(int i=1; i<N; i++)
        pairs.emplace_back(make_pair(arr[i].first-arr[i-1].first, make_pair(arr[i].second, arr[i-1].second)));

    sort(pairs.begin(), pairs.end());
    LL ans=0;
    for(auto p: pairs){
        if(find(tab, p.second.first) == find(tab, p.second.second))
            continue;
        ans += p.first;
        merge(tab, p.second.first, p.second.second);
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 12140
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-01-03 18:27:10
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    LL n, k;
    cin >> n >> k;

    LL x, y;
    
    x = y = 0;
    for (LL i = 1; i <= n; i++) {
        if (i % k == 0) x++;
        if (i % k == k/2) y++;
    }

    LL ans = x * x * x;

    if (k % 2 == 0) ans += y * y * y;

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ms(x, a) memset(x, a, sizeof(x))
#define oo 100000000
#define ll  long long int
#define MOD 1000000007
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    (n==m)?cout<<"Yes":cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int A;
    cin >> A;
    if((65<=A)&&(A<=90)){
        cout << 1 << endl;
    }else if((97<=A)&&(A<=122)){
        cout << 2 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int P = scanner.nextInt();
        int Q = scanner.nextInt();
        int R = scanner.nextInt();

        int x = Math.max(P, Q);
        if (R > x) {
            System.out.println(P + Q);
        } else {
            System.out.println(R + Math.min(P, Q));
        }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define MAX_INT 2100000000
#define rep(i,n) for (i=1;i<=(n);++i)
using namespace std;
typedef long long int ll;
#ifdef COMPILE_IN_VCPP
#include <windows.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
	HWND hwndFound;         // This is what is returned to the caller.
	char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated// WindowTitle.
	char pszOldWindowTitle[MY_BUFSIZE]; // Contains original// WindowTitle.
	ULARGE_INTEGER nt;
	nt.QuadPart = GetTickCount64();
	GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
	wsprintf(pszNewWindowTitle, "%d%d/%d", nt.HighPart, nt.LowPart, GetCurrentProcessId());
	SetConsoleTitle(pszNewWindowTitle);
	Sleep(40);
	hwndFound = FindWindow(NULL, pszNewWindowTitle);
	SetConsoleTitle(pszOldWindowTitle);
	return(hwndFound);
}
#endif
int mod = 1e9 + 7;
int main()
{
	int n,ans=0;
	cin >> n;
	if (n < 10) ans = n;
	if (10 <= n && n < 100) ans = 9;
	if (100 <= n && n < 1000) ans = 9 + n - 99;
	if (1000 <= n && n < 10000) ans = 9 + 999 - 99;
	if (10000 <=n && n < 100000) ans = 9+999-99+ n - 9999;
	if (n == 100000) ans = 9 + 999 - 99 + 99999 - 9999;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
int main() {
	int x[101];
	int ans = 100000007;
	int N;
	int sum = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}
	for (int j = 0; j < 101; j++) {
		for (int i = 0; i < N; i++) {
			sum += (j - x[i]) * (j - x[i]);
		}
		if (ans > sum)ans = sum;
		sum = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#include<functional>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
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;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll N; cin >> N;
    ll A[200100];
    rep(i,0,N) cin >> A[i];
    ll C[200200];
    Fill(C,0);
    ll ans = 0;
    for(int i=N-1;i>=0;i--){
        if(!(i + A[i] >= N-1)) ans += C[i + A[i]];
        if(!(i - A[i] <= 0)) C[i - A[i]]++;
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 6732
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
using namespace std;
typedef long long LL;

int main(void) {
	unsigned long long ans=0, n, i, j, k;
	cin >> n;
	vector<string> name(n);
	vector<LL> siz(5);
	for (i = 0; i < n; i++) {
		cin >> name[i];
		if (name[i][0] == 'M') siz[0]++;
		if (name[i][0] == 'R') siz[1]++;
		if (name[i][0] == 'A') siz[2]++;
		if (name[i][0] == 'C') siz[3]++;
		if (name[i][0] == 'H') siz[4]++;
	}

	for (i = 0; i < 5; i++) {
		for (j = 0; j < 5; j++) {
			for (k = 0; k < 5; k++){
				if ((i != j)&&(j != k)&&(i != k)) {
					ans += siz[i] * siz[j] * siz[k];
				}
			}
		}
	}

	cout << ans/6 << endl;


	return 0;
}

Measured memory_bytes: 6144
#include <stdio.h>

int main(void)
{
	char s[10];
	int i;
	
	while (scanf("%s", s) != EOF){
		if (s[0] == s[1] && s[1] == s[2] && !(s[0] == 's')){
			printf("%c\n", s[0]);
		}
		else if (s[3] == s[4] && s[4] == s[5] && !(s[3] == 's')){
			printf("%c\n", s[3]);
		}
		else if (s[6] == s[7] && s[7] == s[8] && !(s[6] == 's')){
			printf("%c\n", s[6]);
		}
		else if (s[0] == s[3] && s[3] == s[6] && !(s[0] == 's')){
			printf("%c\n", s[0]);
		}
		else if (s[1] == s[4] && s[4] == s[7] && !(s[1] == 's')){
			printf("%c\n", s[1]);
		}
		else if (s[2] == s[5] && s[5] == s[8] && !(s[2] == 's')){
			printf("%c\n", s[2]);
		}
		else if (s[0] == s[4] && s[4] == s[8] && !(s[0] == 's')){
			printf("%c\n", s[0]);
		}
		else if (s[2] == s[4] && s[4] == s[6] && !(s[2] == 's')){
			printf("%c\n", s[2]);
		}
		else {
			printf("d\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 552
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
using Graph = vector<vector<int>>;

pair<int,int> dfs(const Graph &G, int v, int prev){
  pair<int,int> ret(0,v);
  for(auto v_ : G[v]){
    if(v_ == prev) continue;
    ret = max(ret,dfs(G,v_,v));
  }
  ++ret.first;
  return ret;
}

int main(){
  int N;
  cin >> N;
  Graph G(N);
  for(int i = 0; i < N-1; ++i){
    int a, b;
    cin >> a >> b;
    --a,--b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  pair<int,int> tmp = dfs(G,0,-1);
  tmp = dfs(G,tmp.second,-1);
  int d = tmp.first;
  cerr << d << endl;
  //if(d >= 0 and d%4 >= 2) cout << "Second" << endl;
  if(d%3 == 2) cout << "Second" << endl;
  else cout << "First" << endl;
}


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

typedef long long LL;

int a[55];

int main()
{
    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
    {
        scanf("%d", &a[i]);
    }
    int ans1 = 0;
    int ans2 = 0;
    for(int i=0; i<n; i++)
    {
        if(a[i] != i+1)
            ans1 ++;
    }
    // for(int i=0; i<n; i++)
    // {
    //     if(a[i] != n-i)
    //         ans2 ++;
    // }
    // printf("%d %d\n", ans1, ans2);
    if(ans1 > 2)
        printf("NO\n");
    else
    {
        printf("YES\n");
    }
    

    


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define gcd __gcd 
#define digits(n) (int)(log10(n) + 1)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vl;
typedef vector <pll> vll;
typedef vector <pii> vii;

const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;

template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

/*********** TEMPLATE ENDS HERE *************/

int same = 0;

const int DIM = 120;

int pre[DIM][200];
int sub[DIM][200];

main()
{
	IOS
	
	int n;
	cin >> n;
	
	string s;
	cin >> s;
	
	for(int i = 1; i <= n; i++)
		for(int j = 'a'; j <= 'z'; j++)
			pre[i][j] = pre[i - 1][j] + (s[i - 1] == j);
	
	for(int i = n; i >= 1; i--)
		for(int j = 'a'; j <= 'z'; j++)
			sub[i][j] = sub[i + 1][j] + (s[i - 1] == j);
	
	for(int i = 2; i <= n; i++)
	{
		int nr = 0;
		
		for(int j = 'a'; j <= 'z'; j++)
			if(pre[i - 1][j] && sub[i][j])
				nr++;
		amax(same, nr);
	}
	
	cout << same;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,n,m) for(int i=n;i<int(m);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
 
int vx[]={0,0,-1,1};
int vy[]={1,-1,0,0};
int dx[]={1,0,-1,1,-1,1,0,-1};
int dy[]={1,1,1,0,0,-1,-1,-1};
 
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}	
 
const ll mod=1e9+7;
const int INF=INT_MAX/2;

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

Measured memory_bytes: 3636
o = input()
e = input()
if (len(o) == len(e)):
    for i in range(len(o)):
        print(o[i] + e[i], end='')
    print('')
else:
    for i in range(len(e)):
        print(o[i] + e[i], end='')
    print(o[len(o)-1])


Measured memory_bytes: 3060
#define mod 1000000007
#define PI acos(-1)
#include<time.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll INF=0x7fffffffffffffff;
const int inf=0x7fffffff;
const int N=4e5+5;
clock_t start,finish;
void time_in(){start=clock();}
void time_out(){finish=clock();double tim=(double)(finish-start)/CLOCKS_PER_SEC;printf("Running time is %lf\n",tim);}
inline ll mul(ll a,ll b){ll s=0;while(b){if(b&1)s=(s+a)%mod;a=(a<<1)%mod;b>>=1;}return s%mod;}
inline ll pow_mul(ll a,ll b){ll s=1;while(b){if(b&1)s=mul(s,a);a=mul(a,a);b>>=1;}return s;}
inline ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}
inline bool read(int &ret){char c=getchar();int sgn;if(c==EOF)return 0;while(c!='-'&&(c<'0'||c>'9'))c=getchar();
	sgn=((c=='-')?-1:1);ret=((c=='-')?0:(c-'0'));while(c=getchar(),c>='0'&&c<='9')ret=ret*10+(c-'0');ret*=sgn;return 1;}
inline void write(int x){if(x>9)write(x/10);putchar(x%10+'0');}
int fact[10]={1,1,2,6,24,120,720,5040,40320,362880};
int st[4][2]={1,0,0,1,-1,0,0,-1};
int t,cas;
int n,m,k;
struct xxx{int x,w;}a[N];
bool cmp(xxx x,xxx y)
{
	return x.w<y.w;
}
int main()
{
	while(~scanf("%d%d",&n,&k))
	{
		for(int i=1;i<=n;i++)
		{
			a[i].x=k+i-1;
			a[i].w=a[i].x<0?(-a[i].x):a[i].x;
		}
		sort(a+1,a+n+1,cmp);
		int ans=0;
		for(int i=2;i<=n;i++)
		{
			ans+=a[i].x;
		}
		printf("%d\n",ans);
	}
}



Measured memory_bytes: 256
//1803115
#include <stdio.h> 
int main() 
{ 
    int i,n;
    long double x1,x2,x3,y1,y2,y3,dx,dy,x,y,z,a,b,c;
    scanf("%Lf %Lf %Lf %Lf",&x1,&y1,&x2,&y2);
    scanf("%d",&n);
    dx=x1-x2;
    dy=y1-y2;
    y=dy*(x1*y2-x2*y1);
    z=dx*dx;
    a=dx*dy;
    b=dx*(x1*y2-x2*y1);
    c=dy*dy;
    x=z+c;
    for(i=0;i<n;i++)
    {
        scanf("%Lf %Lf",&x3,&y3);
        printf("%0.10Lf %0.10Lf\n",(z*x3+a*y3-y)/x,(b+a*x3+c*y3)/x);
    }
    return 0; 
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<vector<int>> G(N, vector<int> (3));
    for(int i=0; i<N; i++){
        for(int j=0; j<3; j++){
            cin >> G[i][j];
        }
    }
    vector<int> ans(N,0);
    for(int i=0; i<3; i++){
        map<int,int> mp;
        for(int j=0; j<N; j++){
            mp[G[j][i]]++;
        }
        for(int j=0; j<N; j++){
            if(mp[G[j][i]] == 1){
                ans[j] += G[j][i];
            }
        }
    }
    for(int i=0; i<N; i++){
        cout << ans[i] << "\n";
    }
    return 0;

}



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

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
// const long long MOD = (ll)1e6+3;
const long long MAX = (ll)1e5+10;


bool IsPrime(int num)
{
   if (num < 2) return false;
   else if (num == 2) return true;
   else if (num % 2 == 0) return false;
   double sqrtNum = sqrt(num);
   for (int i = 3; i <= sqrtNum; i += 2) {
      if (num % i == 0) return false;
   }
    return true;
}

int main(void) {
   // ll A,B,K;
   // cin>>A>>B>>K;
   // if (K>=0) {
   //    ll now = min(A,K);
   //    K-= now;
   //    A -= now;
   // }
   // if (K>=0) {
   //    ll now = min(B,K);
   //    K -= now;
   //    B -= now;
   // }
   // cout<<A<<" "<<B<<endl;
   ll X;
   cin>>X;
   while(1) {
      if (IsPrime(X)) break;
      else X++;
   }
   cout<<X<<endl;







   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for(int i=0; i<(n); ++i)

int main() {
    int n,r; std::cin >> n >> r;
    int rate=r;
    if(n < 10)
        rate += 100*(10-n);
    std::cout << rate << std::endl;
    return 0;
}

Measured memory_bytes: 3588
// D - Practical Skill Test

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

using POS = pair<int, int>;

unordered_map<int, POS> n_to_pos;
int cum_pow[300 * 300 + 1];

int main() {
	int H, W, D;
	cin >> H >> W >> D;

	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			int A;
			cin >> A;
			n_to_pos[A] = make_pair(i, j);
		}
	}

	// 事前計算
	for (int i=0; i<D; i++) {
		for (int l=i; l+D<=H*W; l+=D) {
			int r = l + D;

			POS l_pos = n_to_pos[l];
			POS r_pos = n_to_pos[r];

			int pow = abs(l_pos.first - r_pos.first) + abs(l_pos.second - r_pos.second);
			cum_pow[r] = cum_pow[l] + pow;
		}
	}

	int Q;
	cin >> Q;

	vector<int> ans;

	for (int i=0; i<Q; i++) {
		int L, R;
		cin >> L >> R;
		ans.push_back(cum_pow[R] - cum_pow[L]);
	}

	for (int a : ans) {
		cout << a << endl;
	}

	return 0;
}

Measured memory_bytes: 8320
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    ll a;   cin >> a;
    string b;   cin >> b;
    ll B100 = (b[0] - '0')*100 + (b[2] - '0')*10 + b[3] - '0';
    printf("%lld\n", a*B100/100);
}


Measured memory_bytes: 3680
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let n = get_line().parse::<usize>().unwrap();
    let mut result = [0;2];

    for _ in 0..n {
        let line = get_line();
        let words  = line.split_whitespace().collect::<Vec<&str>>();
        let (left, right) = (words[0], words[1]);
        if left > right { result[0] += 3; }
        else if left < right { result[1] += 3; }
        else { result[0] += 1; result[1] += 1; }
    }
    println!("{} {}", result[0], result[1]);
}



Measured memory_bytes: 5024
#include<stdio.h>//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_7_C
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
struct Node{
	int p,l,r;//親、左の子、右の子
};
Node T[100001];
int N,pos;
vint pre,in,post;
void rec(int l,int r){
	if(l>=r) return ;
	int root=pre[pos];
	pos++;
	int m;
	rep(i,in.size()){
		if(in[i]==root){
			m=i;
			break;
		}
	}
	rec(l,m);
	rec(m+1,r);
	post.push_back(root);
}
void solve(){
	pos=0;
	rec(0,pre.size());
	rep(i,N){
		printf("%d",post[i]);
		if(i!=N-1) printf(" ");
	}
	kaigyo;
}
int main(){
	scan(N);
	rep(i,N){
		int k;
		scan(k);
		pre.push_back(k);
	}
	rep(i,N){
		int k;
		scan(k);
		in.push_back(k);
	}
	solve();
	return 0;
}



Measured memory_bytes: 3280
N, X = map(int, input().split())
cities = list(map(int, input().split()))
cities.append(X)
cities.sort()
cities = [x - cities[0] for x in cities]

def gcd(a, b):
	if b == 0: return a
	return gcd(b, a % b)

ans = gcd(cities[1], cities[0])
if len(cities) >= 3:
	for i in range(1, len(cities) - 1):
		ans = gcd(ans, cities[i+1])

print(ans)

Measured memory_bytes: 14252
T = [1.1, 0.6, 0.2]
ls = Array.new 4, 0
rs = Array.new 4, 0
$<.each do |s|
  l, r = s.split.map(&:to_f)
  ls[T.find_index {|x| l >= x } || 3] += 1
  rs[T.find_index {|x| r >= x } || 3] += 1
end
puts [ls, rs].transpose.map {|l, r| "#{l} #{r}" }.join ?\n

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

using namespace std;

int main()
{
    string s;
    getline(cin,s);
    if(s[7] == ' ')
    {
        s[8] = toupper(s[8]);
    }
    cout <<"A"<<s[8]<<"C"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repe(i, n) for(int (i) = 0; i <= (n); (i)++)
#define repr(i, n) for(int (i) = (n); (i) > 0; --(i))
#define repre(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define elm1(pair) (pair).first
#define elm2(pair) (pair)).second
typedef long long ll;
typedef unsigned long long ull;
const ull MOD = 1000000007;
ull mpow(ull a, ull n);
ull inv_mod(ull a){return mpow(a, MOD-2);}

ull mpow(ull a, ull n)
{
    ull ans = 1;
    while(n>>=1){
        if(n & 1)(ans *= a)%= MOD;
        (a*=a)%=MOD;
    }
    return ans;
}

ull nCr(ull n, ull r)
{
    vector<ull> factorial(n+1);
    factorial[0]=1;
    rep(i, n)factorial[i+1] = factorial[i]*(i+1)%MOD;
    return factorial[n]*(inv_mod(factorial[n-r])%MOD*inv_mod(factorial[r])%MOD) % MOD;
}

int main()
{
    ll N, W;
    cin >> N >> W;
    vector<vector<ll>> wv(N+10, vector<ll>(2, 0));
    vector<vector<ll>> dp(N+10, vector<ll>(W+10, 0));
    rep(i, N)cin >> wv[i][0] >> wv[i][1];
    repre(i, N-1){
        repe(j, W){
            if(j < wv[i][0]){
                dp[i][j] = dp[i+1][j];
            }
            else{
                dp[i][j] = max(dp[i+1][j], dp[i+1][j-wv[i][0]] + wv[i][1]);
            }
        }
    }
    cout << dp[0][W] << endl;

    return 0;
}


Measured memory_bytes: 87296
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main() {
    string s;cin>>s;
    int cnt[30];
    rep(i,26)cnt[i]=0;
    if(s.size()!=26){
        char x;
        rep(i,s.size())cnt[s[i]-'a']++;
        rep(i,26){
            if(cnt[i]==0){
                x='a'+i;
                break;
            }
        }
        cout << s << x << endl;
        return 0;
    }else{
        for(int i = 24; i >= 0;i--){
            if(s[i] < s[i+1]){
                rep(j,i){
                    cout << s[j];
                }
                char x = s[i]+1;
                while(1){
                    bool can = true;
                    rep(j,i){
                        if(x==s[j]){
                            x++;
                            can = false;
                            break;
                        }
                    }
                    if(can)break;
                }
                cout << x << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}



Measured memory_bytes: 256
# ITP_10_D

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
#p=1

D = 0
for i in range(n):
    D += abs(x[i] - y[i])
print(D)

#p=2
D = 0
for i in range(n):
    D += (x[i]-y[i])**2
print(D**(1/2))

#p=3
D = 0
for i in range(n):
    D += (abs(x[i] - y[i]))**3
print(D ** (1/3))

#p=∞
D=0
for i in range(n):
    if D < abs(x[i] - y[i]):
          D = abs(x[i] - y[i])
print(D)


Measured memory_bytes: 5640