akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

// import java.text.DecimalFormat; 
// import java.text.DecimalFormatSymbols; 
/*
 
 
 
 */

public class Main {

    public static void main(String args[] ) throws Exception {
        PrintWriter pw=new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        
        int t=1;
        //t = sc.ni();
        while(t-->0) {
        	solve(pw,sc);
        }
       
        pw.close();
    }
   
    private static void solve(PrintWriter pw, FastScanner sc) {
    	String s = sc.ne();
    	if(s.charAt(s.length()-1)=='s')
    		s=s+"es";
    	else 
    		s=s+"s";
    	pw.print(s);
    	
	}
   

	static <T> void deb(T x,int o){
       System.out.print(x);
       if(o==0) {
    	   System.out.println();
    	   
       }
    }
   
   
   static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String ne() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		public String ne(int k) {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "Not able to read";
		}
		
		int ni() {
			return Integer.parseInt(ne());
		}
		
		long nl() {
			return Long.parseLong(ne());
		}
		
		double nd() {
			return Double.parseDouble(ne());
		}
		
	    
	}
   
}

Measured memory_bytes: 36452
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		double r;
		Scanner sc = new Scanner(System.in);

		r = sc.nextDouble();

		double l = 2 * r * Math.PI;
		double s = r * r * Math.PI;
		System.out.printf("%f %f",s,l);

		sc.close();
	}

}

Measured memory_bytes: 28040
// @ts-ignore
import * as fs from 'fs';

// メイン
var g_root: number[];
var g_count: number[];

function main(input: string[]) {
    var work0: number[] = input.shift().split(" ").map(x => Number(x));
    var n: number = work0[0];
    var m: number = work0[1];
    var node: number[][] = input.map(x => x.split(" ").map(x => Number(x) - 1));
    g_root = new Array(n).fill(-1);
    g_count = new Array(n).fill(1);
    node.forEach(value => {
        var a: number = value[0];
        var b: number = value[1];
        var roota: number = getRoot(a);
        var rootb: number = getRoot(b);
        if (roota == rootb) return;
        if (roota > rootb) [roota, rootb] = [rootb, roota];
        mergeRoot(roota, rootb);
    });
    console.log(g_count.reduce(function(x, y) { return Math.max(x, y) }));
}

function getRoot(index: number) {
    if (g_root[index] < 0) {
        return index;
    } else {
        var work0: number = getRoot(g_root[index]);
        g_root[index] = work0;
        return work0
    }
}

function mergeRoot(root0: number, root1: number) {
    g_count[root0] += g_count[root1];
    g_count[root1] = 0;
    g_root[root1] = root0;
}

// エントリポイント
// - OSによるパラメタの処理の違いを吸収
function entrypoint() {
    try {
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        console.log("----");
        console.log("file='%s'", __filename.split("\\").slice(-1)[0]);
        console.log("----");
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            console.log("input=%o", input);
            console.time();
            console.log("----")
            main(input);
            console.log("----")
            console.timeEnd();
        });
    }
}
entrypoint();


Measured memory_bytes: 87996
A = [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]
print(A[int(input()) - 1])

Measured memory_bytes: 3060
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

inline bool query(ll x) {
  char buf[10];
  printf("? %lld\n", x);
  fflush(stdout);
  scanf("%s", buf);
  return buf[0] == 'Y';
}

inline void answer(ll x) {
  printf("! %lld\n", x);
  fflush(stdout);
  exit(0);
}


int main(void) {
  ll res = 0;
  bool all9 = true;
  { // 1桁目
    ll left = 0;
    ll right = 9;
    while(left+1 < right) {
      ll md = (left + right) / 2;
      bool q = query(md * 1000000000 + 999999999);
      if(q) { // str(md) > str(N)
        right = md;
      } else {
        left = md;
      }
    }
    if(right != 9) {
      all9 = false;
    }
    res = right;
  }

  for(ll t = 100000000; ; t /= 10) { // 2桁目以降
    // まずあるか無いか
    if(query(res + 1) == !all9) {
      answer(res);
      break;
    } else {
      ll left = -1;
      ll right = 9;
      while(left+1 < right) {
        ll md = (left + right) / 2;
        bool q = query(res * 10*t + md * t + t-1);
        if(q) { // str(md) > str(N)
          right = md;
        } else {
          left = md;
        }
      }
      if(right != 9) {
        all9 = false;
      }
      res = res * 10 + right;
    }
  }
  return 0;
}


Measured memory_bytes: 596
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
  int k,x;
  cin >> k >> x;
  if (k * 500 >= x){
    cout << "Yes\n"; 
  }
  else
  {
    cout << "No\n";
  }
  return 0;   
}

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

const char* out[] = {"Cat", "Rabbit"};
enum {
	CAT, RABBIT
};

char str[512];
int dp[512][512];

int check(int begin, int end)
{
	int i;
	int j;
	
	if (end < begin){
		return (RABBIT);
	}
	else if (dp[begin][end] != -1){
		return (dp[begin][end]);
	}
	else if (begin == end){
		return (dp[begin][end] = CAT);
	}
	else if (str[begin] != 'm' || str[end - 1] != 'w'){
		return (dp[begin][end] = RABBIT);
	}
	
	for (i = begin + 1; i < end - 1; i++){
		if (str[i] != 'e'){
			continue;
		}
		if (check(begin + 1, i) == CAT && check(i + 1, end - 1) == CAT){
			return (dp[begin][end] = CAT);
		}
	}
	
	return (dp[begin][end] = RABBIT);
}

