akhauriyash/Code-Regression huggingface dataset:
/*
 * 2523.cc: Time Complexity
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

typedef long long ll;

const ll MAX_T = 1000000000;

/* typedef */

/* global variables */

/* subroutines */

ll poly(string &s, ll n) {
  ll ans = 0;
  int pos = 0;
  while (pos < s.size()) {
    if (s[pos] == '+') pos++;
    pos += 2; // 'n^'
    int k = s[pos++] - '0'; // '0'-'9'

    ll p = 1;
    for (int i = 0; i < k; i++) {
      p *= n;
      if (p > MAX_T) return -1;
    }
    ans += p;
    if (ans > MAX_T) return -1;
  }
  return ans;
}

/* main */

int main() {
  ll n, t;
  string s;
  cin >> n >> t >> s;

  ll et = poly(s, n) * t;
  if (et >= 0 && et <= MAX_T) printf("%lld\n", et);
  else cout << "TLE" << endl;
  return 0;
}

Measured memory_bytes: 1200
import math
import itertools
N = int(input())
XY = []
for _ in range(N):
    XY.append(list(map(int, input().split())))


def distance(i, j):
    res = (XY[i][0] - XY[j][0]) ** 2 + (XY[i][1] - XY[j][1]) ** 2
    return math.sqrt(res)


m = []

for n in range(N):
    m.append([-1] * N)


for j in range(N):
    for i in range(N):
        m[j][i] = distance(i, j)


ans = 0

for j in range(N):
    for i in range(N):
        ans += m[j][i]

print(ans / N)


Measured memory_bytes: 38256
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;
#define int long long int
#define mod 1000000007
void dfs(int src,vector<int> adj[],int &here,bool visited[])
{
	if(visited[src])
	   return ;
	else
	{
		visited[src]=true;
		here++;
		for(int x:adj[src])
		   dfs(x,adj,here,visited);
	}
}
int prime[1000001];
void sieve()
{
	int j;
	for(j=1;j<=1000000;j++)
	   prime[j]=j;
	for(j=2;j<=1000;j++)
	{
		if(prime[j]==j)
		{
			for(int k=2;j*k<=1000000;k++)
			{
				prime[j*k]=j;
			}
		}
	}
}
int32_t main()
{
	sieve();
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int j,arr[n];
	for(j=0;j<n;j++)
	   cin>>arr[j];
	int g=0;
	for(j=0;j<n;j++)
	{
		g=__gcd(g,arr[j]);
	}
	if(g!=1)
	{
		cout<<"not coprime"<<endl;
		exit(0);
	}
	int count[1000001]={0};
	bool result=true;
	for(j=n-1;j>=0;j--)
	{
		set<int> st;
		int x=arr[j];
		if(x==1)
		   continue;
		while(x!=1)
		{
			int val=prime[x];
			st.insert(x);
			while(x!=1&&prime[x]==val)
			{
				x/=prime[x];
			}
		}
		for(int y:st)
		{
			if(count[y]!=0)
			{
				result=false;
				break;
			}
		}
		for(int y:st)
		{
			count[y]++;
		}
	}
	if(result)
	{
		cout<<"pairwise coprime"<<endl;
	}
	else
	{
		cout<<"setwise coprime"<<endl;
	}
}


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

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

int main(){
  int s;
  cin >> s;
  
  cout << 2 * s * M_PI << endl;
  
  return 0;
  
}


Measured memory_bytes: 3780
#include<stdio.h>

#define N 100000000


int A[101][101];
int P[101];
int n;
void tl(int s,int c){
  int i;
  for(i=0;i<n;i++){
    if(A[s][i+1]==1 && P[i+1] > c){
      P[i+1] = c;
      tl(i+1,c+1);
    }
  }
}
int main(){
  int i,j;
  int u,k,v;
  for(i=0;i<100;i++){
    P[i+1] = N;
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      A[u][v] = 1;
    }
  }
  P[1]=0;
  tl(1,1);
  for(i=0;i<n;i++){
    printf("%d ",i+1);
    if(P[i+1]==N) printf("-1");
    else printf("%d",P[i+1]);
    printf("\n");
  }
  return 0;
}



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

long long calc(long long a, long long b, long long p){
  if (b == 0) return 1;
  else if(b % 2 == 0){
    long long d = calc(a, b/2, p);
    return (d * d) % p;
  }
  else return (a * calc(a, b - 1, p)) % p;
}

