akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    private static final long FIRST_SLICE_IS_BUN = 1;
    private static final long MIDDLE_PATTY = 1;

    public static long process(TestCase testCase) {
        final int N = testCase.N;
        final long X = testCase.X;

        return countNumPatty(N, X);
    }

    private static long countNumPatty(int N, long X) {
        if (X == 0) {
            return 0L;
        }

        final long burgerLength = burgerLength(N);
        boolean isWholeBurgerEaten = X >= burgerLength;
        if (isWholeBurgerEaten) {
            return numPatty(N);
        } else {
            // countPartialBurger
            boolean isOnlyTopSliceRemaining = X == burgerLength - 1;

            final long oneSmallerLayerLength = burgerLength(N - 1);
            final long oneSmallerLayerPatty = numPatty(N - 1);
            if (isOnlyTopSliceRemaining) {
//                return 2 * oneSmallerLayerPatty + MIDDLE_PATTY; // Top slice is bun
                return numPatty(N); // Top slice is bun
            } else {
                boolean canFinishHalfBurger = X >= (burgerLength - FIRST_SLICE_IS_BUN - oneSmallerLayerLength);
                if (canFinishHalfBurger) {
                    return oneSmallerLayerPatty + MIDDLE_PATTY + countNumPatty(N - 1, X - FIRST_SLICE_IS_BUN - oneSmallerLayerLength - MIDDLE_PATTY);
                } else {
                    boolean canFinishOneSmallerLayer = (X - FIRST_SLICE_IS_BUN) >= (FIRST_SLICE_IS_BUN + oneSmallerLayerLength);
                    if (canFinishOneSmallerLayer) {
                        return oneSmallerLayerPatty;
                    } else {
                        boolean canEatSomePatty = X > FIRST_SLICE_IS_BUN;
                        if (canEatSomePatty) {
                            return countNumPatty(N - 1, X - FIRST_SLICE_IS_BUN);
                        } else {
                            return 0L;
                        }
                    }
                }
            }

        }
    }

    private static long burgerLength(int layer) {
        return (long) Math.pow(2, layer + 2) - 3L;
    }

    private static long numPatty(int layer) {
        return (long) Math.pow(2, layer + 1) - 1L;
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final long result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        long X = sc.nextLong();

        sc.close();
        return new TestCase(N, X);
    }

    private static void output(long result) {
        System.out.println(result);
    }

    public static class TestCase {
        final int N;
        final long X;

        public TestCase(int N, long X) {
            this.N = N;
            this.X = X;
        }
    }
}


Measured memory_bytes: 23380
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

const long long MOD = 1000000007;

struct Vertex
{
	int pos;
	std::vector<int> connects;
	
	int parent;	//上一层是什么 
	int visitFlag;
	
    bool operator < (const Vertex &a) const {
        return this->visitFlag > a.visitFlag;//最小值优先
    }	
};
Vertex vertex[210];

char board[210][210];
int N;

void clearVisitFlag()
{
	for (int i = 0 ; i < N ; i++)
	{ 
		vertex[i].visitFlag = -1;
		vertex[i].parent = -1;
	} 
}

int curFlag = 1;

int checkSplit(int startPos)
{
	curFlag = 1;
	vertex[startPos].visitFlag = curFlag;
	vertex[startPos].parent = -1;
	
	std::priority_queue<Vertex> q;
	q.push(vertex[startPos]);
	
	while (q.empty() == false)
	{
		Vertex curVertex = q.top();
		q.pop();
		
		int newPos;
		for (int i = 0 ; i < curVertex.connects.size() ; i++)
		{
			newPos = curVertex.connects[i];
			
			if (vertex[newPos].pos == curVertex.parent)
				continue;
				
			if (vertex[newPos].visitFlag == (curVertex.visitFlag - 1))	//上一层 
				continue;

			if (vertex[newPos].visitFlag == (curVertex.visitFlag + 1))	//上一层 
				continue;
			
			if (vertex[newPos].visitFlag != -1)
				return -1;
				
			vertex[newPos].visitFlag = curVertex.visitFlag + 1;
			vertex[newPos].parent = curVertex.pos;
			q.push(vertex[newPos]);
		}
	}
	
	int maxFlag = -1;
	for (int i = 0 ; i < N ; i++)
	{
		if (maxFlag < vertex[i].visitFlag)
			maxFlag = vertex[i].visitFlag;
	}
	
	return maxFlag;
}


int main()
{
	scanf("%d\n", &N);
	for (int i = 0 ; i < N ; i++)
		scanf("%s", board[i]);
		
	for (int i = 0 ; i < N ; i++)
	{
		vertex[i].pos = i;
		vertex[i].connects.clear();
		
		for (int j = 0 ; j < N ; j++)
		{
			if (board[i][j] == '1')
			{
				vertex[i].connects.push_back(j);
			}
		}
	}
	
	int maxCount = -1;
	
	for (int i = 0 ; i < N ; i++)
	{
		clearVisitFlag();
		int curSetCount = checkSplit(i);
		
		if (maxCount < curSetCount)
			maxCount = curSetCount;
	}
	
	printf("%d\n", maxCount);
	
	return 0;
}


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

