akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var b=new bool[n+1];
		long p=0;
		for(int i = 1;;i++) {
			p=p*10+7;
			p%=n;
			if(b[p]){
				Console.WriteLine(-1);
				return;
			}
			if(p==0){
				Console.WriteLine(i);
				return;
			}
			b[p]=true;
		}
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 28272
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
	int Q;
	string S;
	cin >> S >> Q;

	int T, F;
	char c;
	int opp = 1;

	vector<char> head, tail;

	for(int i=0;i<Q;i++){
		cin >> T;
		if(T==1){
			opp *= -1;
		}else{
			cin >> F >> c;
			if((opp==1 && F==1) || (opp==-1 && F==2)){
				head.push_back(c);
			}else{
				tail.push_back(c);
			}
		}
	}
	int lhead = head.size();
	int ltail = tail.size();

	if(opp==1){
		for(int i=lhead-1;i>=0;i--){
			cout << head[i];
		}
		cout << S;

		for(int i=0;i<ltail;i++){
			cout << tail[i];
		}
		cout <<endl;
	}else{
		for(int i=ltail-1;i>=0;i--){
			cout << tail[i];
		}
		int l = S.size();
		for(int i=l-1;i>=0;i--){
			cout << S[i];
		}

		for(int i=0;i<lhead;i++){
			cout << head[i];
		}
		cout <<endl;
	}
    
  	return 0;
}




Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))

s = 0
tmp1 = 0
for i in range(N):
  s += A[i]
  if i % 2 == 0:
    if s >= 0:
      tmp1 += s + 1
      s = -1
  else:
    if s <= 0:
      tmp1 += -s + 1
      s = 1
#print(tmp1)

s = 0
tmp2 = 0
for i in range(N):
  s += A[i]
  if i % 2 == 0:
    if s <= 0:
      tmp2 += -s + 1
      s = 1
  else:
    if s >= 0:
      tmp2 += s + 1
      s = -1
#print(tmp2)

print(min(tmp1, tmp2))

Measured memory_bytes: 63216
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

m = [a, b, c, d, e]

sub = [(10 - i%10)%10 for i in m]

x = sub.index(max(sub))

ans = 0

for i in range(5):
    if i == x:
        ans += m[i]
    else:
        ans += m[i] + (10 - m[i]%10)%10

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;

ll gcd( ll a, ll b )
{
    ll temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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

void solve(){

    ll a,b;
    cin >> a >> b;
    cout << a * b / (gcd(a,b)) << endl;

}

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


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(){
  int n, m, i, j;

  while(true){
    cin >> n;
    int top = 1, bottom = 6,flont = 2, back = 5, right = 3, left = 4, temp = 0, score = 1;
    if(!n){ break; }
    for(i = 0; i < n; i++){
      string s;
      cin >> s;
      if(s=="North"){
        temp = top;
        top = flont;
        flont = bottom;
        bottom = back;
        back = temp;
      }
      else if(s == "South"){
        temp = top;
        top = back;
        back = bottom;
        bottom = flont;
        flont = temp;
      }
      else if(s == "East"){
	temp = top;
	top = left;
	left = bottom;
	bottom = right;
	right = temp;
      }
      else if(s == "West"){
	temp = top;
	top = right;
	right = bottom;
	bottom = left;
	left = temp;
      }
      else if(s == "Left"){
        temp = flont;
	flont = left;
	left = back;
	back = right;
	right = temp;
      }
      else if (s == "Right"){
	temp = flont;
	flont = right;
	right = back;
	back = left;
	left = temp;
      }
      score += top;
    }
    printf("%d\n", score);
  }
  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <cstdlib>
#include <tuple>
#include <utility>
#include <string>
#include <array>
#include <vector>
#include <unordered_map>


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

using namespace std;

vector<int> load() {
    int n{0};
    scanf("%d", &n);

    vector<int> b(n);
    repeat(i, n) {
        int tmp{0};
        scanf("%d", &tmp);
        b[i] = tmp;
    }

    return b;
}


void solve(vector<int> b) {
    vector<int> output(0);

    int prev_size = b.size();
    while (0 < b.size()) {
        int j = (int)b.size() - 1;
        while (0 <= j) {
            if (j + 1 == b[j]) {
                output.insert(output.begin(), b[j]);
                b.erase(b.begin() + j);
                j = (int)b.size() - 1;
            } else {
                j--;
            }
        }
        if (prev_size == b.size()) {
            printf("-1\n");
            return;
        }
        prev_size = b.size();
    }

    for(int e : output) {
        printf("%d\n", e);
    }
    return;
}

int main()
{
    vector<int> b = load();

    solve(b);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
 
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x first
#define y second
 
const int MOD = 1e9 + 7;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0}; 
const char dir[] = {'R', 'L', 'D', 'U'};
 
int add(int a, int b){
    a += b;
    if(a >= MOD){
        a -= MOD;
    }
    return a;
}
 
int sub(int a, int b){
    a -= b;
    if(a < 0) a += MOD;
    return a;
}
 
int mult(int a, int b){
    return ((ll) a * b) % MOD;
}
 
void setIO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    freopen((s+".in").c_str(),"r",stdin);
//    freopen((s+".text").c_str(),"w",stdout);
}
 
//ctrl q is comment
//ctrl b is run
//ctrl s is compile
//alt r is search & replace
//alt d is delete a line
 
int main(){
    setIO();
    int n; cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    int cnt = 0;
    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[i] + a[k] > a[j] && a[k] + a[j] > a[i]) {
                    if(a[i] == a[j] || a[j] == a[k] || a[i] == a[k]) continue;
                    ++cnt; 
                }
            }
        }
    }
    cout << cnt << "\n";
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;



