akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter out = new PrintWriter(System.out);

    int n = in.nextInt();

    out.println(shichiGoSan(n, ""));

    out.close();
  }

  static int shichiGoSan(int n, String s) {
    if (s.length() > 9)
      return 0;

    boolean seven = false, five = false, three = false;

    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) == '7')
        seven = true;
      if (s.charAt(i) == '5')
        five = true;
      if (s.charAt(i) == '3')
        three = true;
    }

    int ret = (seven && five && three) ? 1 : 0;

    if (s.length() == 0 || Integer.parseInt(s) <= n) {
      return ret
          + shichiGoSan(n, s + '3')
          + shichiGoSan(n, s + '5')
          + shichiGoSan(n, s + '7');
    }

    return 0;
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }

  static void print(int[] arr) {
    Arrays.stream(arr).forEach(i -> System.out.print(i + " "));
    System.out.println();
  }

  public static int[] mergeSort(int[] a) {
    if (a.length <= 1)
      return a;

    int mid = a.length / 2;
    int[] left = new int[mid];
    int[] right = new int[a.length - mid];

    for (int i = 0; i < mid; ++i)
      left[i] = a[i];

    for (int i = mid; i < a.length; ++i)
      right[i - mid] = a[i];

    return merge(mergeSort(left), mergeSort(right));
  }

  public static int[] merge (int[] l, int[] r) {
    int[] merged = new int[l.length + r.length];

    int i = 0, j = 0, k = 0;
    while (i < l.length && j < r.length) {
      if (l[i] <= r[j])
        merged[k++] = l[i++];
      else
        merged[k++] = r[j++];
    }

    while (i < l.length)
      merged[k++] = l[i++];
    while (j < r.length)
      merged[k++] = r[j++];

    return merged;
  }

}



Measured memory_bytes: 38056
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define pop(v) (v).back(); (v).pop_back()
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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

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

    string in;
    getline(cin, in);
    rep(i, siz(in)){
        while(in[i]==' ')ers(in, i);
    }
    double a = sqrt(atoi(in.c_str()));
    Yes(a==(int)a);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int N=2e5+1;
int n, k, a[N], b[N], bit[N];
void inc(int x, int v) {
	for(; x<=n; x+=x&-x) bit[x]+=v;
}
int sum(int x) {
	int res=0;
	for(; x; x&=x-1) res+=bit[x];
	return res;
}
int main() {
	scanf("%d%d", &n, &k);
	for(int i=1; i<=n; ++i) scanf("%d", a+i);
	for(int i=1; i<=k; ++i) {
		for(int i=1; i<=n; ++i) bit[i]=0;
		for(int i=1; i<=n; ++i) {
			inc(std::max(1, i-a[i]), 1);
			inc(i+a[i]+1, -1);
		}
		for(int i=1; i<=n; ++i) b[i]=sum(i);
		bool changed=false;
		for(int i=1; i<=n; ++i) if(a[i]!=b[i]) changed=true;
		if(!changed) break;
		for(int i=1; i<=n; ++i) a[i]=b[i];
	}
	for(int i=1; i<=n; ++i) printf("%d%c", a[i], " \n"[i==n]);
	return 0;
}

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

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

  ll a, b, c;
  cin >> a >> b >> c;

  ll r = c - a - b;
  string ans = "No";

  if (r > 0) {
    if (4 * a * b < r * r) {
      ans = "Yes";
    }
  }
  cout << ans << '\n';
  return 0;
}

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

int main() {
	
	int r, d, x;
	cin >> r >> d >> x;
	rep(i, 10){
		x = r*x - d;
		cout << x << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())

fab = 0

ans = 1000

n_s = int(n ** (1/2))

for i in range(1, n_s + 2):
    if n % i == 0:
        a = len(str(i))
        b = len(str(int(n / i)))
        #print(n/i, i, a, b)
        if a > b and a < ans:
            ans = a
        elif a < b and b < ans:
            ans = b
        elif a == b and a < ans:
            ans = a


print(ans)

Measured memory_bytes: 9460
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;

signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int x; cin >> x;
    cout<< 10-x/200<<endl;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


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

  if(n>k)n %= k;

  cout << min(n, k-n) << endl;
}




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

int main()
{


    int a,b;
    cin >> a >> b;
    if(a == 1 && b == 1) cout << "Draw";
    else if(a == b) cout << "Draw";
    else if(a == 1) cout << "Alice";
    else if(b == 1) cout << "Bob";
    else if(a > b) cout << "Alice";
    else cout << "Bob";
    return 0;
}



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

