akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

template<class T>
constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
  assert(!(hi < lo));
  return (v < lo) ? lo : (hi < v) ? hi : v;
}

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M;
  string S;
  cin >> N >> M >> S;

  vector<int> as;
  int pos = N;
  while (true) {
    as.push_back(pos);
    if (pos == 0) break;
    int next = ::clamp(pos - M, 0, N);
    while (S[next] == '1') next++;
    if (next >= pos) {
      cout << "-1";
      return 0;
    }
    pos = next;
  }
  int n = as.back();
  RF0(i, as.size() - 1) {
    cout << (as[i] - n) << ' ';
    n = as[i];
  }
}
#endif


Measured memory_bytes: 1096
package main

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

func main() {
	var t string
	var s = bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	if s.Scan() {
		t = s.Text()
	}
	n, err := strconv.Atoi(t)
	if err != nil {
		return
	}

	if s.Scan() {
		t = s.Text()
	}
	a, err := strconv.Atoi(t)
	if err != nil {
		return
	}

	if s.Scan() {
		t = s.Text()
	}
	b, err := strconv.Atoi(t)
	if err != nil {
		return
	}

	if a == 0 {
		fmt.Println(0)
		return
	}

	if a > n {
		fmt.Println(n)
		return
	}

	// // Too Slow............
	// var answer = 0
	// var i int
	// for i = 0; i < n; i += a + b {
	// 	if i+a > n {
	// 		answer += a - (i + a - n)
	// 		break
	// 	}
	// 	answer += a
	// }

	var remainder = n % (a + b)
	var division = n / (a + b)

	fmt.Println(division*a + min(a, remainder))

}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int m1,d1,m2,d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if(d2 == 1) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}


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

L = [0]*(10**4+1)

for x in range(1, 100+1):
    for y in range(1, 100+1):
        for z in range(1, 100+1):
            n = x*x + y*y + z*z +x*y + y*z + z*x
            if n <= 10**4:
                L[n] += 1

for i in range(1, N+1):
    print(L[i])

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


int main(){
    string s, t;
    int I = 0;
    cin >> s >> t;
    vector<int> a;

    bool flag2 = false;
    if (t.size() > s.size()) cout << "UNRESTORABLE" << endl;
    else {
        int sn = s.size();
        int tn = t.size();
        for(int i = sn - tn + 1; i >= 0; i--){
            bool flag = true;
            rep(j, tn){
                if (t[j] != s[i + j] && s[i + j] != '?'){
                    flag = false;
                }
            }
            if (flag){
                flag2 = true;
                I = i;
                break;
            }
        }

        if (flag2) {
            rep(l, I){
                if (s[l] == '?') cout << 'a';
                else cout << s[l];
            }
            rep(j, tn) cout << t[j];
            rep(k, sn - tn - I){
                if (s[k + I + tn] == '?') cout << 'a';
                else cout << s[k + I + tn];                
            }
            cout << endl;            
        }
        else cout << "UNRESTORABLE" << endl;
    }
}

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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  int ispoor = 0;
  if(A == B && A != C)ispoor = 1;
  if(B == C && B != A)ispoor = 1;
  if(C == A && C != B)ispoor = 1;

  if(ispoor)cout << "Yes" <<endl;
  else cout<<"No"<<endl;
  return 0;
}

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

