akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
class Main
{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        System.out.println(getData(in.nextInt(), in.nextInt(), in.next()));
    }

    public static String getData(int a, int b, String s){
        for (int i = 0; i < s.length(); i++){
            if (i < a){
                //System.out.println(s.charAt(i));
                if (s.charAt(i) < 48 || s.charAt(i) > 57) return "No";
            }
            else if (i == a){
                //System.out.println(s.charAt(i));
                if (s.charAt(i) != '-') return "No";
            }
            else{
                //System.out.println(s.charAt(i));
                if (s.charAt(i) < 48 || s.charAt(i) > 57) return "No";
            }
            
        }
        return "Yes";
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> T(N), A(N);
	for (int& x : T) cin >> x;
	for (int& x : A) cin >> x;
	vector<int> ma(N, 1<<30), mi(N, 1);
	for (int i = 0; i < N; ++ i) {
		ma[i] = min(T[i], A[i]);
	}
	long long r = 1;
	for (int i = 0; i < N; ++ i) {
		if (i == 0 || T[i] > T[i-1]) {
			if (mi[i] <= T[i] && T[i] <= ma[i]) {
				ma[i] = mi[i] = T[i];
			} else {
				r = 0;
			}
		}
	}
	for (int i = N-1; i >= 0; -- i) {
		if (i == N-1 || A[i] > A[i+1]) {
			if (mi[i] <= A[i] && A[i] <= ma[i]) {
				ma[i] = mi[i] = A[i];
			} else {
				r = 0;
			}
		}
	}
	//for (int i = 0; i < N; ++ i) cout << mi[i] << " " << ma[i] << endl;
	if (r == 1) for (int i = 0; i < N; ++ i) {
		if (ma[i] < mi[i]) {
			r = 0;
			break;
		} else {
			r *= (ma[i] - mi[i] + 1);
			r %= 1000000007;
		}
	}
	cout << r << endl;
}


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

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

    int s;
    int temp = n;
    while(temp > 0) {
        s += temp % 10;
        temp /= 10;
    }

    if (n % s == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
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 (a > b) {
		a = b;
		return true;
	}
	return false;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, A, B; cin >> N >> A >> B;
	cout << min(A, B) << " " << max(0ll,A+B-N) << endl;

	return 0;
}


Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int n, a, b, c; readV(n, a, b, c);
  int[] l; readC(n, l);

  auto d = [a, b, c], r = 10^^9;
  foreach (i; 0..1<<(n*2)) {
    auto sl = new int[](4), sc = new int[](4);
    foreach (j; 0..n) {
      auto k = ((i>>(j*2))&3);
      sl[k] += l[j];
      ++sc[k];
    }
    if (sc[0..3].all!"a>0")
      r = min(r, 3.iota.map!(j => (d[j]-sl[j]).abs+(sc[j]-1)*10).sum);
  }

  writeln(r);
}


Measured memory_bytes: 1276
from sys import stdin

a,b,c = [int(x) for x in stdin.readline().strip().split()]
l = 0
mem = []

while(True):
  if sum([a%2, b%2, c%2]) > 0:
    break
  elif [a,b,c] in mem:
    l = -1
    break
  else:
    l += 1
    mem.append([a,b,c])
    a_tmp = b/2 + c/2
    b_tmp = a/2 + c/2
    c_tmp = a/2 + b/2
    a,b,c = a_tmp,b_tmp,c_tmp
    
print(l)

Measured memory_bytes: 9248
#include <iostream>

using namespace std;

int main(){
	int a,b;

	cin>>a>>b;

	if(a>b){
		cout<<"a"<<" > "<<"b"<<endl;
	}else if(a<b){
		cout<<"a"<<" < "<<"b"<<endl;
	}else{
		cout<<"a"<<" == "<<"b"<<endl;
	}

	return 0;
}

Measured memory_bytes: 3016
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <math.h>
#include <string>
using namespace std;
typedef long long int ll;