int main(){
  long long N, suma = 0, sumb = 0, ans, tmp;
  cin >> N;
  for (long long i = 0; i < N; i++){
    cin >> tmp;
    suma += tmp % (1000000000 + 7);
    sumb += (tmp % (1000000000 + 7) * tmp % (1000000000 + 7)) % (1000000000 + 7);
  }
  suma = ((suma % (1000000000 + 7))* (suma % (1000000000 + 7))) % (1000000000 + 7);
  long long tmp2 = (suma % (1000000000 + 7) - sumb % (1000000000 + 7)) % (1000000000 + 7);
  long long tmp3 = calc(2, 1000000000 + 5, 1000000000 + 7) % (1000000000 + 7);
  ans = tmp2 * tmp3 % (1000000000 + 7);
  if(ans < 0) ans += 1000000000 + 7;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;
public class Main
{

    public static void main(String[] args)throws IOException
    {
    FastReader in=new FastReader(System.in);
    StringBuffer st=new StringBuffer();
        
    int n=in.nextInt();
    int  xs[][]=new int[1000][1000];
    int  ys[]=new int[1000];
    boolean fs[]=new boolean[1000];
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n - 1; ++j)
        {
            int x=in.nextInt();
            xs[i][j] = x - 1;
        }
    }
 
    int r = (int)(n * (n - 1) / 2);
    int c = 0;
 
    while (0 < r)
    {
        int fn = 0;
 
        for (int i = 0; i < n; ++i)
        {
            if (ys[i] < n - 1)
            {
                int x = xs[i][ys[i]];
                fs[i] = (xs[x][ys[x]] == i);
            }
        }
 
        for (int i = 0; i < n; ++i)
        {
            if (fs[i] == true)
            {
                ++fn;
                ys[i] += 1;
            }
 
            fs[i] = false;
        }
 
        if (fn == 0)
        {
            c = -1;
            break;
        }
        else
        {
            r -= fn / 2;
            c += 1;
        }
    }
 
          
        System.out.println(c);
    }
    static class FastReader{
 
        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;
 
        FastReader(InputStream is) {
            in = is;
        }
 
        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }
 
        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }
 
        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
 
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}      

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

signed main(void)
{
	int n, m, k, s;
	cin >> n >> k >> s;
	vector<int> v;
	rep(i, k)
	{
		v.push_back(s);
	}
	if (s < 1000000000)
	{
		rep(i, n - k)
			v.push_back(s + 1);
	}
	else
	{
		rep(i, n - k)
			v.push_back(1);
	}
	rep(i, v.size()) printf("%d%c", v[i], i==v.size()-1?' ':'\n');
	return 0;
}


Measured memory_bytes: 1784
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a[] = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt() - (i + 1);
		}
		Arrays.sort(a);
		int mid = a[n/2];
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += Math.abs(a[i] - mid);
		}

		System.out.println(ans);
	}
}


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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		int ans = 0;
		for (int i = 0; i < 4; i++) {
			if (str.charAt(i) == '+')
				ans++;
			else
				ans--;
		}
		System.out.println(ans);
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}