int main(void)
{
    long long int i = 0;
    int N;
    cin >> N;
    long long int test[N];
    int count = 0;
    long long int ans;
    char a[2][N];

    cin >> a[0];
    cin >> a[1];

    if( N == 1){
        cout << 3;
        return 0;
    }
    else if( N == 2 ){
        cout << 6;
        return 0;
    }
    while( i < N ){
        if(a[0][i] == a[1][i]){
            test[count] = 1; 
            i++;
            count++;
        }else{
            test[count] = 2;
            i += 2;
            count++;
        }
    }
    for(long long int i = 0; i < count; i++){
        //cout << test[i];
    }

    if( test[0] == 1 ) ans = 3;
    else if( test[0] == 2){
        ans = 6;
    }
    for( long long int i = 1; i < count; i++){
        if( test[i-1] == 2 && test[i] == 2){
            ans = ans * 3 % D;
        }
        if( test[i-1] == 1 && test[i] == 1){
            ans = ans * 2 % D;
        }
        if( test[i-1] == 1 && test[i] == 2){
            ans = ans * 2 % D;
        }
        if( test[i-1] == 1 && test[i] == 2){
            ans = ans;
        }
    }
    cout << endl;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/*構造体の宣言*/
typedef struct
{
  int U;
  int V[101];
  int k;
}G;

/*ここからがmain関数*/
int main()
{
  int n, i, j, l;
  int A[101][101];
  G Adj[101];

  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){
      A[i][j] = 0;
    }
  }

  scanf("%d", &n);
  
  for(i = 1; i <= n; i++){
    scanf("%d%d", &Adj[i].U, &Adj[i].k);
    for(j = 1; j <= Adj[i].k; j++){
      scanf("%d", &Adj[i].V[j]);
    }
  }

  for(i = 1; i <= n; i++){
    for(l = 1; l <= Adj[i].k; l++){
      for(j = 1; j <= n; j++){
	if(Adj[i].V[l] == j)
	  A[i][j] = 1;
      }
    }
  }

  for(i = 1; i <= n; i++){
    for(j = 1; j < n; j++){
      printf("%d ", A[i][j]);
    }
    printf("%d\n", A[i][j]);
  }

  return 0;
}



Measured memory_bytes: 2044
X =int(input())
if X > 2000:
    print(1)
    quit()
lst = []
for i in range(20):
    lst.append([i * 105 + 1, i * 100 + 99])
for item in lst:
    if X >= item[0] and X <= item[1]:
        print(0)
        quit()
print(1)


Measured memory_bytes: 2940
#include<stdio.h>
#define N 100000
 
struct Card{
  int num;
  char ch;
  int m;
};
 
struct Card A[N];
 
int Partition(int p, int r){
  int i,j;
  struct Card x,tmp1,tmp2;
  x.num = A[r].num;
  i = p -1;
  for(j = p; j <= r-1; j++){
    if(A[j].num <= x.num){
      i = i + 1;
      tmp1 = A[i];
      A[i] = A[j];
      A[j] = tmp1;
    }
  }
  tmp2 = A[i + 1];
  A[i+1] = A[r];
  A[r] = tmp2;
   
  return i + 1;
}
 
void QuickSort(int p,int r){
  int q;
  if(p < r){
    q =  Partition(p,r);
    QuickSort(p,q-1);
    QuickSort(q+1,r);
  }
}

int main(void){
  
  int i,j,n,flg=0;
  char m1,m2,m3;
  scanf("%d%c",&n,&m1);
  for(i=1;i<=n;i++){
    scanf("%c%c%d%c",&A[i].ch,&m2,&A[i].num,&m3);
    A[i].m = i;
  }
   
  j = Partition(1,n);
  QuickSort(1,n);
  for(i=1;i<n;i++){
    if((A[i].m > A[i+1].m) && (A[i].num == A[i+1].num)){
      flg = 1;
      break;
    }
  }
  
  if(flg == 1)
    printf("Not stable\n");

  else printf("Stable\n");
  
  for(i=1;i<=n;i++)
    printf("%c %d\n",A[i].ch,A[i].num);
  
  return 0;
}

Measured memory_bytes: 1780
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int mod=1000000007;
    int n,tmp=0;
    int a[101]={0};
    while (scanf("%d",&n)!=EOF) {
        a[n]+=1;
        tmp=max(tmp,a[n]);
    }
    for (int i=1;i<101;i++) {
        if (a[i]==tmp) {
            printf("%d\n",i);
        }
    }
    return 0;
}

Measured memory_bytes: 3220
N,M = map(int,input().split())
A_pre = [int(input()) for _ in range(M)]
mod_num = 1000000007

A = []
if len(A_pre)>0:
    A.append(A_pre[0])
    for i in range(1,M):
        if A[-1] != A_pre[i]:
            A.append(A_pre[i])

ans = [0] * (N+1)
ans[0] = 1
break_floor_count = 0
if break_floor_count < len(A) and A[break_floor_count] == 1:
    break_floor_count += 1
else:
    ans[1] = 1

for i in range(2,N+1):
    if break_floor_count < len(A) and A[break_floor_count] == i:
        break_floor_count += 1
    else:
        ans[i] = (ans[i-2]+ans[i-1])%mod_num 

print(ans[N])


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