int main(){
	string s; cin >> s;
	ll k; cin >> k;
	ll ans=0;
	ll res=0;
	int n=s.size();
	int y=-1;
	int g=-1;
	for(int i=0;i<n-1;i++){
		if(s[i]!=s[i+1]){
			y=i+1;
			break;
		}
	}
	for(int i=n-1;i>0;i--){
		if(s[i]!=s[i-1]){
			g=i-1;
			break;
		}
	}
	if(y==-1){
		ll b=n*k;
		cout << b/2 << endl;
		return 0;
	}
	for(int i=y;i<=g;i++){
		if(s[i]==s[i+1]){
			int cnt=0;
			char cp=s[i];
			while(i<=g&&s[i]==cp){
				i++;
				cnt++;
			}
			i--;
			res+=cnt/2;
		}
	}
	ans+=res*k;
	string t=s+s;
	res=0;
	for(int i=g+1;i<n+y;i++){
		if(t[i]==t[i+1]){
			int cnt=0;
			char cp=t[i];
			while(i<n+y&&t[i]==cp){
				i++;
				cnt++;
			}
			i--;
			res+=cnt/2;
		}
	}
	ans+=res*(k-1);
	for(int i=0;i<y;i++){
		if(s[i]==s[i+1]){
			int cnt=0;
			char cp=s[i];
			while(i<y&&s[i]==cp){
				i++;
				cnt++;
			}
			i--;
			ans+=cnt/2;
		}
	}
	for(int i=g+1;i<n-1;i++){
		if(s[i]==s[i+1]){
			int cnt=0;
			char cp=s[i];
			while(i<n&&s[i]==cp){
				i++;
				cnt++;
			}
			i--;
			ans+=cnt/2;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextInt();

        int res = arr[0];

        for (int i=1; i<n; i++) {
            res = gcd(res, arr[i]);
        }

        System.out.println(res);
    }

    int gcd(int m, int n) {
        if (n == 0) return m;
        return gcd(n, m%n);
    }

}



Measured memory_bytes: 51576
N, M, C = map(int, input().split())
B = list(map(int, input().split()))

ret = 0
for n in range(N):
  temp = 0
  A = list(map(int, input().split()))
  for m in range(M):
    temp += A[m] * B[m]
  temp += C
  if 0 < temp:
    ret += 1

print(ret)



Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define w cout
#define e '\n'
#define int long long
#define all(v) (begin(v) , end(v))
#define pb push_back
using namespace std;
const long long N = 1e6 + 10 , MOD = 1e9 + 7;
int k;
vector<int> g[N];
long long store[N] , visited[N];

void dfs(int i) {
	visited[i] = 1;
	int c;
	if(i == 1) {
		c = k - 1;
	} else {
		c = k - 2;
	}
	
	for(auto kk : g[i]) {
		if(!visited[kk])
			store[kk] = c--;
	}
	for(auto j : g[i]) {
		if(!visited[j]) {		
			dfs(j);
		}
	}
}
				

signed main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n ; cin >> n >> k;
	for(int i = 0 ;i < n - 1; i ++ ) {
		int x , y; cin >> x >> y;
		g[x].push_back(y); 
		g[y].push_back(x);
	}
	
	store[1] = k;
	dfs(1);
	long long ans = 1;
	for(int i = 1 ; i <= n ; i ++) {
		if(store[i] < 0) {
			w << 0 ;
			return 0;
		}
		ans = ans*store[i];
		ans %= MOD;
	}
	w << ans;	
}


Measured memory_bytes: 35328
import java.util.*;


public class Main {
	public static void main (String[] args){
		Scanner sc =  new Scanner(System.in);
		int[] N = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		int K = sc.nextInt();
		System.out.println(N[K-1]);
	}	
}

Measured memory_bytes: 21460
#include<iostream>
using namespace std;
int n,m,o,a,b,c,d;
int t[15][15];
 
 
void rotate(int y,int x,int size,int angle){
  y--;x--;
  int u[15][15];
  int v[15][15];
 
  angle/=90;
  for(int i=0;i<size;i++){
    for(int j=0;j<size;j++){
      u[i][j]=t[y+i][x+j];
    }
  }
  while(angle--){
 
    for(int i=0;i<size;i++){
      for(int j=0;j<size;j++){
    v[j][size-1-i]=u[i][j];
      }
    }
 
    for(int i=0;i<size;i++){
      for(int j=0;j<size;j++){
    u[i][j]=v[i][j];
      }
    }
 
  }//while
 
  for(int i=0;i<size;i++){
    for(int j=0;j<size;j++){
      t[i+y][j+x]=u[i][j];
    }
  }
}
 
void reversal(int y,int x,int size){
  y--;x--;
 
  for(int i=0;i<size;i++){
    for(int j=0;j<size;j++){
      t[y+i][x+j]=1-t[y+i][x+j];
    }
  }
}
 