Measured memory_bytes: 21076
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		HashMap<String, Integer> hm = new HashMap<>();
		char[] s;
		Integer[] az;
		String tmp;
		for (int i = 0; i < n; i++) {
			s = sc.next().toCharArray();
			Arrays.sort(s);
			tmp = "";
			for (int j = 0; j < s.length; j++) {
				tmp += s[j];
			}
			if (hm.containsKey(tmp)) {
				hm.put(tmp, hm.get(tmp) + 1);
			} else {
				hm.put(tmp, 1);
			}
		}
		long sum = 0;
		for (String str : hm.keySet()) {
			sum += (long) hm.get(str) * (hm.get(str) - 1) / 2;
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 77512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    string a, b, A = "", B = "";
    cin >> a >> b;
    for(int i = 0; i < stoi(b); ++i) A += a;
    for(int i = 0; i < stoi(a); ++i) B += b;
    string ans = min(A, B);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000007
//0=48,A=65,a=97

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(a[i]%2==n%2){
            cout << 0 << endl;
            return 0;
        }
        if(n%2==0){
            a[i]--;
        }
        a[i] /= 2;
    }

    int m;
    if(n%2==0) m=n/2;
    else m=(n+1)/2;

    vector<int> b(m);
    for(int i = 0; i < n; i++) {
        b[a[i]]++;
    }

    if(n%2==1 && b[0]!=1){
        cout << 0 << endl;
        return 0;
    }
    if(n%2==0 && b[0]!=2){
        cout << 0 << endl;
        return 0;
    }

    for(int i = 1; i < m; i++) {

        if(b[i]!=2){
            cout << 0 << endl;
            return 0;
        }
    }

    ll ans=1;
    if(n%2==0) ans=2;

    for(int i = 0; i < m-1; i++) {
        ans *= 2;
        ans %= INF;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3716
#include<stdio.h>

int main(void){
	int W,H,x,y,r;

	scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
	
	if(x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H){
		printf("Yes\n");
}
else{
	printf("No\n");

}

return 0;

}


Measured memory_bytes: 2692
#include<string>
#include <iostream>
#include<math.h>

using namespace std;


int main(void) {
    int N;
    cin >> N;
    int t[N],x[N+1],y[N+1];
    for(int i=0;i<N;i++){
        cin >> t[i+1] >> x[i+1] >> y[i+1];
    }
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;

    bool flag = true;
    for(int i=0;i<N;i++){

        int dt = t[i+1] - t[i];
        int dx = abs(x[i+1]-x[i]);
        int dy = abs( y[i+1] - y[i]);

        if( dt < dx + dy){
            flag = false;
            break;
        }

        if( dt %2 ==1 && (dx+dy)%2 ==0 || dt %2 ==0 && (dx+dy)%2 ==1 ){
            flag = false;
            break;
        }
    }

    if(flag) cout << "Yes";
    else cout << "No";





    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <map>
#include <math.h>
#include <stack>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<pair<int,int>> v;
    for(int i=0;i<n;i++){
        int x; cin >> x;
        v.push_back(make_pair(x,i));
    }
    sort(v.rbegin(), v.rend());
    int last=n*n;
    int cnt=0;
    int id=n*n-1;
    vector<int> res(n*n,0);
    stack<pair<int,int>> q;
    for(int i=0;i<n;i++){
        cnt+=last-v[i].first;
        last=v[i].first-1;
        res[v[i].first-1]=v[i].second+1;
        int add=n-(v[i].second+1);
        if(cnt<add){
            printf("No\n");
            return 0;
        }
        cnt-=add;
        while(add){
            if(res[id]==0){
                res[id]=v[i].second+1;
                add--;
            }
            id--;
        }
        for(int j=0;j<v[i].second;j++){
            q.push(make_pair(v[i].second+1,v[i].first));
        }
    }
    for(int i=0;i<n*n;i++){
        if(res[i]==0){
            res[i]=q.top().first;
            if(q.top().second<=i){
                printf("No\n");
                return 0;
            }
            q.pop();
        }
    }
    printf("Yes\n");
    for(int i=0;i<n*n;i++){
        printf("%d ",res[i]);
    }
    printf("\n");
}


Measured memory_bytes: 3200
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	a := getNextInt64(scanner)
	v := getNextInt64(scanner)
	b := getNextInt64(scanner)
	w := getNextInt64(scanner)
	t := getNextInt64(scanner)
	if v <= w {
		fmt.Fprintln(writer, "NO")
		return
	}
	if (abs(b-a)+v-w-1)/(v-w) > t {
		fmt.Fprintln(writer, "NO")
		return
	}
	fmt.Fprintln(writer, "YES")
}

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1800
#include <iostream>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
    int h, w, n;
    int r, c;
    string s, t;
    cin >> h >> w >> n >> r >> c >> s >> t;
    int r1 = r, c1 = c;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            c1--;
        }
        if (c1 <= 0) {
            cout << "NO" << endl;
            return 0;
        }
        if (t[i] == 'R') {
            c1 = min(w, c1 + 1);
        }
    }
    r1 = r, c1 = c;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') {
            c1++;
        }
        if (c1 > w) {
            cout << "NO" << endl;
            return 0;
        }
        if (t[i] == 'L') {
            c1 = max(1, c1 - 1);
        }
    }
    r1 = r, c1 = c;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'D') {
            r1++;
        }
        if (r1 > h) {
            cout << "NO" << endl;
            return 0;
        }
        if (t[i] == 'U') {
            r1 = max(1, r1 - 1);
        }
    }
    r1 = r, c1 = c;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'U') {
            r1--;
        }
        if (r1 <= 0) {
            cout << "NO" << endl;
            return 0;
        }
        if (t[i] == 'D') {
            r1 = min(h, r1 + 1);
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 3900
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		solve2440();
	}

	public static void solve2440() {
		Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            int p = sc.nextInt();
            int pfst = p;
            int out = 0;
            if(0 == n&&0 == p){
                break;
            }
            int[] s = new int[n];
            int i = 0;
            while(true){
            	if(s[i]>0&p>0) {
		        	s[i]+=1;
		        	p-=1;
		        }
            	else if(s[i]==0&p>0) {
		        	s[i]+=1;
		        	p-=1;
		        }
            	else if(p==0&s[i]==0) {

		        }
            	else if(p==0&s[i]>0) {
		        	p=s[i];
		        	s[i]=0;
		        }

	        	for(int j=0;j<n;j++) {
	        		if(s[j]==pfst) {
	        			System.out.println(j);
	        			pfst = 0;
	        			break;
	        		}
	        	}

		        if(pfst==0) {
		        	break;
		        }
		        i++;
		        if(i==n) {
		        	i=0;
		        }
            }
        }

	}

}


Measured memory_bytes: 27008
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;
                                                                                                     
