akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

int main() {
  int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k;
  if(e-a > k) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
/* ex6_2
	kanon */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LIMIT 100

int main(void)
{
    //変数を宣言
    char s[LIMIT + 1];
    int length;

    //変数に値を入力する
    scanf("%s", &s);

    //文字列の長さを求めて２を引く
    length = strlen(s) - 2;

    //答えを出力
    printf("%c%d%c\n", s[0], length, s[length + 1]);

    return 0;
}


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

int main(){
	string S;
	cin >> S;
	int a=0,b=0;
	for(int i=0;i<S.size();i++){
		if(S[i]=='0')a++;
		else b++;
	}
	cout << min(a,b)*2 << endl;
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if(H == 0 && W == 0) {
				break;
			}
			for(int h = 0; h < H; h++) {
				for(int w = 0; w < W-1; w++) {
					System.out.print("#");
				}
				System.out.println("#");
			}
			System.out.println();
		}
	}
	// H, W ?????¨?????? 0 ?????¨????????\?????????????????¨????????????

}

Measured memory_bytes: 35108
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,double> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

int main() {
    int n;cin>>n;
    ll a[55];
    ll mx=0,mn=0,mxnum=0,mnnum=0;
    rep(i,n) {
        cin>>a[i];
        if(mx < a[i]) {
            mx = a[i];
            mxnum=i;
        }
        if(mn > a[i]) {
            mn = a[i];
            mnnum=i;
        }
    }
    if(mx == 0 && mn == 0) {
        cout<<0<<endl;
        return 0;
    } else if(mx >= (-1)*mn) {
        cout<<2*n - 1<<endl;
        rep(i,n) cout << mxnum + 1 << " " << i + 1 << endl;
        rep(i,n-1) cout<< i + 1 << " " << i + 2 <<endl;
    } else {
        cout<<2*n - 1<<endl;
        rep(i,n) cout << mnnum + 1 << " " << i + 1 << endl;
        rep(i,n-1) cout<< n - i << " " << n - i - 1 <<endl;
    }
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <map>
#include <set>
using ll = long long;
using namespace std;

void monmo(){
    
}

int main() {
    int a,b;
    cin>>a>>b;
    int num=min(a,b);
    for(int i=0;i<max(a,b);i++){
        cout<<num;
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

N = int(input())
ab = [ tuple(map(int,input().split())) for i in range(N-1) ]

dic = {}
color = {}
root = [0]*N

for i in range(N):
    dic[i+1] = []
for n in range(N-1):
    i = ab[n][0]
    j = ab[n][1]
    dic[i].append(j)
    dic[j].append(i)
    root[i-1] += 1
    root[j-1] += 1
    color[(i,j)] = 0
root_node = root.index(1)+1
ma = max(root)
def rec(now_node,prevcolor):
    nowcolor = 0
    tg_list = dic[now_node][:]
    for elem in tg_list:
        nowcolor += 1
        if nowcolor == prevcolor:
            nowcolor += 1
        dic[elem].remove(now_node)
        color[(elem,now_node)] = nowcolor
        color[(now_node,elem)] = nowcolor
        rec(elem,nowcolor)
rec(root_node,0)
print(ma)
for n in range(N-1):
    i = ab[n][0]
    j = ab[n][1]
    print(color[(i,j)])


Measured memory_bytes: 93380
import sys
input = sys.stdin.readline
N=int(input())
F=[list(map(int,input().split())) for _ in range(N)]
P=[list(map(int,input().split())) for _ in range(N)]
ans=(-1)*float("INF")
for i in range(1,1<<10):
    p=0
    for j in range(N):
        cnt=0
        for k in range(10):
            if 1&i>>k & F[j][k]:
                cnt+=1
        p+=P[j][cnt]
    ans=max(p,ans)
print(ans)


Measured memory_bytes: 42092
sx, sy, tx, ty = map(int,input().split())

dx = tx - sx
dy = ty - sy

txt = ""

for i in range(dx):
    txt += "R"
for i in range(dy):
    txt += "U"
for i in range(dx):
    txt += "L"
for i in range(dy):
    txt += "D"

txt += "D"
for i in range(dx+1):
    txt += "R"
for i in range(dy+1):
    txt += "U"
txt += "L"

txt += "U"
for i in range(dx+1):
    txt += "L"
for i in range(dy+1):
    txt += "D"
txt += "R"

print(txt)



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

int main() {
  long long a,b,c,d,x,y;
  cin>>a>>b>>c>>d;
  x=max(a*c,b*d);
  y=max(a*d,b*c);  
  cout<<max(x,y)<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
string s,pre="",aft="",pre2,aft2;cin>>s;int n=s.length();
string copy=s;  
for(int i=0;i<(n-1)/2;i++)pre+=s[i];
for(int i=(n+1)/2;i<n;i++)aft+=s[i];
  //cout<<pre<<" "<<aft;
  aft2=aft;pre2=pre;
reverse(pre.begin(), pre.end());reverse(aft.begin(), aft.end());
 reverse(copy.begin(), copy.end());
if(  (aft==aft2)  &&  (pre2==pre)  && (copy==s) )cout<<"Yes";
else cout<<"No";
}

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

int main()
{
    int n;
    cin >> n;
    int hoge;
    set<int> a;

    bool ans = false;
    rep(i, n)
    {
        cin >> hoge;
        a.insert(hoge);
    }

    if (a.size() == n)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 9600
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

c = input()
abc = string.ascii_lowercase
for i in range(len(abc)):
    if c == abc[i]:
        ans = abc[i+1]

print(ans)

Measured memory_bytes: 27072
import sys
from collections import Counter
sys.setrecursionlimit(10**7)
n, k = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))

visited = [0]*n


def teleport(v):
    if visited[v]+1 == 3:
        return 0
    visited[v] += 1
    teleport(A[v])


teleport(0)
c = Counter(visited)
init = c[1]
loop_cnt = c[2]

if k <= init:
    min_k = k
else:
    min_k = init + ((k-init) % loop_cnt)

ans = 0
for _ in range(min_k):
    ans = A[ans]
print(ans+1)


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

#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define all(v) v.begin(), v.end()

const ll mod=1000000007;

int countBits(int in){
  int res=0;
  for(int i=0;i<10;i++){
    int msk=1<<i;
    if((in&msk)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string outputYesNo(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n;cin>>n;
  set<string> s;
  while(n-->0){
    string i;cin>>i;
    s.insert(i);
  }
  cout<<s.size()<<endl;
  return 0;
}


Measured memory_bytes: 19200
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int K, X;
    cin >> K >> X;

    int money = 500 * K;
    if(money >= X) cout << "Yes" << endl;
    if(money < X) cout << "No" << endl;

}

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

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n; vector<int> num(n); double ans=0;
  for(auto &x:num) cin >> x;
  sort(num.begin(), num.end());
  ans = num[0];
  for(int i=1;i<n;i++) ans = (ans+num[i])/2;
  cout << ans << "\n";
  return 0;
}

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

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans;
    ans = n / (a + b) * a;
    n %= (a + b);
    if(n < a) cout << ans + n << endl;
    else cout << ans + a << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int n,max=0;
	int in[100]={0};
	while(cin>>n){
		in[n]++;
		if(max<in[n])max=in[n];
	}
	for(int i=0;i<100;i++){
	
		if(max==in[i])cout<<i<<endl;
	}
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N, M;
    cin >> N >> M;
    cout << (100 * N + 1800 * M) * (1 << M) << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main (void) {
char S[100]={'\0'};
char T[100]={'\0'};
int N;
int count=0;
scanf("%d",&N);
scanf("%s %s",S,T);
char res[200]={'\0'};
for (int i=0;i<N*2;i+=2){
    res[i]=S[count];
    res[1+i]=T[count];
    count++;
}
printf("%s",res);
}

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

int main(){
	int q; cin >> q;
    map<string, long long> mp;
    int r;
    string key;
    long long x;
    for(int i=0; i<q; i++){
        cin >> r >> key;
        if(r==0) cin >> mp[key];
        else if(r==1) cout << mp[key] << endl;
        else mp.erase(key);
    }
}


Measured memory_bytes: 27772
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

if __name__ == "__main__":
    n,x = map(int,input().split())
    X = list(map(int,input().split()))
    X.sort()
    a = bisect.bisect_left(X,x)
    X.insert(a,x)
    ans = []
    for i in range(1,len(X)):
        diff = X[i] - X[i-1]
        ans.append(diff)
    d = ans[0]
    for i in range(1,len(ans)):
        d = gcd(d,ans[i])
    print(d)
    

Measured memory_bytes: 14740
<?php
  
  fscanf(STDIN,'%d%d',$D,$N);
  if($D==0){
    if($N==100){
     echo 101; 
      
    }else{
      echo $N;
    }
  }else{
    $J=1;
    for($i=1;$i<=$D;$i++){
     $J=$J*100; 
    }
    if($N==100){
     echo 101*$J; 
      
    }else{
      echo $N*$J;
    }
  }

Measured memory_bytes: 3576
#include <stdio.h>

int main(void)
{
	long int x, y;
	long int ans;
	scanf("%ld %ld", &x, &y);
	ans = x - y;
	
	if ((x < 0) && (y < 0))
	{
		if (x < y) 
			printf("%ld", y - x);
		else if (y < x)
			printf("%ld", x - y + 2);
	}
	
	else if (((x < 0) && (y > 0)) || ((y < 0) && (x > 0)))
	{
		ans = x + y;
		if (ans < 0)
			ans *= -1;
		printf("%ld", ans + 1);
	}
	
	else if ((x > 0) && (y > 0))
	{
		if (x < y)
			printf("%ld", y - x);
		else if (y < x)
			printf("%ld", x - y + 2);
	}
	
	else if (x == 0)
	{
		if (x < y)
			printf("%ld", y);
		else
			printf("%ld", y * (-1) + 1);
	}
	
	else if (y == 0)
	{
		if (x < y)
			printf("%ld", x * (-1));
		else
			printf("%ld", x + 1);
	}
		
	return 0;
}


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

typedef long long ll;
#define rep(n, i) for(ll i = 0; i < n; ++i)

void solve(void) {
  ll n; cin >> n;
  map<ll, ll> a;
  rep(n, i) {
    ll ta; cin >> ta;
    ++a[ta];
  }

  ll res = 0;
  for (auto iter = a.begin(); iter != a.end(); ++iter) {
    ll temp = iter->first - iter->second;
    if (temp > 0) res += iter->second;
    else res -= temp;
  }

  cout << res << endl;
}

int main(void) {
  solve();
  return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define mp(a,b) make_pair(a,b)
#define pi acos(-1)
#define pii pair<int,int>
#define pb push_back
#define lowbit(x) ((x)&(-x))
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int maxn = 3e5 + 10;
const int maxm = 1e6 + 10;
const ll mod =  998244353;



int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    int mx = min(a,b);
    int mn = a + b - n;
    mn = max(mn, 0);
    printf("%d %d",mx,mn);
    return 0;
}


Measured memory_bytes: 256
n=int(input())
f=[list(map(int,input().split())) for _ in range(n)]
p=[list(map(int,input().split())) for _ in range(n)]
x=[]
for i in range(1,2**10):
    j_open=format(i,'b').zfill(10)
    pro_sum=0
    for j in range(n):
        one_sum=0
        for k in range(10):
            if f[j][k]==1 and j_open[k]=='1':one_sum+=1
        pro_sum+=p[j][one_sum]
    x.append(pro_sum)
print(max(x))

Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
    int N;
    int A[21];
    int B[51];
    int C[51];
    int satis=0;
    int num=-1;
    int i;
    scanf("%d",&N);
    for(i=1; i<=N; i++){
        scanf("%d",&A[i]);
    }
    for(i=1; i<=N; i++){
        scanf("%d",&B[i]);
    }
    for(i=1; i<=N-1; i++){
        scanf("%d",&C[i]);
    }
    for(i=1; i<=N; i++){
        satis += B[A[i]];
        if(num+1 == A[i]){
            satis += C[A[i]-1];
        }
        num = A[i];
    }
    printf("%d",satis);
}

Measured memory_bytes: 128
import numpy as np
N,M,C = map(int, input().split())
B=np.array([int(n) for n in input().split()])
A=[]
for i in range(N):
    A.append([int(n) for n in input().split()])
A = np.array(A)
sum = 0
for i in range(N):
    if np.dot(A[i],B) + C >0:
        sum += 1
print(sum)

Measured memory_bytes: 12504
N = int(input())

if N < 105:
  print(0)
else:
  ans = 0
  for i in range(105, N + 1, 1):
    y = 0
    for j in range(1, i + 1, 1):
      if i % 2 == 0:
        break
      else:
        if i % j == 0:
          y += 1
    else:
      if y == 8:
        ans += 1
  else:
    print(ans)



Measured memory_bytes: 9080
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
 
using namespace std;
 
char s[1000010];
 
int main()
{
	scanf("%s",s);int n=strlen(s);
	int l=1,r=1000000;
	while (l<=r)
	{
		int mid=(l+r)>>1;
		int x=mid*9,g=0;
		for (int i=n-1;i>=0;i--)
		{
			while (x>=0&&(x+g)%10!=s[i]-'0') x--;
			if (x<0) break;
			g=(x+g)/10;
		}
		if (x>=0) r=mid-1; else l=mid+1;
	}
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 640
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N, L = map(int, input().split())
    result = []
    for i in range(N):
        result.append([i + L, abs(i + L)])
    result.sort(key=lambda x: x[1])
    result.pop(0)

    print(sum([r[0] for r in result]))


if __name__ == "__main__":
    main()


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

using namespace std;

int n;
long long k;
int a[200100], f[200100];

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

	cin >> n >> k;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) cin >> f[i];
	sort(a, a + n);
	sort(f, f + n, greater<int>());

	long long l = 0, r = 1e12;
	while(l < r){
		long long mid = l + (r - l) / 2;
		long long need = 0;
		for(int i = 0; i < n; i++) need += max(0ll, a[i] - mid / f[i]);
		if(need <= k) r = mid;
		else l = mid + 1;
	}

	cout << l << endl;
}

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

void judge(int n,char[36] [3],char[36][3]);

int main(){
  int i, j, n, minj;
  char temp[36];
  char C_B[36][3], C_S[36][3];

  scanf("%d",&n);

  for( i=0 ; i<n ; i++){
    scanf("%s",C_B[i]);
    strcpy(C_S[i],C_B[i]);
  }
  
//バブルソート開始
  for( i=0 ; i<n ; i++){
    for( j=n-1 ; j>=i+1 ; j--){
      if(C_B[j][1] < C_B[j-1][1]){
	       strcpy(temp,C_B[j-1]);
	       strcpy(C_B[j-1],C_B[j]);
	       strcpy(C_B[j],temp);
      }
    }
    printf("%s",C_B[i]);
    if( i<n-1 ){
      printf(" ");
    }
  }
  printf("\n");
  printf("Stable\n");
  
  //選択ソート開始なう
  for( i=0 ; i<n ; i++){
    minj = i;
    for( j=i ; j<=n-1 ; j++){
      if(C_S[j][1] < C_S[minj][1]){
        minj = j;
      }
    }
    strcpy(temp,C_S[i]);
    strcpy(C_S[i],C_S[minj]);
    strcpy(C_S[minj],temp); 

    printf("%s", C_S[i]);
    if( i<n-1 ){
      printf(" ");
    }
  }
  printf("\n");

  judge(n,C_B,C_S);

  return 0; 
}

void judge(int n,char C_B[36][3],char C_S[36][3]){
  int i;
  int count=0;

  for( i=0 ; i<n ; i++){
    if(strcmp(C_B[i],C_S[i]) == 0){
      count++;
    }
  }
  if(count == n){
    printf("Stable\n");
  }else{
    printf("Not stable\n");
  }
}



Measured memory_bytes: 2084
#include <iostream>
#include <vector>

int main()
{
    int H, W, fillH, fillW;

    scanf("%d", &H);
    scanf("%d", &W);
    scanf("%d", &fillH);
    scanf("%d", &fillW);

    std::vector<std::vector<int>> vec(H, std::vector<int>(W, 0));
    for(int i = 0; i < fillH; i++)
    {
        for(int j = 0; j < W; j++)
        {
            vec[i][j] = 1;
        }
    }

    for(int i = 0; i < fillW; i++)
    {
        for(int j = 0; j < H; j++)
        {
            vec[j][i] = 1;
        }
    }

    int count = 0;
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            if(vec[i][j] == 0)
            {
                count++;
            }

        }
    }

    printf("%d\n", count);

}


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

