akhauriyash/Code-Regression huggingface dataset:
using System;
class MainClass
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');

        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        int k = int.Parse(input[2]);

        int i = 1;
        int cnt = 0;
        int N = 0;

        for( var j = 1; j <= a && j <= b;j++ )
        {
            if (a % j == 0 && b % j == 0)
            {
                N++;
            }
        }

        int m = N - k + 1;


        while (i <= a && i <= b )
        {
            if(a%i==0 && b%i ==0 )
            {
                cnt++;
                if (cnt == m)
                {
                    Console.WriteLine(i);
                    break;
                }
                
            }
            i++;
        }
    }
}

Measured memory_bytes: 13140
N, M, D = map(int, input().split())
S = [input() for i in range(N)]
def calc(f, N, M):
    res = 0
    for i in range(N):
        cnt = 0
        for j in range(M):
            c = f(i, j)
            if c is '#':
                cnt = 0
            else:
                cnt += 1
                if cnt >= D:
                    res += 1
    return res
print(calc(lambda i, j: S[i][j], N, M) + calc(lambda i, j: S[j][i], M, N))

Measured memory_bytes: 5608
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
string S,T,U;
ll K;
ll n;
ll N[101];
ll ans;
ll M;
ll dp[101][101];
int cnt;
ll cntt;
 
 
 
int main(){
    cin >> n>>K;
    
    if(n>K){
        cout<< "safe"<<endl;
    }else{
        cout << "unsafe"<<endl;
    }
    
}
 
 


Measured memory_bytes: 3640
#include <iostream>
#include <cmath>

/*
int main() {
    int N;
    std::cin >> N;
    std::cout << std::pow(N,3.0) << std::endl;
    return 0;
}
*/

int main(){
    int N;
    int satis=0;
    std::cin >> N;
    int A[N], B[N], C[N-1];
    for(int i=0; i<N; i++){
        std::cin >> A[i];
    }
    for(int i=0; i<N; i++){
        std::cin >> B[i];
    }
    for(int i=0; i<N-1; i++){
        std::cin >> C[i];
    }

    for(int i=0; i<N-1; i++){
        satis+=B[i];
        if(A[i+1]==A[i]+1){
            satis+=C[A[i]-1];
        }
    }
    satis += B[N-1];
    std::cout << satis << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(void)
{
    cin.sync_with_stdio(false);
    ll N, x;
    cin >> N >> x;
    vector<ll> As(N);
    REP(n,N) cin >> As[n];
    
    // vector<ll> Bs;
    // auto itr = min_element(ALL(As));
    // auto mn_idx = distance(begin(As), itr);
    // FOR(i,mn_idx,N) {
    //     Bs.pb( As[i] );
    // }
    // REP(i,mn_idx) {
    //     Bs.pb( As[i] );
    // }

    // // for(auto b: Bs) cout << b << ",";
    // // cout << endl;

    // As = Bs;

    vector<ll> costs = As;
    ll ans = accumulate(ALL(costs), 0LL);
    REP(k,N) { // 鬲疲ｳ輔ｒ蜚ｱ縺医ｋ蝗樊焚
        vector<ll> new_costs(N);
        REP(n,N) {
            new_costs[n] = min(costs[n], As[(n - k + N) % N]);
        }
        costs = new_costs;
        ans = min(ans, accumulate(ALL(costs), 0LL) + k * x);
    }
    cout << ans << endl;

    // ll longest_streak = 0;
    // ll ans = As[0];
    // FOR(n,1,N) {
    //     ll cost = As[n];
    //     for(int n2 = n-1; n2 >= 0; --n2) {
    //         ll diff = n - n2;
    //         ll cost2 = diff * x;
    //         if (cost2 < cost) {
    //             longest_streak = max(longest_streak, diff);
    //             cost = As[n2];
    //         }
    //     }
    //     ans += cost;
    // }
    // ans += longest_streak * x;
    
    // cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {

	ios_base :: sync_with_stdio(0); cin.tie(NULL);

	int N;
	cin >> N;

	string ans = "";

	switch(N % 10) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			ans = "hon";
		break;

		case 0:
		case 1:
		case 6:
		case 8:
			ans = "pon";
		break;
		case 3:
			ans = "bon";
		break;
		default: assert(1==0);
		break;
	}

	cout << ans << '\n';


	return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize "trapv"
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define ld long double
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,a,n) for(int i=a;i<n;i++)
#define all(v) v.begin(),v.end()
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
int main()
{
    fio;
    int t=1;;
    //cin>>t;
    while(t--)
    {
       ll n;
       cin>>n;
       ll a[n];
       ll cnt=0;
       rep(i,n)
       cin>>a[i];
       for(int i=0;i<n;i++)
       {
           for(int j=i+1;j<n;j++)
           {
               for(int k=j+1;k<n;k++)
               {
                   if(((a[i]+a[j])>a[k]) && ((a[j]+a[k])>a[i]) && ((a[i]+a[k])>a[j]))
                   {
                       if(a[i]==a[j] || a[j]==a[k] || a[k]==a[i])
                       continue;
                       cnt++;
                       
                      // cout<<i<<" "<<j<<" "<<k<<endl;
                       
                   }
               }
           }
       }
       cout<<cnt<<endl;
    }
}