int main()
{
	int i;
	int j;
	
	scanf("%s", str);
	
	for (i = 0; i < 512; i++){
		for (j = 0; j < 512; j++){
			dp[i][j] = -1;
		}
	}
	
	printf("%s\n", out[check(0, strlen(str))]);
	
	return (0);
}

Measured memory_bytes: 1548
#include<iostream>
#include <utility>
#include<bits/stdc++.h>
#define ull unsigned long long int
#define ll long long int
#define ld long double
// #define loop(i,a,b) for(ll i=a;i<b;i++)
// #define inll(n) ll n;cin>>n;
// #define instr(s)  string s;cin>>s;
// #define inarr(a,n)  ll*a = new ll[n];loop(i,0,n)cin>>a[i]; 
// #define invec(v,n)  vector<ll> v(n);loop(i,0,n)inll(v[i])
// #define arr(a,n) ll*a = new ll[n];
// #define outarr(a,n) loop(i,0,n)cout<<a[i]<<" ";cout<<endl;
#define pb push_back
#define mp make_pair
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector <int>
#define vb vector <bool>
#define vll vector <ll>
#define vc vector <char>
#define clr(a) memset(a,0,sizeof(a))
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define infd 1e+18
#define inf 101901199101
#define mod 1000000007
using namespace std;
inline ll min(ll a,ll b)
{
    return (a<b?a:b);
}
inline ll max(ll a,ll b)
{
    return (a<b?b:a);
}


void swap(ll*a,ll*b)
{
    ll t  = *a;
    *a =*b;
    *b = t;
}
void revere(string &s)
{
    for(ll i = s.length()-1;i>=ceil(s.length()/2);i--)
     swap(s[i],s[s.length()-1-i]);
}
bool isValidParenthesis(string s)
{
    int c = 0;
    for(char i:s)c = (i=='('?c+1:c-1);
    if(c!=0)return 0;
    return 1;
}


string substr(string s,int i,int j)
{
    if(i>j)return "";
    string n;
    for(int k = i;k<j;k++)
    {
        n+=s[k];
    }
    return n;
}

int ans(string s, int i,int j)
{
    if(i==j||j>s.length()||i>j||s.length()==0||s.length()==1)return 0;
    if(substr(s,i,j)=="()")return 1;
    if(isValidParenthesis(substr(s,i+1,j-1))) return 2*ans(s,i+1,j-1);
    int ind = i;
    for(int k = i+1;k<j;k++)
    {
        if(isValidParenthesis(substr(s,i,k+1)))
        {
            ind = k+1;
            break;
        }
    }
    return ans(s,i,ind) + ans(s,ind,s.length());
}

int main()
{
    ll n,k;cin>>n>>k;
    ll a[n] = {0};
    for(ll i = 0;i<n;i++)cin>>a[i];
    ll dp[n];
    clr(dp);
    dp[1] = abs(a[1]- a[0]);
    for(ll i = 2;i<n;i++)
    {
        ll x = max(0,i-k);
        ll mini = 89766878768;
        for(ll j = x;j<i;j++)
        {
            mini = min(dp[j] + abs(a[i]- a[j]), mini);
        }
        dp[i] = mini;
    }
    cout<<dp[n-1]<<endl;
}

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

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

  double tax_rate1 = 0.08;
  double tax_rate2 = 0.1;

 for(int i = 1; i <= 10000; i++){
   if(int(i * tax_rate1) == a && int(i * tax_rate2) == b){
     std::cout << i << std::endl;
     return 0;
   }
 }
 std::cout << -1 << std::endl;
 return 0;
}

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

#define BUF_SIZE 20

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

#define VERTEX_MAX 50
#define EDGE_MAX (VERTEX_MAX*(VERTEX_MAX-1)/2)

struct edge {
    int v1;
    int v2;
};

static int checked[VERTEX_MAX];

void dfs(char graph[][VERTEX_MAX], int size, int node) {
    char *head = graph[node];
    int i;
    checked[node] = 1;
    for(i = 0; i < size; i++) {
        if(!head[i]) continue;
        graph[node][i] = graph[i][node] = 0;
        dfs(graph, size, i);
    }
}