const int maxn = 1e5 + 10 ;

int n ;
vector<int> v[maxn] ;
int path[maxn],top=0 ;
int size[maxn] ;

int dfs(int c, int p){
	int found = 0 ;
	if(c==n) found = 1 ;
	path[top] = c ; top++ ;
	size[c] = 1 ;
	for(int i=0; i<v[c].size(); i++) {
		if(v[c][i]!=p) {
			if(dfs(v[c][i],c)==1) {
				found = 1 ;
			}
			size[c] += size[v[c][i]] ;
		}
	}
	if(found==0) top-- ;
	return found ;
}


int main(void){
//	freopen("1.txt","r",stdin) ;
	scanf("%d",&n) ;
	for(int i=0; i<n-1; i++) {
		int a,b ;
		scanf("%d%d",&a,&b) ;
		v[a].push_back(b) ;
		v[b].push_back(a) ;
	}

	dfs(1,0) ;

	int l=0, r=top-1 ;
	while(l<r) {
		l++; r-- ;
	}
	r++ ;
	if(size[path[r]]*2<n) printf("Fennec\n") ;
	else printf("Snuke\n") ;

	return 0 ;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> edge;
ll n, q;
//ll a[1000000], b[1000000];
edge ab[1000000];
edge ab2[1000000];
ll p[1000000], x[1000000];
ll pi[1000000];
ll pj[1000000];
ll cnt[1000000];
ll pp[1000000];
bool cnt_flg[1000000];

bool comp2(const edge& left, const edge& right) {
    return left.first < right.first;
}

void search_tree(ll cx, ll px, ll p_cnt){
    //cerr<< "search "  << cx << endl;
    edge *index_p;
    edge skey = make_pair(cx, cx);
    if( cnt_flg[cx]==true ) return;
    cnt[cx] = cnt[cx]+p_cnt;
    cnt_flg[cx] = true;
    index_p = lower_bound(ab, ab+n-1, skey, comp2);
    while(true){
        if( index_p->first != cx ) break;
        if( index_p->second != px ){
            //cerr << index_p->first << " to " << index_p->second << endl;
            search_tree(index_p->second, cx, cnt[cx]);
        }
        index_p++;
    }

    index_p = lower_bound(ab2, ab2+n-1, skey,comp2);
    while(true){
        if( index_p->first != cx ) break;
        if( index_p->second != px ){
            //cerr << index_p->first << " to " << index_p->second << endl;
            search_tree(index_p->second, cx, cnt[cx]);
        }
        index_p++;
    }

    return;
}
int main(){

    cin >> n >> q;
    for(int i=0; i<n-1; i++){
        ll a, b;
        cin >> a >> b;
        ab[i] = make_pair(a,b);
        ab2[i] = make_pair(b,a);
    }
    for(int i=0; i<n+1; i++) cnt[i] = 0;
    for(int i=0; i<n; i++) cnt_flg[i] = false;
    for(int i=0; i<q; i++){
        cin >> p[i] >> x[i];
        cnt[p[i]] += x[i];
    }
    sort(ab, ab+n-1, comp2);
    sort(ab2, ab2+n-1, comp2);
    search_tree(1, 0, 0);
    for(int i=1; i<n; i++){
        cout << cnt[i] <<" "; 
    }
    cout << cnt[n] << endl;

    return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		
//		String str = br.readLine();

		while(true){
			int n = Integer.parseInt(br.readLine());
			
			if(n == 0){
				break;
			}
			String[] tmpArray = br.readLine().split(" ");
			int[] input = new int[n];
			int sum = 0;
			for(int i = 0; i < n ; i++){
				input[i] = Integer.parseInt(tmpArray[i]);
				sum += input[i];
			}
			double ave = (double)sum / n;
			
			double var = 0;
			for(int i = 0; i < n ; i++){
				var += Math.pow((input[i] - ave) , 2)/n;
			}
			
			System.out.println(Math.pow(var, 0.5));
		}
//		System.out.println(p1.distance(p2));
		

//		System.out.println(count);

//
//			if(Character.isLowerCase(c)){
//				System.out.print(Character.toUpperCase(c));
//			}
//
//			else if(Character.isUpperCase(c)){
//				System.out.print(Character.toLowerCase(c));
//			}
//			else {
//				System.out.print(c);
//			}
//		}
//		System.out.println();

//		String[] tmpArray = br.readLine().split(" ");
//		int n = Integer.parseInt(tmpArray[0]);
//		int m = Integer.parseInt(tmpArray[1]);
//		int l = Integer.parseInt(tmpArray[2]);
//
//		long[][] a = new long[n][m];
//		long[][] b = new long[m][l];
//		long[][] c = new long[n][l];
//
//		for(int i = 0; i < n; i ++){
//			tmpArray = br.readLine().split(" ");
//			for(int j = 0; j < m; j++){
//				a[i][j] = Long.parseLong(tmpArray[j]);
//			}
//		}
//
//		for(int i = 0; i < m; i ++){
//			tmpArray = br.readLine().split(" ");
//			for(int j = 0; j < l; j++){
//				b[i][j] = Integer.parseInt(tmpArray[j]);
//			}
//		}
//
//		for(int i = 0; i < n; i++){
//			for(int j = 0; j < l; j++){
//				for(int k = 0; k < m; k++){
//					c[i][j] += a[i][k]*b[k][j];
//				}
//
//				if(j != 0 ){
//					System.out.print(" ");
//				}
//				System.out.print(c[i][j]);
//			}
//			System.out.println();
//		}


	}

}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int max=INT_MIN;
  cin>>n;