Measured memory_bytes: 3628
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = Integer.parseInt(sc.next()) - 1;
        }

        boolean[] b = new boolean[n];
        int i = 0;
        int cnt = 0;

        for ( ; !b[i] && i != 1; ++cnt) {
            b[i] = true;
            i = a[i];
        }

        if (i == 1) {
            System.out.println(cnt);
        } else {
            System.out.println(-1);
        }
    }
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W;
  cin >> H >> W;
  vector<vector<int>> C(10, vector<int>(10));
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> C[i][j];
    }
  }
  for (int k = 0; k < 10; k++) {
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }
  int res = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int x;
      cin >> x;
      if (x == -1) continue;
      res += C[x][1];
    }
  }
  cout << res << '\n';
  return 0;
}


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;

// typedef
typedef pair<int, int> P;
typedef tuple<int, int, int> P3;
typedef vector<vector<int>> Graph;

int main() {
    ll n, k;
    scanf("%lld %lld", &n, &k);
    vector<ll> a(n), f(n);
    rep(i, n) scanf("%lld", &a[i]);
    rep(i, n) scanf("%lld", &f[i]);
    sort(a.begin(), a.end());
    sort(f.begin(), f.end(), greater<int>());
    ll worst = 1e12;
    ll ans = worst / 2;
    while (true) {
        ll sum = 0;
        rep(i, n) {
            sum += max((ll)0, a[i] - ans / f[i]);
        }
        if (sum <= k) {
            if (worst == ans) break;
            worst = ans;
            ans /= 2;
        } else {
            if (worst - ans <= 1) break;
            ans = (worst + ans) / 2;
        }
    }
    out(worst);
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = (long)Integer.parseInt(sc.next());
		long K = (long)Integer.parseInt(sc.next());
		sc.close();


		long count = 0;
		long mod = (long) 1e9 + 7;
		for(long i = K; i <= N + 1; i++) {
			long value = i * N - i * (i - 1) + 1;
			count += value;
		}

		long answer = count % mod;
		int ans = (int) answer;
		System.out.println(answer);
	}

}

Measured memory_bytes: 27016
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String c = sc.next();

        sc.close();

        String s = a.substring(0, 1) + b.substring(0, 1) + c.substring(0, 1);
        s = s.toUpperCase();
        System.out.println(s);
    }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef long long LL;
//-------------------------------------------------------------------LYYY↓
namespace LYYY{
	int read()
	{
		int s=0;char c=getchar();int f=1;
		while(c<48||c>57)
		{
			if(c==45) f=-1;
			c=getchar();
		}
		while(c>=48&&c<=57) s=(s<<3)+(s<<1)+(c^48),c=getchar();
		return s*f;
	}
	void write(int x)
	{
		if(x>=10) write(x/10);
		putchar(x%10+48);
	}
	void W(int x)
	{
		if(x<0) x=-x,putchar(45);
		write(x);
	}
}using namespace LYYY;
//-------------------------------------------------------------------bianliang↓
char ss[222222];
//-------------------------------------------------------------------hanshu↓
//-------------------------------------------------------------------main()↓
int main()
{
	scanf("%s",ss+1);
	int N=strlen(ss+1);
	int op=1,cnt=0;
	char c='@';
	while(op<=N)
	{
		++cnt;
		if(ss[op]==c) c='@',op+=2;
		else c=ss[op++];
	}
	if(op!=N+1) --cnt;
	printf("%d",cnt);
}

Measured memory_bytes: 384
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<unordered_map>
#define deg(x) cout<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const ll inf=1e18;
const long double eps=1e-8;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
const double pi=acos(-1);

int a[203040];

int main(){
    TB
    int n,m;
    int flag=0,sum=0;
    cin>>n>>m;
    fd(n) {cin>>a[i];sum+=a[i];}
    sort(a,a+n);
    for(int i=n-1;i>=0;i--){
        if(4*m*a[i]<sum) break;
        else flag++;
    }
    if(flag>=m) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N), B(N), C(N-1);
  for(int i = 0; i < N; i++) cin >> A.at(i);
  for(int i = 0; i < N; i++) cin >> B.at(i);
  for(int i = 0; i < N-1; i++) cin >> C.at(i);
  int ans = 0;
  for(int i = 0; i < N; i++){
    ans += B.at(A.at(i)-1);
    if(i != N-1){
      if(A.at(i+1) == A.at(i)+1) ans += C.at(A.at(i)-1);
    }
  }
  cout << ans << endl;
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		for(int i = 0; i < n ;i++){
			int[] array = new int[10];
			String[] s = br.readLine().split(" ");
			for(int j =0 ;j < 10;j++){
				array[j] = Integer.parseInt(s[j]);
			}
            System.out.println(isSortable(array) ? "YES" : "NO");
		}
	}
	public static boolean isSortable(int[] ballSet) {
        int bufB = 0;
        int bufC = 0;
        for(int ball : ballSet) {
            if(ball > bufB) {
                bufB = ball;
            }
            else if(ball > bufC) {
                bufC = ball;
            }
            else {
                return false;
            }
        }
        return true;
    }

}