if c < d:
    print("Yes" if s[a - 1:d].count("##") == 0 else "No")
else:
    print("Yes" if s[a - 1:c].count("##") ==
          0 and s[b - 2:d + 1].count("...") > 0 else "No")

Measured memory_bytes: 3572
s = list(input())
alph = [chr(i) for i in range(97, 123)]
alph_count = [0] * 26
for i in s:
    alph_count[alph.index(i)] = 1
ans = ["-1"]
if len(s) != 26:
    for i in range(26):
        if alph_count[i] == 0:
            ans = s + [alph[i]]
            break
else:
    for i in range(25, -1, -1):
        c = -1
        for j in range(26):
            if s[i] == alph[j]:
                c = j
            if not c == -1:
                if alph_count[j] == 0:
                    s[i] = alph[j]
                    ans = s[0 : i + 1]
            if not ans[0] == "-1":
                break
        alph_count[c] = 0
        if not ans[0] == "-1":
            break
print("".join(ans))

Measured memory_bytes: 3188
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

long long gcd(long long a, long long b)
{
	if(a<b)
		swap(a, b);
	
	long long c;
	while(b){
		c = b;
		b = a % b;
		a = c;
	}
	
	return a;
}

int main()
{
	int cnt[3];
	for(;;){
		rep(i, 3){
			int a, m;
			scanf("%d%d", &a, &m);
			if(m == 0)
				return 0;
			
			int pos = 1;
			for(cnt[i]=1;; ++cnt[i]){
				pos = a * pos % m;
				if(pos == 1)
					break;
			}
		}
		
		long long g = ((long long)cnt[0])/gcd(cnt[0], cnt[1])*cnt[1];
		printf("%lld\n", g/gcd(g, cnt[2])*cnt[2]);
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long int
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
}
void printMp(mp m)
{
  mp ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printUmp(ump m)
{
  ump ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printSt(st s)
{
  st ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printMst(mst s)
{
  mst ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printVec(vector<int>v)
{
for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
}
void printVec2(vector<int>v[],int n)
{
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
            cout<<v[i][j]<<' ';
        cout<<endl;
    }
}
 set<pair<int,int>> primeset;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primeset.insert(mkp(p,1));
}
int32_t main()
{
fastio;
int a;in a;int b;in b;
int start=b-a+1;
int end=a+b-1;
for(int i=start;i<=end;i++)
    cout<<i<<" ";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    long i,c,sum=0,dummy;
    dummy=scanf("%ld",&c);
    for(i=1;i<=c;i++){
        if(i%3!=0 && i%5!=0){
            sum+=i;
        }
    }
    printf("%ld",sum);
    return 0;
}

Measured memory_bytes: 1732
N = int(input())
L = []
judge = "Yes"

w1 = input()
L.append(w1)
for i in range(N - 1):
	w2 = input()
	if L.count(w2) == 1:
		judge = "No"
		break
	elif w1[-1] != w2[0]:
		judge = "No"
		break
	else:
		L.append(w2)
		w1 = w2

print(judge)

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

// 2 点間の距離 (a, b) (c, d)
double DotDist(double a, double b, double c, double d) {
    return sqrt((c-a)*(c-a)+(d-b)*(d-b));
}
// pair 版
double DotDist(pair<double, double> a, pair<double, double> b) {
    return sqrt((b.first-a.first)*(b.first-a.first)+(b.second-a.second)*(b.second-a.second));
}
// 3 点 (ax, ay), (bx, by), (cx, cy) から三角形の面積を求める
double TriArea(double ax, double ay, double bx, double by, double cx, double cy) {
    return (abs(ay * (bx - cx) + by * (cx - ax) + cy * ( ax - bx))) / 2;
}
// pair 版
double TriArea(pair<double, double> a, pair<double, double> b, pair<double, double> c) {
    return (abs(a.second * (b.first - c.first) + b.second * (c.first - a.first) + c.second * ( a.first - b.first))) / 2;
}

// 3 点 (ax, ay), (bx, by), (cx, cy) から内接円の半径を求める
double IncircleArea(double ax, double ay, double bx, double by, double cx, double cy) {
    double e = DotDist(ax, ay, bx, by) + DotDist(bx, by, cx, cy) + DotDist(cx, cy, ax, ay);
    return (2 * TriArea(ax, ay, bx, by, cx, cy)) / e;
}
// pair 版
double IncircleArea(pair<double, double> a, pair<double, double> b, pair<double, double> c) {
    double e = DotDist(a, b) + DotDist(b, c) + DotDist(c, a);
    return (2 * TriArea(a, b, c)) / e;
}

signed main()
{
    // 頂点
    pair<double, double> v[3];
    REP(i, 3) {
        cin >> v[i].first >> v[i].second;
    }
    // 辺の長さの最大
    double max_e = max({DotDist(v[0], v[1]), DotDist(v[1], v[2]), DotDist(v[2], v[0])});
    // 内接円の半径
    double r = IncircleArea(v[0], v[1], v[2]);

    printf("%.10f\n", (double)(max_e * r / (2 * r + max_e)));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long  
#define pb push_back
#define mk make_pair
#define mod 998244353
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define all(x) x.begin(),x.end()
int main()
{
       ios::sync_with_stdio(0) ;
       cin.tie(0); 
        ll n;
        cin>>n;ll arr[n+1]={0}; ll a[n+1]={0};
        for(ll i=1;i<=n;i++)
        {
            cin>>arr[i];
            a[arr[i]]++;
        }
        ll ans=0;
        
        for(ll i=1;i<=n;i++)
        {
            if(a[i]>=2)
            {
                ll y=a[i]*(a[i]-1);
                y/=2;
                ans+=y;
            }
        }
        for(ll i=1;i<=n;i++)
        {
            ll y=a[arr[i]];
            ll k=y-1;
            if(y>=2)
            {y=y*(y-1);
            y/=2;}
            else
            y=0;
            if(k>=2)
           { k*=(k-1);
            k/=2;}
            else k=0;
            cout<<ans-y+k<<endl;
        }
  return 0 ;
}
//make all values ll



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

#define ii pair<int, int>
#define lli long long int
#define ll pair<lli, lli>
#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

lli gcd(lli a, lli b) {
	return ((b == 0) ? a : gcd(b, a % b));
}

int main() {
	lli a, b;
	scanf("%lld %lld", &a, &b);
	printf("%lld\n", a / gcd(a, b) * b);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;

const int N=1e5+5;
int n,m,x,cnt[N],mi;
int lis[N]={0,2,5,5,4,5,6,3,7,6};
int mx[N],used[N],s[N],len;
int t[N],lent;

void calc(int x)
{
	int i,now=0,tx=x;
	while(tx)
	{
		if(!used[tx%10]) return;
		now+=lis[tx%10];
		tx/=10;
	}
	mx[now]=max(mx[now],x);
}

void copy()
{
	len=lent;
	int i;
	for(i=1;i<=len;++i) s[i]=t[i];
}

void cc()
{
	if(lent>len) copy();
	else if(len==lent)
	{
		int i;
		for(i=1;i<=len;++i)
		{
			if(t[i]<s[i]) break;
			if(t[i]>s[i])
			{
				copy();
				break;
			}
		}
	}
}

void calc(int x,int tme,int num)
{
	lent=0;int tx=x;
	while(tx)
	{
		t[++lent]=tx%10;
		tx/=10;
	}
	for(int i=1;i<=tme;++i) t[++lent]=num;
	sort(t+1,t+lent+1),reverse(t+1,t+lent+1);
	cc();
}

int main()
{
//	freopen("D.in","r",stdin);
//	freopen("D.out","w",stdout);
	int i;
	scanf("%d%d",&n,&m);
	for(i=2;i<=7;++i) cnt[i]=-1;
	for(i=1;i<=m;++i)
	{
		scanf("%d",&x);
		cnt[lis[x]]=max(cnt[lis[x]],x);
		used[x]=1;
	}
	for(i=0;i<=99999;++i) calc(i);
	
	for(i=2;i<=7;++i)
		if(~cnt[i])
			break;
	int tt=cnt[i];
	
	for(i=0;i<=1000;++i)
	{
		if(n<i) continue;
		if(mx[i]==0) continue;
		if((n-i)%lis[tt]!=0) continue;
		calc(mx[i],(n-i)/lis[tt],tt);
	}
	for(i=1;i<=len;++i) printf("%d",s[i]);printf("\n");
	
	return 0;
}

Measured memory_bytes: 256
N, M = list(map(int, input().split()))
s = [sum([2 ** (i - 1) for i in list(map(int, input().split()))[1:]]) for _ in range(M)]
p = list(map(int, input().split()))

ans, n = 0, 2 ** N
for i in range(n):
    for s_, p_ in zip(s, p):
        if bin(i & s_).count("1") % 2 != p_:
            break
    else:
        ans += 1
        
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#define mem(a,b) memset(a,b,sizeof(a))
#define IOSF ios::sync_with_stdio(false)
typedef long long LL;
using namespace std;
const int INF=0x3f3f3f3f;
const int MAX=10e6+5;
const int MOD=10e9+7;

int wa[60000];

int main()
{
    IOSF;
    int N,temp,j,ans=0;
    for(int i=2;i<=55555;i++){
        temp=sqrt(i);
        for(j=2;j<=temp;j++){
            if(i%j==0)
                break;
        }
        if(j>temp&&i%5==1)
            wa[ans++]=i;
    }
    cin>>N;
    for(int i=0;i<N;i++)
        cout<<wa[i]<<" ";
    cout<<endl;
    return 0;
}
/*
7 5 3
*****
*...*
*****
*..**
*****
*.***
*****
4 4 0
****
*...
*.**
*.**
*/



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);		
		String input = scanner.nextLine();
		scanner.close();
		
		String[] arrStr = (input.split(" ",0));
		
		int A, B, C;
		
		int[] arrInt = new int[3];
		int i = 0;
		for (String str : arrStr) {
			arrInt[i] = Integer.parseInt(str);
			i++;
		}
		
		A = arrInt[0];
		B = arrInt[1];
		C = arrInt[2];
		
		int tmp;
		tmp = A;
		A = B;
		B = tmp;
		tmp = A;
		A = C;
		C = tmp;
		
		System.out.println(A + " " + B + " " + C);
	}
}


Measured memory_bytes: 23764
var lines = []; var result = 0;
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
})

