akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unistd.h>

#if __has_include(<local.h>)
#include <local.h>
#endif

using namespace std;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())
#define ALL(x) (x).begin(),(x).end()

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define IPOW(x,y) LL(pow(x,y))

//Debug
#ifdef LOCAL_H
#define TEST cout << "OK\n"
#define DEBUG(a) a
#else
#define TEST
#define DEBUG(a)
#endif

#ifdef LOCAL_H
[[maybe_unused]]
#endif
const double PI = M_PI;
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const int INF = int(999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const long long MOD = int(1000000007);

//Settings
#ifdef LOCAL_H
const bool DO_BENCHMARK = true;
#endif
const int DOUBLE_ACCURACY = 15;

#ifndef LOCAL_H
    const bool DO_BENCHMARK = false;
#endif

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

/************************************************************************************************************************************************/

void solve(){
    LL N;
    cin >> N;
    vector<LL> A (N);
    for(LL i = 0;i < N;i++){
        cin >> A[i];
        A[i] -= i;

    }
    SORT(A);
    LL ans = 0;
    for(int i = 0;i < N;i++){
        ans += abs(A[i]-A[N/2]);
    }
    cout << ans << endl;
}


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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    bool ans=0;
    if(a==b && a!=c) ans=1;
    if(a==c && a!=b) ans=1;
    if(c==b && a!=b) ans=1;
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys

x = input()

if len(x) < 3:
    print(0)
    sys.exit()

prefix = int(x[:-2])
suffix = int(x[-2:])

n = 0
for item in range(5, 0, -1):
    n += suffix // item
    suffix %= item

print(0 if n>prefix else 1)

Measured memory_bytes: 3060
use std::io;

fn read_line()-> String {
    let mut s = String::new();
    let _ = io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
	let mut s = read_line().split_whitespace().map(|e|e.parse().unwrap())
	.collect::<Vec<i32>>();
	s.sort();
	if s[2] == (s[0] + s[1]) {
		println!("Yes");
	}else {
		println!("No");
	}
}

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

using namespace std;
#define ll long long

ll const lmt = 2e5+6;

int main(){
	    ll A,B,C;
    cin>>A>>B>>C;
    ll maxn = 0;
    maxn = max(maxn,A*10 + B + C);
    maxn = max(maxn,A + B*10 + C);
    maxn = max(maxn,A + B + C*10);
 
    cout<<maxn;
    return 0;
	
}

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

typedef long long ll;

vector<ll> divisor(ll n) { 
  vector<ll> ret;
  for (ll i = 1; (ll)i*i <= n; ++i) { 
    if (n % i == 0) {
      ret.push_back(i);
      if (i*i != n) { ret.push_back(n/i); }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
};

int main(){
    // Mの約数のうち、商がN以上で、最大
    long long N,M;
    cin >> N >> M;

    auto v = divisor(M);
    sort(v.rbegin(), v.rend());
    for(auto x: v){
        if(M / x >= N){
            cout << x << endl;
            break;
        }
    }

}


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

int main() {
    int n;
    int a[210];
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    
    int result = 0;
    
    while (true) {
        bool flag = false;
        for(int i=0; i<n; i++){
            if(a[i]%2 != 0)flag = true;
        }
        
        if(flag)break;
        
        for(int i=0; i<n; i++){
            a[i] = a[i]/2;
        }
        result++;
    }
    
    cout << result << endl;
    
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct PP{
  char name[100];
  int t;
}P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%LEN;
}

P dequeue(){
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b){
    return a<b ? a:b;
}

int main(){
  int elaps=0,c;
  int i,q;
  P u;
  scanf("%d %d",&n,&q);
  
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head=1;
  tail=n+1;

  while(head!=tail){
    u=dequeue();
      c=min(q,u.t);
      u.t-=c;
      elaps+=c;
      if(u.t>0)enqueue(u);
      else{
          printf("%s %d\n",u.name,elaps);
      }
    }

    return 0;
}



Measured memory_bytes: 11900
n = int(input())
s = input()

left = 0
right = s[1:].count('E')

ans = right

for i in range(1, n):
    if s[i] == 'E':
        right -= 1
    if s[i - 1] == 'W':
        left += 1
    
    if left + right < ans:
        ans = left + right

print(ans)


Measured memory_bytes: 9596
#include<bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        string  a,b,c;
        cin>>a>>b>>c;
        int count=0;
        for(int i=0;i<n;i++){
            if(a[i]==b[i]&&a[i]==c[i])continue;
            else if(a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i])count+=2;
            else count++;
        }
        cout<<count<<endl;
    }

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

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

	int64_t T = 1, A = 1;
	for (int i = 0; i < N; i++) {
		int64_t t, a;
		cin >> t >> a;

		int64_t n, x, y;
		x = T / t;
		y = A / a;
		if (T % t) x++;
		if (A % a) y++;
		n = max(x, y);
		T = t * n;
		A = a * n;
	}

	cout << T + A << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <algorithm>

int P[10010];

void init(int N) {
	for (int i = 0; i < N; i++) {
		P[i] = i;
	}
}

int root(int a) {
	if (P[a] == a) {
		return a;
	} else {
		return (P[a] = root(P[a]));
	}
}

bool is_same_set(int a, int b) {
	return root(a) == root(b);
}

void unite(int a, int b) {
	P[root(a)] = root(b);
}

int main() {
	int n; // the number of vertcies
	std::cin >> n;
	// input the numbers
	std::tuple<int, int, int> a[n * n];
	int count = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			std::cin >> std::get<0>(a[count]);
			std::get<1>(a[count]) = i;
			std::get<2>(a[count]) = j;
			count++;
		}
	}
	
	// sort hte tree by weight
	std::sort(a, a + n * n);
	
	// Krukas algorithm
	// set the tree
	init(n * n);
	
	int sum = 0;
	for (int i = 0; i < n * n; i++) {
		if (std::get<0>(a[i]) != -1) {
			if(! is_same_set(P[std::get<1>(a[i])], P[std::get<2>(a[i])])) {
				unite(P[std::get<1>(a[i])], P[std::get<2>(a[i])]);
				sum += std::get<0>(a[i]);
			}
		}
	}
	std::cout << sum <<std::endl;
}