void lefts(int y){
  y--;
  int tmp=t[y][0];
  for(int i=0;i<n-1;i++)t[y][i]=t[y][i+1];
  t[y][n-1]=tmp;
}
 
void rights(int y){
  y--;
  int tmp=t[y][n-1];
  for(int i=n-1;i>=1;i--)t[y][i]=t[y][i-1];
  t[y][0]=tmp;
}
 
void dfs(int y,int x,int key){
  if(y<0||y>=n)return;
  if(x<0||x>=n)return;
  if(t[y][x]!=key)return;
  t[y][x]=1-key;
  dfs(y+1,x,key);
  dfs(y-1,x,key);
  dfs(y,x+1,key);
  dfs(y,x-1,key);
}
 
void islandr(int y,int x){
  y--;x--;
  dfs(y,x,t[y][x]);
}
 
int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cin>>t[i][j];
    }
  }
 
  for(int i=0;i<m;i++){
    cin>>o;
    if(o==0){
      cin>>a>>b>>c>>d;
      rotate(a,b,c,d);
    }else if(o==1){
      cin>>a>>b>>c;
      reversal(a,b,c);
    }else if(o==2){
      cin>>a;
      lefts(a);
    }else if(o==3){
      cin>>a;
      rights(a);
    }else{
      cin>>a>>b;
      islandr(a,b);
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j)cout<<' ';
      cout<<t[i][j];
    }
    cout<<endl;
  }
  return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int h[N];
  for (int i = 0; i < N; i++) cin >> h[i];

  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (h[i] >= K) {
      sum++;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 640
//   __                    .__              ________ .________ ________   ______  
//  |  | __  ____    ______|  |__   __ __  /  _____/ |   ____//   __   \ /  __  \ 
//  |  |/ /_/ __ \  /  ___/|  |  \ |  |  \/   __  \  |____  \ \____    / >      < 
//  |    < \  ___/  \___ \ |   Y  \|  |  /\  |__\  \ /       \   /    / /   --   \
//  |__|_ \ \___  >/____  >|___|  /|____/  \_____  //______  /  /____/  \______  /
//       \/     \/      \/      \/               \/        \/                  \/

#include<bits/stdc++.h>
#define range 100005
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<


using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

bool check(int a){
	if(a>=1&&a<=9)
		return true;
	return false;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	int a,b;
	cin>>a>>b;
	if(check(a)&&check(b)){
		cout<<a*b;
		return 0;
	}
	cout<<-1;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF ((ll)1<<31)-1
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int gcd(int a,int b){
	if(!a)return b;
	return gcd(b%a,a);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
int n,a[110];
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,101){
		int st=0;
		rep(j,n){
			st+=a[j];
			if(st<i){
				cout<<i-1<<endl;
				return 0;
			}
			st-=i;
		}
	}
    return 0;
}


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	ll N;
	cin >>N;
	vector<ll> AA(100001, 0);
	vector<ll> A(N, 0);
	ll S=0;
	Rep0(i, N) {
		cin >>A.at(i);
		AA.at(A.at(i))++;
		S +=A.at(i);
	}
	ll Q;
	cin >>Q;
	Rep0(i, Q) {
		ll B, C;
		cin >>B >>C;
		S +=AA.at(B)*(C-B);
		cout <<S <<endl;
		AA.at(C) +=AA.at(B);
		AA.at(B)=0;
	}
	return 0;
}



Measured memory_bytes: 4840
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

ll k;
const int n=50;
vector<ll> a(n);

int main(void){
    cin >> k;
    ll b = k/n;
    int c = k%n;
    REP(i,c){
        a[i] = n+b;
    }
    FOR(i,c,n){
        a[i] = b+n-c-1;
    }
    put(n);
    REP(i,n-1){
        cout << a[i] << " ";
    }
    put(a[n-1]);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n;
	cin >> n;
	vector<double> x(n),y(n);
	rep(i,n)
	{
		cin >> x[i] >> y[i];
	}
	vector<int> patan(n);
	rep(i,n)patan[i]=i;
	int roop=1;
	for(int i=2;i<=n;i++)roop*=i;

	double sum=0;
	rep(iii,roop)
	{
		rep(i,n-1)
		{
			sum+=sqrt((x[patan[i]]-x[patan[i+1]])*(x[patan[i]]-x[patan[i+1]])+(y[patan[i]]-y[patan[i+1]])*(y[patan[i]]-y[patan[i+1]]));
			//cout<<sum<<endl;
		}
		next_permutation(ALL(patan));

	}


	printf("%.10lf",sum/roop);
	return 0;
}

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