rl.on('close', function () {
    var X = Number(lines[0]);
    var ans = 1;

    for (var i = 2; i < 10; i++) {
        for (var j = 1; j < X; j++) {
            var exp = Math.pow(j, i);
            if (exp <= X) { ans =Math.max(ans, exp) }
        }
    }

    console.log(ans);
});

Measured memory_bytes: 7628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		System.out.println(t+s);
	}

}

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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

template <class T>
T gcd(T a, T b){
	if(a < b)swap(a, b);
	while(b){
		a = a % b;
		swap(a, b);
	}
	return a;
}

template <unsigned long long mod> class modint {
public:
	unsigned long long v;
	modint(const long long x = 0) : v(x % mod) {}
	modint operator+(const modint rhs) { return modint(*this) += rhs; }
	modint operator-(const modint rhs) { return modint(*this) -= rhs; }
	modint operator*(const modint rhs) { return modint(*this) *= rhs; }
	modint operator/(const modint rhs) { return modint(*this) /= rhs; }
	modint operator-() { return modint(mod - this->v); }
	modint& operator+=(const modint rhs) {
		v += rhs.v;
		if (v >= mod) v -= mod;
		return *this;
	}
	modint& operator-=(const modint rhs) {
		if (v < rhs.v) v += mod;
		v -= rhs.v;
		return *this;
	}
	modint& operator*=(const modint rhs) {
		v = v * rhs.v % mod;
		return *this;
	}
	modint inverse(modint a) {
		unsigned long long exp = mod - 2;
		modint ret(1ULL);
		while (exp) {
			if (exp % 2) { ret *= a; }
			a *= a;
			exp >>= 1;
		}
		return ret;
	}
	modint& operator/=(modint rhs) {
		(*this) *= inverse(rhs);
		return *this;
	}
	friend ostream& operator<<(ostream& os, modint& u) {
		os << u.v;
		return (os);
	}
	friend istream& operator>>(istream& is, modint& u) {
		is >> u.v;
		return (is);
	}
};