Measured memory_bytes: 3236
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int correspond_val(int d) {
    if(d % 2 == 0) return (1LL << d);
    else return -(1LL << d);
}

int can(int N, int D) {
    int sum = 0;
    if(N > 0) {
        for(int i=0; i<=D; i+=2) {
            sum += correspond_val(i);
        }
        // fprintf(stderr, "D = %lld, sum = %lld\n", D, sum);
        return N <= sum;
    }
    else {
        for(int i=1; i<=D; i+=2) {
            sum += correspond_val(i);
        }
        return sum <= N;
    }
}
 
signed main() {
    int N; cin >> N;

    if(N == 0) {
        cout << 0 << endl;
        return 0;
    }

    const int MAXD = 60;
    string ans(MAXD, '0');

    int itr = 0;
    while(N != 0) {
        int ub = MAXD, lb = -1;
        while(ub - lb > 1) {
            int mid = (ub + lb) / 2;
            if(can(N, mid)) ub = mid;
            else lb = mid;
        }
        // fprintf(stderr, "N (before) = %lld, N (after) = %lld, dig = %lld, val = %lld\n", N, N - correspond_val(ub), ub, correspond_val(ub));
        
        ans[ub] = '1';
        N -= correspond_val(ub);
    }

    reverse(ans.begin(), ans.end());
    int start_p = ans.find('1');
    cout << ans.substr(start_p) << endl;
    return 0;
}

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

int main()
{
  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;
  int sum=a+b+c+d+e+f;
  sum=sum-(min(min(a,b),min(c,d))+min(e,f));
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3132
using System;

class Program
{
  public static void Main(string[] args)
  {
    string t = Console.ReadLine();
    int count = 0;
    while(true)
    {
      string[] s = Console.ReadLine().Split();
      if (s[0] == "END_OF_TEXT") break;
      for (int i = 0; i < s.Length; i ++)
      {
        s[i] = s[i].ToLower();
        if (s[i] == t) count ++;
      }
    }
    Console.WriteLine(count);
  }
}



Measured memory_bytes: 17960
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 998244353LL

ll fac[10000010],ifac[10000010],bin[10000010];
int n;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline ll pls(const ll &x,const ll &y) { return (x+y<mod)?x+y:x+y-mod; }
inline ll mns(const ll &x,const ll &y) { return (x-y<0)?x-y+mod:x-y; }
inline ll ksm(ll x,ll y) { ll res=1;for (;y;y>>=1,x=x*x%mod) if (y&1) res=res*x%mod;return res; }

inline void pre_gao()
{
	fac[0]=1;
	for (int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
	ifac[n]=ksm(fac[n],mod-2);
	for (int i=n-1;~i;i--) ifac[i]=ifac[i+1]*(i+1)%mod;
	bin[0]=1;
	for (int i=1;i<=n;i++) bin[i]=bin[i-1]*2%mod;
}

int main()
{
	n=rd();pre_gao();
	ll ans=0;
	for (int i=n/2+1;i<=n;i++) ans=pls(ans,ifac[i]*ifac[n-i]%mod*bin[n-i+1]%mod);
	printf("%lld\n",mns(ksm(3,n),ans*fac[n]%mod));
	return 0;
}

Measured memory_bytes: 234624
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String input = scan.next();
		int pos1 = - 1 , pos2 = - 1;
		int i , length = input.length();
		for (i = 0;i < length;i ++) {
			if (input.charAt(i) == 'A') {
				pos1 = i;
				break;
			}
		}
		for (i = length - 1;i >= 0;i --) {
			if (input.charAt(i) == 'Z') {
				pos2 = i;
				break;
			}
		}
		
		System.out.println(pos2 - pos1 + 1);
		
	}
	
    
}






	