int main() {
   // 入力
int N;


// DP テーブル
long long dp[100010][3]; 
  long long a[100010][3]; // 
 cin >> N;
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];

    // 初期化は既に 0 に初期化される
    // 初期条件も既に 0 で OK

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k){
                  continue;
                }
                dp[i+1][k]=max(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    // 答え
    long long res = 0;
    for (int i = 0; i < 3; ++i) res=max(res, dp[N][i]);
    cout << res << endl;
}


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

const int N = 55;

int n, k, a[N];
long long ans = 0;

int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 0; i <= k && i <= n; i++)
        for (int j = 0; j <= i; j++)
        {
            vector<int> ve;
            for (int cur = 1; cur <= j; cur++)
                ve.push_back(a[cur]);
            for (int cur = 1; cur <= i - j; cur++)
                ve.push_back(a[n + 1 - cur]);
            sort(ve.begin(), ve.end(), greater<int>());
            long long tmp = 0;
            for (int cur = 0; cur < k - i && !ve.empty() && ve.back() < 0; cur++)
                ve.pop_back();
            for (int &v : ve)
                tmp += v;
            ans = max(ans, tmp);
        }
    cout << ans;
}


Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main()
    {
        var input = MyUtil.ReadulongArray();
        WriteLine(input[0] - input[1] + 1);

        ReadKey();
    }
}
static class MyUtil
{
    public static ulong[] ReadulongArray()
    {
        return ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }
}


Measured memory_bytes: 13396
#include<iostream>
using namespace std;
#define int long long
signed main(){
    int L,R;
    cin >> L >> R;

        R = min(R , L+2019);
        int ans = 2019;
        for(int i=L;i<=R;i++) {
            for(int j=i+1;j<=R;j++) {
                ans = min(ans , (i*j)%2019);
            }
        }

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
const ll MOD=1e9+7;

int main(){

	ll n, T, A, a=1, b=1, ans;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> T >> A;
		ll m=max((a+T-1)/T, (b+A-1)/A);
		a=m*T;
		b=m*A;
	}
	cout << a+b << endl;

	return 0;
}


Measured memory_bytes: 256
#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 fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<int,int>
#define pid pair<int,double>
#define vi vector<int>
#define ff first
#define ss second
#define int long long int
#define ull unsigned long long
#define PI 3.14159265
#define SIZE 200010
#define MOD 1000000007
#define BIG 998244353
#define s(t) scanf("%d",&t)
#define p(t) printf("%d\n",t)
#define mii map<int,int>
#define tc int tcs;cin>>tcs;while(tcs--)
#define set_bit __builtin_popcount
#define MSET(table,i) memset(table, i, sizeof(table))
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ){stringstream ss; ss<< number; return ss.str();}
int power(int x,int y, int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}