ll MOD=1000000007;                                                                                     
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,m,ans=0; cin>>n>>m;
    vector<int> ncnt(100001,0);
    vector<pp> cnt(m,mk(0,0));
    rep(i,n){
        int x; cin>>x;
        ncnt[x]++;
        cnt[x%m].first++;
        if(ncnt[x]%2==0) cnt[x%m].second++;
    }
    rep(i,m/2+1){
        if(i==0 || (m%2==0 && i==m/2)){
            ans+=cnt[i].first/2;
        }
        else{
            if(cnt[i].first>cnt[m-i].first){
                ans+=cnt[m-i].first;
                ans+=min((cnt[i].first-cnt[m-i].first)/2,cnt[i].second);
            }
            else{
                ans+=cnt[i].first;
                ans+=min((cnt[m-i].first-cnt[i].first)/2,cnt[m-i].second);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4220
n, k = list(map(int, input().split()))
d = [0 for i in range(100010)]

for i in range(n):
  a, b = list(map(int, input().split()))
  d[a] += b

for j, e in enumerate(d):
  k -= e
  if k<=0:
    print(j)
    break

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

int depth[100005];

int get_depth(vector<set<int>>& VS, int i) {
  if (0 <= depth[i]) return depth[i];
  else {
    int ret = 0;
    for (auto x : VS[i]) {
      ret = max(ret, get_depth(VS, x) + 1);
    }
    depth[i] = ret;
    return ret;
  }
}

int get_p(vector<set<int>>& VS, int i) {
  int p, maxdepth = -1;
  for (auto x : VS[i]) {
    int d = get_depth(VS, x);
    if (maxdepth < d) {
      p = x;
      maxdepth = d;
    }
  }
  return p;
}

int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < N; i++) depth[i] = -1;
  int NE = N - 1 + M;
  int a, b;
  vector<set<int>> VS(N);
  for (int i = 0; i < NE; i++) {
    cin >> a >> b;
    a--; b--;
    VS[b].insert(a);
  }
  for (int i = 0; i < N; i++) {
    auto S = VS[i];
    if (S.size() == 0) {
      depth[i] = 0;
      cout << 0 << endl;
    } else if (S.size() == 1) {
      int p = *(S.begin());
      depth[i] = get_depth(VS, p) + 1;
      cout << p + 1 << endl;
    } else {
      int p = get_p(VS, i);
      depth[i] = get_depth(VS, p) + 1;
      cout << p + 1 << endl;
    }
  }
}

Measured memory_bytes: 13568
n = input()
dis = {}
for x in xrange(2, n+1):
    i = 2
    while i*i <= x:
        while x % i == 0:
            dis[i] = dis.get(i, 0) + 1
            x /= i
        i += 1
    if x>1:
        dis[x] = dis.get(x, 0) + 1
ans = 1
for k in dis:
    ans = (ans * (dis[k]+1)) % (10**9+7)
print ans


Measured memory_bytes: 2568
#include<stdio.h>
int main(void){
    char ch;
    while(1){
        scanf("%c",&ch);
        if(islower(ch))printf("%c",toupper(ch));
        else if(isupper(ch))printf("%c",tolower(ch));
        else printf("%c",ch);
        if(ch=='\n')break;
    }
    return 0;
}


Measured memory_bytes: 2048
#include<iostream>

using namespace std;

int main(){
	int n;
	char *s;
	s = new char[n];
	cin >> n;
	cin >> s;
	
	char tmp;
	int X[27] = {}, Y[27] = {};
	int tmp_max,max = 0;
	for(int i=1;i<n-1;i++){
		int j_end = 0;
		//cout << "X" <<endl;
      	for(int j=0;j<i;j++){
			X[(int)s[j]-97]+=1;
			//cout << "s:" << s[j] << "\tint:" << (int)s[j]-97 <<endl;
          	j_end = j;
	    }
		//cout << "Y" <<endl;
	    for(int j=j_end+1;j<n;j++){
	    	Y[(int)s[j]-97]+=1;
			//cout << "s:" << s[j] << "\tint:" << (int)s[j]-97 <<endl;
	    }
	    tmp_max = 0;
	    for(int j=0;j<27;j++){
			if((X[j]>0)&&(Y[j]>0))tmp_max++;
		    // cout << X[j] << " " << Y[j] << endl;
			X[j]=0;
			Y[j]=0;
	    }
	    if(max<tmp_max)max=tmp_max;
      	//cout << max << endl;
	}
	cout << max;
	return 0;
}

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

using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define TR(it,c) for( typeof(c.begin()) it = c.begin(); it != c.end(); ++it )
#define TRR(it,c) for( typeof(c.rbegin()) it = c.rbegin(); it != c.rend(); ++it
#define REP(i,a) for (int i = 0; i < (a); i++)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)

#define DRI(a) int a; scanf("%d", &a);
#define DRII(a, b) int a, b; scanf("%d %d", &a, &b);
#define DRIII(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c);
#define RI(a) scanf("%d", &a);
#define RII(a, b) scanf("%d %d", &a, &b);
#define RIII(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define MM(arr, num) memset((arr), (num), sizeof((arr)))
#define DEB(x) cerr << ">>> " << (#x) << " -> " << (x) << endl;
#define DEBA(x,n) cerr << (#x) << " "; deba((x),(n));
void deba(int * a, int n){ cerr << "| "; REP(i,n) cerr << a[i] << " "; cerr << "|" << endl;}


inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

const int INF = 1<<30;
typedef long long ll;
typedef unsigned long long ull;
/*******************************************************/

ll mod = 1000000007;

int a[123456];

int main() {


    DRI(n);
    REP(i,n)RI(a[i]);

    sort(a,a+n);

    if(n%2){
        REP(i,n)if(a[i] %2) {cout << 0 << endl; return 0;}
        if (a[0]!= 0){cout << 0 << endl; return 0;}
        FOR(i,1,n-1){
            if(a[i]!=  ((i+1)/2)*2   ){cout << 0 << endl; return 0;}
        }
    }
    else{
        REP(i,n)if(a[i] %2 == 0) {cout << 0 << endl; return 0;}
        FOR(i,0,n-1){
            if(a[i]!=  ((i)/2)*2 + 1 ){cout << 0 << endl; return 0;}
        }
    }

    ll k = 1;

    REP(i, n/2) {k *= 2; k%= mod; } cout << k << endl;




    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>
#include <cassert>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    loop(num,1,n+1){
        int ans = 0;
        //cout << "!!!!" << num << endl;
        loop(x,1,num)loop(y,1,num){
            int t = num - x*x - y*y - x*y;//z*z + z*(x+y)
            if(t <= 0)break;
            int d = (x+y)*(x+y) + 4*t;
            int sqrtd = sqrt(d);
            //cout << x << " "<< y << " " << sqrtd << endl;
            if(sqrtd*sqrtd == d){
                if(sqrtd%2 == (x+y)%2){
                    if(-(x+y) + sqrtd > 0)ans++;
                }
            }
        }
        cout << ans << endl;
    }

}


Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int num;
		while ((num = in.nextInt()) != 0) {
			String newNum = Integer.toOctalString(num);
			newNum = newNum.replace('7', '9');
			newNum = newNum.replace('6', '8');
			newNum = newNum.replace('5', '7');
			newNum = newNum.replace('4', '5');
			System.out.println(newNum);
		}
	}
}