int arr[n],pre[n],suf[n];
for(int i=0;i<n;i++)
{
    cin>>arr[i];

}
int x=arr[0];
for(int i=0;i<n;i++)
{
    x=__gcd(arr[i],x);
pre[i]=x;


}

x=arr[n-1];
for(int i=n-1;i>=0;i--)
{
x=__gcd(arr[i],x);
suf[i]=x;

}

for(int i=0;i<n-2;i++)
{
   
    if(__gcd(suf[i+2],pre[i])>max)
    {
       
        max=__gcd(suf[i+2],pre[i]);
    }
}
if(suf[1]>max)
max=suf[1];
if(suf[0]>max)
max=suf[0];
if(pre[n-1]>max)
max=pre[n-1];
if(pre[n-2]>max)
max=pre[n-2];
cout<<max;
}


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

using namespace std;

int c[3][3];

int main(){
	for(int i = 0; i < 3; ++i) for(int j = 0; j < 3; ++j) cin >> c[i][j];
	for(int a1 = -100; a1 <= 100; ++a1){
		for(int a2 = -100; a2 <= 100; ++a2){
			for(int a3 = -100; a3 <= 100; ++a3){
				if(c[0][0]-a1 == c[1][0]-a2 && c[1][0]-a2 == c[2][0]-a3 &&
				   c[0][1]-a1 == c[1][1]-a2 && c[1][1]-a2 == c[2][1]-a3 &&
				   c[0][2]-a1 == c[1][2]-a2 && c[1][2]-a2 == c[2][2]-a3){
				   		cout << "Yes" << endl;
				   		return 0;
				   }
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 2e5 + 7;
const int maxm = 1e6 + 7;
const int ALP = 26;
const long long mod = 1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-8;

long long gcd(long long a,long long b)
{
	return b?gcd(b,a%b):a;
}

long long lcm(long long a,long long b)
{
	return a*b/gcd(a,b);
}

int n,m;
long long a[maxn];
long long k[maxn];
long long LCM;

int main()
{
	//freopen("1.in","r",stdin);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	LCM=a[1];
	for(int i=2;i<=n;i++)
		LCM=lcm(LCM,a[i]);
	for(int i=1;i<=n;i++)
		k[i]=LCM/a[i];
	
	for(int i=1;i<=n;i++)
		if(k[i]%2==0)
		{
			printf("0\n");
			return 0;
		}
	
	long long x=LCM>>1;
	long long res=m/x;
	if(res%2==0)
		res--;
	printf("%lld\n",(res+1)>>1);
	return 0;
}


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

int n, cnt = 0;

void dfs(long long now, int ok){
  if(now > n) return;
  
  if(ok == 0b111) cnt++;
  dfs(now * 10 + 7, ok | 0b100);
  dfs(now * 10 + 5, ok | 0b010);
  dfs(now * 10 + 3, ok | 0b001);
}

int main(){
  cin >> n;
  dfs(0, 0);
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define M 1000000007LL
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define mp make_pair
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
#define mod 998244353LL
#define MAXN 300002
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
ll arr[502];
ll a[502];
ll n,kt;
ll ktt;
void f(ll i, ll &ans){
  ll j,k;;
  kt=ktt;
  for(j=0;j<n;j++) a[j]=arr[j]%i;
  sort(a,a+n);
  j=0,k=n-1;
  while(j<k and kt>0){
   // cout<<i<<" "<<j<<" "<<k<<" "<<a[j]<<" "<<a[k]<<endl;
     if(a[j]%i==0) {
      j++;
      continue;
     }
     if(a[k]%i==0){
      k--;
      continue;
     }
     ll pp=min(kt,min(a[j]%i,i-a[k]%i));
     a[j]-=pp;
     a[k]+=pp;
     kt-=pp;
  }
  for(j=0;j<n;j++){
    if(a[j]%i) return; 
  }
//  cout<<i<<endl;
  ans=max(ans,i);
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>kt;
    ktt=kt;
    ll i,j;
    ll sum=0;
    for(i=0;i<n;i++) cin>>arr[i], sum+=arr[i];
    ll ans=1;
    for(i=1;i<=sqrt(sum);i++){
        if(sum%i==0){
          f(i,ans);
          f(sum/i,ans);
      }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#define MOD 1000000007
unsigned long long int sum=1; 
using namespace std;

unsigned long long int fast_power_with_mod(long long base, long long power) {
    long long result = 1;
    while(power > 0) {

        if(power % 2 == 1) { // Can also use (power & 1) to make code even faster
            result = (result%MOD*base%MOD) % MOD;
        }
        base = (base * base) % MOD;
        power = power / 2; // Can also use power >>= 1; to make code even faster
    }
   	return result%MOD;
}

unsigned long long int fast_power(long long base, long long power) {
    long long result = 1;
    while(power > 0) {

        if(power % 2 == 1) { // Can also use (power & 1) to make code even faster
            result = (result%MOD*base%MOD);
        }
        base = (base * base);
        power = power / 2; // Can also use power >>= 1; to make code even faster
    }
   	return result;
}
/*int find_ind(int a[],int n,int elem)
{
	int ret_ind=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==elem)
			ret_ind = i;
	}
	a[ret_ind]=-1;
	return ret_ind;
}*/
int arraySortedOrNot(int arr[], int n) 
{ 
    // Array has one or no element or the 
    // rest are already checked and approved. 
    if (n == 1 || n == 0) 
        return 1; 
  
    // Unsorted pair found (Equal values allowed) 
    if (arr[n - 1] < arr[n - 2]) 
        return 0; 
  
    // Last pair was sorted 
    // Keep on checking 
    return arraySortedOrNot(arr, n - 1); 
}


void implement()
{
	int n;
	cin >> n;
	string s;
	set<string> st;
	for(int i=0;i<n;i++)
	{
		cin >> s;
		st.insert(s);
	}
	cout << st.size() << endl;


	

}

void multi_test(){
	int t;
	cin >> t;
	for(int i=0;i<t;i++)
	{
		implement();
	}
}

void single_test()
{
	implement();
}

int main()
{
	//multi_test();
	single_test();
	return 0;
}



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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (int)(1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define PI 3.1415926535898

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

int main() {
    string s;
    cin >> s;
    set<char> st;
    bool diff = true;

    rep(i, s.length()) {
        if (st.count(s[i])) {
            diff = false;
            break;
        }
        st.insert(s[i]);
    }

    yes(diff);

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
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;
}

//a^n mod を計算する関数
long long modpow(long long a,long long n,long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n % 2 == 1) {
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//a^(-1) mod すなわちaの逆元を返す関数
long long modinv(long long a,long long mod) {
    return modpow(a,mod-2,mod);
}

//最大公約数をを返す関数
long long gcd (long long a,long long b) {
    if(a % b == 0) {
        return b;
    }else {
        return (gcd(b,a%b));
    }
}

const long long INF = 1LL << 60;
const long long P = 1000000007;

//nCkを求める関数
long long conbi (long long n,long long k) {
    long long res = 1;
    long long inv;
    for(long long i = n-k+1; i <= n; i++) {
        res *= i;
        res %= P;
    }
    for(long long i = 1; i <= k; i++) {
        inv = modinv(i,P);
        res *= inv;
        res %= P;
    }
    return res;
}

int main() {
    int a,b;
    cin >> a >> b;
    int count = 0;
    while(true) {
        count++;
        if(a+(a-1)*(count-1) >= b) {
            break;
        }
    }
    if(b == 1) {
        count = 0;
    }
    cout << count << endl;
    return 0;
}


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

class Program
{
  static void Main(string[] args)
  {
    var N = int.Parse(Console.ReadLine());
    var s = Console.ReadLine().Split(' ');
    long max = 0;
    double min = Math.Pow(10, 9);
    for (int i = 0; i < N; i++)
    {
      var a = long.Parse(s[i]);
      min = Math.Min(min, a);
      max = Math.Max(max, a);
    }
    Console.WriteLine(max - min);
  }
}


Measured memory_bytes: 27912
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int A,B;
  cin >> A >> B;
  cout << A*B-A-B+1 << endl;
  return 0;
}


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

using namespace std;
using namespace chrono;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define pb push_back
#define odd(x) ((x)&1)
#define even(x) (!odd(x))
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0ll;i<n;++i)
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define TEST_CASE int tc;cin>>tc;while(tc--)
#define Clock high_resolution_clock::now()

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

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

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define JD
// #define TIME

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


const ll inf = 2e18;
const ll mod = 1e9+7;
const ll N = 1e6+3;


int main()
{
    auto start_time = Clock;
    FASTIO

    #ifndef JD
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif

    
    
    string s;
    cin>>s;
    int n = s.size();
    if(s[n-1]=='s') s+="es";
    else s=s+"s";
    cout<<s;







    

    auto end_time = Clock;
    #ifndef TIME
    	return 0;
    #endif
	cout << "\nTime elapsed: "
	<< (double)duration_cast<milliseconds>(end_time-start_time).count() 
	<< "ms";


    return 0;
}


Measured memory_bytes: 3652
H, W = gets.split.map(&:to_i)
lines = []
H.times do
    s = gets.chomp
    lines << s if !s.delete(".").empty?
end
delete = []
for i in 0..W-1
    delete << lines.map{|s| s[i]}.join.delete(".").empty?
end
lines.each do |line|
    puts line.chars.zip(delete).map{|char, flag| flag ? "" : char}.join
end

Measured memory_bytes: 2172
#include<stdio.h>
#include<stdlib.h>
int main(void){
  long long a,v,b,w,t;
  scanf("%lld%lld%lld%lld%lld",&a,&v,&b,&w,&t);
  int diff;
  diff=abs(b-a);
  if(diff+(w*t-v*t)>0){
    printf("NO\n");
  }else{
    printf("YES\n");
  }
  return 0;
}


Measured memory_bytes: 1660
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N;
bool prime[300010];
vector<int> msprimes() {
    vector<int> ret;
    for(int i=2; i<=300010; i++) {
        if((i % 7 == 1 || i % 7 == 6) && !prime[i]) {
            // if(i < 100) printf("prime: %lld\n", i);
            ret.push_back(i);
            for(int j=i; j<=300010; j+=i) prime[j] = true;
        }
    }
    return ret;
}

signed main() {
    vector<int> primes = msprimes();
    while(cin >> N, N != 1) {
        int M = N;
        vector<int> ans;
        for(int i=0; i<primes.size(); i++) {
            if(N % primes[i] == 0) {
                ans.push_back(primes[i]);
            }
        }
        printf("%lld:", M);
        for(auto x : ans) printf(" %lld", x);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

bool is_prime(int x) {
  for(int i = 2; i * i <= x; ++i) {
    if(x % i == 0) {
      return false;
    }
  }
  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x;
  cin >> x;
  while(!is_prime(x)) x += 1;
  cout << x << '\n';
}



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

int main(){
    ll n;
    cin>>n;
    vector<ll>tp(5);
    rep(i,5)cin>>tp[i];
    sort(tp.begin(),tp.end());
    ll k=tp[0];
    ll ans=0;
    ans+=4;
    if(n<k){
        cout<<5<<endl;
        return 0;
    }
    ll hito=n/k;
    if(n%k!=0)hito+=1;
    ans+=hito;
    cout<<ans<<endl;
    

}

Measured memory_bytes: 256
a = int(input())
su = 0
while a != 0:
    b = list(map(int,input().split()))
    c = sum(b)/len(b)
    for i in range(len(b)):
        if b[i] <= c:
            su += 1
    
    print(su)
    su = 0
    a = int(input())


Measured memory_bytes: 6612
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
const int NMAX = 100000;
int color[NMAX];
bool used[NMAX];

void dfs(vector<vector<P>>& edge, int node, int dst){
    if(dst%2 == 0) color[node] = 0;
    if(used[node]) return;
    used[node] = true;
    for(auto e : edge[node]){
        if(used[e.first]) continue;
        dfs(edge, e.first, dst + e.second);
    }
}

int main(){
    int n;
    cin >> n;
    vector<vector<P>> edge(n, vector<P>());
    int u, v, w;
    for(int i=0;i<n;i++){
        color[i] = -1;
        used[i]  = false;
    }
    for(int i=0;i<n-1;i++){
        cin >> u >> v >> w;
        u--; v--;
        edge[u].push_back(make_pair(v,w));
        edge[v].push_back(make_pair(u,w));
    }
    dfs(edge, 0, 0);
    for(int i=0;i<n;i++) cout << -color[i] << endl;
}

Measured memory_bytes: 10240
#include <bits/stdc++.h>
typedef long long LL;
const int N = 1e6+10;
using namespace std;
const int mod = 1e9+7;
LL f[N];

LL qpow(LL x,LL k)
{
    LL res = 1;
    while(k)
    {
        if(k&1) res=res*x%mod;
        k>>=1;
        x = x*x%mod;
    }
    return res;
}

LL C(LL n,LL m)
{
    return f[n]*(qpow(f[m]*f[n-m]%mod,mod-2))%mod;

}
int main()
{
    LL n;
    f[0] = 1;
    for(int i=1;i<N;i++) f[i] = f[i-1]*i%mod;
    cin>>n;
    if(n<2)
    {
        cout<<0<<endl;
        return 0;
    }
    LL ans = (qpow(10,n) - qpow(8,n)+mod)%mod;
    LL tmp = 0;
    for(LL i=1;i<=n;i++)
    {
        tmp = (tmp + C(n,i)%mod*qpow(8,n-i)%mod)%mod;
    }
    tmp = tmp%mod*2%mod;
    ans = (ans - tmp + mod)%mod;
    cout<<ans<<endl;
    return 0;
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  string s;
  cin >> s;

  ll n = s.size();
  vvll dp(n + 1, vll(2, INF));
  dp[0][0] = 0;
  rep(i, n) {
    ll di = s[i] - '0';
    dp[i + 1][0] = dp[i][0] + di;
    dp[i + 1][1] = dp[i][0] + 10 - di;
    if (dp[i][1] != INF) {
      chmin(dp[i + 1][0], dp[i][1] + di + 1);
      chmin(dp[i + 1][1], dp[i][1] + 9 - di);
    }
  }

  ll ans = min(dp[n][0], dp[n][1] + 1);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 55964
import java.util.*;

public class Main {
	public static void main(String[] args) {
		class Combo {
			String name;
			long time;
		}
		
		Queue<Combo> remain = new LinkedList<Combo>();		
		Scanner scanner = new Scanner(System.in);
		
		long n = scanner.nextLong();
		long q = scanner.nextLong();
				
		for (int i = 0; i < n; i ++) {
			Combo process = new Combo();
			process.name = scanner.next();
			process.time = scanner.nextLong();
			remain.add(process);
		}
		scanner.close();
		

		long GlobeTime = 0;
		
		while (remain.size() > 0) {
			Combo currentProcess = remain.remove();
			
			if (currentProcess.time <= q) {
				GlobeTime += currentProcess.time;
				System.out.println(currentProcess.name + " " + GlobeTime);
			} else {
				currentProcess.time -= q;
				GlobeTime += q;
				remain.add(currentProcess);
			}
		}
		
	}
} 


Measured memory_bytes: 75852
# import bisect
from collections import Counter, deque  # https://note.nkmk.me/python-scipy-connected-components/
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    n, q = map(int, input().split())
    queue = deque([])  # 処理すべきプロセスをqueueで管理
    for i in range(n):
        name, time = input().split()
        time = int(time)
        queue.append([name, time])

    totaltime = 0  # 経過時間
    while queue:
        [name, time] = queue.popleft()
        if time <= q:  # 今回で処理完了
            totaltime += time
            print(name, totaltime)
        else:
            time -= q
            queue.append([name, time])  # 処理しきれなかった時間分を後回し
            totaltime += q


resolve()


Measured memory_bytes: 13304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>

#define INF 100000000

using namespace std;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    for(int i = 1;i<=b;i++)
    {
        if(i*a%b == c)
        {
            cout << "YES\n";
            return 0;
        }
    }
    cout << "NO\n";
    return 0;
}


Measured memory_bytes: 256
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  ll l;
  cin >> l;
  cout << fixed << setprecision(10) << pow(double(l) / 3.0, 3.0) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int N,alice=0,bob=0;
    cin >> N;

    vector<int>a(N);

    for(int i=0;i < N;i++){
        cin >> a.at(i);
    }

    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());

    for(int i = 0;i < N;i++){
        if(i % 2 == 0)
            alice += a.at(i);
        else
        {
            bob += a.at(i);
        }
        
    }

    cout << alice - bob << endl;

}

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

#define rep(i,N) repf(i,0,N)
#define reps(i,N) repfs(i,0,N)
#define repf(i,a,b) for(int i=a;i<b;i++)
#define repfs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define da(arr,N){if(isDebugMode){rep(i,N){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N){rep(j,M){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
int n;
int a[200000];
ll ans;
set<int> s;
int order[200000];
void solve(){
	s.insert(-1);
	s.insert(n);
	rep(i,n){
		int pos=order[i];
		auto itr = s.lower_bound(pos);
		ll r = *itr-pos;
		ll l = pos-*(--itr);
		ans+=r*l*(i+1);
		s.insert(pos);
	}
	cout<<ans<<endl;
}

int main(){
	cin>>n;
	rep(i,n) {
		cin>>a[i];
		order[a[i]-1]=i;
	}
	solve();
	return 0;
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define int ll
//#define endl '\n'

int n;
int a[maxn];
multiset<int> m;

int32_t main()
{
    IOS
    cin>>n;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
        if (m.lower_bound(a[i])==m.begin()) m.insert(a[i]);
        else
        {
            m.erase(prev(m.lower_bound(a[i])));
            m.insert(a[i]);
        }}
    cout<<sz(m)<<endl;
}



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

int main() {
  int N, cost, costex;
  cin >> N;
  costex = 0;
  cost = 200*200*N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  for (int AVE = -100; AVE < 101; AVE++){
    costex=0;
    for (int i=0; i<N; i++){
      costex+=(a.at(i)-AVE)*(a.at(i)-AVE);
    }
    if (costex < cost){
      cost = costex;
    }
  }
  cout << cost <<endl;
}

Measured memory_bytes: 3536
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long ret(vector<bool> da) {//2進法を変換
	long long ans=0,x=1;
	for(int i = 0;i < 40;i++){
		if (da[i])
			ans += x;
		x *= 2;
	}
	return ans;
}

vector<bool> mak(long long n) {//2進法に変換
	vector<bool> ans(40);
	for (int i = 0;i < 40;i++) {
		if (n % 2)
			ans[i] = true;
		else
			ans[i] = false;
		n /= 2;
	}
	return ans;
}

void su(vector<bool> &da) {
	bool x = (da[0] && !da[1]) || (!da[0] && da[1]);
	if (da[0]) {
		for (int i = 1;i < 40;i++) {
			da[i] = false;
		}
	}
	da[0] = x;
}

void ref(vector<bool> da) {//input
	bool x = false;
	for (int i = 39;i > -1;i--) {
		if (da[i])
			x = true;
		if (x) {
			if (da[i])
				cout << 1;
			else
				cout << 0;
		}
	}
	cout << endl;
}

int main() {
	long long a, b,g;
	cin >> a >> b;
	vector<bool> A(40,false), B(40,false), ans(40,false);
	if (a % 4 == 1) {
		A = mak(a - 1);
	}
	else if (a % 4 == 2)
		A[0] = true;
	else if(a%4==3){
		A = mak(a);
	}
	if (b % 4 == 0) {
		B = mak(b);
	}
	else if (b % 4 == 1)
		B[0] = true;
	else if (b % 4 == 2) {
		B = mak(b+1);
	}
	for (int i = 0;i < 40;i++) {
		ans[i] = A[i] ^ B[i];
	}
	cout << ret(ans) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<list>
#include<set>

#define REP(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;


int main(){
	string str;
	set<string> st;
	int n;
	cin >> n;
	REP(i,n){
		cin >> str;
		if(str == "insert") {
			cin >> str;
			st.insert(str);
		}else{
			cin >> str;
			if(st.find(str) != st.end()) cout << "yes" << endl;
			else cout << "no" << endl ;
		}
	}
	return 0;
}

Measured memory_bytes: 32576
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	int n;
	cin>>n;
	long long a[n], dp[n][n], pref[n], calc;
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	pref[0] = a[0];
	for(int i = 1; i < n; i++){
		pref[i] = pref[i-1] + a[i];
	}
	for(int len = 1; len <= n; len++){
		for(int l = 0; l < n; l++){
			int r = l + len - 1;
			if(r == n){
				break;
			}
			if(len == 1){
				dp[l][l] = 0;
			}
			else{
				dp[l][r] = 2e18;
				for(int mid = l; mid < r; mid++){
					if(l == 0){
						calc = dp[l][mid]+dp[mid+1][r]+pref[r];
					}
					else{
						calc = dp[l][mid]+dp[mid+1][r]+pref[r]-pref[l-1];
					}
					dp[l][r] = min(dp[l][r], calc);
				}

			}
		}
	}
	cout<<dp[0][n-1];
	return 0; 
}

Measured memory_bytes: 1536
# coding: utf-8
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces


def main():
    n,m = na()
    hs = na()
    ans = [1 for _ in range(n)]
    for _ in range(m):
        a,b = na()
        a -= 1
        b -= 1
        if hs[a] < hs[b]:
            ans[a] = 0
        elif hs[b] < hs[a]:
            ans[b] = 0
        else:
            ans[a] = 0
            ans[b] = 0
    print(sum(ans))
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 91196
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <memory.h>
#include <fstream>

using namespace std;

const int N = 100005;
int n, k, a[N], dp[N];


int main()
{

	cin >> n >> k;

	for (int i = 0; i < n; i++)
	{
		scanf("%d", a + i);
	}

	for (int i = n - 2; i >= 0; i--) 
	{
		dp[i] = 1e9;
		for (int j = 1; j <= k && i + j < n ; j++)
		{
			dp[i] = min(dp[i + j] + abs(a[i] - a[i + j]), dp[i]);
		}
	}

	printf("%d", dp[0]);
}

Measured memory_bytes: 1024
S=str(input())
num=0
M=0
N=len(S)
for i in range(N):
    if S[i]=='A' or  S[i]=='T' or  S[i]=='C' or  S[i]=='G' :
        num+=1
    else:
        M=max(M,num)
        num=0
M=max(M,num)
print(M)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{   int n,i;
    cin>>n;
    int k=n/2;
    int arr[n],cpy[n];
    for(i=0;i<n;i++)
    {
        int temp;
        cin>>temp;
        arr[i]=temp;
        cpy[i]=temp;
    }
    sort(cpy,cpy+n);
    for(i=0;i<n;i++)
    {
        if(arr[i]<cpy[k])
            cout<<cpy[k]<<endl;
        else
            cout<<cpy[k-1]<<endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int n = 0;
  while (true) {
 	if (pow(2, n) <= N) n++;
    else break;
  }
  cout << pow(2, n - 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)


int main() {
  ll N;
  string S;
  cin>>N>>S;
  
ll tt=0;
  for(ll i=0;i<N;i++){
    if(S.size()>i+2){
      if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C'){
        tt++;
      }
    }
  }


cout<<tt<<endl;

return 0;
  
  }


Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
//		solveA(args);
//		solveB(args);
		solveC(args);
//		solveD(args);
//		solveE(args);
//		solveF(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int N= nextInt();

		if(N>=30) {
			pw.println("Yes");
		}else {
			pw.println("No");
		}
	}
	public static void solveB(String[] args) throws Exception{
		int N = nextInt();
		long D = nextInt();

		int ans = 0;
		for(int i=0;i<N;i++) {
			long x = nextLong();
			long y = nextLong();
			if(x*x+y*y<=D*D) {
				ans++;
			}
		}
		pw.println(ans);
	}
	public static void solveC(String[] args) throws Exception{
		int K = nextInt();
		if(K%2==0) {
			pw.println(-1);
			return ;
		}
		HashMap<Long,Boolean> map = new HashMap<>();
		long ans = 1;
		long v=7;
		map.put(v,true);
		while(true) {
			v%=K;
			if(v==0) {
				pw.println(ans);
				return;
			}
			v*=10;
			v+=7;
			ans++;
			if(map.containsKey(v)) {
				pw.println(-1);
				return;
			}
			map.put(v,true);
		}


	}


	public static void solveD(String[] args) throws Exception{

	}


	public static void solveE(String[] args) throws Exception{


	}

	public static void solveF(String[] args) throws Exception{

	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    vi a;
    a.resize(3);
    REP(i,3) cin>>a[i];

    sort(ALL(a));

    if(abs(a[0]-a[1])+abs(a[1]-a[2])< abs(a[2]-a[1])+abs(a[1]-a[0])){
        cout << abs(a[0]-a[1])+abs(a[1]-a[2]) << endl;
    }else{
        cout << abs(a[2]-a[1])+abs(a[1]-a[0]) << endl;
    }

    return 0;
}

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

int main(){
  int a[3][3];rep(i,3)rep(j,3)cin >> a[i][j];
  int n;cin >> n;
  int b[n];rep(i,n)cin >> b[i];
  rep(k,n){rep(i,3){rep(j,3){if(a[i][j] == b[k]){a[i][j] = 0;}}}}
  if(a[0][0] == 0&&a[0][1] == 0&&a[0][2] == 0)cout << "Yes" << endl;//横
  else if(a[1][0] == 0&&a[1][1] == 0&&a[1][2] == 0)cout << "Yes" << endl;//横
  else if(a[2][0] == 0&&a[2][1] == 0&&a[2][2] == 0)cout << "Yes" << endl;//横
  else if(a[0][0] == 0&&a[1][0] == 0&&a[2][0] == 0)cout << "Yes" << endl;//たて
  else if(a[0][1] == 0&&a[1][1] == 0&&a[2][1] == 0)cout << "Yes" << endl;//たて
  else if(a[0][2] == 0&&a[1][2] == 0&&a[2][2] == 0)cout << "Yes" << endl;//たて
  else if(a[0][0] == 0&&a[1][1] == 0&&a[2][2] == 0)cout << "Yes" << endl;//斜め
  else if(a[2][0] == 0&&a[1][1] == 0&&a[2][0] == 0)cout << "Yes" << endl;//斜め
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int i,x=700;
	char s[4];
	scanf("%s",s);
	for(i=0;i<3;i++){
		if(s[i]=='o'){
			x=x+100;
		}
	}
	printf("%d\n",x);
	return 0;
}

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

int main(){
  int k;
  bool too_long = false;
  vector<int> val(5);

  for(int i = 0; i < 5; i++){
    int v;
    cin >> v;
    val[i] = v;
  }

  cin >> k;

  sort(val.begin(), val.end());
  
  for(int i = 4; i > 0; i--){
    if(val[i] - val[0] > k)
      too_long = true;
  }

  if(too_long)
    cout << ":("  << endl;
  else
    cout << "Yay!" << endl;

  return 0;
}




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

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    Integer count[] = new Integer[N+1];
    Arrays.fill(count, 0);
    for(int i=0; i<N; i++){
      int A = sc.nextInt();
      count[A]++;
    }
    Arrays.sort(count, Comparator.reverseOrder());
    int ans = 0;
    for(int i=K; count[i]>0; i++){
      ans += count[i];
    }
    out.println(ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 77500
A[9999],B[9999];z(int*a,int*b){return*b-*a;}main(n,i,j){for(;scanf("%d",&n),n;puts(i>n?"No":"Yes")){for(i=0;i<n;i++)scanf("%d",A+i);for(i=0;i<n;i++)scanf("%d",B+i);for(i=qsort(A,n,4,z);i<n;A[i++]?i=n+1:1)for(j=0;j<n;j++)B[j]?A[i]--,B[j]--:1;}exit(0);}

Measured memory_bytes: 732