int32_t main()
{
    fast;
    string s,t;
    cin>>s>>t;

    if(t.substr(0,s.length()) == s)
    {
        cout<<"Yes";
    }
    else
    cout<<"No";
    
    
    return 0;
}

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


int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int ans = 0;
  int amari = 0;
  int k = 1;
  int number = a;
  int check[b];
  rep(i, b) {
    check[i] = 0;
  }
  
  while(ans == 0){
    amari = number % b;
    
    k++;
    number = a * k;
    
    if (amari == c){
      ans = 1;
      break;
    }
    
    else
    {
      check[amari] ++;
    }
    
    if(check[amari] > 1){
      ans = 2;
      break;
    }
  }

  if (ans == 1) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3608
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

bool binsearch(int p, int ary[], int first, int last){
    int mid = (first+last)/2;
    if(last < first) return false;
    if(p == ary[mid]) return true;
    else if(p > ary[mid]) return binsearch(p, ary, mid+1, last);
    else return binsearch(p, ary, first, mid-1);
}

int main(){
    int n, t;
    int N[100000], T[50000];
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &N[i]);
    }
    cin >> t;
    for(int i=0; i<t; i++){
        cin >> T[i];
    }

    int cnt = 0;
    for(int i=0; i<t; i++){
        int first = 0, last = n-1;
        int p = T[i];
        while(first <= last){
            int mid = (first+last)/2;
            if(p == N[mid]) {
                cnt++;
                break;
            }
            else if(p > N[mid]){
                first = mid + 1;
            }else{
                last = mid - 1;
            }
        }
    }
    cout << cnt;
    cout << endl;
}


Measured memory_bytes: 3740
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

typedef long long LL;

const int maxn=55;

int n,a,b;
LL c,d;

int main()
{
	scanf("%d %d %d %lld %lld",&n,&a,&b,&c,&d);
	if (a>b) swap(a,b);
	
	int ans=0;
	fo(i,0,n)
	{
		LL ld=c*i, lu=d*i, rd=c*(n-1-i)+b-a, ru=d*(n-1-i)+b-a;
		if (max(ld,rd)<=min(lu,ru)) {printf("YES\n"); return 0;}
	}
	
	printf("NO\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

vector<long long> a;

bool check(long long mid){
    for(auto&& i : a){
        mid -= mid % i;
    }
    return 2 <= mid;
}

bool check2(long long mid){
    for(auto&& i : a){
        mid -= mid % i;
    }
    return mid <= 2;
}

int main(){
    int n;
    cin >> n;
    a.resize(n);
    long long s1 = 0, g1 = 1ll << 60;
    for(auto&& i : a){
        cin >> i;
        g1 = max(g1, i);
    }
    g1 *= 2;
    if(a.back() != 2){
        cout << "-1\n";
        return 0;
    }
    set<long long> s;
    while(abs(s1 - g1) > 1){
        long long mid = (s1 + g1) / 2;
        if(check(mid)){
            g1 = mid;
        }else{
            s1 = mid;
        }
    }
    long long s2 = 0, g2 = 1ll << 60;
    while(abs(s2 - g2) > 1){
        long long mid = (s2 + g2) / 2;
        if(check2(mid)){
            s2 = mid;
        }else{
            g2 = mid;
        }
    }
    if(g1 > s2){
        cout << "-1\n";
        return 0;
    }
    cout << g1 << " " << s2 << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <set>

int main()
{
 std::string str;
 std::cin >> str;
 std::set<char> s;
 for(int i = 0; i < str.size(); i++){
  s.insert(str[i]);
 }
 std::cout << ((s.size() == str.size()) ? "yes" : "no") << std::endl;
 return 0;
}

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

int main(){
	int H,N;
	cin >> H >> N;
//	vector<ll> A(N);
	int A;
	ll sum = 0;
	for(int i = 0;i<N;++i){
		cin >> A;
		sum += A;
		if(sum >= H){
			cout << "Yes" << endl;
			return 0;
		}
	}
	if(sum < H){
		cout << "No" << endl;
		return 0;
	}else{
		cout << "Yes" << endl;
		return 0;
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#define  go return 0
#define pb push_back
#include<utility>
#include <algorithm>
#include<iterator>
#define lp(i, n)  for(int i=0; i<(int)(n); ++i)
#define all(v)   ((v).begin()), ((v).end())
#define sz(v)    ( (int)((v).size()) )
typedef long long ll;
typedef double db;
typedef vector<int> vi;
const int N=1e5+5;
int best = INFINITY;
int arr[N];
int main()
{
    int n,ans=0,arr1[N],arr2[N];
    scanf("%d",&n);
    lp(i,n)
    {
        scanf("%d",arr1+i);
    }
    lp(i,n)
    {
        scanf("%d",arr2+i);
    }
    lp(i,n)
    {
        if(arr1[i]-arr2[i]>0)
            ans+=(arr1[i]-arr2[i]);
    }
    printf("%d",ans);

go;
}


Measured memory_bytes: 256
#include<stdio.h>

int search(int A[],int n,int key){
	int i=0;
	A[n]=key;
	while(A[i] != key)
		i++;
	return i != n;
} 

int main()
{
	int i,n,A[10000+1],q,key,sum=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&A[i]);
		
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&key);
		if(search(A,n,key))
			sum++;
	}
	printf("%d\n",sum);
	
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int buil[4][3][10]={{{}}};
  int b,f,r,v;
  for(int i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    buil[b-1][f-1][r-1]+=v;
  }
  for(int i=0;i<4;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<10;k++){
	cout << " ";
	cout << buil[i][j][k];
      }
      cout << endl;
    }
    if(i<3)cout << "####################" << endl;
  }

  return 0;
}

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