Measured memory_bytes: 24172
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Node
{
  internal int key;
  internal Node left, right, parent;

  public Node(int key)
  {
      this.key = key;
  }
}

class C8
{
    static StringBuilder sb = new StringBuilder();
    static Node root;

    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        for(int i = 0; i < n; i++)
        {
            string[] input = Console.ReadLine().Split(' ');

            switch (input[0][0])
            {
                case 'i':
                    Insert(int.Parse(input[1]));
                    break;
                case 'f':
                    sb.AppendLine(find(root, int.Parse(input[1])) != null ? "yes" : "no");
                    break;
                case 'd':
                    Delete(find(root, int.Parse(input[1])));
                    break;
                default:
                    Inorder(root);
                    sb.AppendLine();
                    Preorder(root);
                    sb.AppendLine();
                    break;
            }
        }
        Console.Write(sb);
    }

    static void Delete(Node z)
    {
        Node x, y;

        if (z.left == null || z.right == null) y = z;
        else y = GetSuccessor(z);

        if (y.left != null) x = y.left;
        else x = y.right;

        if (x != null) x.parent = y.parent;

        if (y.parent == null) root = x;
        else if (y == y.parent.left) y.parent.left = x;
        else y.parent.right = x;
        if (y != z) z.key = y.key;
    }

    static Node GetSuccessor(Node x)
    {
        Node y;

        if (x.right != null)
        {
            y = x.right;

            while (y.left != null)
            {
                y = y.left;
            }
            return y;
        }
        else
        {
            y = x.parent;

            while (y != null && x == y.right)
            {
                x = y;
                y = y.parent;
            }
            return y;
        }
    }

    static Node find(Node u,int k)
    {
        while (u != null && k != u.key)
        {
            u = k < u.key ? u.left : u.right;
        }
        return u;
    }

    static void Insert(int k)
    {
        Node x = root;
        Node y = null;
        Node z = new Node(k);

        while (x != null)
        {
            y = x;
            x = z.key < x.key ? x.left : x.right;
        }

        z.parent = y;

        if (y != null)
        {
            if (z.key < y.key) y.left = z;
            else y.right = z;
        }
        else root = z;
    }

    static void Inorder(Node u)
    {
        if (u == null) return;

        Inorder(u.left);
        sb.Append(" " + u.key);
        Inorder(u.right);
    }

    static void Preorder(Node u)
    {
        if (u == null) return;

        sb.Append(" " + u.key);
        Preorder(u.left);
        Preorder(u.right);
    }
}



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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

bool IsPrime(int);

/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  cout << n*n*n;
  cout << "\n";
  return 0;
}
/***** MAIN *****/

bool IsPrime(int a) {
  if(a <= 1) return false;
  if(a == 2) return true;
  if(a%2 == 0) return false;
  for(int i = 3; i*i <= a; i+=2) {
    if(a%i==0) return false;
  }
  return true;
}