int main(void) {
    int vs, es;
    get_int2(&vs, &es);
    static char graph[VERTEX_MAX][VERTEX_MAX];
    static struct edge edges[EDGE_MAX];
    int i, j;
    for(i = 0; i < es; i++) {
        int v1, v2;
        get_int2(&v1, &v2);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        edges[i] = (struct edge){v1, v2};
        graph[v1][v2] = graph[v2][v1] = 1;
    }

    int ans = 0;
    for(i = 0; i < es; i++) {
        int res = 0;
        int v1 = edges[i].v1; int v2 = edges[i].v2;
        static char g[VERTEX_MAX][VERTEX_MAX];
        for(j = 0; j < vs; j++) {
            memcpy(g[j], graph[j], VERTEX_MAX);
            checked[j] = 0;
        }
        g[v1][v2] = g[v2][v1] = 0;
        dfs(g, vs, 0);
        for(j= 0; j < vs; j++) res += checked[j];
#ifdef DEBUG
        printf("exclude: %d-%d -> %d\n", v1, v2, res);
#endif
        // cannnot traverse all vertexes..
        if(res != vs) ans++;
    }
    printf("%d\n", ans);
    return 0;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<ll> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main2()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	
	cin >>n;
	const int MX = n*2+10;
	vector<double> p(n), dp(MX);
	dp[MX/2] =1;
	rep(i,n) cin >>p[i];
	
	rep(i, n){
		vector<double> np(MX);
		rep(j, MX) if(dp[j] !=0){
			np[j+1]+=p[i]*dp[j];
			np[j-1]+=(1.0-p[i])*dp[j];
		}
		swap(dp, np);
	}
	double ans =0;
	rep2(i,MX/2, MX) ans += dp[i];
	printf("%.15f\n",ans);
	//for(auto x :dp) cout<<x <<" "; puts("");
	return 0;
}
int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	
	cin >>n;
	vector<double> p(n), dp(n+4);
	dp[0] =1;
	rep(i,n) cin >>p[i];
	
	rep(i, n){
		vector<double> np(n+4);
		rep(j, n+2) if(dp[j] !=0){
			np[j+1] +=p[i]*dp[j];
			np[j]   +=(1.0-p[i])*dp[j];
		}
		swap(dp, np);
	}
	printf("%.15f\n", accumulate(dp.begin()+n/2+1, dp.end(), 0.00));
	//for(auto x :dp) cout<<x <<" "; puts("");
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int M,N,a,b,value;
	cin>>N>>M;
	--N;
	--M;
	a=(N*(N+1))/2;
	b=(M*(M+1))/2;
	value=a+b;
	cout<<value;
}

Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }

signed main() {
	int x = in();
	bitset<32>bs(x);
	cout << bs << endl;
	cout << ~bs << endl;
	cout << (bs << 1) << endl;
	cout << (bs >> 1) << endl;
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

int main(){
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    vector<ll> a(N,0);
    for(ll i=0;i<N;i++){
        cin>>a[i]
    ;}

    //dp[i]はi個の飴を分け合う方法
    vector<ll> dp(K+1,0);
    for(ll i=0;i<=a[0];i++){
        dp[i]=1;
    ;}
    
    //子供を一人ずつ解禁
    for(ll k=1;k<N;k++){
        ll sum=0;
        for(ll i=1;i<=a[k];i++){
            if(K-i>=0){sum+=dp[K-i];}
        ;}
        for(ll i=K;i>=0;i--){
            dp[i]+=sum;dp[i]%=MOD;
            if(i-1>=0){sum-=dp[i-1];}
            if(i-a[k]-1>=0){sum+=dp[i-a[k]-1];}
        ;}
    ;}

    cout<<dp[K]<<endl;

    return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3

def main():
    N,L= map(int, input().split())
    ringos = []
    for i in range(N):
        ringos.append(L + i)
    
    full_ringo_pie = sum(ringos)
    min_taste_ringo = 101
    for ringo in ringos:
        if abs(min_taste_ringo) > abs(ringo):
            min_taste_ringo = ringo
    
    print(full_ringo_pie - min_taste_ringo)
        



if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {

    int length;
    
    scanf("%d", &length );
    
    int A[100];
    int i;
    
    for(i=0;i<length;i++)
    {
        scanf("%d", &A[i]);
    }
    
    int j;
    int temp;

    int ppp=0;
    for (i = 0; i < length - 1; i++)
	for (j = 0; j < length - 1 - i; j++)
            if (A[j] > A[j + 1]) {
		temp = A[j];
		A[j] = A[j + 1];
		A[j + 1] = temp;
                ppp = ppp+1;
            }

    for(int n=0; n<length; n++){
        printf("%d", A[n]);
        if(n!=length-1)
            printf(" ");
        else
        {
            printf("\n");
        }     
    }
    printf("%d\n", ppp);
    return 0;

}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define frep(i, m, n) for(int i = m;i < n;i++)
#define frepr(i, m, n) for(int i = m;i >= n;i--)
#define vsort(v) sort(v.begin(),v.end())
#define ll long long
#define inf 999999999
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vst;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
typedef pair<int,P> PP;
typedef pair<ll,LP> LPP;

int main(){
    int n,r;
    while(cin >> n >> r && n*r!=0){
        vi card(n);
        rep(i,n)card[i]=n-i;
        rep(i,r){
            int p,c;
            cin >> p >> c;
            rotate(card.begin(),card.begin()+p-1,card.begin()+p+c-1);
        }
        cout << card[0] << endl;
    }

    return 0;
}


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

#define pb push_back
#define pp pop_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()
typedef long long ll;

using namespace std;

const int N = 4000 + 111, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1.0), eps = 1e-10;

int n;
ll a[N], x, mn[N / 2][N], ans = INF;

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

	cin >> n >> x;

	for(int i = 1; i <= n; ++i)
		cin >> a[i];

	for(int i = n + 1; i <= n + n; ++i)	
		a[i] = a[i - n];

	for(int i = 1; i <= n; ++i){
		ll m = inf;
		for(int j = i; j <= n + n; ++j)
			m = min(m, a[j]), mn[i][j] = m;
	}	

	for(int i = 0; i <= n; ++i){
		ll answer = i * x;
		for(int j = 1; j <= n; ++j)
			answer += mn[j][j + i];
		ans = min(ans, answer); 
	}

	cout << ans;

	return 0;
 	//cout << (clock() + 0.0) / CLOCKS_PER_SEC;	
}

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