int main(){
	int h, w, dp[100][100];
	cin >>h >>w;
	cin.ignore();
	for(int i = 0; i < h; i++){
		string line;
		getline(cin,line);
		for(int j = 0; j < w; j++){
			if(line[j] != 48) dp[i][j] = line[j] - 48;
			else dp[i][j] = 0;
		}
	}
	
	/*for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cout <<dp[i][j] <<" ";
		}
		cout <<endl;
	}
	cout <<endl;*/
	
	for(int i = 1; i < w; i++){
		dp[0][i] = dp[0][i - 1] + dp[0][i];
	}
	for(int i = 1; i < h; i++){
		dp[i][0] = dp[i - 1][0] + dp[i][0];
	}
	
	for(int i = 1; i < h; i++){
		for(int j = 1; j < w; j++){
			if(dp[i - 1][j] < dp[i][j - 1]) dp[i][j] += dp[i - 1][j];
			else dp[i][j] += dp[i][j - 1];
		}
	}
	/*for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cout <<dp[i][j] <<" ";
		}
		cout <<endl;
	}*/
	cout <<dp[h - 1][w - 1] <<endl;
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>


using namespace std;
typedef long long ll;

#define mod 1000000007
#define INF 2000000000
#define LLINF 4000000000000000000
#define SIZE 50010

int main(){
    int n,ans=0,S;
    
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        int f = false;
        scanf("%d",&S);
        
        for(int x=1;2*x*x+2*x <=S;x++){
            if( (S-x)%(2*x+1)==0 ){
                f = true;
                break;
            }
        }
        
        if(!f)
            ans++;
    }
    
    printf("%d\n",ans);
    
    return 0;
}

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

int main ()
{
    int n;
    cin>>n;
    vector<int> card(n);
    for(int i=0;i<n;i++)
    {
        cin>>card.at(i);
    }

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

    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(i%2==0)
        ans+=card.at(n-i-1);
        else
        ans-=card.at(n-i-1);
    }
    cout<<ans<<endl;
}

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

int main() {
  
  int A, B;
  cin >> A >> B;
  
  if (A<10 && B<10) {
    cout << A*B << endl;
  }
  else {
    cout << -1 << endl;
  }
  
return 0;
}

Measured memory_bytes: 3636
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()

for i in range(1, 1001):
  if i*8//100 == A and i//10 == B:
    print(i)
    break
else:
  print(-1)

Measured memory_bytes: 5192
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll) v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

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

    ll N;
    cin >> N;

    int prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
                   31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
                   73, 79, 83, 89, 97, 101, 103, 107};

    unordered_map<ll, ll> mp;

    ll ans = 0, x = 1;
    string s;

    rep(i, N)
    {
        x = 1;
        cin >> s;
        rep(j, len(s)) x *= prime[s[j] - 'a'];
        ans += mp[x];
        ++mp[x];
    }

    print(ans);

    return 0;
}

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

using namespace std;

int H, W;

string A[10];

int C[10][10];

int main(void) {

	cin >> H >> W;

	A[0] = "..........";
	string tmp;
	for (int i = 1; i <= H; i++) {
		cin >> tmp;  A[i]="."+tmp+".";
	}

	C[1][1] = 1;
	int p, q;
	p = 1; q = 1;

	do{
		while (A[p][q + 1] == '#') { q++; C[p][q] = 1; }
		if (A[p + 1][q] == '#') { p++; C[p][q] = 1; }
		else { break; }
	} while (1);

	bool ans = true;

	if (C[H][W] != 1) { ans = false; }

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			//cout << C[i][j];
			if (C[i][j] == 0 && A[i][j] == '#') { ans = false; }
		}
		//cout << endl;
	}

	if (ans) { cout << "Possible" << endl; }
	else { cout << "Impossible" << endl; }


	//system("pause");
	return 0;
}

Measured memory_bytes: 256
from fractions import gcd
from collections import defaultdict

A, B = map(int, input().split())
x = gcd(A, B)
d = defaultdict(int)

d[1]=1
for i in range(2, int(x**0.5)+1):
    while x%i==0:
        x//=i
        d[i]+=1
if x!=1:
    d[x]+=1

ans = len(d.keys())
print(ans)

Measured memory_bytes: 5176
import math
import itertools


def dist(x1, y1, x2, y2):
    return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)


def path_cost(path):
    path_cost = 0
    for coordinate_idx in range(len(path) - 1):
        distance = dist(path[coordinate_idx][0], path[coordinate_idx][1], path[coordinate_idx+1][0], path[coordinate_idx+1][1])
        path_cost += distance
    return path_cost