Measured memory_bytes: 14396
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define N 100005
#define ll long long
#define ull unsigned long long
#define loop1(i, j, k, step) for (int i=j; i<k; i+=step)
#define loop(i, j, k) for (int i=j; i<k; i++) 
#define rloop1(i, j, k, step) for (int i=j; i>=k; i-=step)
#define rloop(i, j, k) for(int i=j; i>=k; i--)
#define rep(i, k) for(int i = (0); i < (k); i++ )
#define rrep(i, k) for(int i = k-1; i >= 0; i-- )

#define forall(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define sz(x) (int)(x).size()
#define endl "\n"
#define Max (int)INT_MAX
#define Min (int)INT_MIN
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;


void solve()
{
	int n,i,j,k,l,q,w;
	cin>>n>>w;
	if(w>=n)
		cout<<"unsafe"<<endl;
	else
		cout<<"safe"<<endl;
}
int  main() 
{
	auto start=clock();
	fast_io;
    int t=1;
    //cin>>t;
    while(t--)
    	solve();
    auto stop =clock();
    cerr<<"time taken:"<<double(stop-start)/double(CLOCKS_PER_SEC)<<" s"<<endl;
	return 0; 
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

string s;
void test() {
    cin>>s;
    cout<<((s[2]==s[3]&&s[4]==s[5])?"Yes":"No")<<endl;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // int t; cin>>t;
    // while (t--) {
    //     test();
    // }
    test();
    // for (int i=1; i<=t; ++i) {
    //     cout<<"Case #"<<i<<": ";
    //     test();
    // }
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	string n,m; cin >> n>>m;
	if (n < m)cout << "<";
	else if (n > m) cout << ">";
	else cout << "=";
	


	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int res=100000;
  cin>>N;
  for (int i = 0; i < 50001; i++)
  {
    if(floor(i*1.08)==N){res=i;}
  }
  if(res==100000){cout<<":(";}
  else{cout<<res;}
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
char s[105], t[105];
int main()
{
	scanf("%d%s%s", &n, s, t);
	int cnt = 0;
	for (int i = 0; i <= n; i++)
	{
		bool flg = 1;
		for (int j = n - i, k = 0; k < i; k++, j++)
		{
			if (s[j] != t[k]) {
				flg = false;
			}
		}
		if (flg) cnt = i;
	}
	printf("%d\n", n * 2 - cnt);
	return 0;
}


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

const int N = 5e5 + 10;
const int INF = 3e5;
char c[N];
string s;
int main() {
	cin >> s;

	int l = INF, r = INF;
	for (int i = 0; i < s.size(); i++, r++) {
		c[r] = s[i];
	}
	r--;

	int n;
	cin >> n;
	bool f = true;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		if (t == 1) {
			f = !f;
		}
		else {
			int p; string str;
			cin >> p >> str;

			if (f) {
				if (p == 1) {
					l--;
					c[l] = str[0];
					//s = c + s;
				}
				else {
					r++;
					c[r] = str[0];
					//s = s + c;
				}
			}
			else {
				if (p == 1) {
					r++;
					c[r] = str[0];
					//s = s + c;
				}
				else {
					l--;
					c[l] = str[0]; 
					//s = c + s;
				}
			}
		}
	}

	if (f) {
		for (int i = l; i <= r; i++)
			cout << c[i];
		cout << endl;
	}
	else {
		for (int i = r; i >= l; i--)
			cout << c[i];
		cout<<endl;
	}

	return 0;
}

Measured memory_bytes: 1024
let K = Int(readLine()!)!
let S = readLine()!
let s: [Character] = S.map({$0})

if S.count > K {
    var text: String = ""
    for n in 0..<K {
        text.append(s[n])
    }
      text.append("...")
    print(text)
} else {
    print(S)
}


Measured memory_bytes: 7720
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
    long long int n;
    long long int ans = 0;
    long long int cnt = 1;

    cin >> n;

    while (n) {
        n /= 2;
        ans += cnt;
        cnt *= 2;
    }

    cout << ans << endl;
}


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

int main (){
    int N;
    cin>>N;
    vector<vector<ll>> X(64, vector<ll>(2, 0));
    for(int i=0; i<64; i++){
        X.at(i).push_back(1);
        
    }
    X[24][2]=0;
    X[18][2]=0;
    X[36][2]=0;
  
    for(int i=3; i<N; i++){
        for(int j=0; j<64; j++){
            X.at(j).push_back(X[(4*j)%64][i-1]+X[(4*j+1)%64][i-1]+X[(4*j+2)%64][i-1]+X[(4*j+3)%64][i-1]);
        }
        X[24][i]=0;
        X[18][i]=0;
        X[36][i]=0;
        //AG*C
        //X[22][i]-=X[24][i-1];
        X[26][i]-=X[40][i-1];
        X[30][i]-=X[56][i-1];
        //A*GC
        //X[25][i]-=X[36][i-1];
        //X[26][i]-=X[40][i-1];
        X[27][i]-=X[44][i-1];
        for(int j=0; j<64; j++){
            X[j][i] %=K;
        }
    }
    ll Sum=0;
    for(int i=0; i<64; i++){
        Sum += X[i][N-1];
        Sum %= K;
    }
    cout<<Sum;
}



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