const int MOD = 1000000007;
using mint = modint<MOD>;

template<class T>
T fastpow(T a, long long p){
	T tmp = a;
	T ret = 1;
	while(p){
		if(p & 1)ret *= tmp;
		p >>= 1;
		tmp = tmp * tmp;
	}
	return ret;
}

class Solution {
public:
	mint f(int x, int y){
		int z = gcd(x, y);
		mint ret = 0;
		//縦横結合なし
		ret += fastpow(mint{2}, x) + fastpow(mint{2}, y) - 1;
		//縦横結合あり
		ret +=  fastpow(mint{2}, z) - 2;
		return ret;
	}

	void solve() {
		long long  h, w, t;
		cin >> h >> w >> t;
		long long x = gcd(w, t);
		long long y = gcd(h, t);
		cout << fastpow(f(w/x, h/y), x*y).v << endl;
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

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

using namespace std;

signed main(){
	int h, w; cin>>h>>w;
	vector<vector<int> > a(h, vector<int>(w));
	vector<vector<int> > vis(h, vector<int>(w, -1));
	queue<pair<int, int> > q;
	for(int i = 0; i < h; i++){
		for(int j =0 ; j < w; j++){
			char c; cin>>c;
			if(c == '#'){
				a[i][j] = 1;
				vis[i][j] = 0;
				q.push({i, j});
			}else{
				a[i][j] = 0;
			}
		}
	}
	int count = 0;
	while(!q.empty()){
		int i = q.front().first, j = q.front().second;
		q.pop();
		vector<int> dx = {1, 0, -1, 0};
		vector<int> dy = {0, 1, 0, -1};
		for(int k = 0; k < 4; k++){
			int nx = dx[k] + i;
			int ny = dy[k] + j;
			if(!(nx >= 0 && nx < h && ny >= 0 && ny < w)) continue;
			if(vis[nx][ny] >= 0) continue;
			q.push({nx, ny});
			vis[nx][ny] = vis[i][j] + 1;
			count = max(count, vis[nx][ny]);
		}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 16400
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize, m: usize,
        xy: [(usize1, usize1); m],
    }
    let mut visited = vec![0; n+2];
    let mut balls = vec![1i64; n];
    visited[0] = 1;

    for &(x, y) in xy.iter() {
        if visited[x] == 1 {
            visited[y] = 1;
        }
        balls[x] -= 1;
        balls[y] += 1;
        if balls[x] == 0 {
            visited[x] = 0;
        }
    }
    let cnt = visited.iter().filter(|x| *x==&1).count();
    let nz_cnt = balls.iter().filter(|x| *x != &0).count();
    println!("{}", if nz_cnt == 1 {1} else {cnt});
}


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

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

    string ans = ((n + 1) / 2) >= k ? "YES" : "NO";
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#define N 25
#define inf 1
#define db double
#define swap(T, a, b) ({T ttt = a; a = b; b = ttt;})
using namespace std;
int n, a[N], L, R; 
db t = 0, Ans = inf; 
int abs(int x) { return x > 0 ? x : -x; } 
db Up(int k, int x) 
{
          if (k == n + 1) return 0; 
          int L = x, R = 2*a[k] - 1, j = x;
          while (j + x <= R) j += x;
          db ans = inf, t;
          for (; j >= L; j -= x)
          {
              t = (db)abs(j - a[k]) / a[k];
              if (t < Ans) ans = min(ans, max(t, Up(k + 1, j))); 
          }
          return ans;
}
int main()
{
    scanf("%d", &n); 
    for (int i = 1; i <= n; i++) 
    {
        scanf("%d", &a[i]); 
        if (a[i] != 1) Ans = min(Ans, (db)(a[i] - 1) / a[i]); 
    }
    int L = 1, R =2*a[1] - 1;
    db t;
    for (int j = R; j >= L; j--)
    {
        t = (db)abs(a[1] - j) / a[1]; 
        if (t > Ans) continue; 
        t = max(t, Up(2, j)); 
        Ans = min(Ans, t);
    }
    if (Ans == inf) Ans = 0; 
    printf("%.12lf", Ans); 
    return 0; 
}

Measured memory_bytes: 1228
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>
using namespace std;
int main()
{
	int a[3005];
	int n;
	scanf("%d", &n);
	int ans = 0;
	for(int i = 1 ; i <= n ; i++){
		scanf("%d", &a[i]);
		ans += a[i] - 1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define mp make_pair
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
signed main() {
    ll N,K,sum;
    cin>>N>>K;
    sum=pow(N/K,3);
    if(K%2==0)sum+=pow((N+K/2)/K,3);
    cout<<sum<<endl;
}


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

using namespace std;

int main()
{
	string w;
	cin >> w;
	
	int cnt[26] = {0};
	for(int i = 0; i < w.size(); i++)
	{
		cnt[w[i] - 'a']++;
	}
	
	for(int i = 0; i < 26; i++)
	{
		if(cnt[i] % 2 == 1)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
from math import gcd
A, B, C, D = map(int, input().split())

if C == 1 or D == 1:
    print(0)
    exit()

def check(A, B, x):
    return B//x - (A-1)//x

print((B - A + 1) - (check(A, B, C) + check(A, B, D) - check(A, B, C*D//gcd(C, D))) )


Measured memory_bytes: 9132
from math import gcd
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

def main():
    N,*ab = map(int, read().split())

    ab_zero = 0
    ratio = []
    for a, b in zip(*[iter(ab)]*2):
        if a == 0 and b == 0:
            ab_zero += 1
        else:
            if b < 0:
                a, b = -a, -b
            if b == 0:
                a = 1
            g = gcd(a, b)
            a //= g
            b //= g
            ratio.append((a, b))
    
    s = Counter(ratio)

    bad = 1
    no_pair = 0
    for k, v in s.items():
        a, b = k
        if a > 0:
            if (-b, a) in s:
                bad *= pow(2, v, MOD) + pow(2, s[(-b, a)], MOD) -1
                bad %= MOD
            else:
                no_pair += v
            
        elif (b, -a) not in s:
            no_pair += v

    bad *= pow(2, no_pair, MOD)
    bad %= MOD

    ans = (bad + ab_zero -1) % MOD
    print(ans)


if __name__ == "__main__":
    main()


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

typedef long long ll;

map <int, int> m;

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

    //freopen("input.txt", "r", stdin);

    string s;
    getline(cin, s);

    for(int i = 0; i < s.size(); i++)
    {
        m[s[i] - 'a']++;
    }

    for(auto it = m.begin(); it != m.end(); it++)
    {
        if(it -> second % 2 != 0)
        {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";



    return 0;
}


Measured memory_bytes: 3640
package main
import (
  // "bufio"
  // "os"
  // "strconv"
  // "strings"
  "fmt"
  // "math"
  // "sort"
)

// 行単位で読み込む場合
// var sc = bufio.NewScanner(os.Stdin)

func main() {
  var N int
  fmt.Scan(&N)
  var list []int

  for i := 0; i < N; i++ {
    var num int
    fmt.Scan(&num)
    list = append(list, num)
  }

  fmt.Println(len(distinctNum(list)))
}

// 配列中の重複要素を削除（数値）
func distinctNum(array []int) []int {
  m := map[int]bool{}
  newArray := []int{}
  for _, e := range array {
    if !m[e] {
      m[e] = true;
      newArray = append(newArray, e)
    }
  }
  return newArray
}

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

int main()
{
	char s[20],*p;
	cin>>s;
	p=s;
	while(*p!='\0')
	{
		if(*p!='h')
		{
			cout<<"No"<<endl;
			return 0;
		}
		p++;
		if(*p!='i')
		{
			cout<<"No"<<endl;
			return 0;
		}
		p++;
	}
	cout<<"Yes"<<endl;
	return 0;
}


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

using namespace std;

int main() {
    unsigned long long n, a, b;

    cin >> n >> a >> b;

    if (a > b) {
        cout << 0 << endl;
        return 0;
    }

    if (n <= 1 && a != b) {
        cout << 0 << endl;
        return 0;
    }

    cout << b * (n - 2) - a * (n - 2) + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stdlib.h>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
//using std::greater;
using std::max;
using std::min;

/*
using lli = long long int;
using ulli = unsigned long long int;
*/

#define INF 999999999;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N, M, K, A, ans;
int f[31];

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

	cin >> N >> M;
	for(int i = 0; i < N; i++){
		cin >> K;
		for(int j = 0; j < K; j++){
			cin >> A;
			f[A - 1] += 1;
		}
	}
	for(int i = 0; i < M; i++){
		if(f[i] == N) ans++;
	}

	cout << ans;


#ifndef EVEL
	system("pause");
#endif

	return 0;
}

Measured memory_bytes: 256
#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];
	}
	int mn = INT_MAX;
	long long res = 0;
	for (int i = 0; i < n; i++) {
		if (i + 1 < n && a[i] < 0) {
			a[i + 1] *= -1;
			a[i] *= -1;
		}
		res += abs(a[i]);
		mn = min(mn, abs(a[i]));
	}
	if (a[n - 1] < 0) res -= 2 * mn;
	cout << res;
	return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

void solve(){
  int n; cin >> n;
  int ans = 0;
  for(int i = 1; i <= n; i++){
    int sum = 0;
    if(i % 2 == 0) continue;
    for(int j = 1; j <= i; j++){
      if(i % j == 0) sum++;
    }
    if(sum == 8) ans++;
  }
  cout << ans << endl;
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    ll x;
    cin>>x;
    ll sum =100,ans = 0;
    while(sum<x)
    {
        sum += sum/100;
        ans++;
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct node
{
  int id;
  struct node *parent;
  struct node *child[2];
} *nodePointer;
nodePointer root;
nodePointer make1node(int);
void insert(nodePointer);
void preorderWalk(nodePointer);
void inorderWalk(nodePointer);
int main(void)
{
  int i;//counter
  int n;//the number of operation
  char op[10];//operation
  int id;//inserted number
  nodePointer p;
  root=NULL;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%s",op);
      if(strcmp(op,"insert")==0)
        {
          scanf("%d",&id);
          p=make1node(id);
          insert(p);
        }
      else if(strcmp(op,"print")==0)
        {
          inorderWalk(root);
          preorderWalk(root);
        }
      else
        {
          printf("undefined operation\n");
          exit(1);
        }
    }
  return 0;
}
nodePointer make1node(int id)
{
  nodePointer p;
  p=(nodePointer)malloc(sizeof(struct node));
  p->id=id;
  p->parent=NULL;
  p->child[0]=NULL;
  p->child[1]=NULL;
  return p;
}
void insert(nodePointer p)
{
  nodePointer parent=NULL;//parent of p
  nodePointer temp=root;
  while(temp!=NULL)
    {
      parent=temp;
      if(p->id < temp->id) temp=temp->child[0];
      else temp=temp->child[1];
    }
  p->parent=parent;
  if(parent==NULL) root=p;
  else if(p->id < parent->id) parent->child[0]=p;
  else parent->child[1]=p;
}
void preorderWalk(nodePointer p)
{
  if(p!=NULL)
    {
      printf(" %d",p->id);
      preorderWalk(p->child[0]);
      preorderWalk(p->child[1]);
      if(p==root)
        {
          printf("\n");
        }
    }
}
void inorderWalk(nodePointer p)
{
  if(p!=NULL)
    {
      inorderWalk(p->child[0]);
      printf(" %d",p->id);
      inorderWalk(p->child[1]);
      if(p==root)
        {
          printf("\n");
        }
    }
}



Measured memory_bytes: 25180