akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m;
    cin >> n >> m;    
    
    vvl G(n);  // 辺の重みがすべて1のグラフ
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(b);
    }

    ll sv, gv;
    cin >> sv >> gv;
    sv--;  gv--;
    
    // BFS。計算量はO(V+E)
    vvl dist(n, vl(3, -1));  // dist[v][x] : 頂点svから頂点vへの3で割った余りがxとなる最短距離(-1のとき未訪問)
    queue<P> Q;
    dist[sv][0] = 0;
    Q.push(make_pair(sv, 0));
    while(!Q.empty()) {
        auto p = Q.front();
        Q.pop();
        ll v = p.first;
        ll x = p.second;
        for(auto u : G[v]) {
            if(dist[u][(x+1)%3] == -1) {
                dist[u][(x+1)%3] = dist[v][x] + 1;
                Q.push(make_pair(u, (x+1)%3));
            }
        }
    }

    if(dist[gv][0] == -1) {
        out(-1);
    }
    else {
        out(dist[gv][0]/3);
    }

    re0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long a,b,c;
  long long k;
  cin>>a>>b>>c>>k;
  if(a==b&&b==c&&a==c)
  {
       cout<<0<<endl;
       return 0;
  }
  if(k==0)
  {
     if(fabs(a-b)>pow(10,18))
     {
        cout<<"Unfair"<<endl;
     }
     else
     {
        cout<<a-b<<endl;
     }
     return 0;
  }
  for(int i=0;i<k%2;i++)
  {
     long long a1,b1,c1;
     a1=b+c;
     b1=a+c;
     c1=a+b;
     a=a1;
     b=b1;
     c=c1;
  }
  cout<<a-b<<endl;
  return 0;
}

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

int main(){
    string O,E;

    cin >> O;
    cin >> E;

    int size;
    string ans;

    size= O.size() + E.size();
    int i,io,ie;
    i=0; io=0; ie=0;
    while(i<size){
        if( io<O.size()){
            ans.push_back(O[io]);
            io++;
            i++;
        }
        if( ie<E.size()){
            ans.push_back(E[ie]);
            ie++;
            i++;
        }        
    }

    cout << ans << endl;

    return 0;
}

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

count = 0
for i in range(N+1):
    if i % 15 == 0:
        i = 'FizzBuzz'
    elif i % 3 == 0:
        i = 'Fizz'
    elif i % 5 == 0:
        i = 'Buzz'
    else:
        count += i
print(count)

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

using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, i;
    cin >> n;
    vi a(n); cin >> a;
    sort(all(a));
    queue<int> Q;
    Q.push(a.back());
    ll ans = 0;
    for(i = n-2; i>=0; i--){
        int c = Q.front();
        Q.pop();
        ans += c;
        Q.push(a[i]);
        Q.push(a[i]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4756
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#define rep(i, n) for(Int (i) = 0; (i) < (n); (i)++)
using namespace std;
using Int = int32_t;
using Uint = uint32_t;
constexpr long long int mod = 1e9 + 7;


int main() {

	Int N, K; cin >> N >> K;
	Int R, S, P; cin >> R >> S >> P;
	string T; cin >> T;

	unordered_map<char, char> win;
	win['r'] = 'p';
	win['p'] = 's';
	win['s'] = 'r';

	unordered_map<char, Int> point;
	point['r'] = R;
	point['p'] = P;
	point['s'] = S;

	string res(N, 'a'); //実際自分が何を出したのか。aは適当な文字。

	Int ans = 0;

	Int loop_num = (N % K == 0) ? (N / K) : (N / K + 1);
	rep(i, loop_num) {
		rep(j, K) {
			if (i * K + j <= N - 1) {//i * K + jがTの範囲内であった場合

				if (i >= 1) {//前の範囲が存在しているとき
					if (res[K * (i - 1) + j] != win[T[i * K + j]]) {//今出したい手とK個前の手が違った場合勝つやつを出す
						res[i * K + j] = win[T[i * K + j]];
						ans += point[res[i * K + j]];
					}
				}
				else {//好きに選べる
					res[j] = win[T[j]];
					ans += point[res[j]];
				}

			}
		}
	}

	cout << ans << endl;

}

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <algorithm>
 
using namespace std;
 
int dp[3939];
 
int main()
{
    int n;
     
    scanf("%d", &n);
    memset(dp, -1, sizeof(dp));
    dp[0] = 0;
    for (int i = 0; i < n; i++){
        int low, up, val;
        scanf("%d %d %d", &low, &up, &val);
         
        for (int d = low; d <= up; d++)
            for (int v = 0; v + d <= 393; v++)
                if (~dp[v]) dp[v + d] = max(dp[v] + val, dp[v + d]);
    }
     
    int m;
    scanf("%d", &m);
     
    int ans[3939];
    for (int i = 0; i < m; i++){
        int s;
        scanf("%d", &s);
        if (~dp[s]) ans[i] = dp[s];
        else return (!printf("-1\n"));
    }
     
    for (int i = 0; i < m; i++) printf("%d\n", ans[i]);
     
    return (0);
}

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

class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
      	
      	while(true){
        	String strArr[] = br.readLine().split(" ");
	        
          	int a = Integer.parseInt(strArr[0]);
    	    int b = Integer.parseInt(strArr[1]);
			if (a == 0 && b == 0) {
            	break;
            }
            
            for(int i = 0; i < a; i++) {
                for(int j = 0; j < b; j++) {
                    if(i == 0 || i == a - 1 || j == 0 || j == b - 1) {
                        sb.append("#");
                    } else {
                        sb.append(".");
                    }
                    
                }
                sb.append("\n");
            }
            sb.append("\n");
        }
        
        System.out.print(sb);
    }
}