int main(){
    int m1,d1,m2,d2;
    cin>>m1>>d1>>m2>>d2;
    if(m1!=m2)cout<<1<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
int main()
{
	while (true)
	{
		int c1, c2, c3;
		std::cin >> c1 >> c2 >> c3;
		if (std::cin.eof())
		{
			break;
		}
		std::vector<int>remains;
		remains.reserve(7);
		for (int i = 1; i <= 10; i++)
		{
			if (i != c1 && i != c2 && i != c3)
			{
				remains.push_back(i);
			}
		}
		std::cout << (c1 + c2 + remains[3] <= 20 ? "YES" : "NO") << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2972
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long
#define MAX 100100
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
struct Line{int v,next;}e[MAX];
int h[MAX],cnt=1;
inline void Add(int u,int v){e[cnt]=(Line){v,h[u]};h[u]=cnt++;}
int n,f[MAX],S[MAX],top;
void dfs(int u)
{
	for(int i=h[u];i;i=e[i].next)dfs(e[i].v);
	top=0;
	for(int i=h[u];i;i=e[i].next)S[++top]=f[e[i].v];
	sort(&S[1],&S[top+1]);
	for(int i=1;i<=top;++i)f[u]=max(f[u],S[i]+top-i+1);
}
int main()
{
	n=read();
	for(int i=2;i<=n;++i)Add(read(),i);
	dfs(1);printf("%d\n",f[1]);
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < int(n); ++ (i))
using ll = long long;
using namespace std;
template <class T> inline void chmax(T & a, T const & b) { a = max(a, b); }
template <class T> inline void chmin(T & a, T const & b) { a = min(a, b); }

constexpr ll INF = (ll)1e18 + 9;
ll solve(int n, int m, vector<vector<pair<int, int> > > const & g) {
    vector<ll> a(n, INF);
    vector<ll> b(n, INF);
    ll x = INF;
    try {
        function<void (int)> dfs = [&](int i) {
            for (auto edge : g[i]) {
                int j, s; tie(j, s) = edge;
                if (a[j] == INF) {
                    // let: a_j x + b_j := s - (a_i x + b_i)
                    a[j] =   - a[i];
                    b[j] = s - b[i];
                    dfs(j);
                } else {
                    // solve: a_i x + b_i + a_j x + b_j = s
                    if (x == INF) {
                        ll num = s - b[i] - b[j];
                        ll den =     a[i] + a[j];
                        if (den == 0) {
                            if (num == 0) {
                                // nop
                            } else {
                                throw 0;
                            }
                        } else if (num % den != 0) {
                            throw 0;
                        } else {
                            x = num / den;
                        }
                    } else {
                        if ((a[i] * x + b[i]) + (a[j] * x + b[j]) != s) {
                            throw 0;
                        }
                    }
                }
            }
        };
        a[0] = 1;
        b[0] = 0;
        dfs(0);
    } catch (int) {
        return 0;
    }

    if (x != INF) {
        REP (i, n) {
            if (a[i] * x + b[i] <= 0) {
                return 0;
            }
        }
        return 1;

    } else {
        // x is arbitrary
        ll l = - INF;
        ll r = INF;
        REP (i, n) {
            // solve: a_i x + b_i > 0
            if (a[i] > 0) {
                chmax(l, (- b[i]) / a[i] + 1);
            } else if (a[i] < 0) {
                chmin(r, (- b[i]) / a[i] - 1);
            }
        }
        return max(0ll, r - l + 1);
    }
}

int main() {
    // input
    int n, m; cin >> n >> m;
    vector<vector<pair<int, int> > > g(n);
    REP (i, m) {
        int u, v, s; cin >> u >> v >> s;
        -- u; -- v;
        g[u].emplace_back(v, s);
        g[v].emplace_back(u, s);
    }

    // solve
    ll answer = solve(n, m, g);

    // output
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 13568
/*  "Sahand Alitanloo"  */
#include <bits/stdc++.h>
#define F first
#define S second
#define fast() ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define per(i) cout<<fixed<<setprecision(i)
#define pb push_back
#define all(v) begin(v),end(v)
#define endl '\n'
using namespace std;
typedef pair<int,int> pii;
typedef long double ld;
typedef long long ll;
const int MAX_N = 1e5+10;
const ll mod = 1e9+7;
const ll INF = 1e9;
inline ll bpow(ll t,ll n){ll ans=1;while(n>0){if(n&1)ans=(ans*t)%mod;t=(t*t)%mod,n>>=1;}return ans;}
/*
ll fact[MAX_N],ifact[MAX_N];
inline ll c(ll n,ll k){if(k>n||k<0)return 0;return (fact[n]*ifact[k]%mod*ifact[n-k])%mod;}
inline void get_fact(){fact[0]=1;ifact[0]=1;for(ll i=1;i<MAX_N;i++)fact[i]=(fact[i-1]*i)%mod,ifact[i]=bpow(fact[i],mod-2);}
*/

main(){
    fast();per(0);
    //get_fact();
    string s;cin>>s;
    for(int i=0;i<int(s.length())-8;i++)
        cout<<s[i];
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;

static constexpr ull MOD = 1000000007;
static constexpr double pi = 3.14159265359;

int main() {
    int N;
    cin >> N;
    double ans = 0;
    for (int i = 0; i < N; ++i) {
        double x;
        string u;
        cin >> x;
        cin >> u;
        if (u == "JPY") {
            ans += x;
        } else {
            ans += 380000.0 * x;
        }
    }
    printf("%lf\n", ans);
}


Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n,k;
	while(cin>>n>>k,n||k){
		vint v(n);
		rep(i,n){
			cin>>v[i];
		}
		int MAX=0;
		rep(i,n-k+1){
			int ss=1;
			// cout<<"k "<<k<<endl;
			rep(j,k){
				ss*=v[j+i];
				// cout<<j<<" "<<v[j]<<endl;
			}
			// cout<<ss<<endl;
			MAX=max(MAX,ss);
		}
		int M=0;
		rep(i,n){
			rep(j,n){
				swap(v[i],v[j]);
				// int ss=1;
				rep(x,n-k+1){
					int ss=1;
					rep(y,k){
						ss*=v[y+x];
					}
					M=max(M,ss);
				}
				swap(v[i],v[j]);
			}
		}
		// cout<<M<<" "<<MAX<<endl;
		if(M<MAX){
			cout<<"NO GAME"<<endl;
		}
		else{
			cout<<M-MAX<<endl;
		}
	}
}

Measured memory_bytes: 1196
/*
 *  Language:   C++
 *  Author:     Debajyoti Dasgupta
 */
#include <bits/stdc++.h>

using namespace std;

#define int long long
const int mod = 998244353;
const int maxx = 2e5 + 10;

vector<int> fact(maxx);

int power(int x, int y) {
    int res = 1;
    while (y) {
        if (y & 1)res = (res * x) % mod;
        x = (x * x) % mod;
        y >>= 1;
    }
    return res;
}

int inv(int x) {
    return power(x, mod - 2);
}

void pre() {
    fact[0] = 1;
    for (int i = 1; i < maxx; ++i) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
}

int ncr(int n, int k) {
    return (fact[n] * inv(fact[n - k])) % mod * inv(fact[k]) % mod;
}

signed main() {
    pre();
    int n, m, k;
    cin >> n >> m >> k;
    int ans = 0;
    for (int i = 0; i <= k; ++i) {
        ans += ncr(n - 1, i) * power(m - 1, n - 1 - i) % mod;
        ans %= mod;
    }
    cout << ans * m % mod << endl;
}

Measured memory_bytes: 4668
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 200005;

template<typename T> class segtree {
private:
    int n,sz;
    vector<T> node;
public:
    segtree(vector<T>& v){
        sz = (int)v.size();
        n = 1;
        while(n < sz){
            n *= 2;
        }
        node.assign(2*n,numeric_limits<T>::min());
        rep(i,sz){
            node[i+n] = v[i];
        }
        for(int i=n-1; i>=1; i--){
            node[i] = max(node[2*i],node[2*i+1]);
        }
    }
    void update(int k,T a)
    {
    	node[k+=n] = a;
    	while(k>>=1){
    		node[k] = max(node[2*k],node[2*k+1]);
    	}
    }
    T query(int a,int b)
    {
        T res1 = numeric_limits<T>::min();
        T res2 = numeric_limits<T>::min();
        a += n, b += n;
        while(a != b){
            if(a % 2) res1 = max(res1, node[a++]);
            if(b % 2) res2 = max(res2, node[--b]);
            a >>= 1, b>>= 1;
        }
        return max(res1, res2);
    }
    void print()
    {
        rep(i,sz){
            cout << query(i,i+1) << " ";
        }
        cout << endl;
    }
};

int h[MAX_N];
ll a[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n){
        cin >> h[i];
        h[i]--;
    }
    rep(i,n){
        cin >> a[i];
    }
    vl hoge(n, 0);
    segtree<ll> sg(hoge);
    rep(i,n){
        ll res = sg.query(0, h[i]+1);
        sg.update(h[i], res+a[i]);
    }
    cout << sg.query(0, n) << "\n";
    return 0;
}

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

const int DIM = 1e5 + 5;

int lev[DIM];

vector<int> edg[DIM];

void dfs( int x, int f, bool &ok ) {
    lev[x] = lev[f] + 1;
    
    for( int y : edg[x] ) {
        if( y == f )
            continue;
        
        if( lev[y] == 0 )
            dfs( y, x, ok );
        else
        if( ( lev[x] - lev[y] ) % 2 == 0 )
            ok = false;
    }
    
    return;
}

int main( void ) {
    
    int n, m;
    cin >> n >> m;
    
    for( int i = 1; i <= m; i ++ ) {
        int x, y;
        cin >> x >> y;
        
        edg[x].push_back( y );
        edg[y].push_back( x );
    }
    
    int cnt1 = 0, cnt2 = 0, cnt3 = 0;
    for( int i = 1; i <= n; i ++ ) {
        if( lev[i] != 0 )
            continue;
        
        if( edg[i].size() == 0 )
            cnt1 ++;
        else {
            bool ok = true;
            dfs( i, 0, ok );
            
            if( ok == true )
                cnt2 ++;
            else
                cnt3 ++;
        }
    }
    
    cout << 1LL * cnt1 * cnt1 + 2LL * cnt1 * (n - cnt1) +
            1LL * cnt3 * cnt3 + 2LL * cnt2 * cnt3 + 2LL * cnt2 * cnt2;
    
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];
  vector<int> b(n);
  
  for(int i=0; i<n; i++){
    b[a[i]-1]=i+1;
  }
  for(int i=0; i<n; i++) cout << b[i] << " ";
  return 0;
}

Measured memory_bytes: 1536
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    int red = 0, blue = 0, count = 0;
    std::string S;
    std::cin >> S;
    for (char ch : S)
    {
        if (ch == '0') { red++; }
        else
        {
            blue++;
        }
    }
    count = 2 * std::min(red, blue);
    std::cout << count << std::endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int n, s = 0, mn = INF;
    cin>>n;
    vi v(n);
    for(int i = 0; i < n; i++)cin>>v[i];
    sort(all(v));
    s=v[n-1];
    int i = n-2;
    int cnt = n-2;
    while(cnt>n%2)
    {
        s+=2*v[i--];
        cnt-=2;
    }
    cout<<s+(n%2)*v[i];
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}


Measured memory_bytes: 4772
package main

import (
  "fmt"
)

func maxInt(a ...int) int {m := a[0]; for _, x := range a {if x > m {m = x}}; return m}
func minInt(a ...int) int {m := a[0]; for _, x := range a {if x < m {m = x}}; return m}
func sumInt(a ...int) int {s := 0; for _, v := range a {s += v}; return s}

func main() {
  var n int 
  fmt.Scan(&n)
  l := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&l[i])
  }

  ans := "No"
  if sumInt(l...) > maxInt(l...) * 2 {
    ans = "Yes"
  }
  fmt.Println(ans)


}