Measured memory_bytes: 256
#include<stdio.h>
int dat[100];
int main(){
	int a,b,c,d,e;
	while(scanf("%d%d%d%d%d",&a,&b,&c,&d,&e),a){
		for(int i=0;i<a;i++)scanf("%d",dat+i);
		int now=0;
		int frame=-1;
		int x=e;
		while(frame<=10001&&now<a){
			frame++;
			if(dat[now]==x){
				now++;
				x=(x*b+c)%d;
			}else{
				x=(x*b+c)%d;
			}
		}
		if(frame>10000)printf("-1\n");
		else printf("%d\n",frame);
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
using namespace std;
int main(){
  long a,b,c,k;
  cin >> a >> b >> c >> k;

  if(k % 2 == 1){
	cout << b - a << endl;
	
  }
  else{
	cout << a -b << endl;
  }
  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = 2 * pow(10, 9) + 1;//+1しないとREになるかも(out of rangeになるんかな?? )

vector<int> dx = { -1, 0, 1, 0, -1, -1, 1, 1 };
vector<int> dy = { 0, -1, 0, 1, -1, 1, -1, 1 };


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

	vector<double> p(N); 
	for (int i = 0; i < N; i++) {
		cin >> p[i];

	}
	//for (int i = 0; i < N; i++) cout << p[i] << " " << endl;
	//cout << endl;

	//累積和
	vector<int> s(N + 1, 0);
	for (int i = 0; i < N; ++i) s[i + 1] = s[i] + p[i];

	//区間の総和の最大を探す
	int sum = 0;
	int index = 0;
	for (int i = 0; i < N - K + 1; i++) {
		int tmp_sum = s[i + K] - s[i];
		if (tmp_sum > sum) {
			sum = tmp_sum;
			index = i;
		}
	}

	

	double ans = 0;
	for (int i = index; i < index+K; i++) {
		ans += p[i] * (p[i] + 1) / 2 / p[i];
		//cout << p[i] << endl;
	}

	cout << fixed;//小数点を確実に8桁で表示するためのもの
	cout << setprecision(8) << ans << endl;

}



Measured memory_bytes: 2560
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<queue>
#include<numeric>
#include<map>
#include<string>

using namespace std;

string max_string(string a, string b) {
    if (a.length() > b.length()) {
        return a;
    } else if (a.length() < b.length()) {
        return b;
    } else {
        for (int i = 0; i < a.length(); i++) {
            if (a[i] > b[i]) return a;
            else if (a[i] < b[i]) return b;
        }
        // 一致
        return a;
    }
}

int mm[10] = {0, 2, 5 ,5,4,5,6,3,7,6};
int a[15];
string dp[11000];
int main() {
    int n, m;

    scanf("%d%d", &n, &m);

    for (int i = 0; i < m; i++) {
        scanf("%d", &a[i]);
    }

    for (int i = 0; i < m; i++) {
        if (dp[mm[a[i]]] == "") dp[mm[a[i]]] = to_string(a[i]);
        else dp[mm[a[i]]] = max_string(dp[mm[a[i]]], to_string(a[i]));
    }
    // for (int i = 0; i< 10; i++) {
    //     printf("%d %s\n", i, dp[i].c_str());
    // }

    for (int i = 1; i <= n; i++) {
        if (dp[i] == "") continue;
        else {
            for(int j = 0; j < m; j++) {
                if (dp[i + mm[a[j]]] == "") dp[i + mm[a[j]]] = to_string(a[j]) + dp[i];
                else dp[i + mm[a[j]]] = max_string(dp[i + mm[a[j]]], to_string(a[j]) + dp[i]);
            }
        }
    }

    printf("%s\n", dp[n].c_str());

    return 0;
}


Measured memory_bytes: 31616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		double ans = 0;
		for(int i = 1; i <= a; i++) {
			double tmp = 1.0 / a;
			int now = i;
			while(now < b) {
				now *= 2;
				tmp /= 2;
			}
			ans += tmp;
		}
		System.out.println((double)ans);
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  double a,b;
  cin>>a>>b;
  cout << (int)ceil((a+b)/2) << endl; 
}


Measured memory_bytes: 256
N, W = map(int, input().split())
vs = []
ws = []
for i in range(N):
    v, w = map(int, input().split())
    vs.append(v)
    ws.append(w)


def knapsack(N, W, weight, value):
    # initialize
    inf = float('inf')
    dp = [[-inf for i in range(W+1)] for j in range(N+1)]
    for i in range(W+1):
        dp[0][i] = 0

    # DP
    for i in range(N):
        for w in range(W+1):
            if w >= weight[i]:
                dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w])
            else:
                dp[i+1][w] = dp[i][w]
    return dp[N][W]


print(knapsack(N, W, ws, vs))



Measured memory_bytes: 42504
N , K = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
divisor = []
n = 1
while n ** 2 <= s:
    q, r = divmod(s, n)
    if r == 0:
        divisor.append(q)
        divisor.append(n)
    n += 1
ans = 1
for d in divisor:
    m = []
    for a in A:
        m.append(a % d)
    m.sort(reverse=True)
    l = sum(m) // d
    a = l * d - sum(m[:l])
    if a <= K:
        ans = max(ans, d)
print(ans)


Measured memory_bytes: 3064
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

class Point
{
private:

	double x_;
	double y_;

public:

	Point() : x_(0), y_(0) { }

	explicit Point(double x, double y) : x_(x), y_(y) { }

	explicit Point(double x1, double y1, double x2, double y2) : x_(x2 - x1), y_(y2 - y1) { }

	double x() { return x_; }
	double y() { return y_; }

	double x() const { return x_; }
	double y() const { return y_; }

	Point& operator+= (const Point& p) { x_ += p.x_; y_ += p.y_; return *this; }
	Point& operator-= (const Point& p) { x_ -= p.x_; y_ -= p.y_; return *this; }

	Point& operator*= (double s) { x_ *= s; y_ *= s; return *this; }
	Point& operator/= (double s) { x_ /= s; y_ /= s; return *this; }

	friend bool operator== (const Point& p1, const Point& p2) { return p1.x_ == p2.x_ && p1.y_ == p2.y_; }
	friend bool operator!= (const Point& p1, const Point& p2) { return !(p1 == p2); }

	friend Point operator+ (const Point& p1, const Point& p2) { return Point(p1.x_ + p2.x_, p1.y_ + p2.y_); }
	friend Point operator- (const Point& p1, const Point& p2) { return Point(p1.x_ - p2.x_, p1.y_ - p2.y_); }

	friend Point operator* (const Point& p, double s) { return Point(p.x_ * s, p.y_ * s); }
	friend Point operator/ (const Point& p, double s) { return Point(p.x_ / s, p.y_ / s); }

	friend Point operator* (double s, const Point& p) { return Point(p.x_ * s, p.y_ * s); }
};

double distance(const Point& p1, const Point& p2)
{
	return sqrt(pow(p2.x() - p1.x(), 2) + pow(p2.y() - p1.y(), 2));
}