int main()
{
	const char cp[][128] = {
		"',.!?",
		"abcABC",
		"defDEF",
		"ghiGHI",
		"jklJKL",
		"mnoMNO",
		"pqrsPQRS",
		"tuvTUV",
		"wxyzWXYZ"
	};
	vector<string> s;
	for (int i = 0; i < 9; i++){
		s.push_back(string(cp[i]));
	}
	
	string str;
	while (cin >> str){
		string res;
		int prev = 0;
		int cnt = -1;
		
		for (int i = 0; i < str.size(); i++){
			if (!prev && str[i] == '0'){
				res += " ";
			}
			else if (!prev && str[i] != '0'){
				prev = str[i] - '0';
				cnt = 0;
			}
			else if (prev != str[i] - '0'){
				res += s[prev - 1][cnt % s[prev - 1].size()];
				prev = str[i] - '0';
				cnt = 0;
			}
			else if (prev == str[i] - '0'){
				cnt++;
			}
			
		}
		if (prev) res += s[prev - 1][cnt % s[prev - 1].size()];
		cout << res << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1196
from itertools import permutations

N=int(input())
P=[int(x) for x in input().split()]
Q=[int(x) for x in input().split()]
L=tuple(permutations([i for i in range(1,N+1)], N))

a = L.index(tuple(P))
b = L.index(tuple(Q))
print(abs(a-b))

Measured memory_bytes: 7992
#include <bits/stdc++.h>
#define PI acos(-1)
#define eq(x,y) (fabs((x)-(y)) < eps)
#define debug(x) cerr<<x<<endl;
#define endl "\n"
#define pb push_back
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const int nmax=1e5+10;
const int eps=1e-8;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(10);
    //cout<<fixed;
    //cout.tie(NULL);
    ll n;
    cin>>n;


    ll ans= (n*(n-1))/2;

    cout<<ans<<endl;




    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    static int n;
    static int[] a;
    static int[][] dp;

    static int rec(int l, int r) {
        if (dp[l][r]!=-1) return dp[l][r];
        if (Math.abs(r-l)<=1) return 0;

        int res = 0;
        if (Math.abs(a[r-1]-a[l])<=1 && rec(l+1, r-1)==r-l-2) {
            res = r-l;
        }

        for (int mid=l+1;mid<r;mid++) {
            res = Math.max(res, rec(l, mid)+rec(mid, r));
        }
        dp[l][r] = res;
        return res;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            n = sc.nextInt();
            if (n==0) break;
            a = new int[n];
            dp = new int[n][n+1];
            for (int i=0;i<n;i++) {
                for (int j=0;j<n+1;j++) {
                    dp[i][j] = -1;
                }
            }
            for (int i=0;i<n;i++) {
                a[i] = sc.nextInt();
            }
            System.out.println(rec(0, n));
        }
    }
}