Measured memory_bytes: 25472
#include<stdio.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
int main(void)
{
  int i=0,N=IN(),r=0,w=0;char stones[N+1];if(!scanf("%s",stones))return -1;
  while(N--){if(stones[N]=='R')r++;}
  while(r--){if(stones[i++]=='W')w++;}
  return printf("%d\n",w),0;
}

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

int main(){
  char s;
  cin >> s;
  if(s=='a'||s=='e'||s=='i'||s=='u'||s=='o'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  ll n;
  cin >> n;
  vector<int> u(n-1);
  vector<int> v(n-1);
  ll i;
  rep(i,n-1) cin >> u[i] >> v[i];
  rep(i,n-1)
  {
    if(u[i] > v[i]) swap(u[i],v[i]);
  }
  ll ans = 0;
  rep(i,n)
  {
    ans += i*(n-i);
  }
  ans += n*(n+1)/2;
  ll dec = 0;
  rep(i,n-1)
  {
    ll kl = u[i];
    ll kr = n+1-v[i];
    dec += kl*kr;
  }
  cout << ans-dec << "\n";
}


Measured memory_bytes: 4784
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;

int main() {
    int N,K;
    cin>>N>>K;
    vi S(N+1);
    S[0]=0;
    for (int i = 1; i < N+1; i++){
        int A; cin>>A;
        S[i]=(S[i-1]+A)%K;
    }
    for (int i = 0; i < N+1; i++){
        S[i]=(i-S[i]+K)%K;
    }
    map<int,int> num;
    for (int i = 0; i < min(K,N+1); i++){
        num[S[i]]++;
    }
    ll ans=0;
    for (int i = 0; i < N+1; i++){
        ans+=num[S[i]]-1;
        num[S[i]]--;
        if(i+K<=N)num[S[i+K]]++;
    }
    cout<<ans<<endl;
}

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

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc169/tasks/abc169_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var num_AB = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            
           int result = num_AB[0]*num_AB[1];

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28292
#include<bits/stdc++.h>
typedef long long LL;
using namespace std;
const int maxn=1e5+10;
const LL mod=1e4+7;
const double pi=acos(-1.0);
inline LL read()
{
	LL X=0; bool flag=1; char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') flag=0; ch=getchar();}
	while(ch>='0'&&ch<='9') {X=(X<<1)+(X<<3)+ch-'0'; ch=getchar();}
	if(flag) return X;
	return ~(X-1);
}
LL a[maxn];
LL sum[maxn<<2];
LL n,q;
LL mp[maxn];
int main()
{
    LL res=0;
    scanf("%lld",&n);
    for(LL i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        mp[a[i]]++;
        res+=a[i];
    }
    scanf("%lld",&q);
    while(q--){
        LL a,b;
        scanf("%lld%lld",&a,&b);
        LL suma=mp[a];
        mp[a]=0;
        mp[b]+=suma;
        res+=(suma*(b-a));
        printf("%lld\n",res);
    }
    return 0;
}


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

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

  vector<int> p(N, 0);
  vector<int> exp(N, 0);
  vector<int> sum_exp(N + 1, 0);
  rep(i, N) {
    cin >> p[i];
    exp[i] = p[i] + 1;
  }
 
  for (int i = 0; i < N; i++) {
    sum_exp[i + 1] = sum_exp[i] + exp[i];
  }

  int max = 0;
  for (int i = 0; i + K <= N; i++) {
    if (sum_exp[i + K] - sum_exp[i] > max) max = sum_exp[i + K] - sum_exp[i];
  }
 
  cout << fixed << setprecision(10) << (double)(max) / 2;
  
}

Measured memory_bytes: 5608
/*
    JAI JAGANNATH!
*/
//@Author : zanj0
#include <bits/stdc++.h>
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int lli;