int main()
{
	int N; double X, Y;

	vector<Point> Plane;

	while (true)
	{
		cin >> N;

		if (N == 0) { break; }

		Plane.clear();

		for (int i = 0; i < N; i++)
		{
			cin >> X >> Y;

			Plane.push_back(Point(X, Y));
		}

		int max_ = 1;

		int count_;

		for (int i = 0; i < N; i++)
		{
			for (int j = i + 1; j < N; j++)
			{
				count_ = 1;

				if (distance(Plane[i], Plane[j]) < 2)
				{
					double vx = (Plane[j].x() - Plane[i].x()) / 2;
					double vy = (Plane[j].y() - Plane[i].y()) / 2;

					double vd = sqrt(vx * vx + vy * vy);

					double dist = sqrt(1 - vd * vd) / vd;

					double rx = Plane[i].x() + vx + -vy * dist;
					double ry = Plane[i].y() + vy + vx * dist;

					Point R(rx, ry);

					count_ = 2;

					for (int k = 0; k < N; k++)
					{
						if (k != i && k != j)
						{
							if (distance(Plane[k], R) < 1)
							{
								count_++;
							}
						}
					}
				}

				max_ = max(count_, max_);

				count_ = 0;

				if (distance(Plane[i], Plane[j]) < 2)
				{
					double vx = (Plane[j].x() - Plane[i].x()) / 2;
					double vy = (Plane[j].y() - Plane[i].y()) / 2;

					double vd = sqrt(vx * vx + vy * vy);

					double dist = sqrt(1 - vd * vd) / vd;

					double rx = Plane[i].x() + vx + vy * dist;
					double ry = Plane[i].y() + vy + -vx * dist;

					Point R(rx, ry);

					count_ = 2;

					for (int k = 0; k < N; k++)
					{
						if (k != i && k != j)
						{
							if (distance(Plane[k], R) < 1)
							{
								count_++;
							}
						}
					}
				}

				max_ = max(count_, max_);
			}
		}

		cout << max_ << endl;
	}

	return 0;
}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long A, long long B, long long N){
    ll C = B-1 <= N ? B-1 : N;
    cout << (A*C/B) - A * (C/B) << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long N;
    scanf("%lld",&N);
    solve(A, B, N);
    return 0;
}


Measured memory_bytes: 3760
N = int(input())
ans = 0
for x in range(1, int(N**.5)+1):
    if N % x == 0:
        y = N//x
        if x == y:
            if y < x-1:
                ans += x-1
        else:
            if y < x-1:
                ans += x-1
            if x < y-1:
                ans += y-1
print(ans)

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

using namespace std;

using lli = long long int;
using ulli = unsigned long long int;

#define EVAL 1

#ifndef EVAL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int A, B, C;

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

  cin >> A >> B >> C;
  if(B-A == C-B) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void) {
  int x;
  scanf("%d", &x);
  int a, b;
  for(a = -118;a < 120;a++) {
    for(b = -119;b < a;b++) {
      if(pow(a, 5) - pow(b, 5) == x) goto result;
    }
  }
  result:
  printf("%d %d\n", a, b);
  return 0;
}

Measured memory_bytes: 2592
#include<iostream>

using namespace std;

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

int main() {
  int res = 0, s;
  rep (i, 10) {
    cin >> s;
    res += s;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1160
/******************************************
* AUTHOR : Ashish Joshi* 
* INSTITUTION : NIT Hamirpur *
******************************************/
#include <bits/stdc++.h>
using namespace std;

#define N 100005
#define MOD 1000000007
#define PI 3.141592653589793

#define dd double
#define loop(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define set(b,i) (b|(1<<i))
#define unset(b,i) (b&!(1<<i))
#define cbit(b,i) bool(b&(1<<i))

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<ll> > vvll;
bool bingo(int a[3][3]){
	bool res=false;
	for(int i=0;i<3;i++){
		if(a[i][0]==a[i][1] && a[i][1]==a[i][2] && a[i][1]==-1)res=true;
		if(a[0][i]==a[1][i] && a[1][i]==a[2][i] && a[1][i]==-1)res=true;
	}
	if(a[0][0]==a[1][1] && a[1][1]==a[2][2] && a[1][1]==-1)res=true;
	if(a[2][0]==a[1][1] && a[1][1]==a[0][2] && a[1][1]==-1)res=true;
	return res;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);
int a[3][3]={0};
for(int i=0;i<3;i++)
	for(int j=0;j<3;j++)
		cin>>a[i][j];
int n;
cin>>n;
for(int c=0;c<n;c++){
	int b;
	cin>>b;
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			if(a[i][j]==b)a[i][j]=-1;
}
if(bingo(a))cout<<"Yes";
else cout<<"No";
return 0;
}

Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
#include<bits/stdc++.h>
 
using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); 
#define nl "\n"
#define sz(a) (int)(a).size() 
#define all(a) (a).begin(),(a).end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;  
#define mt make_tuple 
#define vec vector
 
#define int long long 
 
const int mod = (int) 1e9 + 7 ;
const int MOD = (int) 998244353 ;
const int INF = (int) 1e18 ;
 
typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

const int N = 1e5 + 5;
int a[N], dp[N];

void solve(int test) {
	int n ; cin >> n ;
	rep(i,0,n) cin >> a[i] ;

	dp[0] = 0 ; dp[1] = abs(a[0]-a[1]);

	for(int i = 2 ; i < n ; ++i) {
		dp[i] = min(dp[i-1] + abs(a[i]-a[i-1]), dp[i-2] + abs(a[i]-a[i-2])) ;
	}

	cout << dp[n-1] ;
}
 