Measured memory_bytes: 512
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int N, K; cin >> N >> K;
	if(N%K == 0) cout << 0 << endl;
	else cout << 1 << endl;


	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int N;
	cin >> N;
	vector<ll> A(N), B(N), C(N);
	REP(i, N) { cin >> A[i]; }
	REP(i, N) { cin >> B[i]; }
	REP(i, N) { cin >> C[i]; }
	SORT(A);
	SORT(B);
	SORT(C);
	vector<ll> cumsum(N + 1);
	ll res = 0;
	REP(i, N) {
		int l = LB(A, B[i]);
		cumsum[i + 1] = cumsum[i] + l;
	}
	REP(i, N) {
		int l = LB(B, C[i]);
		res += cumsum[l];
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
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 (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    string S;cin >> S;   
    int sz = S.size();
    int mod = 2019;
    vector<LL> ten_dp(sz + 4);
    ten_dp[0] = 1 % mod;
    for(int i = 1;i <= sz;i++){
        ten_dp[i] = ((ten_dp[i-1]) * 10) % mod;
    }



    vector<LL> dp(sz+4);
    dp[sz-1] = (S[sz-1] - '0') * ten_dp[0];
    for(int i = 1;i < sz;i++){
        int num = S[sz-1-i] - '0';
        dp[sz-1-i] = (((num * ten_dp[i]) % mod) + dp[sz-i]) % mod;
    }

    map<int,int> m;
    rep(i,sz){
        m[dp[i]]++;
    }

    LL ans = 0;

    for(auto t : m){
        ans += (t.S*(t.S - 1)/2);
        if(t.F == 0)ans += t.S;
    }

    cout << ans << endl;
}

Measured memory_bytes: 6828
//https://atcoder.jp/contests/abc154/tasks/abc154_a
//A - Remaining Balls / 
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    string S,T; cin>>S>>T;
    ll A,B; cin>>A>>B;
    string U; cin>>U;
    if (S==U)--A;
    else if (T==U)--B;
    else assert(0);
    cout<<A<<" "<<B<<endl;
    return 0;
}