int main(){
    
    fastio
    lli ans = 0;
    string s;
    cin >> s;
    lli l = 0, r = s.size() - 1;
    while(l < r){
        if(s[l] != s[r])ans++;
        l++;
        r--;
    }
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
    cin>>s;
    int l=s.size();
    for(int i=0;i<l;i++)
    {
        if(s[i]=='C')
        {
            for(int j=i+1;j<l;j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define ll long long
#include<algorithm>
#include<string>
#include<vector>
#include<unordered_set>
#include <iomanip>
using namespace std;
ll ans = 0;



int main()
{
    ll n, k;
    cin>>n>>k;
    int stones[n];

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


    vector<bool> winner(k+1, false);

    for(int i=0; i<=k; ++i)
    {
        for(int j=0; j<n; ++j)
        {
            if(i>=stones[j] && !winner[i - stones[j]])
            {
                winner[i] = true;
            }
        }

    }
    if(winner[k])
    {
        cout<<"First";
    }
    else
    {
        cout<<"Second";
    }


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;

int main()
{
	int a,b;
	while(~scanf("%d%d",&a,&b))
	{
		if(a%3==0 || b%3==0 || (a+b)%3==0)
		{
			printf("Possible\n");
		}
		else printf("Impossible\n");
	}
	return 0;
 } 

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

int main() {
  int N,K;
  cin>>N>>K;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  int sum=0;
  
  for(int i=0;i<K;i++){
    sum+=a[i];
  }
  
  cout<<sum<<endl;
  
}


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

int main(){
  int x1;
  double a,b,x;
  
  cin >> a >> b;
  if(1<=a && a<= 100 && 1<=b && b<=100){
    x = (a+b)/2;
    x1 = x;
    if(x-x1>=0.5){
      cout << x1+1 << endl;
    }
    else{
      cout << x1 << endl;
    }
  }
}

Measured memory_bytes: 384
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, m = LI()
    if n % m == 0:
        print(n // m)
    else:
        print(n // m + 1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
// g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main
// g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vll = vector<vl>;
using vii = vector<vi>;
using pii = pair<int, int>;

using vc = vector<char>;
using vcc = vector<vc>;
using vb = vector<bool>;
using vbb = vector<vb>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using vd = vector<double>;
using vdd = vector<vd>;

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i, a, b) for(int (i) = a; (i) < (b);(i)++)
#define MAX(a, b) ((a > b) ? a : b)
#define MIN(a, b) ((a > b) ? b : a)

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


const int MOD = 1e9 + 7;

vector<pii> prime_factorization(int n){ // 素因数分解をしたvector<素数, 指数>を返す
  vector<pii> res;
  int tmp, root_n = floor(sqrt(n));
  if(n % 2 == 0){
    tmp = 1;
    n /= 2;
    while(n % 2 == 0){
      n /= 2;
      tmp++;
    }
    res.push_back(make_pair(2, tmp));
  }
  ll i = 3;
  while(i <= root_n && i <= n){
    if(n % i == 0){
      tmp = 1;
      n /= i;
      while(n % i == 0){
        n /= i;
        tmp++;
      }
      res.push_back(make_pair(i, tmp));
    }
    i += 2;
  }
  if(n != 1) res.push_back(make_pair(n, 1));
  return res;
}
vector<pli> prime_factorization(ll n){ // 素因数分解をしたvector<素数, 指数>を返す
  vector<pli> res;
  int tmp, root_n = floor(sqrt(n));
  if(n % 2 == 0){
    tmp = 1;
    n /= 2;
    while(n % 2 == 0){
      n /= 2;
      tmp++;
    }
    res.push_back(make_pair(2, tmp));
  }
  ll i = 3;
  while(i <= root_n && i <= n){
    if(n % i == 0){
      tmp = 1;
      n /= i;
      while(n % i == 0){
        n /= i;
        tmp++;
      }
      res.push_back(make_pair(i, tmp));
    }
    i += 2;
  }
  if(n != 1) res.push_back(make_pair(n, 1));
  return res;
}

// n は 2以上の素数表を返す
vb Primes(int n){
  vector<bool> res(n + 1, true);
  res.at(0) = false; res.at(1) = false;
  for(int i = 2; i <= sqrt(n); i++){
    if(res.at(i)){
      for(int j = 2 * i; j <= n; j += i){
        res.at(j) = false;
      }
    }
  }
  return res;
}
// ===================================================

ll power_mod(ll k, int n, int mod){
  if(n == 0) return 1;
  ll tmp = power_mod(k, n / 2, mod);
  tmp = (tmp * tmp) % mod;
  if(n % 2 == 0) return tmp;
  return (k * tmp) % mod;
}

ll v_p(int n, int p){
  int res = 0;
  while(n >= p){
    res += (n / p);
    n /= p;
  }
  return res;
}



int main(){
  int n; cin >> n;
  vi A(n); REP(i, n) cin >> A.at(i);
  sort(A.begin(), A.end());

  int res = 1;
  REP(i, n - 1) if(A.at(i) != A.at(i + 1)) res++;
  if(res % 2 == 1) cout << res << "\n";
  else cout << res - 1 << "\n";
  return 0;
}

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

int main()
{
  int n, x;
  cin >> n >> x;
  int mmin;
  for (int i = 0; i < n; i++) {
    int m;
    cin >> m;
    if(i == 0) 
      mmin = m;
    x -= m;
    if (mmin > m)
      mmin = m;
  }
  int cnt = n;
  while(x >= mmin) {
    x -= mmin;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    char[] sChars = s.toCharArray();
    char[] tChars = t.toCharArray();
    int min = 10000;
    for (int i = 0, len = sChars.length - tChars.length + 1, lent = tChars.length; i < len; i++) {
      int count = 0;
      for (int j = 0; j < lent; j++) {
        if (sChars[i + j] != tChars[j]) {
          count++;
        }
      }
      if (count < min) {
        min = count;
      }
    }
    System.out.println(min);
  }
}


Measured memory_bytes: 27028
N,K,C = map(int, input().split())
S = list(input())

memo = [0]*N
f = 0
for i in range(N-1, max(-1, N-C-2), -1):
    if S[i] == "o":
        f = 1
        break
if f == 1:
    for i in range(N-1, max(-1, N-C-2), -1):
        memo[i] = 1
for i in range(max(-1, N-C-2), -1, -1):
    if S[i] == "o":
        memo[i] = memo[i+C+1]+1
    else:
        memo[i] = memo[i+1]

m2 = [0]*N
cnt = 0
i = 0
while i < N:
    if S[i] == "o":
        cnt += 1
        m2[i] = cnt
        i += C+1
    else:
        i += 1
m2[0] = (m2[0], 0)
for i in range(1, N):
    if m2[i] == 0:
        m2[i] = m2[i-1]
    else:
        m2[i] = (m2[i], i)

ans = []
for i in range(1, N-1):
    if S[i] == "x":
        continue
    if m2[i-1][1]+C+1 >= N:
        if m2[i-1][0] < K:
            ans.append(i+1)
    elif m2[i-1][0] + memo[max(m2[i-1][1]+C+1, i+1)] < K:
        ans.append(i+1)

if N > 1:
    if m2[-2][0] < K and S[-1] == "o":
        ans.append(N)
    if memo[1] < K and S[0] == "o":
        ans.append(1)
elif S[0] == "o" and K > 0:
    ans.append(1)
ans.sort()
for a in ans:
    print(a)

Measured memory_bytes: 76872
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cctype>
#include <cstdlib>
using namespace std;

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

int main() {
  string s;
  int ans =0;
  while(getline(cin,s)) {
    for(int i=0; i<s.length(); i++) {
      if (isdigit(s[i])) {
        int p=i;
        for (; i<s.length(); i++) {
          if (!isdigit(s[i])) break;
        }
        ans += atoi(s.substr(p,i-p).c_str());
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
	int N;
	string str;
	vector<string> vec;
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> str;
		vec.push_back(str);
	}
	sort(vec.begin(),vec.end());
	vec.erase(unique(vec.begin(),vec.end()),vec.end());
	cout <<vec.size() << endl;
	return 0;
}

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

int main(void) {

	long long int N, A, B;
	cin >> N >> A >> B;

	long long int AB = A + B;

	long long int answer = (N / AB) * A;

	// 先頭から何個チェックする？
	long long int check_num = N % AB;
	
	if (A > check_num) {
		answer += check_num;
	}
	else {
		answer += A;
	}

	cout << answer;

	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
// #include <bitset>
const int oo=2139063143;
const int N=310;
const int P=1000000007;
using namespace std;
typedef long long LL;
typedef double db;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
	if (x< 0) putchar('-'),x=-x;
	if (x>=10) print(x/10);
	putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
int del(int x) { return x>=P?x-P:x; }
void add(int &x,int y) { x=del(x+y); }
int f[N][N][N];
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
vector <pii> v[N];
int main ()
{
	// freopen (".in","r",stdin);
	// freopen (".out","w",stdout);
	int n,m; sc(n),sc(m);
	while (m--)
	{
		int l,r,x; sc(l),sc(r),sc(x);
		v[r].pb (mp(l,x));
	}
	int ans=0;
	f[0][0][0]=1;
	for (int i=0; i<=n; i++)
		for (int j=0; j<=n; j++)
			for (int k=0; k<=n; k++) if (f[i][j][k])
			{
				int c=max (i,max (j,k)),g=f[i][j][k];
				bool fg=1;
				for (pii r:v[c])
				{
					int l=r.fi,x=r.se,h=(i>=l)+(j>=l)+(k>=l);
					if (h!=x) { fg=0; break; }
				}
				if (!fg) { f[i][j][k]=0; continue; }
				if (c==n) { add(ans,g); continue; }
				add(f[c+1][j][k],g),add(f[i][c+1][k],g),add(f[i][j][c+1],g);
			}
	pr(ans);

	return 0;
}

Measured memory_bytes: 114944
# ABC143E - Travel by Car
def floyd_warshall(dist):
    """
    Compute the shortest paths of all pairs and modify dist.
    """
    for i in range(N + 1):  # intermediate point
        for j, c2 in enumerate(dist[j][i] for j in range(N + 1)):  #  source
            for k, (c1, c3) in enumerate(zip(dist[j], dist[i])):  # target
                if c2 + c3 < c1:
                    dist[j][k] = c2 + c3
    return dist

def main():
    # FW -> once more FW to edges <= L
    global N
    N, M, L, *X = map(int, open(0).read().split())
    ABC, ST = X[: 3 * M], X[3 * M + 1 :]
    INF = float("inf")
    dist = [[INF] * (N + 1) for _ in range(N + 1)]
    for i in range(N + 1):
        dist[i][i] = 0
    for v, u, cost in zip(*[iter(ABC)] * 3):
        dist[v][u] = dist[u][v] = cost
    dist = floyd_warshall(dist)

    # assume distance within L as 1 and compute the number of fueling
    modified_dist = [[1 if x <= L else INF for x in d] for d in dist]
    modified_dist = floyd_warshall(modified_dist)
    ans = [
        modified_dist[s][t] - 1 if modified_dist[s][t] != INF else -1
        for s, t in zip(*[iter(ST)] * 2)
    ]
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()

Measured memory_bytes: 121236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int func(string s,string t){
  int ans=0;
  for(char w='a';w<='z';w++){
    bool b=false,f=false;
    for(int j=0;j<s.size();j++){
      if(s[j]==w)b=true;
    }
    for(int i=0;i<t.size();i++){
      if(t[i]==w)f=true;
    }
    if(b&&f)ans++;
  }
  return ans;
}
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<=n;i++){
    int tmp=func(s.substr(0,i),s.substr(i));
    if(tmp>ans)ans=tmp;
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		n: usize,
		d: f64,
	}

	let mut count = 0;
	for _i in 0..n {
		input! {
			x: f64,
			y: f64,
		}
		if (x*x + y*y).sqrt() <= d {
			count += 1;
		}
	}
	println!("{}", count);
}



Measured memory_bytes: 4984
H, W = map(int, input().split())
s="#"*W+"".join("#"+input() for _ in range(H))
f=(W+1)*(H+1)
d=[[0]*f for _ in range(f)]
for i in range(W,f-1):
 d[i][i-1]=s[i]==s[i-1]=="."
 d[i][i-W-1]=s[i]==s[i-W-1]=="."
from scipy.sparse.csgraph import csgraph_from_dense as C,floyd_warshall as F
Q=F(C(d),directed=False)
r=-1
for q in Q:
 for x in q:
  if f>x:
   r=max(r,int(x))
print(r)

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

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> mass(H, vector<char>(W));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> mass.at(i).at(j);
        }
    }

    vector<bool> row(H, false);
    vector<bool> col(W, false);

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(mass.at(i).at(j) == '#'){
                row.at(i) = true;
                col.at(j) = true;
            }
        }
    }
    for(int i = 0; i < H; i++){
        if(row.at(i)){
            for(int j = 0; j < W; j++){
                if(col.at(j)) cout << mass.at(i).at(j);
            }
            cout << endl;
        }
    }
}

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

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

int main(){
  int N; cin >> N;
  vector<vector<long long> >happy(N,vector<long long>(3));
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      cin >> happy.at(i).at(j);
    }
  }
  vector<vector<long long> >dp(N,vector<long long>(3,-1));
  for(int i=0;i<3;i++){
    dp.at(0).at(i) = happy.at(0).at(i);
  }
  for(int i=1;i<N;i++){
    chmax(dp.at(i).at(0),dp.at(i-1).at(1) + happy.at(i).at(0));
    chmax(dp.at(i).at(0),dp.at(i-1).at(2) + happy.at(i).at(0));
    chmax(dp.at(i).at(1),dp.at(i-1).at(0) + happy.at(i).at(1));
    chmax(dp.at(i).at(1),dp.at(i-1).at(2) + happy.at(i).at(1));
    chmax(dp.at(i).at(2),dp.at(i-1).at(0) + happy.at(i).at(2));
    chmax(dp.at(i).at(2),dp.at(i-1).at(1) + happy.at(i).at(2));
  }
  cout << max(dp.at(N-1).at(0),max(dp.at(N-1).at(1),dp.at(N-1).at(2))) << endl;


}


