akhauriyash/Code-Regression huggingface dataset:
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define unmap unordered_map
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define sh short int
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const int inf = 1e9;
const ll mod = 998244353;

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


Measured memory_bytes: 3596
#include <stdio.h>

int main() {
	
	char S[2][2];
	for(int i=0; i<3; i++){
		for(int j=0; j<3; j++){
		scanf("%c", &S[i][j]);	
		}
		getchar();
	}
	printf("%c%c%c\n", S[0][0], S[1][1], S[2][2]);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
vector<int> to[200005];
vector<int> ans;
void dfs(int v,int p=-1){ //v:現在　p　どこからきたか
    for(auto i:to[v]){
        if(i==p) continue;
        ans[i] += ans[v];
        dfs(i,v);
    }
}
int main(){
   int n,q;
   cin >> n >> q;
   for(int i=0;i<n-1;i++){
       int a,b;
       cin >> a >> b;
       a--;b--;
       to[a].push_back(b);
       to[b].push_back(a);
   }
   ans.resize(n);
   for(int i=0;i<q;i++){
       int p,x;
       cin >> p >> x;
       p--;
       ans[p] += x;
   }
   dfs(0);
   for(int i=0;i<n;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 23424
import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		int n = sc.nextInt();

		while (n-- != 0) {
			double x1 = sc.nextDouble();
			double y1 = sc.nextDouble();
			double x2 = sc.nextDouble();
			double y2 = sc.nextDouble();
			double x3 = sc.nextDouble();
			double y3 = sc.nextDouble();
			double x4 = sc.nextDouble();
			double y4 = sc.nextDouble();
			double dx1 = x1 - x2;
			double dy1 = y1 - y2;
			double dx2 = x3 - x4;
			double dy2 = y3 - y4;
			ln((Math.abs(dx1 * dy2 - dx2 * dy1) < Double.MIN_NORMAL) ? "YES"
					: "NO");
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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; }

int X,cnt;

int main(){
    cin>>X;
    for(int i=1;X>0;i++){
        X-=i;
        cnt++;
    }
    out(cnt);
}


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

int max(int a, int b){
  return a >= b ? a : b;
}
int min(int a, int b){
  return b >= a ? a : b;
}
int sei(int a){
  return a>0 ? a : 0;
}
long int power(int a,int b){
  long int count=1;
  for(int i=0;i<b;i++){
    count *= 2;
  }
  return count;
}
int factorial(int n) {
    if (n > 0) return n*factorial(n - 1);
		else return 1;
}
int compare_up_int(const void *a, const void *b){
   return *(int*)a - *(int*)b;
}
int compare_down_int(const void *a, const void *b){
   return *(int*)b - *(int*)a;
}
int euclid(int a, int b){
  if(a < b){int tmp = a;a = b;b = tmp;}
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  float a,b;
  scanf("%f %f",&a,&b);
  printf("%d",(int)ceil((a+b)/2));
  return 0;
}


Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
one=0
four=0
two=0
for i in range(n):
    cnt=0
    num=a[i]
    while num%2==0:
        cnt+=1
        num//=2
    if cnt==0:
        pin=1
    elif cnt==1:
        pin=2
    else:
        pin=4
    if pin==1:
        one+=1
    elif pin==4:
        four+=1
    else:
        two+=1
if two>0:
    one+=1
if one<=four+1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 20112
#include<iostream>
#include<algorithm>
using namespace std;
string result(long long num)
{
    string res;
    int temp=0;
    long long number=num;
    while(num!=0)
    {
        temp=num%-2;
        if(temp<0) 
        {
            temp=temp+2;
            num=num/-2+1;
        }
        else
        {
            num=num/-2;
        }
        res.append(to_string(temp));
    }
    reverse(res.begin(),res.end());
    return res;
}
int main()
{
    long long num;
    while(cin>>num)
    {
        if(num==0) cout<<0<<endl;
        else cout<<result(num)<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+100;
const int mod = 1e9+7;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
inline bool read(ll &num) {
    char in;bool IsN=false;
    in=getchar();
    if(in==EOF) return false;
    while(in!='-'&&(in<'0'||in>'9')) in=getchar();
    if(in=='-'){ IsN=true;num=0;}
    else num=in-'0';
    while(in=getchar(),in>='0'&&in<='9'){
            num*=10,num+=in-'0';
    } 
    if(IsN) num=-num;
    return true;
}
int L[N],R[N],a[N];
int main(){
    //freopen("1.in", "r", stdin);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    int ans=0;
    int cnt=1;
    int now=a[1];
    for(int i=2;i<=n;i++){
        if(a[i]<=now){
            cnt++;
            now=a[i];
        }
        else{
            ans=max(ans,cnt);
            cnt=1;
            now=a[i];
        }
    }
    ans=max(ans,cnt);
    cout<<ans-1<<endl;
    return 0;
}

Measured memory_bytes: 768
/******************************************
* AUTHOR : Dharmveer Jakhar *
* Handle : dvjakhar *
* INSTITUTION : IIT (BHU) Varanasi *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define N 100005
#define mod 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define debug(x) cout<<(#x)<<" is "<<(x)<<endl
#define lb(arr,n,x) lower_bound(arr,arr+n,x)-arr
#define ub(arr,n,x) upper_bound(arr,arr+n,x)-arr

typedef long long ll;
//Calculation of (x^y)%mm
ll mod_exp(ll x,ll y,ll mm)
{
    if(y==0)
        return(1);
    else if(y%2==0)
        return(mod_exp((x*x)%mm,y/2,mm));
    else
        return((x*mod_exp((x*x)%mm,(y-1)/2,mm))%mm);
}
int binary_search(int array[],int n,int x)
{
	int a = 0, b = n-1;
while (a <= b) {
int k = (a+b)/2;
if (array[k] == x) {
	return k;
// x found at index k
}
if (array[k] > x) b = k-1;
else a = k+1;
}
}



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    int q;
    cin >> s >> q;
    vector<char> ff, ss;
    int rev = 0;
    while (q--) {
        int typ;
        cin >> typ;
        if (typ == 1) {
            rev ^= 1;
        } else {
            int f;
            char c;
            cin >> f >> c;
            --f;
            if (rev) {
                f ^= 1;
            }
            if (f == 0) {
                ff.emplace_back(c);
            } else {
                ss.emplace_back(c);
            }
        }
    }
    if (rev) {
        swap(ff, ss);
        reverse(s.begin(), s.end());
    }
    reverse(ff.begin(), ff.end());
    for (auto &ch : ff) {
        cout << ch;
    }
    cout << s;
    for (auto &ch : ss) {
        cout << ch;
    }
    cout << "\n";
    return 0;
}



Measured memory_bytes: 976
from itertools import accumulate
N, K = list(map(int, input().split()))
C = list(map(int, input().split()))
A=[]
for i in range(N):
  A.append((C[i]+1)/2)
B = [0] + A
B = list(accumulate(B))

ans = []
for i in range(N-K+1):
    ans.append(B[i+K]-B[i])
print(max(ans))

Measured memory_bytes: 30276
#include<iostream>

using namespace std;

int main( )
{
	int m, f, r;
	
	while( true ) {
		cin>>m>>f>>r;
		if( -1 == m &&  -1 == f && -1 == r ) { break; }
		
		int sum = m + f;
		if( -1 == m || -1 == f ) {
			cout<<"F"<<endl;
		} else if(  80 <= sum ) {
			cout<<"A"<<endl;
		} else  if( 65 <= sum ) {
			cout<<"B"<<endl;
		} else if( 50 <= sum ) {
			cout<<"C"<<endl;
		} else if( 30 <= sum ) {
			if( 50 <= r ) {
				cout<<"C"<<endl;
			} else {
				cout<<"D"<<endl;
			}
		} else {
			cout<<"F"<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n,m,k,a,b,c;
		String s;
		int min=1000;
		s=sc.next();
		for(int i=0;i<s.length()-2;i++) {
			min=Math.min(min,Math.abs(753-Integer.parseInt(s.substring(i, i+3))));
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 21844
#include <cstdio>

int
main(void)
{
  int s_in, h, m, s;
  scanf("%d", &s_in);

  h = s_in / 3600;
  m = s_in / 60 - h * 60;
  s = s_in - h * 3600 - m * 60;

  printf("%d:%d:%d\n", h, m, s);

  return 0;
}



Measured memory_bytes: 2712
//#pragma comment(linker, "/STACK:134217728")

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;

typedef long long Int;
typedef pair<int,int> PII;
typedef vector<int> VInt;

#define FOR(i, a, b) for(i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(i = (a) - 1; i >= (b); --i)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair

int L[1 << 18];
int C[1 << 18][32];
vector<pair<string, char>> V;

Int g(int d, int f, int t)
{
    Int res = 0;
    VInt v;
    while(f < t && L[f] == d)
    {
        v.push_back(V[f].second - 'a');
        ++f;
    }
    int i, j;
    FOR(i, f, t)
    for(int c : v)
        if(C[i][c] > 0)
            ++res;
    
    FOR(i, f + 1, t + 1)
        if(i == t || V[i].first[d] != V[f].first[d])
        {
            int t = V[f].first[d] - 'a';
            FOR(j, f, i) --C[j][t];
            res += g(d + 1, f, i);
            FOR(j, f, i) ++C[j][t];
            f = i;
        }
    
    return res;
}

void solve(int test)
{
    int n;
    cin >> n;
    V.resize(n);
    int i, j;
    FOR(i, 0, n)
    {
        string s;
        cin >> s;
        V[i].second = s.front();
        reverse(ALL(s));
        s.pop_back();
        V[i].first = s;
    }
    sort(ALL(V));
    CLEAR(C, 0);
    FOR(i, 0, n)
    {
        L[i] = SIZE(V[i].first);
        ++C[i][V[i].second - 'a'];
        FOR(j, 0, L[i])
            ++C[i][V[i].first[j] - 'a'];
    }
    cout << g(0, 0, n) << endl;
}

int main()
{
    int T = 1, t;
    //cin >> T;
    FOR(t, 0, T)
    {
        solve(t);
    }
    return 0;
}


Measured memory_bytes: 173816
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	int a, b ,c;
	int ans = 1;
	cin >> a >> b >> c;
	if( a != b ) ans++;
	if( a != c && b != c) ans++;
	cout << ans <<endl;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())

m = max(a, max(b, c))

if (3 * m - (a + b + c)) % 2 == 0:
    print((3 * m - (a + b + c)) // 2)
else:
    print((3 * (m + 1) - (a + b + c)) // 2)


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<assert.h>

using namespace std;

int main(void) {
    int i,j,k;
    int h,w,n;
    int height=0;
    int counter=0;
    cin >> h >> w;
    cin >> n;
    int a[n];
    int memo[w];
    for (i=0; i<n; i++) {
        cin >> a[i];
    }
    for (i=0; i<n; i++) {
        for (j=0; j<a[i]; j++) {
            if (height%2 == 0) {
                cout << i+1 << " ";
            } else {
                memo[counter%w] = i+1;
                if (counter%w == w-1) {
                    for (k=w-1; k>=0; k--) {
                        cout << memo[k] << " ";
                    }
                }
            }
            if (counter % w == w-1) {
                cout << endl;
                height++;
            }
            counter++;
        }
    }
    return 0;
}


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

const long long INF = 1e9;

long long dp[10010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, n;
    cin >> h >> n;
    for(int i = 0; i < 10010; i++){
    	dp[i] = INF;
    }
    dp[0] = 0;
    for(int i = 0; i < n; i++){
    	int a, b;
    	cin >> a >> b;
    	for(int j = 0; j < 10010; j++){
    		int id = max(0, j-a);
    		dp[j] = min(dp[j], dp[id]+b);
    	}
    }
    cout << dp[h] << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "YES" << endl;}
void no(){ cout << "NO" << endl;}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();

    ll a, v ;
    cin >> a >> v ;
    ll b, w ;
    cin >> b >> w ;
    ll t ;
    cin >> t ;
    if(a<b){
        if(a+v*t>=b+w*t){
            yes() ;
        }
        else{
            no() ;
        }
    }
    else{
        if(b-w*t>=a-v*t){
            yes() ;
        }
        else{
            no() ;
        }
    }



    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
using namespace std;


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

	if(a > b){
		swap(a,b);
	}

	if((b-a)%2){
		cout << "IMPOSSIBLE" << endl;
	}else{
		cout << a + (b-a)/2 << endl;
	}

	return 0;
}

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

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

    int n, k, b; cin >> n >> k;
    vector<int> s(n, 0);
    vector<int> a(110, 0);

    int ans = 0;

    for (int i=0; i<k; i++) {
        
        int d; cin >> d;

        for (int i=0; i<d; i++) {
            int num; cin >> num;
            a[num] = 1;
        }
    }

    for (int i=1; i<=n; i++) if (a[i]==0) ans += 1;

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

Measured memory_bytes: 3628
N = int(input())
L = list(map(int, input().split()))
L.sort()

tri_list = []

ans = 0
for i in range(0,len(L)):
  for j in range(i,len(L)):
    for k in range(j,len(L)):
      if L[i] != L[j] and L[j] != L[k] and (L[i] + L[j]) > L[k]:
        ans+=1
print(ans)

Measured memory_bytes: 9184
#include <stdio.h>
#include<vector>
#include<iostream>
#include<string>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<cmath>
#include<algorithm>
#include<numeric>
#define LONG long long int
using namespace std;
int main() {
	int n;
	string s;
	cin >> n;
	cin >> s;
	if (n % 2 == 0)
	{
		for (int i = 0; i < n / 2; i++)
		{
			if (s[i] != s[i + n / 2])
			{
				break;
			}
			if (i + n / 2 == n - 1) { cout << "Yes" << endl; return 0; }
		}
	}
	cout << "No" << endl;
	


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll rec(ll a,ll b){
  if(b==0) return 0;
  if(a<b) return rec(b,a);
  return b*(a/b)+rec(b,a%b);
}

int main(){
  ll n,x;
  cin>>n>>x;
  cout<<3*rec(x,n-x)<<endl;
  return 0;
}

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

#define ll long long

ll knapsackBottomUp(const vector<int> &wts, const vector<int> &prices,int n,int w){
    vector< vector<ll> > dp(n+1, vector<ll>(w+1));

    for(int i=0;i<=n;i++){
        for(int j=0;j<=w;j++){
            if(i==0 || w==0){
                dp[i][j] = 0;
            }
            else {
                ll include = 0 ,exclude = 0;
                if(wts[i-1]<=j){
                    include = prices[i-1] + dp[i-1][j-wts[i-1]] ; 
                }

                exclude = dp[i-1][j];

                dp[i][j] = max(include,exclude) ; 
            }
        }
    }

    return dp[n][w];
}

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

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


    cout << knapsackBottomUp(w, price, n , W) << "\n";


    return 0;
}

Measured memory_bytes: 80256
#include <iostream>
#include <vector>
#include <map>

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int K, X; cin >> K >> X;
    if (500*K >= X) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();
        String s=sc.nextString();
        int a=Integer.valueOf(s.substring(0, 2)); 
        int b=Integer.valueOf(s.substring(2, 4)); 
        String ans="";
        String A="MM",B=A;
        if(a==0 || a>12)A="YY";
        if(b==0 || b>12)B="YY";
        ans=A+B;
        if(ans.equals("YYYY")) {
        	ans="NA";
        }else if(ans.equals("MMMM"))
        ans ="AMBIGUOUS";
        
        out.println(ans);
        out.flush();
    }
    



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int id,T;
//    P(int id, int T) {
//        this.id=id;
//        this.T=T;
//    }
//    public int compareTo(P p){
//        return id-p.id; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

int main() {
  int a, b, c, d, x;
  cin >> x;
  a = x / 1000;
  b = (x % 1000) / 100;
  c = (x % 100) / 10;
  d = x % 10;
  if (((a == b) && (b == c)) || ((b == c) && (c == d))){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i,s.size()){
        if(s[i] != t[i]) ++ans;
    }
    cout << ans << endl;
    return 0;
}


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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

int main() {
  string s;
  cin >> s;

  // string 版
  std::string str = s;
  std::smatch smatch;
  if (std::regex_search(str, smatch, std::regex("[a-z]"))) {
    ANS('a');
  }else{
    ANS('A');
  }
  return 0;
}


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

using namespace std;

template<typename T>void read(T&x){x=0;int fl=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')
fl=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}x*=fl;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t);read(args...);}

typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define mp(x, y) make_pair(x, y)
#define pb(x) emplace_back(x)

int n, m, a;

int main(){
	read(n, m);
	for(int i = 1; i <= m; i++){
		read(a);
		n -= a;
	}
	if(n < 0)	puts("-1");
	else	printf("%d\n", n);
	return 0;
}

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

using namespace std;

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

  string s;
  cin >> s;
  string stk;
  for (auto &x : s) {
    if (x == 'T' && (!stk.empty() && stk.back() == 'S')) {
      stk.pop_back();
    } else {
      stk += x;
    }
  }
  cout << (int) stk.size() << "\n";
}


Measured memory_bytes: 916
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
s=input()
ans=""

for i in range(len(s)):
    tmp=n
    if ord(s[i])+n>ord("Z"):
        tmp=ord(s[i])+n-ord("Z")
        ans+=chr(tmp+ord("A")-1)
        continue
    ans+=chr(ord(s[i])+tmp)
print(ans)

Measured memory_bytes: 41580
from math import atan2
n = input()
p = [map(int, raw_input().split()) for i in xrange(n)]
for t in xrange(input()):
    x, y = map(int, raw_input().split())

    inline = 0
    theta = 0.
    for i in xrange(n):
        x0 = p[i-1][0] - x
        y0 = p[i-1][1] - y
        x1 = p[i][0] - x
        y1 = p[i][1] - y

        if x0*y1 == y0*x1 and x0*x1+y0*y1 <= 0:
            inline = 1
            break
        theta += atan2(x0*y1-y0*x1, x0*x1+y0*y1)
    if inline:
        print 1
    elif theta > 1:
        print 2
    else:
        print 0

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

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
#define debug( fmt, ... ) \
        fprintf( stderr, \
                  fmt "\n", \
                  ##__VA_ARGS__ \
        )

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1 << 29;
const double EPS = 1e-10;

double zero(double d) {
    return d < EPS ? 0.0 : d;
}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
    os << '[';
    rep(i, a.size()) os << (i ? " " : "") << a[i];
    return os << ']';
}

string toString(int i) {
    stringstream ss;
    ss << i;
    return ss.str();
}

const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
    ll res = 1ll;
    ll x = a;
    while (k != 0) {
        if ((k & 1) == 1)
            res = (res * x) % M;
        x = (x * x) % M;
        k >>= 1;
    }
    return res;
}

struct prepare {
	prepare() {
	    cout.setf(ios::fixed, ios::floatfield);
	    cout.precision(8);
	    ios_base::sync_with_stdio(false);
	}
} _prepare;

int main() {
	int N;
    cin >> N;
    vi a(N);
    rep(i, N)
        cin >> a[i];

    ll res = 1ll<<60;

    rep(q, 300) {
        int v = q - 150;
        ll tmp = 0;
        rep(i, N) {
            int t = (v-a[i])*(v-a[i]);
            tmp += t;
        }
        chmin(res, tmp);
    }

    cout << res << endl;
	
    return 0;
}

Measured memory_bytes: 764
#include<stdio.h>

int main(void) {

	int multiple = 0, flag = 0;
	int smallnum, largenum;
  
	scanf("%d",&multiple);
	scanf("%d", &smallnum);
	scanf("%d", &largenum);

	for (int i = smallnum; i < (largenum + 1); i++) {
		if ((i % multiple) == 0) {
			flag++;
			break;
		}
	}

	if (flag == 0) {
		printf("NG\n");
	}
	else if (flag >= 1) {
		printf("OK\n");
	}

	return 0;
}

Measured memory_bytes: 1616
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <queue>
#include <cctype>
#include <climits>
#include <stack>
#include <map>
#include <cstring>
#include <cassert>
 
using namespace std;

int main(){

    long long k;
    cin>>k;

    vector<long long> a(k);
    for(int i=0;i<k;i++) cin>>a[i];
    
    long long l=2,r=2;
    while(k--){
        long long X=((l+a[k]-1)/a[k])*a[k];
        long long Y=(r/a[k])*a[k];
        if(l<=X && X<=r && l<=Y && Y<=r){
            l=X;
            r=Y+a[k]-1;
        }else{
            cout<<-1<<endl;
            return 0;
        }
    }

    cout<<l<<" "<<r<<endl;


	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
 
int main(void)
 
{
 
 
int a,b,c;
 
 
scanf("%d",&a);
 
 
scanf("%d",&b);
 
 
scanf("%d",&c);
 
 
if(a<b&&b<c)
 
 
{
 
 
printf("Yes\n");
 
 
}
 
 
else
 
 
{
 
 
printf("No\n");
 
 
}
 
 
return 0;
 
 
}

Measured memory_bytes: 580
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();

    if (a <= 8 && b <= 8) {
      System.out.println("Yay!");
    } else {
      System.out.println(":(");
    }
  }
}


Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int a, b, k; cin >> a >> b >> k;
    int cnt=0;
    for(int i=min(a, b); i>=1; --i){
        if(a%i==0 && b%i==0) ++cnt;
        if(cnt==k){
            cout << i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define INF INT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
 
typedef long long ll;
typedef std::pair<int,int> pii;
 
using namespace std;
 
ll max_v = 10000;

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

    string s,t;
    cin >> s >> t;
    vector<vector<ll>> dp(3005, vector<ll>(3005,0)),memo(3005, vector<ll>(3005,-1));

    for(int i = 0;i < s.size();i++){
        for(int j = 0;j < t.size();j++){
            if(s[i] == t[j]){
                dp[i+1][j+1] = dp[i][j] + 1;
                memo[i+1][j+1] = i*t.size() + j;
            }else{
                dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
                if(dp[i+1][j] > dp[i][j+1]){
                    memo[i+1][j+1] = memo[i+1][j];
                }else{
                    memo[i+1][j+1] = memo[i][j+1];
                }
            }
            // cout << memo[i+1][j+1] << endl;
        }
    }

    // cout << dp[s.size()][t.size()] << endl;
    string ans = "";    
    ll index_s = s.size(),index_t = t.size();
    while(index_s >= 0 && index_t >= 0 && memo[index_s][index_t] >= 0){
        ll ss = memo[index_s][index_t] / t.size();
        ll tt = memo[index_s][index_t] % t.size();
        // cout << "ss:" << ss << " tt:" << tt << " memo:" << memo[ss][tt]<< endl;
        ans = s[ss] + ans;
        index_s = ss,index_t = tt;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 141568
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long 
#define pb push_back
#define fo(i,N) for(int i = 0 ; i < N ; i++)
#define foo(i,x,N) for (int i = x; i < N ; i++)
#define fill(a,val) memset(a,val,sizeof(a))
#define fastio()  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define ff first
#define ss second
#define MAX 1234567
#define pii pair<int,int> 
#define pll pair<ll,ll> 
#define inf 1e9+1
#define all(a) a.begin(),a.end()


vector <int> p(301);
int n,k;

string solve()
{
  int dp[k+1]={0};

  for(int i = 1; i <= k ; i++)
  {
    for (int j = 0 ; j < n ; j++)
    {
      if ( p[j] > i)
        continue;
      if ( dp[i-p[j]] == 0)
        dp[i] = 1;
    }
  }

  return dp[k] ? "First" : "Second";

}

int main()
{  
   cin >> n >> k;
   
   fo(i,n)
   { 
    cin >> p[i];
   }

  cout << solve() << endl;
  
}



Measured memory_bytes: 640
import java.util.*;
 
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] l = new int[n];
    for(int i=0; i<n; i++){
      l[i] = sc.nextInt();
    }
    Arrays.sort(l);
    int count = 0;
    int sum = 0;
    while(count < k){
      sum += l[l.length-1-count];
      count++;
    }
    System.out.println(sum);

    sc.close();
  }
}

Measured memory_bytes: 21332
import bisect
A,B,Q=map(int,input().split())
INF=10**18
S=[-INF]+[int(input()) for i in range(A)]+[INF]
T=[-INF]+[int(input()) for i in range(B)]+[INF]
for q in range(Q):
    x=int(input())
    i=bisect.bisect_left(S,x)
    j=bisect.bisect_left(T,x)
    d=INF
    for s in [S[i-1],S[i]]:
        for t in [T[j-1],T[j]]:
            d1=abs(x-s)+abs(s-t)
            d2=abs(x-t)+abs(s-t)
            d=min(d,d1,d2)
    print(d)

Measured memory_bytes: 12804
#include<bits/stdc++.h>
#define see(x) cerr<<#x<<"="<<x<<endl;
using namespace std;
typedef long long ll;
const ll mod= 998244353;
ll fast(ll x,ll n) {ll ans=1;for(;n;n>>=1,x=x*x%mod) if(n&1) ans=ans*x%mod; return ans;}
const int N=1e6+100;

ll n,k,ans;
int main() {
    cin>>n>>k;
    ans=abs(n-k);
    ll t=n%k;
    t+=k;
    if(t<=n) ans=min(ans,abs(t-k) );
    t-=k;
    ans=min(ans,abs(t-k) );
    t=k-t;
    ans=min(ans,abs(t-k) );
    cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

void mainsolve(){

	ll n,k;
	cin >> n >> k;

	ll tmp = 1;
	ll res = 0;
	while(n >= tmp){
		res++;
		tmp *= k;
	}
	cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
/* CM one day */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <algorithm>
#include <unordered_map>
#define int                long long
#define pb                 push_back
#define pi                 pair<int,int>
#define vi                 vector<int>
#define all(v)             v.begin(),v.end()
#define MOD                1000000007
#define F                  first
#define S                  second
#define FOR(i,r)           for(int i=0;i<r;i++)
#define REP(i,l,r)         for(int i=l;i<r;i++)
#define RER(i,l,r)         for(int i=l;i>=r;i--)
#define print(v)           for(auto i : v)cout << i << ' ';
#define FASTIO             ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mem(arr,k)         memset(arr,k,sizeof(arr));
#define pii                acos(-1.0)
#define PI                 3.1415926535897932385
#define Sin(a)             sin((pi*a)/180)
#define test()             int x;cin >> x;while(x--)
using namespace std;
const int inf = (int)1e17;
const int N = (int)1e5+5;
int32_t main(){

	
	FASTIO;
	int n;
	cin >> n;
	int ans = 0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				ans += __gcd(__gcd(i,j),k);
			}
		}
	}
	cout << ans << endl;
    return 0;

}

Measured memory_bytes: 3636
<?php
fscanf(STDIN, '%d', $n);
fscanf(STDIN, '%s', $s);

$res = $white = substr_count($s, '.');

// .が1つもない || 全て. || #の右側に.が存在しない場合は変更する必要ないので0を返す
if ($white === 0 || $white === $n || preg_match('/^\.*#*$/', $s)) {
    echo 0;
    return;
}

$black = 0;
for ($i = 0; $i < $n;$i++) {
    if ($s[$i] === '#') {
        $black++;
    } else {
        $white--;
    }
    $res = min($res, $black + $white);
}

echo $res > 0 ? $res : 0;


Measured memory_bytes: 4728
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  string t;
  cin>>t;
  for(int i=0;i<t.size();i++){
    if(t[i]=='?') cout<<'D';
    else cout<<t[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <sstream>
 
#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  For(i,0,n)
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)
 
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;
 
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
void printhoge(set<int> v) {
    ALL(it, v) {
        cout << *it << " ";
    }
    cout << endl;
 
}
int main() {

    string str;int n;
    cin >> str >> n;
    int index = 0;
    while (index < str.length()){
        cout << str[index];
        index += n;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 5000 + 5;
const int mod = 1e9 + 7;
int n , k;
int a[maxn];
bitset<maxn> dp[maxn] , dp1[maxn];
int sum[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w  ",stdout);
    }
    cin >> n >> k;
    for(int i = 1 ; i <= n ; ++i){
        cin >> a[i];
        a[i] = min(a[i] , k);
    }
    sort(a + 1 , a + n + 1);
    dp[0][0] = 1;
    dp1[n + 1][0] = 1;
    for(int i = 1 ; i <= n ; ++i){
        dp[i] = dp[i - 1] | (dp[i - 1] << a[i]);
    }
    for(int i = n ; i >= 1 ; --i){
        dp1[i] = dp1[i + 1] | (dp1[i + 1] << a[i]);
    }
    int res = 0;
    for(int i = n ; i >= 1 ; --i){
        bool ok = 0;
        for(int j = 0 ; j <= k ; ++j){
            sum[j] = 0;
            if(j > 0)sum[j] += sum[j - 1];
            sum[j] += (dp1[i + 1][j]);
        }
        for(int j = 0 ; j < k && ok == 0 ; ++j){
            if(dp[i - 1][j]){
                if(sum[k - j - 1] > (k - j - a[i] - 1 < 0 ? 0 : sum[k - j - a[i] - 1])){
                    ok = 1;
//                    cout << i << " " << j << " " << endl;
                }
            }
        }
        if(!ok)return cout << i , 0;
    }
    cout << 0;
}


Measured memory_bytes: 6528
import java.io.*;
 
public class Main{
  public static void main(String[] args)throws IOException{
     
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
 
    String[] strAry = str.split(" ");
     
    int x = Integer.parseInt(strAry[0]);
    int y = Integer.parseInt(strAry[1]);
    int z = Integer.parseInt(strAry[2]);
 
    if(x < y & y < z & x < z){
      System.out.println("Yes");
    }
    else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 24208
#include<stdio.h>
int func(int n){
	int i,ans=0;
	for(i=1;i*i<n;i++){
		ans+=n%i==0;
	}
	ans*=2;
	ans+=i*i==n;
	return ans;
}
int main(void){
	int i,n,sum=0;
	scanf("%d",&n);
	for(i=1;i<n;i++){
		sum+=func(i);
	}
	printf("%d",sum);
	return 0;
}


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

using namespace std;

#define REP(i, a, b) for(ll i=a;i<b;i++)
#define REPR(i, a, b) for(ll i=b-1;i>=a;i--)
#define forr(i, n) for(ll i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define w(t) int t;cin>>t;while(t--)
#define W(t) ll t;cin>>t;while(t--)
#define endl '\n'
#define space ' '
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl

typedef long long ll;

// const int N = 2e5 + 5;

int main() {

	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll K, i = 0;
	cin >> K;
	if (K % 2 == 0 | K % 5 == 0)
	{cout << "-1\n";}
	else {
		ll num = 7, i = 1;
		while (num % K != 0)
		{
			num = (num % K) * 10 + 7;
			++i;
		}

		cout << i << "\n";
	}

	return 0;
}


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

//A rope may form )( a trail in a maze.

int main(){
	while(1){
		string data;
		for(char in = 0;in != '.';){
			in = cin.get();
			data += in;
		}
		cin.get();
		if(data == ".") break;
		
		stack<char> stk;
		int pc = 0;
		while(1){
			char in = data[pc];
			pc++;
			
			if(in == '(' || in == '['){
				stk.push(in);
			}
			if(in == ')' || in == ']'){
				if(stk.empty()){
					cout << "no" << endl;
					break;
				}
				char begin = stk.top();
				if((begin == '(' && in != ')') || (begin == '[' && in != ']')){
					cout << "no" << endl;
					break;
				}else{
					stk.pop();
				}
			}
			if(in == '.'){
				if(stk.empty()){
					cout << "yes" << endl;
				}else{
					cout << "no" << endl;
				}
				break;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 892
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
   
#include <x86intrin.h>
#include <bits/stdc++.h>   
 
using namespace std;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, k, a[N], ans;

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n >> k;
   for (int i = 1; i <= n; i ++) {
      cin >> a[i];
      ans += (a[i] >= k);
   }
   cout << ans;
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

Measured memory_bytes: 640
n, m = [int(i) for i in input().split()]
p = [[int(i) for i in input().split()] for _ in range(m)]
a = []
for x in p:
    if x[0] == 1:
        a.append(x[1])

b = []
for x in p:
    if x[1] == n:
        b.append(x[0])
if set(a) & set(b):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


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

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  
  int cnt = K;
  int ans;
  for (int i=min(A,B); i>0; --i) {
    if ((A%i==0) && (B%i==0)) {
      --cnt;
    }
    if (cnt == 0) {
      ans = i;
      break;
    }
  }
  
  cout << ans << endl;
  return 0;
}









Measured memory_bytes: 256
N, M = map(int,input().split())

L = []
S = []
for i in range(N):
  temp = list(map(int,input().split()))
  L.append(temp)
  TL = []
  TL.append(temp[0]+temp[1]+temp[2])
  TL.append(-1*temp[0]+temp[1]+temp[2])
  TL.append(temp[0]-temp[1]+temp[2])
  TL.append(temp[0]+temp[1]-temp[2])
  TL.append(-1*temp[0]-temp[1]+temp[2])
  TL.append(-1*temp[0]+temp[1]-temp[2])
  TL.append(temp[0]-temp[1]-temp[2])
  TL.append(-1*temp[0]-temp[1]-temp[2])
  S.append(TL)

ans = -float('inf') 
for i in range(8):
  TMP = []
  for j in range(N):
    TMP.append(S[j][i])
  TMP.sort(reverse=True)
  ans = max(ans,sum(TMP[:M]))
  
print(ans)

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < b; i++)
int N;
int cnt = 0;
vector<ll> l;
bool check(vector<ll> l) {
    // cout << l[0] << "," << l[1] << "," << l[2] << endl;
    if(l[0] + l[1] > l[2] && l[1] + l[2] > l[0] && l[2] + l[0] > l[1]) {
        if(l[0] != l[1] && l[1] != l[2] && l[2] != l[0])
            return true;
    }
    return false;
}
void recursive_comb(vector<ll> v, int s, int rest) {

    // cout << s << "," << rest << endl;
    if(rest == 0) {
        if(check(v)) {
            cnt++;
        }
        return;
    } else {
        if(s < 0)
            return;
        recursive_comb(v, s - 1, rest);
        v.push_back(l[s]);
        recursive_comb(v, s - 1, rest - 1);
    }
}
void foreach_comb(int n, int k) {
    vector<ll> v;

    // cout << n << "," << k << endl;
    recursive_comb(v, n - 1, k);
    v.clear();
}

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

    cin >> N;
    l.resize(N);
    rep(i, 0, N) { cin >> l[i]; }
    // cout << "aa" << endl;
    sort(l.begin(), l.end());
    foreach_comb(N, 3);

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3564
#include<stdio.h>
int main()
{
	int a, b; char arr[20] = { 0 };
	while (~scanf("%d%d", &a, &b))
	{
		getchar();
		for (int i = 0; i < a + b + 1; i++)
		{
			scanf("%c", &arr[i]);
		}
		int f = 1;
		for (int i = 0; i < a + b + 1; i++)
		{
			if (i != a)
			{
				if (!(arr[i] >= '0'&&arr[i] <= '9'))
				{
					f = 0;
					break;
				}
			}
			else if (arr[i] != '-')
			{
				f = 0; break;
			}
		}
		if (f)printf("Yes\n");
		else printf("No\n");
	}
}

Measured memory_bytes: 128
l=input()
ans=[0]*len(l)
l=l.replace("RL","X")
cnt=0
now=l[0]
l2=[]
r_c=0
for i in l:
   if now != i:
      l2.append((now,cnt))
      now=i
      cnt=1
   else:
      cnt+=1
l2.append((now,cnt))
now=0
for i,j in l2:
   if i == "R":
      now+=j
      r_c=j
   elif i == "L":
      ans[now-2]+=j//2+j%2
      ans[now-1]+=j//2
      now+=j
   if i == "X":
      ans[now+1]+=r_c//2+r_c%2
      ans[now]+=r_c//2
      r_c=0
      for k in range(j):
         ans[now]+=1
         ans[now+1]+=1
         now+=2
print(*ans)

Measured memory_bytes: 9492
#include<cstdio>

int main() {
    int S;
    scanf("%d\n",&S);
    int h = S / 3600;//時間
    S %= 3600;// S = S % 3600
    int m = S / 60;//分
    int s = S % 60;//秒

    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 2672