int main() {
  ll x;
  cin >> x;

  ll ans = 0;
  ll pos = 0;
  for (ll i = 1; i <= x; i++) {
    pos += i;
    ans++;
    if (pos >= x) break;
  }
  if (pos == x) {
    cout << ans << endl;
    return 0;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int main(){
    int a;
    int b;
    int c;
    cin >> a >> b >> c;
    
    if (a < b) {
        
        if (b < c) {
        
            cout << "Yes" << endl;
            
        } else {
            
            cout << "No" << endl;
            
        }
        
    } else {
        
        cout << "No" << endl;
        
    }
    
}


Measured memory_bytes: 3104
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
using namespace std;
int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    for(int i= sy;i<ty;i++){
        cout<<"U";
    }
    for(int i=sx;i<tx;i++){
        cout<<"R";
    }
    for(int i=sy;i<ty;i++){
        cout<<"D";
    }
    for(int i=sx;i<=tx;i++){
        cout<<"L";
    }
    for(int i=sy;i<=ty;i++){
        cout<<"U";
    }
    for(int i=sx;i<=tx;i++){
        cout<<"R";
    }
    cout<<"DR";
    for(int i=sy;i<=ty;i++){
        cout<<"D";
    }
    for(int i=sx;i<=tx;i++){
        cout<<"L";
    }
    cout<<"U"<<endl;
}



Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int inf = 1e9 + 7;
const ll mod = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	double ans = 0;
	rep(i, n) {
		ans += 1.0 / a[i];
	}
	cout << fixed << setprecision(7) <<  1.0/ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

        final int N = sc.nextInt();

        final Set D = new HashSet<Integer>();
        for (int i = 0; i < N; i++) D.add(sc.nextInt());

        System.out.println(D.size());
    }
}


Measured memory_bytes: 21716
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[0]*N
for i in range(M):
  a,b=list(map(int,input().split()))
  A[a-1]=max(A[a-1],H[b-1])
  A[b-1]=max(A[b-1],H[a-1])
s=0
for i in  range(N):
  if H[i]>A[i]:
    s+=1
print(s)
    



Measured memory_bytes: 20040
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
#include<math.h>
//#include<string.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
double SimpleInterest(int,int);
double CompoundInterest(int,int);
int main() {
	int n,y,b,r,t,ans;
	double a;
	double (*po[])(int, int) = { SimpleInterest,CompoundInterest };
	while (~fscanf(stdin, "%d", &n), n != 0) {
		a = 0.0;
		fscanf(stdin, "%d", &y);
		while (n--) {
			fscanf(stdin, "%d%d%d", &b, &r, &t);
			if (a < po[t - 1](r, y)) ans = b,a=po[t-1](r, y);
		}
		P(d, ans);
	}
	return 0;
}

double SimpleInterest(int r, int y){
	return 1+y*r/100.0;
}

double CompoundInterest(int r, int y){
	return pow(1+r/100.0,y);
}

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

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

  set<int> st;
  st.insert(S);
  int i = S;
  int ans = 1;
  while (true) {
    ans++;
    if (i % 2 == 0) {
      i /= 2;
    } else {
      i = 3 * i + 1;
    }

    if (st.find(i) != st.end()) {
      cout << ans << endl;
      return 0;
    } else {
      st.insert(i);
    }
  }
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int f(ll a, ll b) {
  int cnt1 = 0;
  int cnt2 = 0;
  while (0 < a) {
    cnt1++;
    a /= 10;
  }
  while (0 < b) {
    cnt2++;
    b /= 10;
  }
  return max(cnt1, cnt2);
}