def average_distance(coordinates, n):
    paths = list(itertools.permutations(coordinates, n))
    distance = 0
    for path in paths:
        distance += path_cost(path)
    return distance / len(paths)


n = int(input())
coordinates = []

for _ in range(n):
    coord_input = input().split()
    coordinates.append((int(coord_input[0]), int(coord_input[1])))
    
print(average_distance(coordinates, n))

Measured memory_bytes: 8052
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int pp = 0, fp = 0;
  char c;
  for (int i = 0; i < N; i++){
    cin >> c;
    if (c == 'a'){
      if (pp < A + B){
        cout << "Yes" << endl;
        pp++;
      } else {
        cout << "No" << endl;
      }
    }
    if (c == 'b'){
      if (pp < A + B && fp < B){
        cout << "Yes" << endl;
        pp++;
        fp++;
      } else {
        cout << "No" << endl;
      }
    }
    if (c == 'c') cout << "No" << endl;
  }
}

Measured memory_bytes: 640
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = breads >>= print . solve 

solve :: [Int] -> Int
solve [n, m]
    | n > 1 && m > 1 = n * m - (n + m) * 2 + 4
    | n == 1 && m == 1 = 1
    | otherwise = n * m - 2

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)

Measured memory_bytes: 380
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"YES\n":"NO\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  bool f = false;
  cin >> a >> b >> c;
  if(c - b == b - a) f = true;
  YesorNo(f);
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};


int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N;
    cin >> N;
    vector<ll> a(N);
    map<ll,ll> m;
    rep(i,N) cin >> a[i], m[a[i]]++;
    if(N % 3 != 0 || m.size() == 1){
      rep(i,N){
        if(a[i]) {
          print("No"); 
          return 0;
        }
      }
      print("Yes");
      return 0;
    }
    if(m.size() == 2){
      ll count = 0;
      rep(i,N) if(!a[i]) count++;
      if(count == N / 3){
        print("Yes"); 
        return 0;
      }
      print("No");
      return 0;
    }
    ll tmp = 0;
    if(m.size() == 3){
      for(auto itr = m.begin(); itr != m.end(); ++itr){
        if(itr->second != N / 3){ 
          print("No");
          return 0;
        }
        tmp ^= itr->first;
      }
      if(!tmp) {
        print("Yes"); 
        return 0;
      }
      print("No");
      return 0;
    }
    if(m.size() > 3) {
      print("No"); 
      return 0;
    }
}

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

int main() {
  int A,B,N;
  cin >> N;
  cin >> A >> B;
  
  if(( A % N ) == 0 ){
    cout << "OK" << endl;
  }else{
    if(( A / N ) < ( B / N )){
      cout << "OK" << endl;
    }else{
      cout << "NG" << endl;
    }
  }
}


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

#define ll long long
#define ar array
 
using namespace std;


int main() {
	
	int a,b,c, r;
	
	cin >> a >> b >> c;
	
	if(a > b){
		r = 0;
		cout << r << endl;
	}else if(a == b){
		r = 1;
		cout << r << endl;
	}else if( (a*c)<=b){
		r = c;
		cout << r << endl;
	}else{
		r=b/a;
		cout << r << endl;
	}
	
	
   	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n;i++)
using ll = long long;
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
    int n; cin>>n;
    int f; cin>>f;
    vector<string>vs;
    rep(i,n){
        string t; cin>>t;
        vs.push_back(t);
    }
    vector<string>ans;
    vector<bool>used(n,true);
    rep(i,n)rep(j,n){
        if(i==j||used[j]==false||used[i]==false)continue;
        string temp=vs[j];
        reverse(all(temp));
        if(temp==vs[i]){
            used[i]=false; used[j]=false;
            if(vs[i]<vs[j])ans.push_back(vs[i]);
            else ans.push_back(vs[j]);
        }
    }
    string middle;
    rep(i,n){
        if(!used[i])continue;
        bool flag=true;
        for(ll z=0; z<vs[i].size()/2;z++)
            if(vs[i][z]!=vs[i][vs[i].size()-1-z])flag=false;
        if(flag){
            if(middle.size()==0)middle=vs[i];
            else if(middle.size()==vs[i].size()&&vs[i]<middle)middle=vs[i];
        }
    }
    string s;
    sort(all(ans));
    rep(i,ans.size())s+=ans[i];
    string l=s;
    reverse(all(l));
    cout<<s<<middle<<l<<endl;
}