Measured memory_bytes: 11136
#include<stdio.h>
#include<queue>
#include<algorithm>
using namespace std;
int zy[1000];
int zx[1000];
int x1[100];
int y1[100];
int x2[100];
int y2[100];
int t[300][300];
int y[300][300];
int v[300][300];
void bfs(int a,int b){
	queue<pair<int,int> >Q;
	v[a][b]=1;
	Q.push(make_pair(a,b));
	while(Q.size()){
		int row=Q.front().first;
		int col=Q.front().second;
		Q.pop();
		if(row<299&&!y[row][col]&&!v[row+1][col]){
			v[row+1][col]=1;
			Q.push(make_pair(row+1,col));
		}
		if(col<299&&!t[row][col]&&!v[row][col+1]){
			v[row][col+1]=1;
			Q.push(make_pair(row,col+1));
		}
		if(row&&!y[row-1][col]&&!v[row-1][col]){
			v[row-1][col]=1;
			Q.push(make_pair(row-1,col));
		}
		if(col&&!t[row][col-1]&&!v[row][col-1]){
			v[row][col-1]=1;
			Q.push(make_pair(row,col-1));
		}
	}
}
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++){
			scanf("%d%d%d%d",x1+i,y2+i,x2+i,y1+i);
			zx[i*2]=x1[i];
			zx[i*2+1]=x2[i];
			zy[i*2]=y1[i];
			zy[i*2+1]=y2[i];
		}
		std::sort(zx,zx+a*2);
		std::sort(zy,zy+a*2);
		for(int i=0;i<300;i++)for(int j=0;j<300;j++)t[i][j]=y[i][j]=v[i][j]=0;
		for(int i=0;i<a;i++){
			x1[i]=lower_bound(zx,zx+a*2,x1[i])-zx;
			x2[i]=lower_bound(zx,zx+a*2,x2[i])-zx;
			y1[i]=lower_bound(zy,zy+a*2,y1[i])-zy;
			y2[i]=lower_bound(zy,zy+a*2,y2[i])-zy;
			for(int j=x1[i]+1;j<=x2[i];j++){
				y[y1[i]][j]=y[y2[i]][j]=1;
			}
			for(int j=y1[i]+1;j<=y2[i];j++){
				t[j][x1[i]]=t[j][x2[i]]=1;
			}
		}
		int ret=0;
		for(int i=0;i<300;i++)for(int j=0;j<300;j++){
			if(!v[i][j]){
				ret++;
				bfs(i,j);
			}
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 2116
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
           
#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
    int n, h;
    while (scanf("%d%d", &n, &h), n | h)
    {
	vector<int> pos[3 * 2];
	int res = n*n*n;
	while (h--)
	{
	    char c[8];
	    int a[2];
	    scanf("%s%d%d", c, a, a + 1);
	    // xy, xz, yz
	    int p[2], cross[2];
	    if (!strcmp(c, "xy"))
	    {
		p[0] = 0, cross[0] = 2;
		p[1] = 1, cross[1] = 4;
	    }
	    else if (!strcmp(c, "xz"))
	    {
		p[0] = 2, cross[0] = 0;
		p[1] = 3, cross[1] = 5;
	    }
	    else
	    {
		p[0] = 4, cross[0] = 1;
		p[1] = 5, cross[1] = 3;
	    }

	    int passed = 0;
	    bool used[512] = { false };
	    rep (i, 2)
	    {
		pos[p[i]].push_back(a[i]);
		int verti;
		if (cross[i] & 1)
		    verti =cross [i] - 1;
		else
		    verti = cross[i] + 1;

		rep (j, pos[cross[i]].size())
		{
		    if (a[i] == pos[cross[i]][j] && !used[pos[verti][j]])
			++passed, used[pos[verti][j]] = true;
		}
	    }
	    res -= n - passed;
	}
	printf("%d\n", res);
    }
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define pb push_back
using namespace std;
int main()
{
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> ral;
	for(int i=0; i<n; i++){
		int x;
		cin >> x;
		ral.pb(x);
	}
	sort(ral.begin(), ral.end());
	int temp, dis = 1000000000;
	for(int i=1; i<=100; i++){
		temp = 0;
		for(int j=0; j<n; j++){
			temp += (ral[j]-i)*(ral[j]-i);
		}
		dis = min(temp, dis);
		temp = 0;
	}
	cout << dis << endl;
	return 0;
}


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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int n;

int main() {
  cin >> n;
  int res = 0;
  int cur = -1;
  int l = 0;
  range(i, 0, n) {
    int a;
    cin >> a;
    if(a != cur) {
      res += (i - l) / 2;
      cur = a;
      l = i;
    }
  }
  res += (n - l) / 2;
  cout << res;
  return 0;
}


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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

typedef long long ll;

int main(){
  int a, b; cin >> a >> b;
  if(a<=b) cout << "unsafe" << endl;
  else cout << "safe" << endl;
  return 0;
}

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

using namespace std;

int a[3];

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

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

    sort(a, a + 3);

    cout << a[2] * 10 + a[1] + a[0];

    return 0;
}


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