Measured memory_bytes: 51732
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int n; cin>>n;
	vector<ll>a(n),b(n);
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)cin>>b[i];
	reverse(b.begin(),b.end());
	int i=0,j=n-1;
	bool c=true;
	
	// 1 1 2 3
	// 3 3 2 1
	for(int r=0;r<n;r++)
	{
		if(a[r]==b[r])
		{
			if(a[i]!=b[r] && b[i]!=a[r]) 
			{
				//i++;
				swap(b[i],b[r]);
				i++;
			}
			else if(a[j]!=b[r] && b[j]!=a[r])
			{
				swap(b[j],b[r]);
				j--;
			}
			else
			{
				c=false; break;
			}
			
		}
		
	}
	if(!c)cout<<"No\n";
	else {cout<<"Yes\n";
	for(auto x: b)cout<<x<<" ";}
	
}

Measured memory_bytes: 6424
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(void) {
  ll x;cin>>x;
  ll a = 100;
  ll ans = 0;
  while(a < x) a=(ll)a*1.01, ans++;
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll n, k,ans=0;
	std::cin >> n >> k;
	vll h(n);
	rep(i, 0, n) {
		std::cin >> h[i];
	}

	sort(h.begin(), h.end(), greater<ll>());

	rep(i, 0, n) {
		if (k > 0) {
			k--;
		}
		else {
			ans += h[i];
		}
	}
	outn(ans);
	return 0;

}


Measured memory_bytes: 1792
#include<stdio.h>

int main(){
  int N,M,X,Y,temp,i;
  scanf("%d%d%d%d",&N,&M,&X,&Y);
  for(i=0;i<N;i++){
    scanf("%d",&temp);
    if(temp>X)X = temp;
  }
  for(i=0;i<M;i++){
    scanf("%d",&temp);
    if(temp<Y)Y = temp;
  }
  puts(Y>X?"No War":"War");
  return 0;
}


Measured memory_bytes: 128
import itertools
import math
n = int(input())
lis1 = []
for i in range(n):
    lis1.append(list(map(int, input().split())))
S = 0
for i in list(itertools.permutations(range(n))):
    for j in range(n-1):
        S += math.sqrt((lis1[i[j]][0]-lis1[i[j+1]][0])**2 + (lis1[i[j]][1]-lis1[i[j+1]][1])**2)
for i in range(1, n+1):
    S = S / i
print(S)

Measured memory_bytes: 8100
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int read(){
	int x=0,w=1;
	char ch=0;
	while (ch<'0' || ch>'9'){
		  if (ch=='-') w=-1;
		  ch=getchar();
	}
	while (ch<='9' && ch>='0'){
		  x=(x<<1)+(x<<3)+ch-'0';
		  ch=getchar();
	}
	return x*w;
}
int n,k;
int main(){
	n=read()-1;k=read()-1;
	int ans=n/k;
	if (n%k) ++ans;
	printf("%d\n",ans); 
	return 0;
}