Measured memory_bytes: 3284
program prob4
    implicit none
    integer(8) :: N
    integer :: m

    read(*,*) N
    N = N + 1

    m = 0
    do while(N >= 10)
        N = N / 10
        m = m + 1
    end do

    write(*,*) 9*m + N - 1

    stop
contains
end program prob4

Measured memory_bytes: 2836
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

typedef pair<int, int> pii;
const int N = int(3e5) + 2;
const int mod = 998244353;

unordered_map<int, int> dem;
int n, x, s[N], cnt[N];

bool Check(int t, int k) {
    if(1ll * t * k > n) return 0;
    if(cnt[t] >= k) return 1;
    return s[t - 1] >= t * (k - cnt[t]);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> x;
        ++dem[x];
    }
    for(auto p: dem) ++cnt[p.se];
    for(int i = 1; i <= n; ++i) s[i] = s[i - 1] + cnt[i] * i;
    for(int i = n; i >= 1; --i) cnt[i] += cnt[i + 1];
    for(int i = 1; i <= n; ++i) {
        int mid, low = 0, high = n;
        while(low <= high) {
            mid = (low + high) >> 1;
            if(Check(mid, i)) low = mid + 1;
            else high = mid - 1;
        }
        cout << high << '\n';
    }
}


Measured memory_bytes: 16244
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 111111;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    vector<pair<int,int>> v(m);
    for(int i=0;i<m;i++)cin>>v[i].second>>v[i].first;
    sort(All(v));
    reverse(All(v));
    int cnt=n;
    for(auto it:v){
        for(int i=0;i<min(cnt,it.second);i++){
            a.push_back(it.first);
        }
        cnt-=it.second;
        if(cnt<=0)break;
    }
    sort(All(a));
    reverse(All(a));
    int res=0;
    for(int i=0;i<n;i++)res+=a[i];
    cout<<res<<endl;
}

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