int n, i, m, x, y, f[200010];
bool flag;

int main()
{
    scanf("%d%d", &n, &m);
    for (i = 1; i <= m; i++)
    {
        scanf("%d%d", &x, &y);
        f[x]++; f[y]++;
    }
    flag = true;
    for (i = 2; i <= n; i++)
        if (f[i] % 2 != 0)
        {
            flag = false;
            break;
        }
    if (flag) puts("YES");
    else puts("NO");
    return 0;
}

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

int main(void)
{
	vector<long long int> point(5);
	long long int N, ans;
	cin >> N;
	for (int i = 0; i < 5; i++) {
		cin >> point[i];
	}
	sort(point.begin(), point.end());
	ans = (N + point[0] - 1) / point[0] + 4;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
int r;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
        
	int n;
	cin >> n;
	string s;
	cin >> s;
	if(n%2){
		cout << "No" << endl;
		return 0;
	}
	string s1 = s.substr(0, n/2);
	string s2 = s.substr(n/2, n/2);
	if(s1==s2){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

return 0;
}
///....


Measured memory_bytes: 256
#include "stdio.h"
int main()
{
    int a,b,c,x,i;
    a=b=c=-1; i=10;
    while(i--){
        scanf("%d",&x);
        if(x>=a){
            c=b; b=a; a=x;
        }
        else if(x>=b){
            c=b; b=x;
        }
        else if(x>c)
            c=x;
    }
    printf("%d\n%d\n%d\n",a,b,c);
    return 0;
}

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

int main() {
  string SA,SB,SC;
  cin >> SA;
  cin >> SB;
  cin >> SC;
  string S = SA;
  char c = 'a';
  while(true){
    if(S.at(0) == 'a'){
      S.erase(S.begin());
      if(c == 'a'){
        SA = S;
      }
      else if(c == 'b'){
        SB = S;
      }
      else{
        SC = S;
      }
      S = SA;
      c = 'a';
    }
    else if(S.at(0) == 'b'){
      S.erase(S.begin());
      if(c == 'a'){
        SA = S;
      }
      else if(c == 'b'){
        SB = S;
      }
      else{
        SC = S;
      }
      S = SB;
      c = 'b';
    }
    else{
      S.erase(S.begin());
      if(c == 'a'){
        SA = S;
      }
      else if(c == 'b'){
        SB = S;
      }
      else{
        SC = S;
      }
      S = SC;
      c = 'c';
    }
    if(S == ""){
      if(c == 'a'){
        cout << 'A' << endl;
      }
      else if(c == 'b'){
        cout << 'B' << endl;
      }
      else{
        cout << 'C' << endl;
      }
      break;
    }
  }
}


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


int main() {
	int n;
	long long ans= 0,k,modk,mod = 1000000007;
	cin >> n >> k;
	vector<int> a(n),invs_my(n,0),invs_other(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (a[i] > a[j])invs_my[i]++;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (a[i] > a[j])invs_other[i]++;
		}
	}

	for (int i = 0; i < n; i++) {

		modk = ((k - 1) * k / 2)%mod;
		ans = (ans + modk * invs_other[i]) %mod;
		ans = (ans + k * invs_my[i]) % mod;
	}
	cout << ans << endl;


}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