Measured memory_bytes: 128
s = input()

upper = int(s[:2])
lower = int(s[2:4])

if upper > 12:
    if lower > 12 or lower <= 0: print('NA')
    else: print('YYMM')
elif upper <= 0:
    if lower <= 12 and lower > 0: print('YYMM')
    else: print('NA')
else:
    if lower > 12: print('MMYY')
    elif lower <= 0: print('MMYY')
    else: print('AMBIGUOUS')



Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)

using namespace std;
typedef pair<int, int> ipair;

class DisjointSets {
    class Node {
        public: 
        int parent = -1;
        int rank = 0;
        int degree = 1;
    };
    
private:
    Node *nodes;

    void make_set(int x) {
        nodes[x].parent = x;
        nodes[x].rank = 0;
        nodes[x].degree = 1;
    }

public:
    int find_set(int x) {
        if(nodes[x].parent == x)
            return x;

        //経路圧縮
        nodes[x].rank = 0;
        return nodes[x].parent = find_set(nodes[x].parent);
    }

    int count = 0;

    DisjointSets(){}
    DisjointSets(int length) {
        nodes = (Node *)malloc(sizeof(Node) * length);
        count = length;

        for(int i = 0; i < length; ++i)
            make_set(i);
    }

    ~DisjointSets() {
        free(nodes);
    }

    int degree(int x) {
        return nodes[find_set(x)].degree;
    }

    void unite(int x, int y) {
        int set_x = find_set(x);
        int set_y = find_set(y);
        if(set_x == set_y) return;
        --count;

        if(nodes[x].rank < nodes[y].rank) {
            nodes[set_x].parent = set_y;
            nodes[y].degree += nodes[x].degree;
        } else if(nodes[x].rank > nodes[y].rank) {
            nodes[set_y].parent = set_x;
            nodes[x].degree += nodes[y].degree;
        } else {
            nodes[set_y].parent = set_x;
            nodes[x].rank++;
            nodes[x].degree += nodes[y].degree;
        }
    }

    bool same(int x, int y) {
        int set_x = find_set(x);
        int set_y = find_set(y);
        return set_x == set_y;
    }
};

int N, M;
int main(int argc, char **argv) {
    cin >> N >> M;

    DisjointSets *sets = new DisjointSets(N * 2);
    /*
        A_iについて
            偶数である事象...2 * i
            奇数である事象...2 * i + 1
    */

    for(int i = 0; i < M; ++i) {
        int X, Y, Z;
        cin >> X >> Y >> Z;
        X--;
        Y--;
        if(Z % 2 == 0) {
            sets->unite(2 * X, 2 * Y);
            sets->unite(2 * X + 1, 2 * Y + 1);
        } else {
            sets->unite(2 * X + 1, 2 * Y);
            sets->unite(2 * X, 2 * Y + 1);
        }
    }

    int groups = 0;
    set<int> new_num;
    for(int i = 0; i < 2 * N; ++i) {
        int root = sets->find_set(i);
        if(new_num.find(root) == new_num.end()) {
            new_num.insert(root);
            ++groups;
        }
    }

    delete sets;
    cout << (groups + 1) / 2 << endl;
}

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    long long d;
    cin >> n >> d;
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        long long a, b;
        cin >> a >> b;
        long long dist = a * a + b * b;
        if(dist <= d * d){
            cnt++;
        }
    }
    cout << cnt << '\n';


    return 0;
}

Measured memory_bytes: 3604
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int N, M;
    scan(N, M);

    auto adj = new int[][](N, 0);
    foreach (i ; 0 .. M) {
        int xi, yi;
        scan(xi, yi);
        xi--, yi--;
        adj[xi] ~= yi;
    }

    auto ord = topSort(adj);
    auto dp = new int[](N);

    int ans;

    foreach (v ; ord) {
        ans = max(ans, dp[v]);
        foreach (u ; adj[v]) {
            chmax(dp[u], dp[v] + 1);
        }
    }

    writeln(ans);
}