int main() {
    int W, H, N;
    cin >> W >> H >> N;
    vector<int> x(N), y(N), a(N);
    vector<vector<int>> HW(H, vector<int>(W, 0));
    for (int i = 0; i < N; i++) {
        cin >> x.at(i) >> y.at(i) >> a.at(i);
    }
    
    for (int i = 0; i < N; i++) {
        if (a.at(i) == 1) {
            if (x.at(i) != 0) {
                for (int j = 0; j < H; j++) {
                    for (int k = 0; k < x.at(i); k++) {
                        HW.at(j).at(k) = 1;
                    }
                }
            }
        } else if (a.at(i) == 2) {
            if (x.at(i) != W) {
                for (int j = 0; j < H; j++) {
                    for (int k = x.at(i); k < W; k++) {
                        HW.at(j).at(k) = 1;
                    }
                }
            }
        } else if (a.at(i) == 3) {
            if (y.at(i) != 0) {
                for (int j = 0; j < y.at(i); j++) {
                    for (int k = 0; k < W; k++) {
                        HW.at(j).at(k) = 1;
                    }
                }
            }
        } else {
            if (y.at(i) != H) {
                for (int j = y.at(i); j < H; j++) {
                    for (int k = 0; k < W; k++) {
                        HW.at(j).at(k) = 1;
                    }
                }
            }
        }
    }
    int sum = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (HW.at(i).at(j) == 0) sum++;
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 N, K;
  cin >> N >> K;
  vi A(N);
  cin >> A;
  i64 cd = A[0];
  rep(i, 1, N){
    cd = __gcd(cd, A[i]);
  }
  if(K <= *max_element(rng(A)) and K % cd == 0){
    cout << "POSSIBLE\n";
  } else {
    cout << "IMPOSSIBLE\n";
  }
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

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

const int mod = 1000000007;

char s[100010];
int n;
int dp[100010][2];

long long dfs(int x, int p){
	if (x == -1) return 1;
	if (~dp[x][p]) return dp[x][p];
	if (p == 1){
		if (s[x] == '0') return dp[x][p] = dfs(x - 1, 1);
		else return dp[x][p] = (dfs(x - 1, 1) * 2 % mod + dfs(x - 1, 0)) % mod;
	} else {
		return dp[x][p] = dfs(x - 1, 0) * 3 % mod;
	}
}

int main(){
	memset(dp, -1, sizeof(dp));
	scanf("%s", s), n = strlen(s);
	reverse(s, s + n);
	long long ans = 0;
	printf("%lld\n", dfs(n - 1, 1));
	return 0;
}


Measured memory_bytes: 4224
#include<stdio.h>

#define N 20
#define Q 200

int solve(int,int);

int A[N],M[Q];
int count,n;

int main(){ 
  int q,i;
  
  scanf("%d", &n);
  for( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  scanf("%d", &q);
  for( i = 0; i < q; i++ ) scanf("%d", &M[i]);
  
  for(i=0;i<q;i++){
    count=0;
    if(solve(0,M[i])==1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i,int m){
  if(i<n &&count==0&& m>0){
    if(A[i]==m){
      count++;
      return 1;
    }
  solve(i+1,m-A[i]);
  solve(i+1,m);
  }
}

Measured memory_bytes: 580
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main(void) {


    int a, b, c, d; cin >> a >> b >> c >> d;
    int k; cin >> k;
    a *= 60; c *= 60;
    int m = (c + d) - (a + b);
    out(m - k);





    return 0;
}









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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    if((s[0]==s[1] && s[1]==s[2]) || (s[1]==s[2] && s[2]==s[3])) cout << "Yes" << "\n";
    else cout << "No" << "\n";

    return 0;
}

Measured memory_bytes: 3608
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n;
    cin >> n;
    int v[25];
    for( int i = 0; i < n; ++i ) {
        int a;
        cin >> a;
        v[i] = a;

    }

    int b[25];
    for( int i = 1; i <= n; ++i ) {
        cin >> b[i];

    }

    int be = -1;
    int c[25] = {};
    for( int i = 1; i <= n - 1; ++i ) {
        cin >> c[i];

    }

    int res = 0;
    for( int i = 0; i < n; ++i ) {
        if( be + 1 == v[i] ) res += c[be];
        res += b[v[i]];
        be = v[i];
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {

    val (N, K, Q) = readLine()!!.split(" ").map { it.toInt() }

    val points = Array(N){K-Q}

    for(i in 0 until Q){
        val a = readLine()!!.toInt()
        points[a-1]++
    }

    points.forEach {
        if(it > 0) println("Yes") else println("No")
    }
}

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

int main(){
	int n,a;
	cin >> n;
	rep(i, n){
		cin >> a;
      	if(a%2 == 0) {
          	if(a%3 == 0 || a%5 == 0) {
            	continue; 
            } else {
            	cout << "DENIED" << endl; 
              	return 0;
            }
        }
   }
	cout << "APPROVED" << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


class UnionFind():
    def __init__(self):
        self.__table = {}
        self.__size = defaultdict(lambda: 1)
        self.__rank = defaultdict(lambda: 1)

    def __root(self, x):
        if x not in self.__table:
            self.__table[x] = x
            return x
        else:
            a = x
            ul = []
            while a != self.__table[a]:
                ul.append(a)
                a = self.__table[a]
            for u in ul:
                self.__table[u] = a

        return self.__table[x]

    def same(self, x, y):
        return self.__root(x) == self.__root(y)

    def union(self, x, y):
        x = self.__root(x)
        y = self.__root(y)
        if x == y:
            return False

        if self.__rank[x] < self.__rank[y]:
            self.__table[x] = y
            self.__size[y] += self.__size[x]
        else:
            self.__table[y] = x
            self.__size[x] += self.__size[y]
            if self.__rank[x] == self.__rank[y]:
                self.__rank[x] += 1
        return True

    def size(self, x):
        return self.__size[self.__root(x)]

    def num_of_group(self):
        g = 0
        for k, v in self.__table.items():
            if k == v:
                g += 1
        return g


@mt
def slv(N, Q, TUV):
    uf = UnionFind()

    ans = []
    for t, u, v in TUV:
        if t == 1:
            ans.append(1 if uf.same(u, v) else 0)
        else:
            uf.union(u, v)

    return ans


def main():
    N, Q = read_int_n()
    TUV = [read_int_n() for _ in range(Q)]
    print(*slv(N, Q, TUV), sep='\n')


if __name__ == '__main__':
    main()


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

int main() {
	int a , b;
  	string s , t , u;
  	cin >> s >> t;
  	cin >> a >> b;
  	cin >> u;
  	if(u == s) cout << a-1 << " " << b << "\n";
  	else cout << a << " " << b-1 << "\n";
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{
	int a, b = 0;
	int num = 2;
	cin >> a;
	cin >> b;
	if (1 <= a, b <= 100) {
		cout << a*b << ' ';
		cout << a*num + b*num << '\n';
	}
	return 0;
}

Measured memory_bytes: 3032
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main()
{
	int n;
	string str;
	cin>>n;
	cin>>str;
	int sum = 1;
	char currentColor = str[0];
	for(int i = 1; i < n; i++){
		if( currentColor != str[i]){
			currentColor = str[i];
			sum++;
		}
	} 
	cout<<sum<<endl;
	return 0;
}



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

#define LL long long
#define lowbit(x) ((x) & -(x))

const int INF = (int) 2e9;
const int maxn = (int) 1e5 + 20;
const int MOD = 1e9 + 7;

int n, k;

void work()
{
    cin >>n >>k;

    if(k > (n - 1) * (n - 2) / 2)
    {
        puts("-1");
        return ;
    }

    vector<pair<int, int> > v;

    for(int i = 2; i <= n; i++)
        v.push_back(make_pair(1, i));

    k = (n - 1) * (n - 2) / 2 - k;

    for(int i = 2; i < n && k; i++)
        for(int j = i + 1; j <= n && k; j++)
        {
            k--;
            v.push_back(make_pair(i, j));
        }

    cout <<v.size() <<endl;
    for(auto x : v)
        cout <<x.first <<" " <<x.second <<endl;
}

int main()
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
#endif // yukihana0416
    work();
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using PII = pair<ll, ll>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
///////////////////////////////////////
ll dp[2010][2010];
//DP[x][y]:=活発度の高い方からx+y人をすでに配置しそのうちx人では
//Ai*p[i])を選択しy人ではAi*(p[i]-i)を選択した時のスコアの最大値x+yの昇順に計算
//左に寄せるのと右に寄せるので決め打つ
int main() {
	ll N;
	cin >> N;
	vector<PII>vec;
	REP(i, N) {
		ll a; cin >> a;
		vec.push_back({ a,i });
	}
	sort(vec.begin(), vec.end(), greater<PII>());
	REP(i, 2010) {
		REP(j, 2010) {
			dp[i][j] = 0;
		}
	}
	for (ll i = 0; i < vec.size(); ++i) {
		for (ll j = 0; j < vec.size(); ++j) {
			if (i + j <= N-1) {
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + vec[i + j].first*(vec[i + j].second-i));
				dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + vec[i + j].first*(N - 1 -j- vec[i + j].second));
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i < 2010; ++i) {
		for (int j = 0; j < 2010; ++j) {
			if (i + j == N) {
				ans = max(ans, dp[i][j]);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 35252
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int A,B,C;
    cin >> A >> B >> C;
    int ans = 3;
    if(A == B)ans--;
    if(A == C)ans--;
    if(B == C)ans--;
    if(A==B && B == C)ans++;
    cout << ans << endl;
}


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

int main(void) {
    string S,T;
    cin >> S >> T;

    bool flag = true;
    for(int i=0; i<S.size(); i++){
        if(S[i] != T[i])
          flag = false;
    }

    if(S.size()+1 != T.size())
      flag = false;

    if(flag)
      cout << "Yes" << endl;
    else
      cout<<"No" <<endl;

    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
const ll maxi =20000;
#define ip pair<ll,ll>
#define mp make_pair
int main()
{ 
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);

ll n,d;
cin>>n>>d;
ll ans=0;
for(ll i=0;i<n;i++)
{
  ll x,y;
  cin>>x>>y;
  
  double dist=sqrt(x*x+y*y);
  if(dist<=d)ans++;

}cout<<ans<<endl;

}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 205
using namespace std;

typedef long long ll;
ll n, m, r, s, mn = 1e18, a[15], d[N][N], num[N], b[15];
bool v[15];
int main()
{
	ll i, j, k, t1, t2, t3;
	cin >> n >> m >> r;
	for (i = 0; i <= n; i++) for (j = 0; j <= n; j++) d[i][j] = 1e9;
	for (i = 0; i <= n; i++) d[i][i] = 0;
	for (i = 0; i < r; i++) scanf("%lld", &a[i]);
	for (i = 0; i < m; i++) scanf("%lld %lld %lld", &t1, &t2, &t3), d[t1][t2] = d[t2][t1] = t3;
	for (k = 1; k <= n; k++) {
		for (i = 1; i <= n; i++) {
			for (j = 1; j <= n; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	sort(a, a + r);
	do {
		s = 0;
		for (i = 1; i < r; i++) {
			s += d[a[i - 1]][a[i]];
		}
		mn = min(mn, s);
	} while (next_permutation(a, a + r));
    cout << mn << endl;
    return 0;
}

Measured memory_bytes: 512
h,w=map(int,input().split())
a=[]
for i in range(h):
    a.append(list(input()))
j=0
lis=[]
l=[]
count=0
for i in range(h):
    for j in range(w):
        if a[i][j]!='.':
            break
        if j==w-1:
            l.append(i)
x=0
while x<len(l):
    del a[l[x]-count]
    count+=1 
    x+=1
#print(a)
for k in range(len(a)):
    for l in range(w):
        if a[k][l]=='.':
            c=0
            while c<len(a):
                if a[c][l]!='.':
                    break
                if c==len(a)-1 and l not in set(lis):
                    lis.append(l)
                c+=1
ans=''
#print(lis)
tmp=0
count=0
for o in range(len(lis)):
    tmp=lis[o]
    for s in range(len(a)):
        del a[s][tmp-count]
    count+=1    
for q in range(len(a)):
    for e in range(len(a[0])):
        ans+=a[q][e]
    print(ans)
    ans=''


Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int n, x;
    cin >> n >> x;
    
    int ans = 0;
    if(x > 0) ans -= x;
    else if(abs(0-x) >= n) ans -= x + n - 1;

    REP(i, n) ans += x+i;
    cout << ans << endl;
}


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

int main() {
  int S, h, m, s;
  cin >> S;
  s = S % 60;
  S /= 60;
  m = S % 60;
  h = S / 60;
  cout << h << ':' << m << ':' << s << endl;

  return 0;
}



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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> an(n, k-q);
    for (int i = 0; i < q; i++) {
        int a;
        cin >> a;
        an[a-1]++;
    }
    for (auto& e : an) cout << (e > 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 1024
i = list(map(int, input().split()))
W = i[0]
H = i[1]
x = float(i[2])
y = float(i[3])

if (x == W/2) & (y == H/2):
  way = 1
else:
  way = 0

area = W * H / 2

print(str(area) + " " + str(way))

Measured memory_bytes: 3064
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define eb emplace_back
#define ep emplace
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
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;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}

main(){
    ll n=in(),m=lin();
    ll l=0,r=2000000001;
    vecll a;
    rep(i,n)a.pb(in());
    sort(all(a));
    while(l<r-1){
        ll mid=(l+r)/2;
        ll cnt=0;
        rep(i,n){
            ll t=distance(lower_bound(all(a),mid-a[i]),a.end());
            cnt+=t;
        }
        if(cnt>=m)l=mid;
        else r=mid;
        // (cnt>=m ? l : r)=mid;
    }
    ll ans=0;
    vecll rui;
    rui.pb(0);
    rep(i,n)rui.pb(rui.back()+a[i]);
    ans=rui.back()*n*2;
    ll cnt=0;
    rep(i,n){
        ll t=distance(lower_bound(all(a),l-a[i]),a.end());
        t=n-t;
        ans-=rui[t]+a[i]*t;
        cnt+=n-t;
    }
    // cout<<l<<" "<<cnt<<endl;
    ans-=l*(cnt-m);
    cout<<ans<<endl;
    // cout<<ans-l*(cnt-m);
}


Measured memory_bytes: 2676
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define INF 2147483647
#define fi first
#define se second
int abs(int a,int b){
  int c=max(a,b)-min(a,b);
  return c;
}
int gcd(int a,int b){
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
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;
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  if(a>9||b>9) cout<<"-1";
  else cout<<a*b;
  cout<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 100000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, K;
  cin >> N >> K;
  if (K % 2 != 0) {
    cout << setprecision(16) << pow(N / K, 3) << endl;
  }
  else {
    ll temp = N / K;
    ll ans = pow(temp, 3);
    ans += pow((N / (K / 2)) - temp, 3);
    cout << setprecision(16) << ans << endl;
  }
}


Measured memory_bytes: 256