def main():
    N, K, Q = map(int, input().split())
    P = [0] * N

    for i in range(Q):
        A = int(input()) - 1
        P[A] += 1

    for Pi in P:
        Pt = K - Q + Pi
        if Pt > 0:
            print( "Yes" )
        else:
            print( "No" )

if __name__ == "__main__":
    main()


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

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

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    ostr << p.first << " " << p.second;
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
// vll x(n); x[i]=a;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;
typedef vector<vector<ll>> vvll;
// vvll x(m,vi(n)); x[i][j]=a;

#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

int main(){
    string s, t;
    cin >> s;
    cin >> t;
    ll ans = 0;
    REP(i,3) if(s[i] == t[i]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include <cstdlib>
#include <cstdio>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <memory>
#include <numeric>
#include <type_traits>

using namespace std;

#define rep(i,n) for (int (i)=0;(i)<(n);i++)
typedef long long ll;
const int MAXV = 1e9;



int main(){
  int N; cin >> N;
  vector<ll> A(N);
  rep(i,N){
    cin >> A[i];
    A[i] -= (i+1);
  }
  sort(A.begin(), A.end());
  ll ans = 0;
  if (N%2 == 1)
  rep(i,N){
    ans += abs(A[i]-A[N/2]);
  }
  else{
    ll temp = 0;
    rep(i,N){
      temp += abs(A[i]-A[N/2]);
    }
    rep(i,N){
      ans += abs(A[i]-A[N/2+1]);
    }
    if(temp < ans) ans = temp;
  }
  cout << ans;


  return 0;
}

Measured memory_bytes: 1792
#include <cmath>
#include <cstdio>

#define int long long
#define dotimes(i, n) for (int i : range(n))

using namespace std;

class range {
  class iterator {
    int i, s;
  public:
    iterator(int i, int s): i(i), s(s) {}
    int& operator*() {
      return i;
    }
    void operator++() {
      i += s;
    }
    bool operator!=(iterator const& that) {
      return i < that.i;
    }
  };
  iterator b, e;
public:
  range(int e): b({0, 1}), e({e, 1}) {}
  range(int b, int e): b({b, 1}), e({e, 1}) {}
  range(int b, int e, int s): b({b, s}), e({e, s}) {}
  iterator begin() {
    return b;
  }
  iterator end() {
    return e;
  }
};

int rint() {
  int n;
  scanf("%lld", &n);
  return n;
}

void wint(int n) {
  printf("%lld\n", n);
}

template<typename T>
inline int size(T container) {
  return static_cast<int>(container.size());
}

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

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

signed main() {
  double a = rint();
  double b = rint();
  double x = rint();
  double c = x / a;
  double d;
  if (c >= a * b / 2.0)
    d = atan2(b - (2.0 * c / a - b), a) / M_PI * 180;
  else
    d = 90 - atan2(2.0 * c / b, b) / M_PI * 180;
  printf("%.8lf\n", d);
  return 0;
}


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

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

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

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

		if (n <= k + (k - 1)*(x - 1)) {

			ans = min(ans, x);

		}

	}
	
	cout << ans << endl;

	return 0;
}

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