Measured memory_bytes: 256
N,M = [int(x) for x in input().split()]
s = []
for i in range(M):
    array = list(map(str,input().split()))
    s.append(array)

answer = 0
penalty = 0

WA = [0 for i in range(N)]
#print(t)
for i in range(M):
    if WA[int(s[i][0])-1] != "AC":
        if s[i][1] == "WA":
            WA[int(s[i][0])-1] += 1
        else:
            penalty += WA[int(s[i][0])-1]
            answer += 1
            WA[int(s[i][0])-1] = "AC"
    #print(WA)
print(answer,penalty)

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

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> rui(n + 1);
    rui[0] = 0;
    for (int i = 1; i <= n; i++) rui[i] = rui[i - 1] + a[i - 1];

    for (int i = k + 1; i <= n; i++) {
        ll num = rui[i] - rui[i - k];
        ll num1 = rui[i - 1] - rui[i - k - 1];

        if (num > num1)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 5636
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string>


typedef long long ll;

using namespace std;

int main() 
{ 
	string res = ""; 

	ll n, b;
	cin >> n >> b;

	while (n != 0) {
		if (n < b) {
			res += to_string(n);
			break;
		}
		ll rem = (n % b);
		res += to_string(rem);
		n /= b;
	}

	cout << res.size() << endl;

	return 0; 
} 


Measured memory_bytes: 256
def Counting_Sort(A,k):
    c = [0]*(k+1)
    b = [0]*n
    for a in A:
        c[a]+=1
    for i in range(1,k+1):
        c[i] = c[i] + c[i-1]
    
    for a in A:
        rank = c[a]
        b[rank-1] = a
        c[a] -= 1
    print(*b)

n = int(input())
a = list(map(int, input().split()))
k = max(a)+1
Counting_Sort(a,k)



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

int main(){
  int A, B;
  cin >> A >> B;
  int num = 0;
  for(int i=A; i<=B; i++){
    if(i%10 == 0) continue;
    int N = i;
    int M = i;
    int count = -1;
    if(i%10 == 0) break;
    for(int j=0; N>0; j++){
      N/=10;
      count++; 
    }
    int L = 0;
    for(int j=0; M>0; j++){
      int a = M % 10;
      L += a * pow(10, count);
      M /= 10;
      count--;
    }
    if(i == L){
      num++;
    }
  }
  cout << num << endl;
}

Measured memory_bytes: 256
<?php
	$input = trim(fgets(STDIN));
	list($n, $m, $l) = explode(" ", $input);

	$a = $b = array();
	for ($i = 0; $i < $n; $i++) {
		$a[] = explode(" ", trim(fgets(STDIN)));
	}
	for ($i = 0; $i < $m; $i++) {
		$b[]= explode(" ", trim(fgets(STDIN)));
	}

	$c = array_fill(0, $n, array_fill(0, $l, 0));
	for ($i = 0; $i < $n; $i++) {
		for ($j = 0; $j < $l; $j++) {
			for ($k = 0; $k < $m; $k++) {
				$c[$i][$j] += ($a[$i][$k] * $b[$k][$j]);
			}
		}
	}

	foreach ($c as $arr) {
		echo implode(" ", $arr) . "\n";
	}

Measured memory_bytes: 11616
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	loopTimes, _ := strconv.Atoi(stdin.Text())
	count := 0
	for i := 1; i <= loopTimes; i++ {
		if (i >= 1 && i <= 9) || (i >= 100 && i <= 999) || (i >= 10000 && i <= 99999) {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define ve vector
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int n;
    cin >> n;
    ve<ll> a(n+1);
    a[0] = 0;
    rep(i,n) cin >> a[i+1];
    rep(i,n) a[i+1] += a[i];
    ve<ve<ll>> dp(405, ve<ll>(405));

    rep(i,n-1) dp[i][i+1] = a[i+2]-a[i];
    for(int len = 2; len < n; len++){
        for(int i = 0; i+len<n; i++){
            dp[i][i+len] = dp[i][i] + dp[i+1][i+len];
            dp[i][i+len] += a[i+len+1] - a[i];
            for(int m = 1; m < len; m++){
                ll memo = dp[i][i+m]+dp[i+m+1][i+len];
                memo += a[i+len+1] - a[i];
                dp[i][i+len] = min(dp[i][i+len], memo);
            }
        }
    }
    cout << dp[0][n-1] << endl;
    return 0;
}

Measured memory_bytes: 1536
import math

N = int(input())
root = [list(map(int,input().split())) for i in range(N)]
way = []
for i in range(N-1):
    for j in range(i+1,N):
        way.append(math.sqrt((root[i][0]-root[j][0])**2 + (root[i][1]-root[j][1])**2))
ans = sum(way) * (math.factorial(N-1)*2)
print(ans/math.factorial(N))

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int count=0;
    for(int i=11;;i+=10){
        int c=0;
        for(int j=1;j<=i;j++){
            if(i%j==0){
                c++;
            }
        }
        if(c==2){
            cout<<i;
            count++;
            if(count!=n){
                cout<<" ";
            }
        }
        if(count==n){break;}
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
int N;
ll A[100005];
ll Lgcd[100005];
ll Rgcd[100005];
const int inf=1e9+7;
int ans=0;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}
ll gcd(ll a, ll b)
{
  if(b>a) swap(a,b);
  if(b==0) return a;
  return gcd(b,a%b);
}
int main(void)
{
  cin >> N;
  Fill(Lgcd,inf);
  Fill(Rgcd,inf);
  for (int i = 1; i <= N; ++i)
    {
      cin >> A[i];
    }
  //sort(A,A+N);
  ll ans=A[1];
  for(int i=2;i<=N;i++)
    {
      ans=gcd(ans,A[i]);
    }
  for (int i = 1; i <= N; ++i)
    {
      if(i==1) Lgcd[i]=A[i];
      else Lgcd[i]=gcd(A[i],Lgcd[i-1]);
    }
  for (int i = N; i >= 0; i--)
    {
      if(i==N) Rgcd[i]=A[i];
      else Rgcd[i]=gcd(A[i],Rgcd[i+1]);
    }
  for (int i = 1; i <= N; ++i)
    {
      if(i==1) ans=max(ans,Rgcd[i+1]);
      else if(i==N) ans=max(ans,Lgcd[i-1]);
      else
	{
	  ll tmp=gcd(Lgcd[i-1],Rgcd[i+1]);
	  ans=max(ans,tmp);
	}
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int N = reader.nextInt();
        String S = reader.next();
        if (N%2 == 1) {
            System.out.println("No");
            return;
        }
        for (int i=0; i<N/2; i++) {
            if (S.charAt(i) != S.charAt(i+N/2)) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



Measured memory_bytes: 21332
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        a: usize, b: usize,
    }

    let mut ans = 0;
    for i in a..(b+1) {
        let l2 = (i/10  % 10) + ((i % 10) * 10);
        if i / 1000 == l2 { ans += 1 }
    }
    println!("{}", ans)
}


Measured memory_bytes: 2152
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX



 
void solve()
{
    int k;
    string s;
    cin >> k >> s;
    if(s.size()<=k)
        cout << s<< endl;
    else
        cout << s.substr(0,k) + "..." << endl;
}


signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 3656
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input())
    L = [0]*(N+1)
    L[0] = 2
    L[1] = 1
    for i in range(2,N+1):
        L[i] = L[i-2]+L[i-1]
    print(L[N])
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3940
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    rotate(s.begin(), s.begin() + 1, s.end());
    if (s == t) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256