class UnionFind:
    def __init__(self, n):
        # par = Parent Number or NoV
        self.par = [-1 for i in range(n+1)]
        # rank = Tree Height
        self.rank = [0] * (n+1)
    
    # 自分が所属する集合の数を返す
    def size(self, x):
        return -self.find(self.par[x])

    # 連結成分
    def num_graph(self):
        return len([i for i in self.par[1:] if i < 0])

    # 根なら番号を返す
    def find(self, x):
        
        if(self.par[x] < 0):
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.find(self.par[x])

    # 親が同じか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)

        # もう繋がれている
        if(x == y):
            return False

        # つなぎ替える
        if(self.size(x) < self.size(y)):
            x,y = y,x
        
        # xのサイズを更新
        self.par[x] += self.par[y]
        # yのサイズ(おやばんごう)をxに
        self.par[y] = x

        return True 

def solve(N: int, M: int, X: "List[int]", Y: "List[int]", Z: "List[int]"):
    uf = UnionFind(N)

    for i in range(M):
        uf.union(X[i],Y[i])

    print(uf.num_graph())

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = [int()] * (M)  # type: "List[int]" 
    Y = [int()] * (M)  # type: "List[int]" 
    Z = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        X[i] = int(next(tokens))
        Y[i] = int(next(tokens))
        Z[i] = int(next(tokens))
    solve(N, M, X, Y, Z)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14984
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (X, A, B) = Slice3<long>();
            if (B <= A)
                WriteLine("delicious");
            else if (B <= A + X) 
                WriteLine("safe");
            else
                WriteLine("dangerous");
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 27420
N = int(input())
l=[]
if N==1:
   print(1)
   exit()