int main() {
  ll N;
  cin >> N;
  int ans = 1e9;
  for (ll i = 1; i * i <= N; ++i) {
    if (N % i != 0) continue;
    ans = min(ans, f(i, N / i));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        int[] input = ReadInts();
        int N = input[0], M = input[1];
        bool[,] light = new bool[M, N];
        int[] p = new int[M];
        for (int i = 0; i < M; i++)
        {
            input = ReadInts();
            int k = input[0];
            for (int j = 1; j <= k; j++)
            {
                light[i, input[j]-1] = true;
            }
        }
        input = ReadInts();
        for (int i = 0; i < M; i++)
        {
            p[i] = input[i];
        }
        int ans = 0;
        for (int i = 0; i < Math.Pow(2,N); i++)
        {
            int on = 0;
            for (int j = 0; j < M; j++)
            {
                int onf = i;
                int cnt = 0;
                for (int k = 0; k < N; k++)
                {
                    if (light[j, k])
                    {
                        if (onf % 2 == 1) cnt++;
                    }
                    onf /= 2;
                }
                if (cnt % 2 == p[j]) on++;
            }
            if (on == M) ans++;
            //Console.WriteLine(on);
        }
        return ans.ToString();
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 13140
N,A,B = map(int,input().split())
S = input()

countA = 0
countB = 0

for i in range(len(S)):
  if S[i] == 'a':
    if countA+countB < A+B:
      countA += 1
      print("Yes")
    else:
      print("No")
    
  elif S[i] == 'b':
    if countA+countB < A+B and countB < B:
      countB += 1
      print("Yes")
    else:
      print("No")
    
  elif S[i] == 'c':
    print("No")

Measured memory_bytes: 9224
#include<bits/stdc++.h>
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define M 1000000007
using namespace std;
long long int findProductSum(vector<long long int> A, int n)
{
    long long int array_sum = 0;
    for (int i = 0; i < n; i++)
        array_sum = array_sum + A[i];

    long long int array_sum_square = 1;
    array_sum_square = (array_sum_square*array_sum)%M;
    array_sum_square = (array_sum_square*array_sum)%M;

    long long int individual_square_sum = 0;
    for (int i = 0; i < n; i++) {
        long long int prod = 1;
        prod = (prod*A[i])%M;
        prod = (prod*A[i])%M;
        individual_square_sum = (individual_square_sum + prod) % M;
    }

    return (((array_sum_square - individual_square_sum)%M+M)%M)/2;
}
int main() {

    jaldi

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

//long long int ans = findProductSum(a,n);
//    ans = ans%M;
//    cout<<ans<<'\n';
    vector<long long int> suffix(n-1,0);
    suffix[n-2]=a[n-1];
    for(int i=n-3;i>=0;i--) {
        suffix[i] = (suffix[i+1]+a[i+1]);
    }

    int ans = 0;
    for(int i=0;i<n-1;i++) {
        int product = 1;
        product = ((a[i]%M)*(suffix[i]%M)) % M;
        ans = (ans+product)%M;
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 5544
dic = dict()
maxWords = ""
words = list(x for x in input().split())

for w in words:
    if len(w) > len(maxWords):
        maxWords = w
    value = dic.get(w)
    if not value:
        dic.setdefault(w,1)
    else:
        dic.update({w:value + 1})
dic = dict(sorted(dic.items(), key=lambda x: x[1],reverse=True))
print(list(dic.keys())[0],maxWords)


Measured memory_bytes: 5564
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  vector<int> p(1000000,-1);
  int n; cin>>n;
  vector<int> a(n);
  for(auto &i:a){
    cin>>i;
  }
  int g = a.at(0);
  for(int i=0; i<n; i++){
    g = gcd(g,a.at(i));
  }
  if(g!=1){
    cout << "not coprime"<<endl;
    return 0;
  }
  
  for(int i=0; i<n; i++){
    ll k = 2;
    while(1){
      if(a.at(i)%k==0){
        a.at(i)/=k;
        if(p.at(k)!=i && p.at(k)!=-1){
          cout<<"setwise coprime"<<endl;
          return 0;
        }
        else {
          p.at(k)=i;
        }
      }
      else k++;
      
      if(a.at(i)==1){
        break;
      }
      if(a.at(i)<(k-1)*(k-1)){
        if(p.at(a.at(i))!=-1 && p.at(a.at(i))!=i){
          cout<<"setwise coprime"<<endl;
          return 0;
        }
        else{
          p.at(a.at(i))=i;
          break;
        }
      }
    }
  }
  cout <<"pairwise coprime"<<endl;
}


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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	int n;
	cin >> s; n = s.size();
	vector <int> dp1, dp2;
	dp1.assign(n+1, 0);
	dp2.assign(n+1, 0);
	for (int i=1; i<=n; i++) {
		if (s[i-1] == '<') {
			dp1[i] = 1+dp1[i-1];
		}
	}
	for (int i=n-1; i>=0; i--) {
		if (s[i] == '>') {
			dp2[i] = 1+dp2[i+1];
		}
	}
	ll ans = 0;
	ans += dp2[0];
	ans += dp1[n];
	for (int i=1; i<n; i++) {
		if (s[i-1] == '>' && s[i] == '>') {
			ans += dp2[i];
		}
		if (s[i-1] == '<' && s[i] == '<') {
			ans += dp1[i];
		}
		if (s[i-1] == '<' && s[i] == '>') {
			ans += max(dp2[i], dp1[i]);
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 4764
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let ans = s.chars().filter(|&c| c == '1').count();
    println!("{}", ans);
}


Measured memory_bytes: 4352
/**
 *   created: 20 August 2019  11:36:13
**/
#include<bits/stdc++.h>
using namespace std;

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

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
	optimizeIO();
	int tt=1;
	//cin>>tt;
	while(tt--){
		int n;
		cin>>n;
		vi h(n);
		rep(i,0,n)
			cin>>h[i];
		vi mem(n);
		mem[0] = 0;
		mem[1] = abs(h[0]-h[1]);
		rep(i,2,n){
			mem[i] = min(mem[i-2]+abs(h[i-2]-h[i]),mem[i-1]+abs(h[i-1]-h[i]));
		}
		cout<<mem[n-1];
	}
	return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int num = sc.nextInt();
        String str = sc.next();
        String str2[] = str.split("");
        for(int i=0;i<num-1;i++)
        {
            if(!(str2[i].equals(str2[i+1])))
            {
                sum++;
            }
        }
        System.out.println(sum+1);
    }
}

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

int main() {
  int n, m;
  cin >> n >> m;
  if (n == 1) {
    cout << m << endl;
    return 0; 
  }
  for (int i = m / n; i >= 0;i-=1) {
    if (m % i == 0) {
      cout << i << endl;
      return 0;
    }
  }
  return 0; 
}
    


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

struct node{
  node* l;
  node* r;
  ll val;
};

ll n,l;
string s[100001];
node ns[500001];
ll idx=0;

node* add(ll val){
  ns[idx].val=val;
  ns[idx].l=NULL;
  ns[idx].r=NULL;
  return &ns[idx++];
}

ll dfs(node* crt,ll d){
  if(d==l+1)return 0;
  if(crt==NULL){
    ll h=l-d+1;
    ll g=1;
    while(h%g==0)g*=2;
    return g/2;
  }
  if(crt->val==1) return 0;
  else return dfs(crt->l,d+1)^dfs(crt->r,d+1);
}

int main(){
  cin>>n>>l;
  rep(i,n)cin>>s[i];
  node* rt=add(0);
  rep(i,n){
    node* crt=rt;
    rep(j,s[i].size()){
      if(s[i][j]=='0'){
        if(crt->l==NULL){
          crt->l=add(0);
          crt=crt->l;
        }else{
          crt=crt->l;
        }
      }else{
        if(crt->r==NULL){
          crt->r=add(0);
          crt=crt->r;
        }else{
          crt=crt->r;
        }
      }
    }
    crt->val=1;
  }
  if(dfs(rt,0)==0)cout<<"Bob"<<endl;
  else cout<<"Alice"<<endl;
  return 0;
}


Measured memory_bytes: 9984
import sys
input=sys.stdin.readline

def main():
    _,W = map(int,input().split())
    N = int(input())
    A = []
    a = list(map(int, input().split()))
    for i in range(N):
        A.append((i+1, a[i]))
    A.sort(key=lambda x: x[1])

    x = 0
    y = 0
    s = ""
    for c,n in A:
        for i in range(n):
            if y%2 == 0:
                if s == "":
                    s = str(c)
                else:
                    s = s + " " + str(c)
            else:
                s = str(c) + " " + s
            x += 1
            if x == W:
                print(s)
                y += 1
                x = 0
                s = ""
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef vector<vector<int>> vii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;




#define rep(i, n) for(ll i=0; i<(n); ++i)
#define repp(i, a, b) for(ll i = (a); i <= (b); i++)

const ll MOD=pow(10, 9) + 7;


int main(void){
    ll n, k;
    cin >> n >> k;
    vll A(2010);
    rep(i, n) cin >> A[i];
    

    //１ループ内の転倒数
    ll cnt1 = 0;
    rep(i, n-1) repp(j, i+1, n-1){
        if(A[i] > A[j]) cnt1++;
    }
    cnt1 *= k;
    cnt1 %= MOD;

    //外の転倒数
    ll cnt2 = 0;
    rep(i, n) rep(j, n){
        if(A[i] > A[j]) cnt2++;
    }
    cnt2 *= (k*(k-1)/2 %MOD);

    ll cnt = (cnt1 + cnt2) % MOD;
    cout << cnt << endl;
}

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

int main()
{
	
    
	int n, m ;
	cin>>n>>m; 
	int a[n];
	int sum = 0 ;
	for(int i = 0 ; i < n ; i++)
		{
			cin>>a[i];
			sum += a[i];
		}
	
	
	int count = 0 ;
	for(int i = 0 ; i < n ; i++)
	{
		if(a[i] >= (float) sum / float(4 * m) )
		
			++count ;
			
	}
	if(count >= m )
		cout<<"Yes";
	else
		cout<<"No";

}



Measured memory_bytes: 256
from fractions import gcd
N=int(input())
A=list(map(int,input().split(' ')))
ans = 0
l_1 = 1
l_2 = 1
mod = 10**9+7
def lcm(x,y):
    return x*y//gcd(x,y)
for i in A[:N//2]:
    l_1 = lcm(l_1,i)
for j in A[N//2:]:
    l_2 = lcm(l_2,j)
l = lcm(l_1,l_2)
out1 = sum([l_1//i for i in A[:N//2]])
out2 = sum([l_2//i for i in A[N//2:]])
out1 *= l//l_1
out2 *= l//l_2
print((out1+out2)%mod)

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


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

    vector<int> v(N);
    rep(i, N) {
        cin >> v.at(i);
        X -= v.at(i);
    }

    int res = N;
    sort(v.begin(), v.end());
    res += X / v.at(0);

    cout << res << endl;
}


Measured memory_bytes: 3620
K,N = map(int,input().split())
num_list = list(map(int, input().split())) 
num_list.sort()
num_list_sort=num_list
maxa_b=0
for i in range(len(num_list_sort)):
  a=num_list_sort[i]
  if(i==len(num_list_sort)-1):
    b=num_list_sort[0]
  else:
    b=num_list_sort[i+1]

  a_b=min(max(a,b)-min(a,b),min(a,b)+K-max(a,b))
  if(maxa_b<=a_b):
    maxa_b=a_b
print(K-maxa_b)

Measured memory_bytes: 77900
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define rep(i, a, N) for(int i = a; i < N; i++)
#define rrep(i, a, N) for(int i = a; i >= N; i--)

int main() {
    ll X, Y;
    cin >> X >> Y;

    ll ans = 1;
    while (X * 2 <= Y) {
        ans++;
        X *= 2;
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
	vector<int> v(5);
	
	for(int i = 0; i < 5; i++) scanf("%d", &v[i]);
	int k;
	scanf("%d", &k);
	
	sort(v.begin(), v.end());
	
	if(v[4] - v[0] > k) printf(":(");
	else printf("Yay!");
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

vector<ll> A;
unordered_map<ll, ll> memo;

ll rec(ll from, ll to, ll turn) {
  ll p =  from * 10000 + to;
  if (memo.count(p)) return memo[p];
  if (from == to) return turn == 0 ? A[from] : -A[from];
  ll foo = rec(from + 1, to, 1 - turn);
  if (turn == 0) foo += A[from];
  else foo -= A[from];
  ll bar = rec(from, to - 1, 1 - turn);
  if (turn == 0) bar += A[to];
  else bar -= A[to];
  ll ans = turn == 0 ? max(foo, bar) : min(foo, bar);
  memo[p] = ans;
  return ans;
}

void solve() {
  ll N;
  cin >> N;
  rep (i, N) {
    ll tmp;
    cin >> tmp;
    A.push_back(tmp);
  }
  cout << rec(0, N-1, 0) << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 239704
import sys
l,r = map(int,input().split())
if l+2019<=r:
  print(0)
  sys.exit()
l=l%2019
r=r%2019
if l>=r:
  print(0)
  sys.exit()

ans=2018
for i in range(l,r):
  if ans == 0:
    break
  for j in range(i+1,r+1):
    ans = min(ans,i*j%2019)
    if ans == 0:
      break
print(ans)

Measured memory_bytes: 64480
import java.util.Scanner;

/**
 * @author 0x306e
 * 
 *         judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1172
 *
 */
public class Main {

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

    int data = sc.nextInt();

    while (data != 0) {
      if (data != 1) {
        System.out.println(cntPrimeNumber(data));
        data = sc.nextInt();
      } else {
        System.out.println(1);
        data = sc.nextInt();
      }
    }

    sc.close();
  }

  public static int cntPrimeNumber(int n) {
    int cnt = 0;
    if (isPrimeNumber(n)) {
      cnt--;
    }

    for (int i = n; i < n * 2; i++) {
      if (isPrimeNumber(i)) {
        cnt++;
      }
    }

    return cnt;
  }

  public static boolean isPrimeNumber(int n) {
    if (n < 2) {
      return false;
    } else if (n == 2) {
      return true;
    } else if ((n % 2) == 0) {
      return false;
    }

    double sqrtNum = Math.sqrt(n);
    for (int i = 3; i <= sqrtNum; i += 2) {
      if ((n % i) == 0) {
        return false;
      }
    }
    return true;
  }

}

Measured memory_bytes: 27504
#include "bits/stdc++.h"
/* Properties of modulo:
	(a/b)%m ,where m is prime  = (a%m) * (b^(m-2))%m
*/
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define ll long long
#define pb push_back
#define gcd __gcd
#define nl cout<<"\n"
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
template<typename T>
#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
// o_set(ll) name ; -- defining ordered set
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set - returns iterator
bool compare(ll a, ll b){
    return a > b;
}
ll power(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
void solve(){
    ll n;
    set<string > a;
    cin >> n;
    while(n--){
        string s;
        cin >> s;
        a.insert(s);
    }
    cout << a.size() << endl;
}
int main(){
    IOS;
    ll T=1;
    //cin>>T;
    ll t=0;
    while(t++<T){
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 19404
import java.util.*;
import java.io.*;

public class Main{
    static int SENTINEL=1000000001;
    static int cnt=0;
    public static void main (String args[]){


      
        //初期処理
        Scanner sc=new Scanner(System.in);
        int n=Integer.parseInt(sc.nextLine());
        String[] sElementArray=sc.nextLine().split(" ");
        int[] array=Arrays.stream(sElementArray).mapToInt(Integer::parseInt).toArray();
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    //    try{
    //         n= Integer.parseInt(br.readLine());
    //         sElementArray = br.readLine().split(" ");
    //         array = Arrays.stream(sElementArray).mapToInt(Integer::parseInt).toArray();
    //     }catch(IOException e){e.printStackTrace();}

            mergeSort(array,n,0,n);
            String[] ss=Arrays.stream(array).mapToObj(Integer::toString).toArray(s->new String[s]);
            String str=String.join(" ",ss);
            System.out.println(str);
            System.out.println(cnt);
        
    }

    public static void mergeSort (int[] array,int n,int left,int right){
        if(left+1<right){
            int mid=(right+left)/2;
            
            mergeSort(array, n, left, mid);
            mergeSort(array, n, mid, right);
            merge(array,n,left,mid,right);
        }
    }
    
    public static void merge(int[] array,int n,int left,int mid,int right){
        int n1=mid-left;
        int n2=right-mid;
        int[] L = new int[n1+1];
        int[] R = new int[n2+1];

        for(int i=0;i<n1;i++){L[i]=array[left+i];}
        for(int i=0;i<n2;i++){R[i]=array[mid+i];}
        L[n1]=SENTINEL;
        R[n2]=SENTINEL;

        int i=0;
        int j=0;
        for(int k=left;k<right;k++){
            if(L[i]<=R[j]){
                array[k]=L[i];
                i++;
            }else if(L[i]>R[j]){
                array[k]=R[j];
                j++;
            }
            cnt++;
        }

    }
}



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

class Main{

		public static void main(String[] args)throws IOException{
			InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			String buf = br.readLine();
			int S = Integer.parseInt(buf);
			int h = S / 3600;
			int m = S % 3600 / 60;
			int s = S % 60;
			System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 24416
#include<iostream>

typedef struct {
  long long int x;
  long long int y;
  long long int z;
} cake;

int main() {
  int N, M;
  std::cin >> N >> M;
  
  cake cakes[N];
  for (int i=0; i<N; i++)
    std::cin >> cakes[i].x >> cakes[i].y >> cakes[i].z;
  
  long long int m[2][2][2][N+1][M+1] = {0};
  const int par[] = {1, -1};
  for (int xn=0; xn<2; xn++)
      for (int yn=0; yn<2; yn++)
          for (int zn=0; zn<2; zn++)
            for (int i=0; i<=N; i++) {
              for (int j=0; j<=M; j++) {
                m[xn][yn][zn][i][j] = 0;
                if (i == 0 || j == 0) continue;
                long long int a = m[xn][yn][zn][i-1][j-0];
                long long int b = m[xn][yn][zn][i-1][j-1]
                  + cakes[i-1].x * par[xn]
                  + cakes[i-1].y * par[yn]
                  + cakes[i-1].z * par[zn];
                m[xn][yn][zn][i][j] = i == j ? b : (a > b ? a : b);
              }
            }
     
  long long int ans = 0;
  for (int xn=0; xn<2; xn++)
    for (int yn=0; yn<2; yn++)
      for (int zn=0; zn<2; zn++) {
        long long int val = m[xn][yn][zn][N][M];
        std::cerr << val << std::endl;
        if (ans < val) ans = val;
      }
  
  std::cout << ans << std::endl;
  return 0;
}

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

using namespace std;

const int M = 200005;

struct node {
    int x, y;
    long long s0, s1;
};

node A[4 * M];
int S[M];
bool rev[4 * M];
int n, q;

node merge(node A, node B) {
    return (node) {A.x + B.x, A.y + B.y, A.s0 + B.s0 + (long long) A.y * B.x, A.s1 + B.s1 + (long long) A.x * B.y};
}

void push_up(int p) {
    A[p] = merge(A[p << 1], A[p << 1 | 1]);
}

void push_down(int p) {
    if (rev[p]) {
        rev[p << 1] ^= true;
        swap(A[p << 1].x, A[p << 1].y);
        swap(A[p << 1].s0, A[p << 1].s1);
        rev[p << 1 | 1] ^= true;
        swap(A[p << 1 | 1].x, A[p << 1 | 1].y);
        swap(A[p << 1 | 1].s0, A[p << 1 | 1].s1);
        rev[p] = false;
    }
}

void build(int p, int l, int r) {
    if (l == r) {
        if(S[l] == 1)
            A[p] = (node){0, 1, 0, 0};
        else
            A[p] = (node){1, 0, 0, 0};
        return;
    }
    int mid = (l + r) >> 1;
    build(p << 1, l, mid);
    build(p << 1 | 1, mid + 1, r);
    push_up(p);
}

void modify(int p, int l, int r, int a, int b) {
    if (l == a && r == b) {
        rev[p] ^= true;
        swap(A[p].x, A[p].y);
        swap(A[p].s0, A[p].s1);
        return;
    }
    push_down(p);
    int mid = (l + r) >> 1;
    if (mid < a)
        modify(p << 1 | 1, mid + 1, r, a, b);
    else if (b <= mid)
        modify(p << 1, l, mid, a, b);
    else {
        modify(p << 1, l, mid, a, mid) ;
        modify(p << 1 | 1, mid + 1, r, mid + 1, b);
    }
    push_up(p);
}

node query(int p, int l, int r, int a, int b) {
    if (l == a && r == b)
        return A[p];
    push_down(p);
    int mid = (l + r) >> 1;
    if (mid < a)
        return query(p << 1 | 1, mid + 1, r, a, b);
    if (b <= mid)
        return query(p << 1, l, mid, a, b);
    return merge(query(p << 1, l, mid, a, mid),query(p << 1 | 1, mid + 1, r, mid + 1, b));
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &S[i]);
    build(1, 1, n);
    while (q-- != 0) {
        int op, l, r;
        scanf("%d%d%d", &op, &l, &r);
        if (op == 1)
            modify(1, 1, n, l, r);
        if (op == 2)
            printf("%lld\n", query(1, 1, n, l, r).s0);
    }
    return 0;
}

Measured memory_bytes: 17416