int32_t main() {
 

    fast;
	int t=1;
	// cin>>t;
	rep(i,1,t+1) {
		solve(i) ;
	}
 
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 5168
from math import factorial
N, K = map(int, input().split())
mod = 10**9 + 7
def combination(n, r):
	if n >= r:
		return int(factorial(n) // (factorial(r) * factorial(n - r)))
	else:
		return 0

for i in range(1, K+1):
	print(combination(N-K+1, i) * combination(K-1, i-1)%mod)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+10;
int pre[maxn],sizes[maxn],ranks[maxn];
int m,n;
void inint()
{
    for(int i=1;i<=n;i++)
    {
        pre[i]=i;
        sizes[i]=1;
        ranks[i]=0;

    }
}
int finds(int x)
{
    if(x==pre[x])
    {
        return x;
    }
  else
    return pre[x]=finds(pre[x]);
}
bool same(int a,int b)
{
  return finds(a)==finds(b);

}
void unint(int a,int b)
{
       int x=finds(a);
       int y=finds(b);
       if(x==y)
        return ;
       if(ranks[x]<ranks[y])
       {
           pre[x]=y;
           sizes[y]+=sizes[x];
       }
       else
       {
           pre[y]=x;
           sizes[x]+=sizes[y];
           if(ranks[x]==ranks[y])
               ranks[x]++;
       }
       
       return ;

}
int main()
{
     scanf("%d%d",&n,&m);
     vector<int>a(m),b(m);
     inint();
     vector<ll>ans(m);
     for(int i=0;i<m;i++)
      cin>>a[i]>>b[i];
    ans[m-1]=(long long)n*(n-1)/2;
    for(int i=m-1;i>=1;i--)
    {
        ans[i-1]=ans[i];
        if(!same(a[i],b[i]))
        {
            ans[i-1]-=(ll)sizes[finds(a[i])]*sizes[finds(b[i])];
            unint(a[i],b[i]);
        }
    }
    for(int i=0;i<m;i++)
      cout<<ans[i]<<endl;

    return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
char s[1023];
long long d;
int cnt[1023], nume;
int main(){
    scanf("%s%lld", s+1, &d);
    bool flag = true;
    for(int i = 1; s[i]; i ++){
        if(s[i] != s[i-1]){
            ++ nume;
        } 
        cnt[nume] ++;
    }
    if(nume == 1){
        long long temv = strlen(s + 1) * d;
        printf("%lld\n", temv / 2);
        return 0;
    }
    long long ans = 0;
    if(s[1] == s[strlen(s+1)]){
        for(int i = 2; i < nume; i ++){
            ans += cnt[i] / 2 * d;
        }
        ans += (cnt[1] + cnt[nume]) / 2 * (d - 1);
        ans += cnt[1] / 2;
        ans += cnt[nume] / 2;
    }
    else{
        for(int i = 1; i <= nume; i ++){
            ans += cnt[i] / 2 * d;
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>

using namespace std;
typedef long long ll;
const int maxx = 1e5 + 5;
ll n, i, j;
string s;
string std1 = "JPY";
string std2 = "BTC";
const int mod = 380000;
double m, ans;

int main(){
	while(cin >> n){
		ans = 0;
		for(i = 0; i < n; i++){
			cin >> m >> s;
			if(s == std1) ans += m;
			else ans += (m * mod);
		}
		printf("%.4lf\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,a[85];
ll ans=1000;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){
		int j=i;
		while(j<n&&a[j+1]>a[j])j++;
		if(j>i){
			int t=ans%a[i];
			ans=ans/a[i]*a[j]+t;
		}
		i=j;
	}
	cout<<ans;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    for(int i = 0; i < N;++i){
        int a;
        cin >> a;
    }
    cout << ceil((double)(N - 1) / (K - 1)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
  string s;
  cin >> s;
  if(s[5]=='1'||s[6]>'4')cout << "TBD";else cout << "Heisei";
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main(){

  
  int N ,K;
  cin>>N>>K;
  double ans=0;
  for (int i=1;i<=N;i++){
      double tmp=1;
      int now=i;
      while(now<K){
          now*=2;
          tmp*=0.5;
      }
      ans+=tmp;

  }
  ans/=N;
  cout <<fixed<<setprecision(10)<<ans<<endl;
    return 0;
}


Measured memory_bytes: 768
import std.stdio, std.string, std.array, std.algorithm;

struct Point {int x,y;}

string[111] s;
Point[] q;
int[] dx = [0, 1, 0, -1];
int[] dy = [-1, 0, 1, 0];
int[111][111] cost; 

void main(){
	Point p;
	int n, m, tx, ty, newCost, ans;
	while (readf("%d %d\n", &n, &m), n || m) {
		foreach (y; 0..m) {
			s[y] = readln.chomp;
			cost[y] = 999999;
			foreach (x; 0..n) if (s[y][x] == '&') p = Point(x, y);
		}
		// solve by BFS
		cost[p.y][p.x] = 0;
		q ~= p;
		while (!q.empty) {
			p = q.front; q.popFront();
			foreach (i; 0..4) {
				tx = dx[i] + p.x;
				ty = dy[i] + p.y;
				if (tx < 0 || ty < 0 || tx >= n || ty >= m) continue;
				newCost = cost[p.y][p.x] + ((s[ty][tx] == '#' && s[p.y][p.x] != '#')  ? 1 : 0);
				if (cost[ty][tx] > newCost){
					cost[ty][tx] = newCost;
					q ~= Point(tx, ty);
				}
			}
		}
		ans = 999999;
		foreach (x; 0..n) foreach (i; [0, m-1]) ans = min(ans, cost[i][x]);
		foreach (y; 0..m) foreach (i; [0, n-1]) ans = min(ans, cost[y][i]);
		writeln(ans);
	}
}

Measured memory_bytes: 2400
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
step = [0] * (n+1)
step[0] = 1
if 1 not in a:
    step[1] = 1
else:
    step[1] = 0
for i in range(2,n+1):
    if i in a:
        continue
    step[i] = (step[i-1] + step[i-2]) % 1000000007
print(step[-1])

Measured memory_bytes: 19036
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = LIST()
A = [x-1 for x in A]
D = 60
to = [[0]*N for _ in range(D)]
to[0] = A.copy()

for i in range(D-1):
	for j in range(N):
		to[i+1][j] = to[i][to[i][j]]

v = 0
for i in range(D-1, -1, -1):
	l = 1<<i
	if l <= K:
		v = to[i][v]
		K -= l
print(v+1)


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

int main(){
	int n; cin >> n;
	double s = 0;
	for (int i = 0; i < n; i++) {
		double a; cin >> a;
		s += 1.0 / a;
	}
	cout << (1.0 / s) << endl;
	return 0;
}


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


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

    ll n,p;
    string s;
    cin>>n>>p>>s;
    ll ans = 0;
    ll now = 0;
    ll cnt[p+1]={};
    ll beki=1;
    if(p==2){
        for(int i=0;i<n;i++){
            if((s[i]-'0') % 2 == 0){
                ans += i+1;
            }
        }
        cout << ans << endl;
        return 0;
    }
    if(p==5){
        for(int i=0;i<n;i++){
            if(s[i]=='5' || s[i]=='0'){
                ans += i+1;
            }
        }
        cout << ans << endl;
        return 0;
    }
    cnt[0]=1;
    reverse(s.begin(),s.end());
    for(int i=0;i<n;i++){
        now += beki*(s[i]-'0')%p;
        beki *= 10;
        now %= p;
        beki %= p;
        ans += cnt[now];
        cnt[now]++;
    }
    cout << ans << endl;
    // cout << 500%3 << endl;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
int a[3],b[3],p[3];
int main(){
	int i,j,k;
	for(i=0;i<3;++i){
		scanf("%d%d",a+i,b+i);
		p[i]=i;
	}
	do{
		for(k=0;k<8;++k){
			for(i=0;i<3;++i){
				if(k&(1<<i)) swap(a[i],b[i]);
			}
			for(i=0;i<2;++i){
				//if(b[p[i]]!=a[p[i+1]]) swap(a[p[i+1]],b[p[i+1]]);
				if(b[p[i]]!=a[p[i+1]]) break;
			}
			if(i==2){
				printf("YES\n");
				return 0;
			}
			for(i=0;i<3;++i){
				if(k&(1<<i)) swap(a[i],b[i]);
			}
		}
	}while(next_permutation(p,p+3));
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
/*
██████╗  ███████╗  
██╔══██╗ ██╔════╝ 
██████╔╝ ███████╗ 
██╔══██╗ ╚════██║  
██║  ██║ ███████║      
╚═╝  ╚═╝ ╚══════╝                                                                                                             
*/

#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define haha(j,a,n) for(int j=a;j<n;j++)
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define endl "\n"
#define bc(v) v.begin(),v.end()
#define vl vector<ll>
#define vi vector<int>
#define mod 1000000007
#define NUM 100005
#define F first
#define S second
#define bhar(a) rep(i,a.size()) cin>>a[i];
#define show(a) rep(i,a.size()) cout<<a[i]<<" ";
#define sott(a) sort(bc(a))
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define mapp map<ll,ll>
#define dkac cout<<fixed<<setprecision(15);
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define yeah(n) while(n--)
ll gcd(int a, int b){if(b==0) return a; else return gcd(b,a%b);}
ll bitfun(ll x){
  return (x&(-x));
}
void solve(){
  ll n; cin>>n;
  set<string>s;
  rep(i,n){
    string x; cin>>x;
    s.insert(x);
  }
  cout<<s.size();
}
int main(){
    ios
    int t=1; 
    //cin>>t;
    yeah(t){
      solve();
    }
}

Measured memory_bytes: 19200
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
int h[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  REP(i, n) cin >> h[i];

  int ma = INF;
  bool f = true;
  RREP(i, n) {
    if(h[i] > ma) {
      if(h[i] - 1 != ma){
        f = false;
        break;
      }
    } else {
      ma = h[i];
    }
  }

  cout << ((f) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
N = int(input())
L = sorted(list(map(int, input().split())))

ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i]==L[j] or L[j]==L[k]: continue
            if L[i]+L[j]>L[k]: ans+=1

print(ans)


Measured memory_bytes: 9176
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/

#pragma comment(linker, "/STACK:268435456")
#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 endl ("\n")
#define deb(n) cerr << #n << " = " << (n) << '\n'
#define PI (3.14159265358979323846264338)
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define MOD (1000000007ll)
using ll = long long;

vector<int> parent, len;

int find(int n)
{
    if (parent[n] == n)
        return n;
    return parent[n] = find(parent[n]);
}
void add(int u, int v)
{
    int a = find(u);
    int b = find(v);
    if (a == b)
        return;
    if (len[b] > len[a])
        swap(a, b);
    len[a] += len[b];
    parent[b] = a;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
    cout.precision(10);
    // Those who forgive themselves, and are able to accept their true nature...THEY ARE THE STRONG ONES

    int n, m;
    cin >> n >> m;
    for (int i = 0;i <= n;i++) {
        parent.push_back(i);
        len.push_back(1);
    }
    while (m--) {
        int a, b;
        cin >> a >> b;
        add(a, b);
    }

    int sol = 1ll;
    for (int i = 1;i <= n;i++) {
        sol = max(sol, len[find(i)]);
    }
    cout << sol;
    
    return 0;
}

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

int main()
{
    vector<vector<int>> a(3,vector<int>(3));
    rep(i,3) {
        rep(j,3) {
            cin >> a.at(i).at(j);
        }
    }

    int n; cin >> n;
    vector<int> b(n);
    rep(i,n) cin >> b.at(i);

    vector<vector<int>> arr(8,vector<int>(3));

    rep(i,3) {
        arr.at(i).at(0) = a.at(i).at(0);
        arr.at(i).at(1) = a.at(i).at(1);
        arr.at(i).at(2) = a.at(i).at(2);
    }
    rep(i,3) {
        arr.at(i+3).at(0) = a.at(0).at(i);
        arr.at(i+3).at(1) = a.at(1).at(i);
        arr.at(i+3).at(2) = a.at(2).at(i);
    }

    arr.at(6).at(0) = a.at(0).at(0);
    arr.at(6).at(1) = a.at(1).at(1);
    arr.at(6).at(2) = a.at(2).at(2);

    arr.at(7).at(0) = a.at(0).at(2);
    arr.at(7).at(1) = a.at(1).at(1);
    arr.at(7).at(2) = a.at(2).at(0);

    int cnt;
    bool ans = false;

    rep(i,8) {
        cnt = 0;
        rep(j,3) {
            for(int x: b) {
                if(arr.at(i).at(j) == x) {
                    cnt++;
                }
            }
            if(cnt==3) {
                ans = true;
                break;
            }
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 
int main() {
	ll n,d;
	cin>>n>>d;
	d=d*2+1;
	cout << (n+d-1)/d;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>

int main()
{
	int n;
	std::cin >> n;
	
	int* memory = new int[n];
	
	for (int i=0; i<n; i++) {
		std::cin >> memory[i];
	}
	std::cout << memory[n-1];
	for (int i=n-2; i>=0; i--) {
		std::cout << " " << memory[i];
	}
	std::cout << std::endl;
	
	delete[] memory;
	
	return 0;
}




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

#define FOR(i, j, k) for(int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

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

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
    for(T &x : vec) {
        is >> x;
    }
    return is;
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    ll A, B;
    cin >> A >> B;

    if((A - B) % 2 == 0) {
        cout << abs(A - B) / 2LL + min(A, B) << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#define N 100005
pair<int,int> ret[N];
vector<int> adj[N];
int depth[N],vis[N];
int retNum = 0;

#define NOT_MATCHED 1
int dfs(int node, int p) {
	if (vis[node]) {
		if (depth[node] < depth[p])
			return NOT_MATCHED;
		else
			return 0;
	}
	vis[node] = true;
	int pid = -1, sz = adj[node].size(), ch;
	for (int i = 0; i < sz; ++i) {
		ch = adj[node][i];
		if (ch == p) {
			continue;
		}
		if (!vis[ch]) {
			depth[ch] = depth[node] + 1;
		}
		int R = dfs(ch, node);
		if (R) {
			if (pid == -1) {
				pid = ch;
			}
			else {
				ret[retNum++] = make_pair(node, ch);
				ret[retNum++] = make_pair(node, pid);
				pid = -1;
			}
		}
	}
	int pEdgeRem = true;
	if (pid != -1) {
		ret[retNum++] = make_pair(node, pid);
		ret[retNum++] = make_pair(node, p);
		pid = -1;
		pEdgeRem = false;
	}
	return pEdgeRem;
}
void solve() {
	int n, m;
	scanf("%d %d", &n, &m);
	if (m & 1) {
		printf("-1\n");
		return;
	}
	for (int i = 0; i < m; ++i) {
		int a, b;
		scanf("%d %d", &a, &b);
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	dfs(1, 0);
	for (int i = 0; i < m; ++i) {
		printf("%d %d\n", ret[i].first, ret[i].second);
	}
}
int main() {
	//freopen("input.txt", "r", stdin);
	solve();
	return 0;
}

Measured memory_bytes: 16256