int main() {
  int n,k,x,ans = 0;
  cin >> n >> k;
  for(int i = 0; i < n; i++){
    cin >> x;
    ans += min(x,k - x);
  }
  cout << ans * 2 << endl;
}


Measured memory_bytes: 384
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back 
#define MP make_pair
typedef long long ll;
const ll INF=1<<28;
const ll LINF=1ll<<61;
//My own input/output stream
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putsp()
#define putii(x,y) puti(x),putnum(y),putsp()
#define putiii(x,y,z) putii(x,y),putnum(z),putsp()
#define putsi(x) putnum(x),putendl()
#define putsii(x,y) puti(x),putnum(y),putendl()
#define putsiii(x,y,z) putii(x,y),putnum(z),putendl()
inline ll getnum()
{
	register ll r=0;register bool ng=0;register char c;c=getchar();
	while(c!='-'&&(c<'0'||c>'9'))c=getchar();
	if(c=='-')ng=1,c=getchar();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=getchar();
	if(ng)r=-r;return r;
}
template <class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline void putsp(){putchar(' ');}
inline void putendl(){putchar('\n');}
inline char mygetchar(){register char c=getchar();while(c==' '||c=='\n')c=getchar();return c;}
int n,a[100111];
const int mod=1e9+7;
int main()
{
	geti(n);
	for(int i=1;i<=n;i++)
	{
		geti(a[i]);
	}
	int it=1;
	ll ans=1;
	for(int i=1;i<=n;i++)
	{
		while(it<n&&a[it]>=(it-i)*2+1)it++;
//		cout<<"it="<<it<<endl;
		ans=1ll*ans*(it-i+1)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
diff_A = []
for i in range(1, N):
    diff_A += [(i - 1, A[i] - A[i - 1])]
### A_N → A1 の距離
diff_A += [(N, K - A[i] + A[0])]
sorted_diff_A = sorted(diff_A, key=lambda x: x[1], reverse=True)
print(K - sorted_diff_A[0][1])

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

class P
{
    static void Main()
    {
        int[] a = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
        bool isexistseven = a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0;
        if (isexistseven)
        {
            Console.WriteLine(0);
        }
        else
        {
            Console.WriteLine((long)a[0] * a[1]);
        }
    }
}

Measured memory_bytes: 11348
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(){
    char search[21], word[21];
    int count=0;
    int i;
    
    scanf("%s", search);
    while(1){
        scanf(" %s", word);
        if(strcmp(word, "END_OF_TEXT")==0)break;
        for(i=0;word[i]!='\0';i++){
            word[i]=tolower(word[i]);
        }
        if(strcmp(word, search)==0){
            count++;
        }
    }
    printf("%d\n", count);

    return 0;
}


Measured memory_bytes: 2112
import java.io.File;
import java.io.IOException;
import java.util.Scanner;

/*
 * メモ
 * Scanner:nextは空白か改行までの単語
 * String[][] c = new String[h][w];
 * TemplateMain,"template_input.txt"
 */

public class Main {

	public static void printlnYN(boolean b){
		if(b) System.out.println("Yes");
		else System.out.println("No");
	}

	public static void main(String[] args) throws IOException {

		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

    	int A = sc.nextInt();
    	int B = sc.nextInt();

    	int max = A+B;
    	if(A-B > max) max = A-B;
    	if(A*B > max) max = A*B;
    	System.out.println(max);
	}

}

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

#define INF 1e9
using namespace std;

int main() {

    int N; cin >> N;

    bool ans = false;
    for (int i = 0; i <= 25; ++i) {
        for (int j = 0; j <= 14; ++j) {
            if (4 * i + 7 * j == N) {
                ans = true;
            }
        }
    }

    if (ans) {
        puts("Yes");
    } else {
        puts("No");
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc128_b

N = int(input())
numbers = []
cities = []
points = []

for i in range(N):
    city, point = input().split()
    numbers.append(i+1)
    cities.append(city)
    points.append(int(point))

def switch_order(l, i, j):
    tmp = l[i]
    l[i] = l[j]
    l[j] = tmp

for i in range(N):
    for j in range(i):
        if cities[j] < cities[i]:
            continue
        if cities[j] > cities[i]:
            switch_order(numbers, i, j)
            switch_order(cities, i, j)
            switch_order(points, i, j)
        if cities[j] == cities[i] and points[j] < points[i]:
            switch_order(numbers, i, j)
            switch_order(cities, i, j)
            switch_order(points, i, j)

for i in range(N):
    print(numbers[i])


Measured memory_bytes: 9172
import Control.Monad
import Data.List

getInt = read <$> getLine :: IO Int
getInts = map read . words <$> getLine :: IO [Int]

f k x = min (2*x) (x+k)

main = do
    n <- getInt
    k <- getInt
    print $ foldr ($) 1 $ replicate n (f k)



Measured memory_bytes: 508
use io::*;
use proconio::{fastout, input};
use std::*;

#[fastout]
fn main() {
    input! {
        N: usize,
        A: [i64; N]
    }
    let mut curr = A.iter().fold(0, |acc, a| acc ^ a);
    for i in 0..N {
        curr ^= A[i];
        match i {
            0 => print!("{}", curr),
            _ => print!(" {}", curr),
        }
        curr ^= A[i];
    }
    println!();
}


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

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair

const int MAXN = 410;

int n, m;

string s[MAXN];

int bio[MAXN][MAXN];
int B, W;

const int smjerx[] = {0, 0, 1, -1};
const int smjery[] = {1, -1, 0, 0};

void dfs(int x, int y) {
  if (s[x][y] == '.') W++;
  else B++;
  bio[x][y] = 1;

  REP(i, 4) {
    int nx = x + smjerx[i];
    int ny = y + smjery[i];
    if (nx < 0 || ny < 0 || nx >= n || ny >= m || bio[nx][ny] || s[nx][ny] == s[x][y]) continue;
    dfs(nx, ny);
  }
}

int main() {
  cin >> n >> m;
  REP(i, n) cin >> s[i];
  ll sol = 0;
  REP(i, n) REP(j, m) {
    if (bio[i][j]) continue;
    B = W = 0;
    dfs(i, j);
    sol += (ll)B * W;
  }
  cout << sol << endl;
}


Measured memory_bytes: 18560
dy = [0, 1]
dx = [1, 0]

def dfs(x, y, v, m, lx, ly):
	ans = v + m[y][x]
	if x == lx and y == ly:
		return ans
	for i in range(2):
		ny = y + dy[i]
		nx = x + dx[i]
		if nx > lx or ny > ly:
			continue
		tmp = dfs(nx, ny, v + m[y][x], m, lx, ly)
		ans = max(ans, tmp)
	return ans

def resolve():
	n = int(input())
	m = [list(map(int, input().split())) for _ in range(2)]
	ans = dfs(0, 0, 0, m, n-1, 1)
	print(ans)
resolve()

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

int main() {
    int x, y;
    int x_flg = -1;
    int y_flg = -1;
    int a[10] = {1, 3, 5, 7, 8, 10, 12};
    int b[10] = {4, 6, 9, 11};
    std::cin >> x >> y;
    for (int i = 0; i < 7; i++) {
        if (a[i] == x) {
            x_flg = 0;
        }
        if (a[i] == y) {
            y_flg = 0;
        }
    }

    for (int i = 0; i < 4; i++) {
        if (b[i] == x) {
            x_flg = 1;
        }
        if (b[i] == y) {
            y_flg = 1;
        }
    }
    std::cout << ((x_flg == y_flg) ? "Yes" : "No") << std::endl;
    return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    ans = []
    while abs(N) > 0:
        ans.append(N % 2)
        N //= 2
        N *= -1

    if ans:
        ans = ''.join(map(str, reversed(ans)))
    else:
        ans = 0

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9084
#include <iostream>
#include <utility>
#include <algorithm>

using namespace std;

int main(){
	pair< int ,int > p[100010];
	int a,b,l,r,ans=1;
	int n,m;
	cin >> n >> m;
	for(int i=0;i<m;i++){
		cin >> a >> b;
		p[i] = make_pair(a,b);
	}
	sort(p,p+m);
	
	l = p[0].first;
	r = p[0].second;
	for(int i=0;i<m;i++){
		if(p[i].first<=r){
			l = p[i].first;
		}
		if(p[i].second<=r){
			r = p[i].second;
		}
		
		if(p[i].first>=r){
			ans ++;
			l = p[i].first;
			r = p[i].second;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

const int MAX_V = 10004;
int V;

struct SCC {
    vector<vector<int>> adj;
    vector<vector<int>> rev;
    vector<int> vs;
    vector<int> cmp;
    vector<bool> used;
    SCC(int n) {
        adj.resize(n);
        rev.resize(n);
        cmp.resize(n);
        used.resize(n);
    }

    void addEdge(int to, int from) {
        adj[to].push_back(from);
        rev[from].push_back(to);
    }
    void dfs(int v) {
        used[v] = true;
        for (auto u : adj[v]) {
            if (!used[u]) dfs(u);
        }
        vs.push_back(v);
    }
    void rdfs(int v, int k) {
        used[v] = true;
        cmp[v] = k;
        for (auto u : rev[v]) {
            if (!used[u]) rdfs(u, k);
        }
    }

    int operator()() {
        int n = used.size();
        used.assign(n, 0);
        vs.clear();
        rep(i, V) if (!used[i]) dfs(i);
        used.assign(n, 0);

        int k = 0;
        for (int i = vs.size() - 1; i >= 0; i--) {
            if (!used[vs[i]]) rdfs(vs[i], k++);
        }
        return k;
    }
    bool same(int v, int u) { return cmp[v] == cmp[u]; }
};
int E;
int main() {
    cin >> V >> E;
    SCC scc{V};
    rep(i, E) {
        int a, b;
        cin >> a >> b;
        scc.addEdge(a, b);
    }
    scc();
    int Q;
    cin >> Q;
    rep(_, Q) {
        int a, b;
        cin >> a >> b;
        if (scc.same(a, b))
            cout << "1" << endl;
        else
            cout << "0" << endl;
    }
    return 0;
}

Measured memory_bytes: 4460
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }
using ll = long long;
const ll MOD=1e9+7;
const long long INF = 1LL<<60;

int main() {
    int l, r, d;
    cin >> l >> r >> d;

    int answer = 0;
    for(int i = l;i<=r;i++){
        if(i%d==0) answer++;
    }

    cout << answer << endl;
}

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

#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<typename T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b){ if(a>b){ a=b; return 1;} return 0;}


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int n, i; cin >> n;
    vi h(n);
    rep(i,n) cin >> h[i];
    h.push_back(0);

    int cnt = 0;
    for(int i = 1; i <= 100; i++){
        for(int j = 0; j < n; j++){
            if(h[j] >= i && h[j+1] < i) cnt++;
        }
    }
    cout << cnt << '\n';
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
        int n;
        int a, b;

        scanf("%d%d%d", &n, &a, &b);

        if(n * a < b){
                printf("%d\n", n * a);
        }
        else{
                printf("%d\n", b);
        }

        return 0;
}

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

const int64_t MOD = 1000000007;
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
    return t;
    }
};

using mint = Fp<MOD>;
mint comb(uint64_t n, uint64_t k)
{
    mint result = 1;
    for(uint64_t i=1; i<=k; i++)
    {
        result *= n--;
        result /= i;
    }
    return result;
}

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

    mint total = modpow((mint)2, n) - 1;
    total -= comb(n, a) + comb(n, b);
    cout << total << endl;
    return 0;
}

Measured memory_bytes: 256
#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() {
    int N;cin >> N;
    vector<vector<int>> A(2,vector<int>(N));
    rep(i,2)rep(j,N)cin >> A[i][j];

    vector<int> ruia(N+1);
    vector<int> ruib(N+1);

    rep(i,N){
        ruia[i+1] = ruia[i] + A[0][i];
        ruib[i+1] = ruib[i] + A[1][i];
    }

    int ans = 0;
    rep(i,N+1){
        if(i == 0)continue;
        int sum = ruia[i] + ruib[N] - ruib[i-1]; 
        chmax(ans,sum);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <climits>
#include <numeric>
#include <algorithm>

using namespace std;

bool all_0(int a, int b, int c){
    return a == b && b == c && c == 0;
}

int main()
{
    int n,m;
    cin >> n >> m;
    
    vector<char> digits(n, -1);

    for(int i = 0; i < m; ++i){
        int s, c;
        cin >> s >> c;
        if(digits[s-1] != -1 && digits[s-1] != c){
            // 矛盾
            cout << "-1\n";
            return 0;
        }
        digits[s-1] = c;
    }
    if(digits[0] == 0 && n != 1){
        // 先頭が0
        cout << "-1\n";
        return 0;
    }
    if(digits[0] == -1){
        digits[0] = (n == 1 ? 0 : 1);
    }
    for(int i = 1; i < n; ++i){
        if(digits[i] == -1){
            digits[i] = 0;
        }
    }
    for(int d : digits){
        cout << d;
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))

l=[]
l2=[]
for i in range(n):
    temp=0
    temp2=0
    for j in range(n):
        if a[i]>a[j]:
            if i<j:
                temp2+=1
            temp+=1
    l.append(temp)
    l2.append(temp2)
ans=0
for i in range(n):
    ans=(ans+k*l2[i]+(((k-1)*k*l[i]))//2)%(10**9+7)
print(ans)

Measured memory_bytes: 41964
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
template<typename T>
void vprint(std::vector<T>& vector)
{
  int len = int(vector.size());
  for(int i =0;i<len;i++){
    cout << vector[i] <<",";
  }
  cout <<endl;
}

double mean(double x,double y){
  return (x +y)/2;
}

int main(){
  int N;
  cin >> N;
  std::vector<double> v(N);
  for(int i = 0;i<N;i++)cin >>v[i]; 
  double sum = 0.0;

  // vprint(v);
  // sort(v.begin(),v.end());
  // vprint(v);
  // remove(v,0);
  // vprint(v);
  // double x,y;
  // for(int i = 0;i<N-1;i++){
  //   x = v[0];
  //   y = v[1];
  //   v[1] = (x + y)/2.0;
  //   remove(v,0);
  // }
  sort(v.begin(),v.end());
  int index;
  for(int i =1;i <= N-1;i++){
    index = N - i;
    if(i == 1){
      sum = (v[0] +v[1]) /pow(2,index);
    }else{
      sum += v[i]/pow(2,index);
    }
  }
  
  cout << sum;
  return 0;
}

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	ll X, Y, ans;

	cin >> X >> Y;

	if (X % Y == 0) ans = -1;
	else ans = X * (Y - 1);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

    if (a == b)
    {
        std::cout << "Draw";
    }
    else
    {
        a = (a + 11) % 13;
        b = (b + 11) % 13;
        std::cout << (a > b ? "Alice" : "Bob");
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 3576
mod = 10**9+7
rng = 400100
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
  finv.append(pow(fctr[i],mod-2,mod))
def cmb(n,k):
  if n<0 or k<0:
    return 0
  else:
    return fctr[n]*finv[n-k]*finv[k]%mod
n,k=map(int,input().split())
dp=[0 for i in range(n+1)]
dp[0]=1
for i in range(1,n+1):
  x=cmb(n,i)*cmb(n-1,i)%mod
  dp[i]=(dp[i-1]+x)%mod
print(dp[min(k,n-1)])

Measured memory_bytes: 72812
import sys

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

if __name__ == "__main__":
    n = int(input())
    pl = list(map(int, input().split()))

    count = 0
    for i in range(1, n-1):
        if (pl[i-1] < pl[i] <= pl[i+1]) or (pl[i+1] < pl[i] <= pl[i-1]):
            count += 1

    print(count)


Measured memory_bytes: 3060
#include <stdio.h>
#define MAXNUM 10000

int main(){
	int i,temp=1;
	int dataset[MAXNUM];
	for(i=0;i<MAXNUM;i++){
		dataset[i]=0;
	}
	
	i=0;
	while(temp!=0){
		scanf("%d\n",&temp);
	    dataset[i]=temp;
	    i++;
	}
	
	i=0;
	while(1){
		if(dataset[i]==0){
			break;
		}else{
			printf("Case %d: %d\n",i+1,dataset[i]);
			i++;
		}
	}
	
	
	return 0;
} 


Measured memory_bytes: 2108
#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;

int a[3][3];
bool mark[3][3];
int n;
int b[20];

void doMark(int num) {
	for (int r = 0 ; r < 3 ; r++) {
		for (int c = 0 ; c < 3 ; c++) {
			if (num == a[r][c]) {
				mark[r][c] = true;
			}
		}
	}
}

int main()
{
	for (int r = 0 ; r < 3 ; r++) {
		for (int c = 0 ; c < 3 ; c++) {
			scanf("%d", &(a[r][c]));
			mark[r][c] = false;
		}
	}
	
	scanf("%d", &n);
	for (int i = 0 ; i < n ; i++) {
		scanf("%d", &(b[i]));		
		doMark(b[i]);
	}
	
	for (int r = 0 ; r < 3 ; r++) {
		bool isAccepted = true;
		for (int c = 0 ; c < 3 ; c++) {
			if (mark[r][c] == false) {
				isAccepted = false;
				break;
			}
		}
		
		if (isAccepted) {
			printf("Yes\n");
			return 0;
		}
	}
	
	for (int c = 0 ; c < 3 ; c++) {
		bool isAccepted = true;
		for (int r = 0 ; r < 3 ; r++) {
			if (mark[r][c] == false) {
				isAccepted = false;
				break;
			}
		}
		
		if (isAccepted) {
			printf("Yes\n");
			return 0;
		}
	}	
	
	if ((mark[0][0] == true) && (mark[1][1] == true) && (mark[2][2] == true)) {
		printf("Yes\n");
		return 0;
	}
	
	if ((mark[2][0] == true) && (mark[1][1] == true) && (mark[0][2] == true)) {
		printf("Yes\n");
		return 0;
	}
	
	
	printf("No\n");
	
	return 0;
}


Measured memory_bytes: 128
/*input
20 30 70 90
3
*/

#include <bits/stdc++.h>
using namespace std;

#define mx 100005
#define ll long long
#define MOD 1000000007

int main()
{
	ll q,h,s,d;
	cin >> q >> h >> s >> d;
	ll n;
	cin >> n;
	if(2*q < h) h = 2*q;
	if(2*h < s) s = 2*h;
	if(2*s < d) d = 2*s;
	if(n & 1) cout << 1ll * (n/2) * d + s << endl;
	else cout << 1ll * n/2 * d << endl;
	return 0;
}


Measured memory_bytes: 256
#python3

def div(x):
    a = []
    i = 1
    while i*i<x:
        if x%i == 0:
            a.append(x//i)
            a.append(i)
        i+=1
    n = len(a)
    return n 

def main():
    n = int(input())
    c = 0
    for i in range(1, n+1):
        if (i%2 != 0) and (div(i) == 8):
            c += 1
    print(c)
main()

Measured memory_bytes: 3060
import bisect
n=int(input())
p=[[0,0] for i in range(n)]
p[0]=[0,1]
x,l=[],[]
y=[]
for i in range(n):
    tmpx,tmpl=list(map(int,input().split()))
    y.append([tmpx+tmpl,tmpx])
y.sort()
x=[y[i][1] for i in range(n)]
l=[y[i][0]-y[i][1] for i in range(n)]

a=[x[i]+l[i] for i in range(n)]
for i in range(1,n):
    s=bisect.bisect_right(a,x[i]-l[i])
    if s>0:
        p[i]=[max(p[i-1]),max(p[s-1])+1]
    else:
        p[i]=[max(p[i-1]),1]

print(max(p[n-1]))

Measured memory_bytes: 42244
import math

def F(x, y):
    tmp = max(x, y)
    ans = 0
    while tmp != 0:
      tmp = tmp // 10
      ans += 1
      #print(tmp)
    
    return ans
  
n = int(input())

keta = F(0, n)

#print ( int(math.sqrt(n))+1 )

for i in range(1,int(math.sqrt(n))+1,1):
  if n % i == 0:
    tmp = F( n / i, i )
    if tmp < keta:
      keta = tmp

print( keta )


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d;
    while(~scanf("%d%d%d%d",&a,&b,&c,&d))
    {
        if(a>b)
        {
            a=b;
        }
        if(c>d)
        {
            c=d;
        }
        printf("%d\n",a+c);
    }
}


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

int main()
{
    bool isYYMM = false;
    bool isMMYY = false;
    std::string s;
    cin >> s;

    int num[4];
    char c[4] = "";
    for(int i=0; i<4; i++){
        c[i]= s[i];
        num[i] = atoi(&c[i]);
    }
    int a = num[0]*10 + num[1];
    int b = num[2]*10 + num[3];
    if(a >= 1 && a <= 12){
        isMMYY = true;
    }
    if(b >= 1 && b <= 12){
        isYYMM = true;
    }
    if(isYYMM == true){
        if(isMMYY == true){
            cout << "AMBIGUOUS" << endl; 
        }else{
            cout << "YYMM" << endl; 
        }
    }else{
        if(isMMYY == true){
            cout << "MMYY" << endl; 
        }else{
            cout << "NA" << endl; 
        }
    }
    return 0;
}

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

#define N 100

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

    int n, count = 0;
    cin>>n;  //データの数の入力
    int a[N];
    for(int i = 0; i < n; i++) cin>>a[i];  //データの入力

    //バブルソート
    for(int i = 0; i < n; i++) {
        for(int j = n-1; j > i; j--) {
            if(a[j] < a[j-1]) {
                int s = a[j-1]; //入れ替えのための値保持
                a[j-1] = a[j];
                a[j] = s;
                count++;  //カウント
            }
        }
    }

    //出力
    for(int i = 0; i < n-1; i++) cout<<a[i]<<' ';
    cout<<a[n-1]<<endl;
    cout<<count<<endl;
    return 0 ;
}



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

int main(){
  int H, W;
  cin >> H >> W;
  int ans;
  if(H%3==0 || W%3==0) ans=0;
  else if(H==2 && W==2) ans=1;
  else{
    int pall = min(H, W);
    int triH = max({H/3*W, (H-H/3)*(W/2), (H-H/3)*((W+1)/2)})-min({H/3*W, (H-H/3)*(W/2), (H-H/3)*((W+1)/2)});
    int triW = max({W/3*H, (W-W/3)*(H/2), (W-W/3)*((H+1)/2)})-min({W/3*H, (W-W/3)*(H/2), (W-W/3)*((H+1)/2)});
    int traH = max({(H+2)/3*W, (H-(H+2)/3)*(W/2), (H-(H+2)/3)*((W+1)/2)})-min({(H+2)/3*W, (H-(H+2)/3)*(W/2), (H-(H+2)/3)*((W+1)/2)});
    int traW = max({(W+2)/3*H, (W-(W+2)/3)*(H/2), (W-(W+2)/3)*((H+1)/2)})-min({(W+2)/3*H, (W-(W+2)/3)*(H/2), (W-(W+2)/3)*((H+1)/2)});
    ans =min({pall, triH, triW, traH, traW});
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int n,count,ans;
    scanf ("%d",&n);
    int d[n][2];
    count = 0;
    ans =0;
    for(int i=0;i<n;i++){
        scanf("%d %d",&d[i][0],&d[i][1]);
        if(d[i][0]==d[i][1]){
            count++;
            if(ans<count){
                ans =count;
            }
        }else{
            count =0;
        }
    }
    if(ans>2){
        printf("Yes");
    }else{
        printf("No");
    }
    
    return 0;
}



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

int main(){
  int N;
  cin >> N;
  uint64_t f0,f1;
  f0 = 2; f1 = 1;
  for(int i=2; i<=N; i++){
    uint64_t tmp;
    tmp = f1;
    f1 = f0+f1;
    f0 = tmp;
  }
  cout << f1 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;

int main(){
  int n;
  scanf("%d",&n);
  int res=0;
  rep(i,n) res+=i+1;
  printf("%d\n",res);


  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A=in();
    int B=in();
    if(B%A==0){
        cout<<A+B<<endl;
    }else{
        cout<<B-A<<endl;
    }
    return 0;
}

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

int main() {
  int N, M, x, y;
  cin >> N >> M >> x >> y;
  vector<int> X(N), Y(M);
  for (int i=0; i<N; i++) {
    cin >> X[i];
  }
  for (int i=0; i<M; i++) {
    cin >> Y[i];
  }
  
  sort(X.begin(), X.end());
  sort(Y.begin(), Y.end());
  
  if ((x<y && max(x, X[N-1])<min(y, Y[0])) || (x>y && min(x, X[0])>max(y, Y[M-1]))) {
    cout << "No War" << endl;
  }
  else {
    cout << "War" << endl;
  }

}


Measured memory_bytes: 3644