int main() {
  int N;
  double M = 0;
  cin >> N;
  vector<double> A(N);
  for(int i = 0; i < N; i++){
      cin >> A.at(i);
  }
  for (int i = 0; i < N; i++){
      M = M + 1/A.at(i);
  }
  cout << 1/M << endl;
}

Measured memory_bytes: 256
//20181208
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;


int main() {

    int n;

    unsigned long long h,w;

    cin >> n >> h >> w;

    unsigned long long a[n],b[n];

    int count = 0;

    for(int i=0; i<n ;i++){
        cin >> a[i] >> b[i];
        if(a[i] >= h && b[i]>=w) count++;
    }

    cout << count << endl;


    return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
inline ll read(){
	ll x=0,c=getchar(),f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';c=getchar())
	x=(x<<1)+(x<<3)+c-'0';return f?-x:x;
}
inline void write(int x){
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

ll n,m;
ll ans;

int main(){
	n = read(); m = read();
	if(n*2 <= m){
		ans += n;
		m -= n*2;
	}
	else{
		ans += m/2;
		printf("%lld\n", ans);
		return 0;
	}
	ans += m/4;
	printf("%lld\n", ans);
	return 0;
}

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

const int MAX = 200000;
int ans[MAX];
vector<vector<int>> g;

void dfs(int u, int p){
    for(int i = 0; i < g[u].size(); i++){
        int v = g[u][i];
        if(v == p) continue;
        ans[v] += ans[u];
        dfs(v, u);
    }
}

int main(){
    int n, q;
    cin >> n >> q;
    g.resize(n);
    rep(i,n) ans[i] = 0;
    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i,q){
        int p, x;
        cin >> p >> x;
        --p;
        ans[p] += x;
    }
    dfs(0, -1);
    rep(i,n) printf("%d ",ans[i]);
}

Measured memory_bytes: 23424
#include <bits/stdc++.h>
#define ll long long
ll mod=1000000007;
#define vl vector<ll>
#define pl pair<ll,ll>
#define rep(i,b) for(ll i=0;i<b;i++)
#define all(v) (v).begin(),(v).end()
using namespace std;

ll a[20],ans=0;
int main(){
    ll n;
    cin>>n;
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n-2){
        if(a[i]<a[i+1]&&a[i+1]<a[i+2])ans++;
        if(a[i]>a[i+1]&&a[i+1]>a[i+2])ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x1,x2,x3,x4,x5; 
  cin >> x1 >> x2 >> x3 >> x4 >> x5;
  int ans = 0;
  if (x1 == 0) ans =1;
  if (x2 == 0) ans =2;
  if (x3 == 0) ans =3;
  if (x4 == 0) ans =4;
  if (x5 == 0) ans =5;
  cout << ans << endl;
  return 0;
 }

Measured memory_bytes: 3592
function Main (I) {
  I = I.split("\n")[0].split(" ");
  I = parseInt(I[0] + I[1], 10);
  console.log(Math.pow(Math.floor(Math.sqrt(I, 2)), 2) == I ? "Yes" : "No");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 8264
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
	if(y<=0) return 1;
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//------------------------------------------------------------------------------------------

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<<fixed<<setprecision(10);

	ll x;
	cin>>x;
	ll ans=0;
	while(1){
		ans++;
		if((ans*x)%360==0) break;
	}
	cout<<ans;


    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1LL<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1LL<<(i))))
#define setbit1(n,i) ((n)|(1LL<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define DBG(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define EN cout<<"\n"
#define fi first
#define se second
#define PI (acos(-1))
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
#define mod (998244353)
#define asz 300005
template<class T> ostream& operator<<(ostream &s,pair<T,ll> a)
{
    s<<a.fi<<' '<<a.se;
    return s;
}
int main()
{
    fastread;
    ll x;
    cin>>x;
    cout<<(x/500)*1000+(x%500)/5*5<<endl;
}

Measured memory_bytes: 256
t = [["a","f","k","p","u","z"],["b","g","l","q","v","."],["c","h","m","r","w","?"],["d","i","n","s","x","!"],["e","j","o","t","y"," "]]