Measured memory_bytes: 58092
n = int(input())
a = list(map(int, input().split()))
rec = [0] * n
mod = 10 ** 9 + 7
if n % 2 == 0:
    for i in range(n):
       rec[a[i]] += 1

    flag = True
    for i in range(n):
        if rec[i] > 2:
            flag = False

    if rec[0] == 0 and flag:
        print((2 ** (n // 2)) % mod)
    else:
        print(0)
else:
    for i in range(n):
       rec[a[i]] += 1

    flag = True
    for i in range(n):
        if rec[i] > 2:
            flag = False

    if rec[0] == 1 and flag:
        print((2 ** (n // 2)) % mod)
    else:
        print(0)

Measured memory_bytes: 14008
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element


int N, M, K;
int A[200010];
int B[200010];


signed main()
{
	cin >> N >> M >> K;
	REP(i, N)
	{
		cin >> A[i];
	}
	REP(i, M)
	{
		cin >> B[i];
	}

	int a = -1;
	int b = -1;
	int cnt = 0;
	int cur = 0;
	for (int i = 0; i < N; i++)
	{
		if (cur + A[i] > K)
		{
			break;
		}

		a = i;
		cur += A[i];
		cnt++;
	}

	for (int i = 0; i < M; i++)
	{
		if (cur + B[i] > K)
		{
			break;
		}

		b = i;
		cur += B[i];
		cnt++;
	}

	
	int ma = cnt;
	for (; a >= 0; a--)
	{
		cur -= A[a];
		cnt--;

		for (int j = b + 1; j < M; j++)
		{
			if (cur + B[j] > K)
			{
				break;
			}

			b = j;
			cur += B[j];
			cnt++;
		}

		ma = max(cnt, ma);
	}

	cout << ma << endl;
}



Measured memory_bytes: 6748
s,t=input(),input()
ss,ts=[set()for i in range(26)],[set()for i in range(26)]
sc={}
tc={}
for i in range(len(s)):
    if s[i]not in sc:
        if t[i] in tc:print("No");exit()
        else:
            d=len(sc)
            ss[d].add(i)
            ts[d].add(i)
            tc[t[i]]=d
            sc[s[i]]=d
    else:
        if t[i]not in tc or sc[s[i]]!=tc[t[i]]:print("No");exit()
        else:
            ss[sc[s[i]]].add(i)
            ts[sc[s[i]]].add(i)
for i in range(26):
    if ss[i]!=ts[i]:print("No");break
else:print("Yes")

Measured memory_bytes: 28056
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

#define REP(i,n) for(i=0;i<n;i++)
#define ll long long
#define PI M_PI

int main(void){
    int i, j;
    int N; scanf("%d",&N);
    int A[N];
    REP(i,N) scanf("%d",&A[i]);

    int ans[N];

    REP(i,N){
        ans[A[i]-1] = i+1;
    }
    REP(i,N){
        printf("%d ",ans[i]);
    }
    return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>

int main(void) {
	int N, A, B, C, D;
	int sumipe, kanape;
	if (scanf("%d%d%d%d%d", &N, &A, &B, &C, &D) != 5) return 1;
	sumipe = B * ((N + A - 1) / A);
	kanape = D * ((N + C - 1) / C);
	printf("%d\n", sumipe <= kanape ? sumipe : kanape);
	return 0;
}



Measured memory_bytes: 2124
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<cstring>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<climits>

#define FASTREAD      ios_base::sync_with_stdio(0);cin.tie(nullptr);
#define ll long long
#define dd double
#define scl(n)        scanf("%lld",&n)
#define scd(n)        scanf("%lf",&n)
#define scc(n)        scanf("%c",&n)
#define scs(n)        scanf("%s",&n)
#define ptl(n)        printf("%lld",n)
#define ptd(n)        printf("%f",n)
#define ptc(n)        printf("%c",n)
#define pts(n)        printf("%s",n)
#define nline         printf("\n")
#define pb            push_back
#define FOR(i,a,b)    for(ll i=a;i<=b;i++)
#define FORr(i,a,b)   for(ll i=a;i>=b;i--)
#define pi            2*acos(0.0)
#define pii           pair<ll,ll>
#define uu            first
#define vv            second
#define m 1000000007
using namespace std;
ll dp[1005][1005];
int main()
{
    ll r,c;
    char ch[1005][1005];
    scl(r);
    scl(c);
    FOR(i,0,r-1)
    {
        scs(ch[i]);
    }
    dp[0][0]=1;
    FOR(i,1,c-1)
    {
        if(ch[0][i]!='#')
            dp[0][i]=dp[0][i-1];
        else
            dp[0][i]=0;
    }
    FOR(i,1,r-1)
    {
        if(ch[i][0]!='#')
            dp[i][0]=dp[i-1][0];
        else
            dp[i][0]=0;
    }
    ll op1,op2;
    FOR(i,1,r-1)
    {
        FOR(j,1,c-1)
        {
            if(ch[i][j]!='#')
                dp[i][j]=(dp[i][j-1]%m+dp[i-1][j]%m)%m;
            else
                dp[i][j]=0;
         //   cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        }
    }
    ptl(dp[r-1][c-1]);
    return 0;
}


Measured memory_bytes: 12556
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, A[300][300];
bool b[300][300];
ll res;

int main() {
	cin >> N;
	for (int i = 0; i != N; ++i) {
		for (int j = 0; j != N; ++j) {
			cin >> A[i][j];
			b[i][j] = true;
		}
	}
	for (int i = 0; i != N; ++i) {
		for (int j = 0; j != N; ++j) {
			for (int k = 0; k != N; ++k) {
				if (i == j || j == k || k == i)continue;
				if (A[i][j] + A[j][k] < A[i][k]) {
					cout << -1 << endl;
					return 0;
				}
				if (A[i][j] + A[j][k] == A[i][k]) {
					b[i][k] = false;
				}
			}
		}
	}
	for (int i = 0; i != N; ++i) {
		for (int j = i + 1; j != N; ++j) {
			if (b[i][j])res += A[i][j];
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 640
//
#include <iostream>
#include <string>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()


int main(){
	string str;
	cin >> str;
	int counter = 0;
	char before = str[0], after;
	REP(i,1,str.size()){
		after = str[i];
		if(after != before) counter++;
		before = after;
	}
	printf("%d\n", counter);

	return 0;
}


Measured memory_bytes: 512
from collections import deque

h, w = map(int, (input().split()))
maze = ['#' * (w + 2)] + ['#{}#'.format(input()) for i in range(h)] + ['#' * (w + 2)]
directions = [[0, -1], [-1, 0], [1, 0], [0, 1]]
queue = deque()
answer = 0

for start_x in range(1, h + 1):
    for start_y in range(1, w + 1):
        if maze[start_x][start_y] == '.':
            distance = [[-1] * (w + 2) for i in range(h + 2)]
            distance[start_x][start_y] = 0
            queue.append([start_x, start_y])
            while queue:
                x, y = queue.popleft()
                for direction in directions:
                    next_x, next_y = x + direction[0], y + direction[1]
                    if maze[next_x][next_y] == '.' and distance[next_x][next_y] == -1:
                        distance[next_x][next_y] = distance[x][y] + 1
                        queue.append([next_x, next_y])
                        answer = max(answer, distance[next_x][next_y])

print(answer)

Measured memory_bytes: 3316
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,m = [int(i) for i in readline().split()]
#d = [int(i) for i in readline().split()]


n = int(input())
a = [int(i) for i in readline().split()]

m = n+10
ans = 0
for i,ai in enumerate(a):
    m = min(m,ai)
    if m==ai:
        ans += 1

print(ans)
    
    

Measured memory_bytes: 24288
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vct vector<ll>
#define umap unordered_map<ll,ll>
#define mpp map<ll,ll>
#define stt set<ll>
#define pir pair<ll,ll>
#define vpp vector<pair<ll,ll> >

ll poww(ll x,ll y,ll m){   
    ll res=1;
    while(y){if(y%2==0){x=(x*x)%m;y=y/2;}else{res=(res*x)%m;y--;}}
    return res;
}
void prt(vct v)
{
    // cout<<"\n";
    for(ll i=0;i<v.size();i++)cout<<v[i]<<" ";
    cout<<"\n";
    
}
vct siev(ll n)
{
    vct ans;ll ar[n+1];
    memset(ar,-1,sizeof(ar));ar[0]=0;ar[1]=0;
    for(ll i=2;i<=n;i++)
    {if(ar[i]==-1){ans.push_back(i);ar[i]=1;for(ll j=2*i;j<=n;j=j+i)ar[j]=0;}}
    return ans;
}
bool isprime(ll n)
{
    for(ll i=2;i<=sqrt(n);i++)if(n%i==0)return false;
    return true;
}

vct divsors(ll n)
{
    vct ans;ans.push_back(1);
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            ans.push_back(i);
            if(i!=(n/i))ans.push_back(n/i);
        }
    }
    return ans;
}
ll cnd(ll n){ll cnt=0;while(n){cnt++;n=n/10;}return cnt;}

ll fibdig(ll n)
{
    if (n == 1) 
        return 1; 
    long double d = (n * log10(1.6180339887498948)) -((log10(5)) / 2);
    return ceil(d); 
}


ll t;ll n,m,k;
// vct v;
ll t1,t2;
ll mod=1000000007;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // setprecision(10);
    cin>>n;
    double tm=1.0*n;
    double ans;
    if(n%2==0)
    {
        ans=tm/(2.0*tm);
    }
    else
    {
        ans=((tm/2.0)+0.5)/tm;
    }
    
        cout << fixed << setprecision(10) << ans ;
    
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
using namespace std;
int main() {
	ll n;
	scanf("%lld",&n);
	printf("%lld\n",n*(n+1)/2-n);
	
	return 0;
}

Measured memory_bytes: 256
N= int(input())
A= list(map(int, input().split()))
B= list(map(int, input().split()))
s=sum(A)-sum(B)
if s<0:
    print(-1)
else:
    ans=0
    tmp=0
    C=[a-b for a,b, in zip(A,B)]
    C.sort()
    for i in C:
        if i<0:
            ans+=1
            tmp+=i
        else:
            break
    for i in C[::-1]:
        if tmp>=0:
            break
        tmp+=i
        ans+=1
    print(ans)

Measured memory_bytes: 18356
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int c11, c12, c13, c21, c22, c23, c31, c32, c33;
	cin >> c11 >> c12 >> c13 >> c21 >> c22 >> c23 >> c31 >> c32 >> c33;
	for(int a1=0; a1<=c11; a1++){
		int b1=c11-a1;
		for(int a2=0; a2<=c22; a2++){
			int b2=c22-a2;
			for(int a3=0; a3<=c33; a3++){
				int b3=c33-a3;
				if(a1+b2==c12 && a1+b3==c13 && a2+b1==c21 && a2+b3==c23 && a3+b1==c31 && a3+b2==c32){
					cout << "Yes\n";
					return 0;
				}
			}
		}
	}
	cout << "No\n";
	return 0;
}

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

#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()  
{ 
    FAST_INP;
    long long n,k; 
    cin >> n >> k;
    long long a[n];
    unordered_map<long long,long long> m,d,c;
    bool duplicate=false;
    for(long long i=0;i<n;i++){
        cin >> a[i];
        m[i]=a[i];
    }

    long long i=0,step=0,kk=k;
    while(!duplicate&&kk){
        step++;
        if(d[i]==1){
            duplicate=true;
            continue;
        }
        d[i]=1;
        c[i]=step;
        i=m[i]-1;
        kk--;
    }

    if(kk){
        long long r = (k-c[i])%(step-c[i]);
        while(r>=0){
            i=m[i]-1;
            r--;
        } 
    }

    cout << i+1 << "\n";

    return 0;
} 

Measured memory_bytes: 27096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(A*N, B) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
#define REP(i,j,n) for(int i=j;i<n;i++)
#define rep(i,n) REP(i,0,n)


// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int ary[n][2];
    rep(i,n) rep(j,2) cin >> ary[i][j];
    bool flag = false;
    rep(i,n-2)
    {
        if (ary[i][0]==ary[i][1] && ary[i+1][0]==ary[i+1][1] && ary[i+2][0]==ary[i+2][1])
        {
            flag = true;
        }
    }
    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    


}


Measured memory_bytes: 3648
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,a,b;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

  cin >> n >> a >> b;
  if( a%2==b%2 ){
    cout << (b-a)/2 << endl;
  }        
  else {
    int ans = min( a + (b-a)/2, (n-b+1) + (b-a)/2 );
    cout << ans << endl;
  }
    

return 0;
}
///....


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	int count[4] = {}; 
	for(int i = 0; i < 6; i++){
		int A; 
		cin >> A; 
		count[A-1] ++; 
	}
	sort(count, count + 4); 
	if(count[0] == 1 && count[1] == 1 && count[2] == 2 && count[3] == 2){
		cout << "YES" << endl; 
	}
	else cout << "NO" << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int64_t A, B, V, W, T;

void solve()
{
  int64_t t = (abs(A - B) + (V - W - 1)) / (V - W);
  if (t <= T)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

int main()
{
  cin >> A >> V >> B >> W >> T;
  if (A == B)
    cout << "YES" << endl;
  else if (W >= V)
    cout << "NO" << endl;
  else
    solve();
}

Measured memory_bytes: 3584
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
using namespace std;

int main() {
	bool flag = false;
	int c = 0;
	char S[51], T[50],C[51];
	cin >> S >> T;
	for (int i = strlen(S) - strlen(T); i >=0 ; i--)
	{
		for (int k = 0; k < strlen(S); k++)
		{
			C[k] = S[k];
		}
		C[strlen(S)] = '\0';
		c = 0;
		for (int j = 0; j < strlen(T); j++)
		{
			if (S[i + j] == T[j] || S[i + j] == '?') {
				c++;
				C[i + j] = T[j];
			}
		}
		if (c == strlen(T)) {
			for (int j = 0; j < strlen(S); j++)
			{
				if (C[j]=='?')
				{
					C[j] = 'a';
				}
			}
			flag = true;
			break;
		}
	}
	cout << ((flag)?C:"UNRESTORABLE");

}


Measured memory_bytes: 256
import java.util.*;	
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int ans[] = new int[n+1];
		int data[] = new int[m*2];
		for(int i= 0;i < m*2;i++) {
			data[i] = sc.nextInt();
		}
		for(int i = 1;i <= n;i++) {
			for(int k = 0;k < m*2;k++) {
				if(data[k] == i)ans[i]++;
			}
		System.out.println(ans[i]);
		}
	}

}


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

int main() {
    unsigned long long X, Y;
    cin >> X >> Y;

    unsigned long long Z = Y / X;
    int ans = 1;
    while (Z / 2 != 0) {
        Z /= 2;
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
   
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int a,b;
        a=scan.nextInt();
        b=scan.nextInt();
        System.out.print("a");
        if(a>b)System.out.print(" > ");
        else if(a<b)System.out.print(" < ");
        else if(a==b)System.out.print(" == ");
        System.out.println("b");
        }
}

Measured memory_bytes: 26076
#include<iostream>
#include<cstdio>
//This code is written by Itst
using namespace std;

inline int read(){
	int a = 0;
	char c = getchar();
	while(!isdigit(c))
		c = getchar();
	while(isdigit(c)){
		a = a * 10 + c - 48;
		c = getchar();
	}
	return a;
}

#define ll long long
const int MAXN = 2e5 + 7;
struct node{
	int l , r;
	ll minN;
}Tree[MAXN * 40];
int pos[MAXN];
ll dp[MAXN] , sum[MAXN];
int rt1 , rt2 , cnt , N , Q;

#define mid ((l + r) >> 1)
int insert(int x , int l , int r , int tar , ll num){
	int t = ++cnt;
	Tree[t] = Tree[x];
	Tree[t].minN = min(Tree[t].minN , num);
	if(l == r) return t;
	if(mid >= tar) Tree[t].l = insert(Tree[t].l , l , mid , tar , num);
	else Tree[t].r = insert(Tree[t].r , mid + 1 , r , tar , num);
	return t;
}

ll query(int x , int l , int r , int L , int R){
	if(!x || (l >= L && r <= R)) return Tree[x].minN;
	ll minN = 1e18;
	if(mid >= L) minN = min(minN , query(Tree[x].l , l , mid , L , R));
	if(mid < R) minN = min(minN , query(Tree[x].r , mid + 1 , r , L , R));
	return minN;
}

inline ll abss(ll a){return a < 0 ? -a : a;}

int main(){
	Tree[0].minN = 1e18;
	N = read();
	Q = read() + 2;
	for(int i = 1 ; i <= Q ; ++i){
		pos[i] = read();
		sum[i] = sum[i - 1] + abss(pos[i] - pos[i - 1]);
	}
	rt1 = insert(rt1 , 1 , N , pos[1] , dp[2] - pos[1] - sum[2]);
	rt2 = insert(rt2 , 1 , N , pos[1] , dp[2] + pos[1] - sum[2]);
	for(int i = 3 ; i <= Q ; ++i){
		dp[i] = min(query(rt1 , 1 , N , 1 , pos[i]) + pos[i] , query(rt2 , 1 , N , pos[i] + 1 , N) - pos[i]) + sum[i - 1];
		rt1 = insert(rt1 , 1 , N , pos[i - 1] , dp[i] - pos[i - 1] - sum[i]);
		rt2 = insert(rt2 , 1 , N , pos[i - 1] , dp[i] + pos[i - 1] - sum[i]);
	}
	ll minN = 1e18;
	for(int i = 2 ; i <= Q ; ++i)
		minN = min(minN , dp[i] + sum[Q] - sum[i]);
	cout << minN;
	return 0;
}


Measured memory_bytes: 121088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1 << 18;

typedef pair <int, int> pii;
#define x first
#define y second

int val[sz], wet[sz];
vector <int> g[sz];
vector <pii> cmbs[sz];

int main()
{
   int n;
   cin >> n;
   for(int i=1; i<=n; i++) scanf("%d %d", &val[i], &wet[i]);

   int db = min(n, 1 << 9);
   cmbs[0].emplace_back(0, 0);
   for(int i=1; i<=db; i++) {
      int j = i >> 1;
      cmbs[i] = cmbs[j];
      for(auto p : cmbs[j]) {
         cmbs[i].emplace_back(p.x + wet[i], p.y + val[i]);
      }
      sort(cmbs[i].begin(), cmbs[i].end());
      for(int k=0, v=0; k<cmbs[i].size(); k++) {
         v = max(v, cmbs[i][k].y);
         cmbs[i][k].y = v;
      }
   }

   int q;
   cin >> q;
   for(int i=1; i<=q; i++) {
      int v, mxw;
      scanf("%d %d", &v, &mxw);
      vector <pii> up;
		up.emplace_back(0, 0);
		while(v > db) {
			int z = up.size();
			for(int j=0; j<z; j++) {
				auto p = up[j];
				up.emplace_back(p.x + wet[v], p.y + val[v]);
			}
			v >>= 1;
		}
		int ans = 0;
		for(auto p : up) {
			if(p.x <= mxw) {
				int k = upper_bound(cmbs[v].begin(), cmbs[v].end(), make_pair(mxw - p.x, INT_MAX)) - cmbs[v].begin() - 1;
				ans = max(ans, cmbs[v][k].y + p.y);
			}
		}
		printf("%d\n", ans);
	}
}


Measured memory_bytes: 19516
isPrime = [True] * 50100
prime = []
def calcPrime():
    isPrime[0] = isPrime[1] = False
    for i in range(len(isPrime)):
        if(isPrime[i]):
            prime.append(i)
            for j in range(2 * i, len(isPrime), i):
                isPrime[j] = False

calcPrime()
while(True):
    try:
        n = input()
        pos = 0
        while(prime[pos] < n):
            pos += 1
        print(prime[pos - 1]),
        if(n == prime[pos]):
            print(prime[pos + 1])
        else:
            print(prime[pos])
    except Exception:
        break

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

#define ll long long
#define ull unsigned long long

#define vi vector < int >
#define vll vector < ll >
#define vs vector < string >

#define pii pair < int, int >
#define pll pair < ll, ll >

#define pb push_back

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

const int maxn = 1e5 + 5;

ll cnt[maxn];

int main()
{
    fast;

    int n;

    cin >> n;

    ll x, sum = 0;

    for(int i = 0; i < n; i++){
        cin >> x;

        cnt[x]++;
        sum += x;
    }

    int q;

    cin >> q;

    while(q--){
        int b, c;

        cin >> b >> c;

        sum = sum - (b * cnt[b]) + (c * cnt[b]);

        cout << sum << endl;

        cnt[c] += cnt[b];
        cnt[b] = 0;
    }

    return 0;
}




Measured memory_bytes: 4316
use std::io::*;
use std::str::FromStr;

fn main(){
    let h: usize = read();
    let w: usize = read();
    let a: Vec<Vec<char>> = (0..h).map(|_| read::<String>().chars().collect()).collect();

    let mut red: Vec<Vec<char>> = vec![vec!['.'; w]; h];
    let mut blue: Vec<Vec<char>> = vec![vec!['.'; w]; h];
    for i in 0..h {
        red[i][0] = '#';
        for j in 1..w-1 {
            if i % 2 == 0 {
                red[i][j] = '#';
            } else {
                blue[i][j] = '#';
            }
            if a[i][j] == '#' {
                red[i][j] = '#';
                blue[i][j] = '#';
            }
        }
        blue[i][w-1] = '#';
    }
    println!();
    for i in 0..h {
        for j in 0..w {
            print!("{}", red[i][j]);
        }
        println!();
    }
    println!();
    for i in 0..h {
        for j in 0..w {
            print!("{}", blue[i][j]);
        }
        println!();
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

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

using namespace std;

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

   int count=0;
   int answer=0;

   for(int i=0;i<S.size();++i){
      if(S[i]=='A'||S[i]=='T'||S[i]=='G'||S[i]=='C')  count++;
      else {
         if(count>answer) answer=count;
         count = 0;
      }
      if(count>answer) answer=count;
   }

   cout << answer << endl;

   return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main(void) {

    int N, M, X; cin >> N >> M >> X;
    int c[N], a[N][M];
    rep(i,N) {
        cin >> c[i];
        rep(j,M) {
            cin >> a[i][j];
        }
    }

    ll ans = INF;
    for (int bit = 0; bit < (1<<N); ++bit) {
        ll a_sum[M];
        ll c_sum = 0;
        rep(i,M) a_sum[i] = 0;
        for (int i = 0; i < N; ++i) {
            if (bit & (1<<i)) {
                c_sum += c[i];
                for (int j = 0; j < M; ++j) {
                    a_sum[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        rep(i,M) {
            if (a_sum[i] < X) ok = false; 
        }
        if (ok) {
            ans = min(ans, c_sum);
        }
    }
    
    if (ans == INF) {
        out(-1);
    }
    else {
        out(ans);
    }
    
    
    
    return 0;
}






Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long k,a,b,ans;cin >> k >> a >> b;
  if(k>a && a<=b){
    cout << -1 << "\n";return 0;
  }
  if(a<=b){
    cout << 1 << "\n";return 0;
  }
  cout << (k-b-1)/(a-b)*2+1 << "\n";
}
  

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

int N, M;
vector<int>G[123456];
int degp[123456];
set<pair<int, int>>S;

bool used[123456];
int dfs(int x, int las) {
	used[x] = true;
	int chx = degp[x];
	for (int ch : G[x]) {
		if (used[ch])continue;
		chx ^= dfs(ch, x);
	}
	if (las != -1 && chx > 0) {
		int p = x;
		int q = las;
		if (!S.count({ p,q }))swap(p, q);
		S.erase(S.find({ p,q }));
		S.insert({ q,p });
	}
	return chx;
}

int main() {
	cin >> N >> M;
	if (M % 2 != 0) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
		S.insert({ a,b });
		degp[a] ^= 1;
	}
	dfs(0, -1);
	for (auto hen : S) {
		cout << hen.first + 1 << " " << hen.second + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 18816
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
//No change above here

const ll maxi = (2 * 1e5 + 3);
ll mod = (1e9 + 7);

//function for power
ll power(ll x, ll n) {
	ll res = 1;
	x %= mod;
	while (n) {
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

ll dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll p, q;
bool valid(ll i, ll j) { return i >= 1 && i <= p && j >= 1 && j <= q; }

//declare needed things here
unordered_map<int, int> m;
int main()
{
	IOS;
	ll n ,ans=0,k,a,b;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> k;
		m[k]++;
		ans += k;
	}
	cin >> q;
	while (q--)
	{
		cin >> a >> b;
		int counta = m[a];
		ans -= counta * a;
		ans += counta * b;
		cout << ans << endl;
		m.erase(a);
		m[b] += counta;
	}
	return 0;
}

Measured memory_bytes: 6564
#include <iostream>
using namespace std;
typedef long long ll;
const int N = 2e5+9, INF = 0x3f3f3f3f;

int main( void ) {
    ios::sync_with_stdio( false );
    int dt[7];
    for( int i = 1; i <= 6; ++i ) cin >> dt[i];
    int f[7][10] = { {0}, { 0, 2, 3, 5, 4, 2 }, { 0, 6, 3, 1, 4, 6 }, { 0, 1, 2, 6, 5, 1 },
    { 0, 2, 1, 5, 6, 2 }, { 0, 1, 3, 6, 4, 1 }, { 0, 2, 4, 5, 3, 2 } };
    int q, a, b;
    cin >> q;
    while( q-- ) {
        cin >> a >> b;
        int k, h;
        for( int i = 1; i <= 6; ++i ) {
            if( dt[i] == a ) {
                k = i;
            }
            if( dt[i] == b ) {
                h = i;
            }
        }
        for( int i = 1; i <= 4; ++i ) {
            if( f[k][i] == h ) {
                cout << dt[f[k][i + 1]] << '\n';
                break;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3104
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let a = read::<f64>();
  let b = read::<f64>();

  println!("{}", a / b);
}



Measured memory_bytes: 4352
function Main(input) {
    var input  = input.split(' ');
    var n = input[0];
    var a = input[1];
    var b = input[2];
    var Sum = 0;
    for (j = 1; j <= n; j++) {
        var str = j.toString();
        var arr = str.split('').map(n => parseInt(n));
        var x =  arr.reduce(function(prev, current, i, arr) {
                return prev+current;
            });
        if(a <= x && x <= b) {
            Sum += j;
        }
    }
    console.log(Sum);
    }
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 10972
#include <stdio.h>
int main(void){
    int n, i, max=0, x=0;
    char s[101];
    scanf("%d%s", &n, s);
    for(i=0; i<n; i++){
        if(s[i]=='I'){x++;}else{x--;}
        if(max<x){max = x;}
    }
    printf("%d\n", max);
}


Measured memory_bytes: 128
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#ans = [0]*n
n = int(input())
a = list(map(int, input().split()))
ans = [0]*n

for i in a:
    ans[i-1] += 1

for j in ans:
    print(j)


Measured memory_bytes: 32228
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
 
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");
 
T lread(T = long)()
{
    return readln.chomp.to!T();
}
 
T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}
 
void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n = 0;
    auto s = sread();
    foreach(i;s)
    {
        if(i == '+')
        {
            n++;
        }
        else
        {
            n--;
        }
    }
    n.writeln();
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld eps = 1e-12;
constexpr int inf = numeric_limits<int>::max() / 2;
constexpr ll mod = 1e9 + 7;
mt19937_64 rnd{random_device()()};

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

const int N_MAX = 1 << 20;
vector<ll> v(N_MAX), w(N_MAX);
vector<int> dep(N_MAX);

vector<int> get_path(int cur) {
  vector<int> ret = {cur};
  while (cur != 0) {
    cur = (cur - 1) / 2;
    ret.push_back(cur);
  }
  return ret;
}

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

  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i] >> w[i];
  }
  dep[0] = 0;
  for (int i = 0; i < n; i++) {
    int ch1 = 2 * i + 1, ch2 = 2 * i + 2;
    if (ch1 < n) dep[ch1] = dep[i] + 1;
    if (ch2 < n) dep[ch2] = dep[i] + 1;
  }
  const int L_MAX = 100010;
  const int DEP_MAX = 9;
  int DP_MAX = min(n, (1 << (DEP_MAX + 1)) - 1);
  // dp[i][j] := ノードiまでで重さj
  vector<vector<ll>> dp(DP_MAX, vector<ll>(L_MAX, -inf));
  dp[0][0] = 0;
  dp[0][w[0]] = v[0];
  for (int i = 1; i < DP_MAX; i++) {
    int par = (i - 1) / 2;
    for (int j = 0; j < L_MAX; j++) {
      dp[i][j] = max(dp[i][j], dp[par][j]);
      if (j + w[i] < L_MAX)
        dp[i][j + w[i]] = max(dp[i][j + w[i]], dp[par][j] + v[i]);
    }
  }
  for (int i = 0; i < DP_MAX; i++) {
    for (int j = 1; j < L_MAX; j++) {
      dp[i][j] = max(dp[i][j], dp[i][j - 1]);
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int cur;
    cin >> cur;
    cur--;
    int cap;
    cin >> cap;
    if (dep[cur] <= DEP_MAX) {
      cout << dp[cur][cap] << endl;
      continue;
    }
    auto path = get_path(cur);
    vector<int> cands;
    int par = -1;
    for (auto p : path) {
      if (dep[p] <= DEP_MAX) {
        par = p;
        break;
      }
      cands.push_back(p);
    }
    ll ret = 0;
    int sz = cands.size();
    for (int mask = 0; mask < (1 << sz); mask++) {
      ll vsum = 0, wsum = 0;
      for (int j = 0; j < sz; j++) {
        if ((mask >> j) & 1) {
          int pos = cands[j];
          vsum += v[pos];
          wsum += w[pos];
        }
      }
      if (wsum > cap) continue;
      ret = max(ret, dp[par][cap - wsum] + vsum);
    }
    cout << ret << endl;
  }
}


Measured memory_bytes: 826600
import sys
input = sys.stdin.readline
S = input().strip()

def check(s):
  i = 0
  j = len(s)-1
  while i <= j:
    if s[i] != s[j]:
      return False
    i += 1
    j -= 1
  return True

if not check(S):
  print('No')
  exit()
if not check(S[:(len(S)-1)//2]):
  print('No')
  exit()
if not check(S[(len(S)+3)//2-1:]):
  print('No')
  exit()
print('Yes')

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	private static final int TIME_ALMOST_TLE = 1900;
	private static final int TIME_AC = 100;

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

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int M = sc.nextInt();

		int T = (N - M) * TIME_AC + M * TIME_ALMOST_TLE;

		int prec = 1;
		for (int i = 0; i < M; i++) {
			prec *= 2;
		}
		System.out.println(T * prec);
		sc.close();
	}

}

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

/*
提出前に確認!
- setとmultisetを間違えない
*/

int	main(void)
{
	long long x, k, d;
	cin >> x >> k >> d;
	//x反転しても一般性を失わない
	x = abs(x);
	//がんばっても0を越せないならそこが限界
	if (x / d >= k) cout << x - d * k << endl;
	else if ((x / d) % 2 == k % 2) cout << x - x / d * d << endl;
	else cout << (x / d + 1) * d - x << endl;
	return (0);
}


Measured memory_bytes: 3628
N = int(input())
T_s = list(map(int,input().split()))
M = int(input())
PX_s = [list(map(int,input().split())) for _ in range(M)]
SUM = sum(T_s)
for P,X in PX_s:
    print(SUM - (T_s[P-1] - X))

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int x,y,s;
    cin >> x >> y >> s;
    if(x==0) return 0;
    int ma=0;
    for(int i=1;i<s;i++){
      for(int j=1;j<s;j++){
        if(i*(100+x)/100+j*(100+x)/100==s){
          ma=max(ma,i*(100+y)/100+j*(100+y)/100);
        }
      }
    }
    cout << ma << endl;
  }
  return 0;
}



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

int n, a, c;
multiset<int> s;
multiset<int>::iterator iter;

int main(){
	cin >> n;
	cin >> a;
	s.insert(a);
	for (int i = 0; i < n-1; ++i){
		cin >> a;
		iter = s.lower_bound(a);
		if (iter != s.begin()) s.erase(--iter);
		s.insert(a);
	}
	cout << s.size();
}

Measured memory_bytes: 4992