for i in range(N):
   a,b=map(int,input().split())
   l.append((a,b))
l2=[]
for i in range(N):
   for j in range(N):
      if i!=j:
         l2.append((l[i][0]-l[j][0],l[i][1]-l[j][1]))
from collections import Counter
l2=max(Counter(l2).values())
print(N-l2)

Measured memory_bytes: 9700
#include <bits/stdc++.h>
#define int long long
#define sync ios_base::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);
using namespace std;
const int N = 35001;
const int inf = 1e9 + 7;
const int MOD = 1e9 + 7;
const int P = 1e5 + 3;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
signed main() {
    sync;
#ifdef varex
    freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
#endif
    int n;
    cin >> n;
    vector <int> v;
    int sum = 0;
    int sq = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        sq += x * x;
        sum += x;
        v.push_back(x);
    }
    int best = inf;
    for (int i = 1; i <= 100; i++) {
        int cur = 0;
        for (auto it : v) cur += (it - i) * (it - i); 
        best = min(best, cur);
    }
    cout << best << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 3
#define MAX 15
typedef struct{
  int A[N][N];
}Pazzle;
Pazzle P;
int d_x[4]={0,1,0,-1};
int d_y[4]={1,0,-1,0};

void swap(int *A,int *B){
  int hoge;
  hoge=*A;
  *A=*B;
  *B=hoge;
 
 
}

int check(Pazzle P){
  int sum=0,i,j,hy,hx;
  for(i=0;i<N;i++){
 
    for(j=0;j<N;j++){
      if(P.A[i][j]==0)
        continue;
      hy=(P.A[i][j]-1)/N-i;
      hx=(P.A[i][j]-1)%N-j;
      if(hy<0)
        sum-=hy;
      else
        sum+=hy;
      if(hx<0)
        sum-=hx;
      else
        sum+=hx;
 
 
    }
  }
 
  return sum;
}