while 1:
    try:
        s = input()
        ans = ""
        i = 0
        l = len(s)
        
        if l % 2 == 0:
            while i < l:
                i1 = int(s[i + 1]) - 1
                i2 = int(s[i]) - 1
                if (i1 >= 0 and i1 <= 4) and (i2 >= 0 and i2 <= 5):
                    ans += t[i1][i2]
                else:
                    break
                i += 2
        if len(ans) * 2 != l:
            ans = "NA"
        print(ans)
    except:
        break


Measured memory_bytes: 5592
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int INF=1e9;
const long double eps=1e-9;
inline ll read(){
	ll x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
int main(){
	ll i,j,k,m,n;
	n=read();m=read();
	if(n>m)swap(n,m);
	if(n==1 && m==1)return printf("%lld\n",1),0;
	if(n==1)return printf("%lld\n",m-2),0;
	printf("%lld\n",(n-2)*(m-2));
	return 0;
}


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

using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;

    double p;
    if (n % 2 == 0)
    {
        p = 0.5;
    }
    else
    {
        p = ((n + 1) / 2.0) / n;
    }
    
    cout << p << endl;

    return 0;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M;
vector <int> Graph[int(2e5+5)];
int Group[int(2e5+5)];
bool visited[int(2e5+5)];
int cnt[int(2e5+5)];

int DFS(int num){
  visited[num] = true;
  Group[num] = num;
  queue <int> que; que.push(num);
  while (!que.empty()){
    int Q = que.front(); que.pop();
    for (int next : Graph[Q]){
      if (visited[next]) continue;
      visited[next] = true;
      que.push(next);
      Group[next] = Group[Q];
    }
  }
  return 0;
}

int main(){
  cin >> N >> M;
  for (int i = 0; i < M; i++){
    int A, B; cin >> A >> B;
    Graph[A].push_back(B);
    Graph[B].push_back(A);
  }

  for (int i = 1; i <= N; i++){
    if (!visited[i]) DFS(i);
    cnt[Group[i]]++;
  }

  int ans = 0;
  for (int i = 1; i <= N; i++){
    ans = max(ans, cnt[i]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 16064
h, w = map(int, raw_input().split())
S = [[0 if c == "." else 1 for c in raw_input()] for i in range(h)]
L = [[0]*w for i in range(h)]
R = [[0]*w for i in range(h)]
U = [[0]*w for i in range(h)]
D = [[0]*w for i in range(h)]

for i in xrange(h):
    ps = 0
    for j in xrange(w):
        if S[i][j] == 1:
            ps = 0
        else:
            ps += 1
            L[i][j] = ps

for j in xrange(w):
    ps = 0
    for i in xrange(h):
        if S[i][j] == 1:
            ps = 0
        else:
            ps += 1
            U[i][j] = ps

for i in xrange(h-1, -1, -1):
    ps = 0
    for j in xrange(w-1, -1, -1):
        if S[i][j] == 1:
            ps = 0
        else:
            ps += 1
            R[i][j] = ps
for j in xrange(w-1, -1, -1):
    ps = 0
    for i in xrange(h-1, -1, -1):
        if S[i][j] == 1:
            ps = 0
        else:
            ps += 1
            D[i][j] = ps
maxLight = 0
for i in xrange(h):
    for j in xrange(w):
        maxLight = max(maxLight, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)
print maxLight


Measured memory_bytes: 192052
s=input()
n=len(s)

ans = 0

for bit in range(1 << 3):
  f = s[0]

  for i in range(3):
    if bit & (1 << i):
      f += '+'
    else:
      f += '-'
    
    f += s[i + 1]

  if eval(f) == 7:
    ans = f + '=7'

print(ans)

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

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
typedef pair<int, int> P;

template<typename T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return (a * b) / gcd(a, b);
}

int main()
{
    int N; cin >> N;
    string s, t; cin >> s >> t;
    if (s == t) {
        cout << N << endl;
        exit(0);
    }

    int same = 0;
    for (int i = 0; i < N ; i++) {
        if (s.substr(i, N - i) == t.substr(0, N - i)) {
            same = N - i;
            break;
        }
    }
    int ans = N * 2 - same;
    cout << ans << endl;
}

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

n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

div = make_divisors(n)

ans = 10000000000

for i in range(len(div)):
    length = max(len(str(div[i])),len(str(int(n/div[i]))))
    ans = min(length,ans)

print(ans)

Measured memory_bytes: 3064
import java.util.*;
import static java.lang.System.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		if ( x < a) out.println(0);
		else out.println(10);

	}
}

Measured memory_bytes: 23636
n,m = map(int, input().split())

if n == 1 or n == 0:
  a = 0
else:
  a = int(n*(n-1)/2)

if m == 1 or m == 0:
  b = 0
else:
  b = int(m*(m-1)/2)

print(a+b)

Measured memory_bytes: 9108
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str[500005];

void solve()
{
    int n;
    scanf("%d%s", &n, str);
    set<int> z[26];
    int i;
    for(i=0; i<n; i++) {
        int tmp=str[i]-'a';
        z[tmp].insert(i);
    }
    int Q;
    scanf("%d", &Q);
    for(i=0; i<Q; i++) {
        int flag;
        scanf("%d", &flag);
        if(flag==1) {
            int a; char str0[3]={0};
            scanf("%d%s", &a, str0); a--;
            int tmp=str0[0]-'a';
            int prev=str[a]-'a';
            z[prev].erase(a);
            z[tmp].insert(a);
            str[a]='a'+tmp;
        }
        else {
            int a,b;
            scanf("%d%d", &a, &b); a--;
            int cnt=0;
            int k;
            for(k=0; k<26; k++) {
                if(z[k].lower_bound(b)!=z[k].lower_bound(a)) cnt++;
            }
            printf("%d\n", cnt);
        
        }

    }


    return;
}


int main(int argc, char* argv[])
{
#if 1
	solve();
#else
	int T; scanf("%d", &T);
	while (T--) {
		solve();
	}
#endif
	return 0;
}


Measured memory_bytes: 24192
#include<stdio.h>

int main(void){
  int n, m;
  int a[10000];

  scanf("%d %d", &n, &m);
  for(int i=0;i<m;i++){
    scanf("%d", &a[i]);
    n -= a[i];
  }
  if(n<0){
    n=-1;
  }
  printf("%d\n", n);
  return 0;
}


Measured memory_bytes: 1768
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int N = in.nextInt();
			int M = in.nextInt();
			int[] a = new int[M];
			int[] b = new int[M];
			for(int i = 0; i < M; i++) {
				a[i] = in.nextInt();
				b[i] = in.nextInt();
			}
			for(int i = 1; i <= N; i++) {
				int ans = 0;
				for(int j = 0; j < M; j++) {
					if(a[j] == i || b[j] == i) {
						ans++;
					}
				}
				out.println(ans);
			}
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


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

int main(){
  int n,l;
  cin>>n>>l;
  int ans=0;
  int cnt=0;
  if(l>=0){
    for(int i=l+1;cnt<n-1;i++){
      ans+=i;
      cnt++;
    }
  }else{
    if((n+l)>0){
      for(int i=l;cnt<n;i++){
        ans+=i;
        cnt++;
      }
      
    }else{
      for(int i=l;cnt<n-1;i++){
        ans+=i;
        cnt++;
      }
    }

    
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int gcd(int m,int n){
    if(0 == n)return m;
    return gcd(n,m%n);
}
int main(){
    int A,B,C;
    cin >> A >> B >> C;
    cout<<(A/gcd(A,B))*(B/gcd(A,B))*C<<endl;
}



Measured memory_bytes: 3096
//https://atcoder.jp/contests/abc096/tasks/abc096_d
//D - Five, Five Everywhere
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}

auto Eratosthenes(const int n)
{
    vector<ll> result;
    vector<bool> is_prime(n+1,true); //trueで初期化
    for(ll i = 2; i <= n; ++i){
        if (is_prime.at(i)) {
            for(ll j = 2 * i; j <= n; j += i){
                is_prime[ j ] = false;
            }
            result.emplace_back( i );
        }
    }
    return result;
}

int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N; cin>>N;
    auto prime_tbl = Eratosthenes(55555);
    //4n+1
    vector<ll> ans;
    for(const auto& p:prime_tbl){
        if(p%5==1){ //5で割って1余る素数
            ans.push_back(p);
            if(ans.size()>=N) break;
        }
    }
    FOR(i,0,ans.size()){
        if(i!=0) cout<<" ";
        cout<<ans[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int A[100010];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),K=gi(),qaq=0,p;
	for(int i=1;i<=n;++i){
		A[i]=gi();
		if(i&&A[i]+A[i-1]>qaq)qaq=A[i]+A[i-1],p=i-1;
	}
	if(qaq<K)return puts("Impossible"),0;
	puts("Possible");
	for(int i=1;i<p;++i)printf("%d\n",i);
	for(int i=n-1;i>=p;--i)printf("%d\n",i);
	return 0;
}


Measured memory_bytes: 1152
#include <stdio.h>
int main(void){
  int i,N,max=0,max_i=0,sum = 0;
  scanf("%d",&N);
  long int a[N];
  
  for(i=0;i<N;i++){
    scanf("%ld",&a[i]);
    if(max < a[i]){
      sum += max;
      max = a[i];
      max_i = i;
    }else{
      sum += a[i];
    } 
  }
  if(sum > a[max_i]){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}
  


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

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

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	double a, b, x;
	cin >> a >> b >> x;

	double ans;
	if (x / a >= a * b / 2) {
		double h = (2 * (a * b - (x / a))) / a;
		ans = atan2(h, a);
	}
	else {
		double h = (2 * x) / (a * b);
		ans = atan2(b, h);
	}

	ans = ans / (2 * acos(-1)) * 360;
	printf("%.10f\n", ans);
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
	int A,B;
	
	scanf("%d",&A);
	scanf("%d",&B);
	
	if(A == 3){
		if(B == 2){
			printf("1\n");
		}else if(B == 1){
			printf("2\n");
		}
	}else if(A == 2){
		if(B == 3){
			printf("1\n");
		}else if(B == 1){
			printf("3\n");
		}
	}else{
		if(B == 3){
			printf("2\n");
		}else if(B == 2){
			printf("3\n");
		}
	}
	return 0;
}

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

int main(void){
   string s;
   cin>>s;
   map<char,int> dict;
   map<char,bool> judge;
   for(int i=0;i<s.size();i++){
      if(s[i]=='A'&&judge[s[i]]==true) continue;
      dict[s[i]]=i+1;
      judge[s[i]]=true;
   }
   cout<<dict['Z']-dict['A']+1<<endl;
   return 0;
}



Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        long a = long.Parse(input[0]);
        long b = long.Parse(input[1]);
        long c = long.Parse(input[2]);
        long d = long.Parse(input[3]);*/
//        string temp = ReadLine();
        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        int c = int.Parse(ReadLine());
//        int d = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
//        string c = ReadLine();
        string[] input = ReadLine().Split(' ');
//        string ko = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        int max = 0;
        int min = 9999;
        for(int i=0;i<a;i++){
            int temp = int.Parse(input[i]);
            max = Max(max,temp);
            min = Min(min,temp);
        }
        WriteLine(max-min);
    }
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(x) ll t; cin >> t; x.push_back(t);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<string> vvs;

const static ll MOD = 1e9 + 7;

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

    ll h[100010];
    ll dp[100010];
    NREP() {
        cin >> h[i];
        dp[i] = LONG_LONG_MAX;
    }

    dp[0] = 0;

    NREP() {
        if (i == 0) continue;
        for (int j = 1; j <= k; ++j) {
            if (i - j < 0) break;
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
        }
    }

    MSG(dp[n - 1])
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define n 500000
#define mem(arr) memset(arr, 0, sizeof(arr))
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
void solve();
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int times = 1;
//	cin >> times;
	for(int i=0; i<times; i++)
	{
		solve();
		cout << '\n';
	}
	return 0;
}

int a, b, c, d, e, f, g, h;
int arr[n + 50], arr1[n + 50], arr2[n + 50];

//type here

void solve()
{
	cin >> a;
	int mi = 0, cnt = 0;
	for(int i=0; i<a; i++)
	{
		int tmp; cin >> tmp;
		if(tmp >= mi)
		{
			mi = tmp;
			cnt ++;
		}
	}
	cout << cnt;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while( scan.hasNextInt() ){
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c;
            int i = 1;
            c =a+b;
            while(c/10 > 0){
                c=c/10;
                i++;
                
            }
             System.out.println(i);
        }
    }
}



Measured memory_bytes: 26648