int[] topSort(int[][] adj) {
    auto N = adj.length.to!int;
    auto deg = new int[](N);
    foreach (v ; 0 .. N) {
        foreach (u ; adj[v]) {
            deg[u]++;
        }
    }
    int[] res;
    int[] next;
    foreach (v ; 0 .. N) {
        if (!deg[v]) next ~= v;
    }

    while (!next.empty) {
        int[] nn;

        foreach (v ; next) {
            res ~= v;
            foreach (u ; adj[v]) {
                deg[u]--;
                if (!deg[u]) nn ~= u;
            }
        }

        next = nn;
    }

    return res;
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

int main(){
    string s;
    int q;
    
    cin>>s>>q;
    
    deque<char> deq;
    
    rep(i,s.size())deq.push_back(s[i]);
    int par = 0;
    
    rep(i,q){
        int t; cin>>t;
        
        if(t==1){
            par++;
            continue;
        }
        
        int f; cin>>f;
        char c; cin>>c;
        
        if((f+par)%2)deq.push_front(c);
        else deq.push_back(c);
        
    }
    
    if(par%2){
        while(!deq.empty()){
            cout << deq.back();
            deq.pop_back();
        }
    }else{
        while(!deq.empty()){
            cout << deq.front();
            deq.pop_front();
        }
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 896
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;
 
typedef pair<int, int> paii;
typedef long long ll;

bool cmpr(char l, char r){
	if( abs(l-r) == abs('('-')') )
		return true;
	if( abs(l-r) == abs('{'-'}') )
		return true;
	if( abs(l-r) == abs('['-']') )
		return true;
	if( l==r && l == 'i')
		return true;
	
	return false;
}
	
int main()
{
	string str;
	cin >> str;	

	int n = str.size();
	int w = str.find_first_of('w');
	int dp[20][20];
	
	string str2 = string(str.begin()+w, str.end());
	str = string(str.begin(), str.begin()+w);
	str = string(str.rbegin(), str.rend());
	memset(dp, 0, sizeof(dp));
	
	for(int i = 0; i < str2.size(); i++){
		for(int j = 0; j < str.size(); j++){
			if(cmpr(str2[i], str[j]))
				dp[i+1][j+1] = dp[i][j]+1;
			else
				dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
		}
	}
	
	cout << 2*dp[str2.size()][str.size()]+1 << endl;
	
	return 0;
}

Measured memory_bytes: 1192
n, k = map(int, input().split())
d = {str(x) for x in input().split()}
a = {int(x) for x in range(10)}
l = a - d

for i in range(n,100000+1):
    i2 = str(i)
    for j in range(len(i2))[::-1]:
        if i2[j] in d:
            break
    else:
        print(i2)
        break

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

void print(int A[],int n){
    for(int i=0;i<n;i++){
        if(i==0)cout<<A[i];
        else cout<<' '<<A[i];
    }
    cout<<endl;
    return;
}

void insert_sort(int A[],int n){
    print(A,n);
    for(int j=1;j<n;j++){
        int k=A[j];
        int i=j-1;
        while(i>=0&&A[i]>k){
            A[i+1]=A[i];
            i--;
        }
        A[i+1]=k;
        print(A,n);
    }
    return;
}


int main(){
    int A[100],n;
    cin>>n;
    for(int i=0;i<n;i++)cin>>A[i];
    insert_sort(A,n);
    return 0;
}


Measured memory_bytes: 3116
#include <string>
#include <iostream>
#include <algorithm>


using namespace std;

int main()
{
    
	int N, K;
	string S;
	string smallS;

	cin >> N >> K;

	cin >> S;
	smallS = S;

	std::transform(S.cbegin(), S.cend(), smallS.begin(), ::tolower);

	S[K-1] = smallS[K-1];

	cout << S;

	return 0;

}

Measured memory_bytes: 256
//============================================================================
// Name        : tokuteigai.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int a,b,c,d;
	cin>>a;
	d=a%7;
	if(d==1){
		cout<<"fri"<<endl;
	}
	if(d==2){
		cout<<"sat"<<endl;
	};
	if(d==3){
		cout<<"sun"<<endl;
	}
	if(d==4){
		cout<<"mon"<<endl;
	}
	if(d==5){
		cout<<"tue"<<endl;
	};
	if(d==6){
		cout<<"wed"<<endl;
	}
	if(d==0){
		cout<<"thu"<<endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<string,int>mp;
int main()
{
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int cnt=0;
    int maxx=0;
    string s;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        int p=mp[s]++;
        p++;
        if(p>maxx)
            maxx=p;

    }
    map<string,int>::iterator it;
    for(it= mp.begin();it!=mp.end();it++)
    {
        if(it->second==maxx)
            cout<<it->first<<endl;
    }


}


Measured memory_bytes: 23808
#include <bits/stdc++.h>
#define rep(i, f, n) for (ll i = (f); i < (ll)(n); i++)
#define repe(i, f, n) for (ll i = (f); i <= (ll)(n); i++)
using namespace std;
using ll = long long;
using GraphC = vector<vector<char>>;
using pint = pair<int, int>;

int main() {
  int N, M;
  cin >> N >> M;
  GraphC A(N, vector<char>(N));
  rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
  GraphC B(M, vector<char>(M));
  rep(i, 0, M) rep(j, 0, M) cin >> B[i][j];

  rep(ly, 0, N) {
    rep(lx, 0, N) {
      // 範囲外
      if (ly + M - 1 >= N || lx + M - 1 >= N) continue;

      bool match = true;
      rep(y, 0, M) {
        rep(x, 0, M) {
          if (A[ly + y][lx + x] != B[y][x]) {
            match = false;
            break;
          }
        }
      }
      if (match) {
        cout << "Yes" << endl;
        return 0;
      };
    }
  }

  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>


int main(int argc, char const *argv[])
{
    int a, b;
    std::cin >> a >> b;

    int sum = 1;
    int cnt = 0;


    while (b > sum)
    {
        sum = sum - 1 + a;
        cnt += 1;
    }
    
    std::cout << cnt << std::endl;
    return 0;
}

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

int main(void){
	long   i, j;
	long  n,mini,big;
	scanf("%ld", &n);
	mini = 1, big = n;
	for (i = 1; i <= sqrt(n); i++) {
		if (n % i == 0) {
			mini = i;
			big = n / i;
		}
	}
	//printf("n=%ld\n", n);
	//printf("mini=%ld\nbig=%ld\n", mini, big);
	printf("%ld", mini + big - 2);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    int v[n];
    forn(i, 0, n) {
        cin >> v[i];
    }
    int ans = 0;
    forn(i, 1, n-1) {
        int aux[3] = {v[i-1], v[i], v[i+1]};
        sort(aux, aux+3);
        if (v[i] == aux[1]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], up, n;
long long sum;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) 
		cin >> a[i];
	sort(a, a + n);
	for (int i = 0; i < n; i++) {
		if (up <= i)
			sum += a[i], up++;
		while (up < n && sum * 2 >= a[up])
			sum += a[up], up++;
		if (up == n) {
			cout << n - i;
			break;
		}
	}
	return 0;
}


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

//østrðtÉµÄstrÉãü·éÖ
void reverseString(char *str){
	char *hoge;
	int length;

	hoge = (char *)malloc( sizeof(char) * strlen(str) );
	
	length = strlen(str);
	for(int i=0 ; i<length ; i++){
		hoge[length-i-1] = str[i];
	}
	for(int i=0 ; i<length ; i++){
		str[i] = hoge[i];
	}
	free(hoge);
} 
 
int main(){
	char str[80];

	while (scanf("%s", str) != EOF) {
		reverseString(str);
		printf("%s\n", str);
	}

	return 0;
} 

Measured memory_bytes: 0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] l = new int[2 * n];
            for (int i = 0; i < 2 * n; i++) {
                l[i] = Integer.parseInt(in.next());
            }
            int ans = 0;

            Arrays.sort(l);

            for (int i = 2; i <= 2 * n; i = i + 2) {
                ans += Math.min(l[i - 2], l[i - 1]);
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 21844
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_map = dict()
for i in range(n):
    if a[i] not in num_map:
        num_map[a[i]] = 1
    else:
        num_map[a[i]] += 1

rest_key_num = max(0, len(num_map) - k)
values = sorted(list(num_map.values()))
res = 0
for j in range(rest_key_num):
    res += values[j]
print(res)


Measured memory_bytes: 34644
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAXN 200001
ll a[MAXN];
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    ll ret = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] < a[i - 1]) {
            ret += a[i - 1] - a[i];
            a[i] = a[i - 1];
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 5188
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
const int N=105;
const int inf=1e9;
int c[N],n,m,x,a[N][N];
int b[N],ans=inf;
void dfs(int s,int sum) {
  if(s>n) {
    for (int i=1;i<=m;++i) {
      if(b[i]<x) return ;
    }
    ans=min(ans,sum);
    return ;
  }
  dfs(s+1,sum);
  for (int i=1;i<=m;++i) b[i]+=a[s][i];
  dfs(s+1,sum+c[s]);
  for (int i=1;i<=m;++i) b[i]-=a[s][i];
  return ;
}
int main() {
  scanf("%d%d%d",&n,&m,&x);
  for (int i=1;i<=n;++i) {
    scanf("%d",&c[i]);
    for (int j=1;j<=m;++j) scanf("%d",&a[i][j]);
  }
  dfs(1,0);
  if(ans==inf) ans=-1;
  printf("%d\n",ans);
  return 0;
}


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

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

  int count=10000000;

  for(int i=0; i<N; i++){
    int x;
    cin>>x;
    int z=0;
    while(x%2==0){
      x/=2;
      z++;
    }
    if(count>z)
    count=z;

  }

  cout <<count<<endl;

}


Measured memory_bytes: 3544
H, W = map(int, input().split())
a = []
ans = []
ans2 = []
for i in range(H):
    a.append(input())
for i in range(H):
    if all(x == '.' for x in a[i]):
      continue
    else:
        ans.append(a[i])

ans = list(map(list, zip(*ans)))

for i in range(W):
    if all(x == '.' for x in ans[i]):
      continue
    else:
        ans2.append(ans[i])
        
ans2 = list(map(list, zip(*ans2)))    

for i in range(len(ans2)):
    for j in range(1, len(ans2[0])):
        ans2[i][0] += ans2[i][j]
    print(ans2[i][0])

Measured memory_bytes: 3188