int dfs(int x,int y,int max,int cnt,int m){
  int i;
  int heau;
  int x_0,y_0;
  int ans=-1;   
  heau=check(P);
  if(heau==0) return cnt;
  if(cnt+heau>max) return -1; 
  for(i=0;i<4;i++){
    x_0=x+d_x[i];
    y_0=y+d_y[i];      
   
    if((m!=-1&&i==(m+2)%4)||!(0<=x_0 && x_0<N && 0<=y_0 && y_0<N)) continue;    
    swap(&P.A[y][x],&P.A[y_0][x_0]);
    ans=dfs(x_0,y_0,max,cnt+1,i);
    if(ans!=-1) return ans;       
    swap(&P.A[y][x],&P.A[y_0][x_0]);
  }   
  return -1;
}

int main(void){
  Pazzle t_P;
  int  i,j,ans;
  int x0,y0;


  for(i=0;i<N;i++){
    if(i<N)break;
  }
  
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      scanf("%d",&P.A[i][j]);
      if(P.A[i][j]==0){
	x0=j;
	y0=i;
                
      }
            
    }
  }
  t_P=P;
  for(i=1;i<46;i++){
    P=t_P;
    ans=dfs(x0,y0,i,0,-1);
    if(ans!=-1){printf("%d\n",ans); break;}
  }
  return 0;
}







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

#define INF              1e15
#define EPS               1e-9
#define MOD             1000000007
#define Pi               3.14159265358979323846264338327950288419716939937510

#define umap             unordered_map
#define uset             unordered_set
#define fi               first
#define se               second
#define ll               long long 
#define vi               vector<int>
#define pii             pair<int,int>
#define vll             vector<ll>
#define pll              pair<ll,ll>
#define pb               push_back
#define pob             pop_back
#define pf               push_front
#define pof             pop_front
#define maxE(a,n)           *max_element(a,a+n);
#define minE(a,n)           *min_element(a,a+n);
#define all(x)             x.begin(), x.end()

#define fast             ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fori(i,a,n)         for (ll  i=a;i<n;i++)
#define ford(i,a,n)         for (ll  i=n-1;i>=a;i--)

ll gcd(ll a, ll b){ll temp;while (b > 0){temp = a%b;a = b;b = temp;} return a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll power(ll x, ll b,ll m) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= m;} b >>= 1; x *= x; x %= m;} return p % m;}

using namespace std;


void solve(){

    int n;
    cin>>n;
    vector<pii> a(n);
    for(int i=0;i<n;i++){
      cin>>a[i].first>>a[i].second;
    }

    bool flag = false;

    for(int i=0;i<n - 2;i++){
      if(a[i].first == a[i].second && a[i+1].fi == a[i+1].se && a[i+2].fi == a[i+2].se){
        flag = true;
      }
    }

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


int main(){

  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  fast;
  ll t = 1;


  while(t--){
    solve();
  }
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using llu=unsigned long long;
#define mod 1000000007
#define mode 998244353
#define PI 3.14159265358979323846
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mms(x,y) memset(x,y,sizeof(x))
#define pqm priority_queue<ll,vector<ll>,greater<ll>>
#define pb push_back
#define um unordered_map
#define pr pair
#define mm multimap
#define ms multiset
#define mp make_pair
#define vr vector
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define inf INT_MAX
#define ninf INT_MIN
#define ff first
#define ss second
#define gcd __gcd
int main()
{
    fast;
    ll t,n,m,i,j,k;
    ll a,b;
    cin>>a>>b;
    ll ans=0;
    ans=max(ans,a-2*b);
    cout<<ans;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

 
int main()
{
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if (x-r >= 0 && y-r >= 0 && H-(y+r) >= 0 && W-(x+r) >= 0 )
    
        cout << "Yes" << endl;
    else cout << "No" << endl;
    
        
}


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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

// template<class T> void chmin(T& a, T b) {
//     if (a > b) {
//         a = b;
//     }
// }

// template<class T> void chmax(T& a, T b) {
//     if (a < b) {
//         a = b;
//     }
// }

int gcd(int a, int b) {
    if (a<b) swap(a, b);

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

int main(void) {
    int k;
    cin >> k;

    int ans = 0, tmp;
    for(int ia=1;ia<=k;ia++) {
        for(int ib=1;ib<=k;ib++) {
            for(int ic=1;ic<=k;ic++) {
                tmp = gcd(ia,ib);
                tmp = gcd(tmp, ic);
                ans += tmp;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

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

  cin >> s;
  s.length();
  long long ans = 0;

  for (int bit = 0; bit < (1 << (s.length() - 1)); ++bit) {
    vector<long> comb;
    for (int shift = 0; shift < s.length() - 1; ++shift) {
      if (bit & (1 << shift)) {  // i が bit に入るかどうか
        comb.push_back(shift);
      }
    }
    comb.push_back(s.length() - 1);

    long tmp = 0;
    for (long i = 0; i < comb.size(); ++i) {
      ans += stol(s.substr(tmp, comb[i] - tmp + 1));
      tmp = comb[i] + 1;
    }
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
def a_fairness(A, B, C, K):
    # *橋くんの持っている整数の値は大きくなるが、
    # 高橋-中橋の値は-1倍されていくだけ
    # 解が'Unfair'となることはない
    ans = A - B if K % 2 == 0 else B - A
    return ans

A, B, C, K = [int(i) for i in input().split()]
print(a_fairness(A, B, C, K))

Measured memory_bytes: 3064