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

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int h = fs.nextInt();
		int w = fs.nextInt();
		
		String[][] matrix = new String[h][];
		
		for(int i = 0; i < h; i++) {
			matrix[i] = fs.next().split("");
		}
		
		
		for(int i = 0 ; i < h; i++) {
			for(int j = 0; j < w; j++) {
				
				String strAt = matrix[i][j];
				if(strAt.equals("#")) {
					boolean canPaint = false;
					
					if(i < h-1 && matrix[i+1][j].equals("#")) {
						canPaint = true;
					}
					
					if(i > 0 && matrix[i-1][j].equals("#")) {
						canPaint = true;
					}
					
					if(j < w-1 && matrix[i][j+1].equals("#")) {
						canPaint = true;
					}
					
					if(j > 0 && matrix[i][j-1].equals("#")) {
						canPaint = true;
					}
					
					if(!canPaint) {
						System.out.println("No");
						return;
					}
				}
			}
		}
		
		System.out.println("Yes");
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 33548
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second


int main() {
	string s;
	cin >> s;
	ll siz = s.size(), cnt[30] = { 0 }, ans = (siz - 1)*siz / 2;
	for (int i = 0;i < siz;i++) {
		cnt[s[i] - 'a']++;
	}
	for (int i = 0;i < 26;i++) {
		ans -= (cnt[i] - 1)*cnt[i] / 2;
	}
	cout << ans+1 << endl;
	return 0;
}

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

signed main(){
  Int n,l,r;
  while(cin>>n>>l>>r,n||l||r){
    vector<Int> a(n);
    for(Int i=0;i<n;i++) cin>>a[i];
    auto is_uruu=[&](Int x)->Int{
      for(Int i=0;i<n;i++){
	if(x%a[i]==0) return (i%2==0);
      }
      return (n%2==0);
    };
    Int ans=0;
    for(Int i=l;i<=r;i++) ans+=is_uruu(i);
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	int n;
	cin >> n;
	
	vector<int> b (n,0);
	
	for (int i = 0; i < n-1; i++){
		cin >> b.at(i);
	}
	
	b.at(n-1) = b.at(n-2);
	
	long ans = 0;
	
	ans += b.at(0);
	
	for (int i = 0;i < n-1;i++) {
		ans += min(b.at(i),b.at(i+1));
	}
	
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
///HELLO THERE~!
///CREATED BY MD SADMAN MEHEDI SIVAN [IUT CSE(SWE)-19]
 
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
using namespace std;
 
#define fastio          ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define read            freopen("blue.txt","r",stdin);
#define write           freopen("red.txt","w",stdout);
#define nl              '\n'
#define sq(a)           ((a) * (a))
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<long long,long long>>
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define SORT(v)         sort(v.begin(),v.end())
#define rsort(v)        sort(v.rbegin(), v.rend())
#define rev(v)          reverse(v.begin(),v.end())
#define mem(a)          memset(a,-1,sizeof a)
#define clr(a)          memset(a,0,sizeof a)
#define GCD(a,b)        __gcd(a,b)
#define LCM(a,b)        (a / __gcd(a,b) ) *b
#define precision(a)    fixed << setprecision(a)
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define DEBUG(x) cerr << #x << " = " << x << endl
 
using ll=long long;
using ull=unsigned long long;
 
const double pi = 2*acos(0.0);
 
int  main()
{
 
    fastio;
 
    int a,b;
    cin>>a>>b;
    cout<<a*b;
        

    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int[] data = { a, b, c };
		Arrays.sort(data);
		System.out.println(data[0] + " " + data[1] + " " + data[2]);
	}
}


Measured memory_bytes: 26264
import itertools
import numpy as np
h, w, k = list(map(int, input().split()))
a = np.zeros((h, w))
c = 0
for i in range(h):
    s = input()
    for j in range(w):
        if s[j] ==  '#':
            a[i, j] = 1
for i in itertools.product([0, 1], repeat = h):
    for j in itertools.product([0, 1], repeat = w):
        if sum(sum((a.T * i).T * j)) == k:
            c += 1
print(c)

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

int main(){
  string s;
  cin >> s;
  int n = s.size();
  bool ok = true;
  for(int i=0; i<n; ++i){
    if(i%2 == 0 && s[i] == 'L') ok = false;
    else if(i%2 == 1 && s[i] == 'R') ok = false;
  }
  cout << (ok ? "Yes":"No") << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
const int maxn = 300 + 10;
int dp[maxn][maxn][maxn];
char s[maxn];
int n, k, ans;
int f(int i, int j, int k)
{
	if(i == 0 || j == n + 1) return 0;
	if(~dp[i][j][k]) return dp[i][j][k];
	int ret = max(f(i - 1, j, k), f(i, j + 1, k));
	if(s[i] == s[j]) ret = max(ret, f(i - 1, j + 1, k) + 1);
	else if(k > 0) ret = max(ret, f(i - 1, j + 1, k - 1) + 1);
	return dp[i][j][k] = ret;
}
int main()
{
	memset(dp, -1, sizeof dp);
	scanf("%s", s + 1);
	scanf("%d", &k);
	n = strlen(s + 1);
	for(int i = 1; i < n; ++i) ans = max(ans, f(i, i + 1, k) * 2);
	for(int i = 1; i <= n; ++i) ans = max(ans, f(i - 1, i + 1, k) * 2 + 1);
	printf("%d\n", ans);
	return 0;
}
	

Measured memory_bytes: 116608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _166B
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] NK = Console.ReadLine().Split(' ').Select(tmp => long.Parse(tmp)).ToArray();
           
            var I = new List<long>();
            var I_dum = new List<long>();
            long temp = 0;
            long[] vals = new long[NK[0]];
                       
            for (var i = 0; i < NK[0]; i++) {
                I.Add(i+1);
            }
                          
            for (var k = 0; k < NK[1]; k++)
            {
                temp = long.Parse(Console.ReadLine());
                vals = Console.ReadLine().Split(' ').Select(tmp => long.Parse(tmp)).ToArray();

                foreach (var i in I)
                {
                    if (vals.Contains(i)) 
                    {
                        I_dum.Add(i);
                    }
                    
                }
                foreach (var dum in I_dum)
                {
                    I.Remove(dum);
                }
                I_dum.Clear();
            }

            Console.WriteLine(I.Count());
        }
    }
}


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

int main() {
  double n,m;
  cin>>n>>m;
  vector<double> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
    sort(vec.begin(), vec.end()); 
    reverse(vec.begin(), vec.end());
  
  int all=0;
  for(int j=0;j<n;j++){
    all+=vec.at(j);
  }
  double b=1/(4*m);
  bool t=true;
  
  for(int k=0;k<m;k++){
    if(vec.at(k)/all<b){
      t=false;
    }
  }
  if(t){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
 
    
    
    
  
}
  



Measured memory_bytes: 256
import numpy as np
from numba import njit
u4 = np.uint32

@njit
def get_factorization(n):
    sieve_size = (n - 1) // 2
    sieve = np.ones(sieve_size, u4)
    for i in range(sieve_size):
        if sieve[i] == 1:
            value_at_i = i*2 + 3
            for j in range(i, sieve_size, value_at_i):
                value_at_j = j * 2 + 3
                p = 1
                while value_at_j % value_at_i == 0:
                    value_at_j //= value_at_i
                    p += 1
                sieve[j] *= p
    return sieve


@njit('(u4,)', cache=True)
def solve(N):
    sieve = get_factorization(N)
    ans = 0
    for j in range(1, N):
        a = j
        p2 = 1
        while a % 2 == 0:
            p2 += 1
            a //= 2
        if a > 1:
            s_a = (a - 3) // 2
            ans += p2 * sieve[s_a]
        else:
            ans += p2
    return ans


def main():
    N = int(input())
    ans = solve(N)
    print(ans)

main()

Measured memory_bytes: 108220
x = int(input())

if 400 <= x and x <= 599:
    ans = 8
if 600 <= x and x <= 799:
    ans = 7
if 800 <= x and x <= 999:
    ans = 6
if 1000 <= x and x <= 1199:
    ans = 5
if 1200 <= x and x <= 1399:
    ans = 4
if 1400 <= x and x <= 1599:
    ans = 3
if 1600 <= x and x <= 1799:
    ans = 2
if 1800 <= x and x <= 1999:
    ans = 1

print(ans)


Measured memory_bytes: 9136
#include<stdio.h>

int main()
{
	int a[10],n;
	while(scanf("%d",&n)!=EOF)
	{
		a[3]=n%10;
		n/=10;
		a[2]=n%10;
		n/=10;
		a[1]=n%10;
		n/=10;
		a[0]=n%10;
		int plus[10][10]={{1,1,1},{1,1,-1},{1,-1,1},{1,-1,-1},{-1,1,1},{-1,1,-1},{-1,-1,1},{-1,-1,-1}};
	int i=0;
	for(i=0;i<8;i++)
	{
		if(a[0]+plus[i][0]*a[1]+plus[i][1]*a[2]+plus[i][2]*a[3]==7)
		break;
	}
	int j;
	for(j=0;j<3;j++)
	{
		if(plus[i][j]==1)plus[i][j]=0;
		else plus[i][j]=1;
	}
	char x[2]={'+','-'};
	printf("%d%c%d%c%d%c%d=7\n",a[0],x[plus[i][0]],a[1],x[plus[i][1]],a[2],x[plus[i][2]],a[3]);
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
        PriorityQueue<Integer> prices = new PriorityQueue(Collections.reverseOrder());
        for (int i = 0; i < n; i++) {
          prices.add(Integer.parseInt(sc.next()));
        }
        for (int i = 0 ; i < m; i++) {
          int maxValue = (int)prices.poll();
          prices.add(maxValue / 2);
        }
        long ans = 0;
        for (int i = 0; i < n; i++) {
          ans += (int)prices.poll();
        }
        
		// 出力
		System.out.println(ans);
	}
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		int N=in();
		if(!N) break;
		
		vector<vector<int>> S(N+1,vector<int>(N+1,0));
		REP(i,N){
			string T=in<string>();
			REP(j,N){
				if(T[j]=='*') S[i+1][j+1] = 1; 
			}
		}
		REP(i,N+1){
			REP(j,N){
				S[i][j+1] += S[i][j]; 
			}
		}
		REP(j,N+1){
			REP(i,N){
				S[i+1][j] += S[i][j]; 
			}
		}
		int left=0,right=N;
		while(right-left>0){
			int mid = (right+left)/2+1;
			bool exist = false;
			for(int i=0;i<N-mid+1;i++){
				for(int j=0;j<N-mid+1;j++){
					if(S[i][j]+S[i+mid][j+mid]-S[i+mid][j]-S[i][j+mid]==0){
						exist = true;
						break;
					}
				}
			}
			if(exist){
				left = mid;
			}
			else{
				right = mid-1;
			}
		}
		out(left);
	}

	return 0;
}


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

int main(){
  int A, B, count=0;
  cin >> A >> B;  
  for(int i=A; i<=B; i++) if(i/10000 == i%10 && i/1000%10 == i/10%10) count++;
  cout << count;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scanln(&a, &b)
	var c string
	switch {
	case a > b:
		c = ">"
	case a < b:
		c = "<"
	default:
		c = "=="
	}
	fmt.Println("a", c, "b")
	return
}



Measured memory_bytes: 1120
#include<stdio.h>
int main(){
  char d[3][60];
  char c;
  int u,l,r;
  while(scanf("%s",d[0])){
    if(d[0][0]=='-')break;
    scanf("%s %s",d[1],d[2]);
    c=d[1][0];
    r=u=0;
    l=1;
    while(d[2][r]){
      if(c==d[2][r]){
	c=d[0][u++];
	r++;
      }
      else{
	printf("%c",c);
	c=d[1][l++];
      }
    }
    printf("%c%s\n",c,d[1]+l);
  }
  return 0;
}
    

Measured memory_bytes: 540
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  var n = input[0];
  var n= parseInt(input[0], 10);
  var a = [];
for (var i = 0; i < n; i++) {
  var r= parseInt(input[i+1], 10); 
  a[i] = r;
} 
  var b = a.concat();
  
   a.sort(function(a,b){
     return b - a; });
  var c1 = a[0];
  var c2 = a[1];
   for (var i = 0; i < n; i++) {
     if( c1 > b[i] ){console.log(c1);}
       else if( c1 = b[i] ){console.log(c2);}
   }

  
  
   }
     
 //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));    


Measured memory_bytes: 39220
use proconio::*;

fn main() {
    input! {
        x: i32,
        y: i32,
    }

    for i in 0..x+1 {
        if y == i * 2 + 4 * (x - i) {
            println!("Yes");
            return;
        }
    }

    println!("No");
}

Measured memory_bytes: 2144
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] S = sc.next().toCharArray();
		int x = 0;
		int max = 0;
		for (int c : S) {
			if (c == 'I') {
				x++;
			} else if (c == 'D') {
				x--;
			}
			max = Math.max(max, x);
		}

		System.out.println(max);
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}


Measured memory_bytes: 8148
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ppp pair<pii,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define CL(x) memset(x,0,sizeof(x))
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x.size())
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
#define DI(x) (int)(x-'0')
#define LL_MAX (1LL<<60)
#define DB 0
#define DBG(x) if(DB)cout << #x << " : " << x << '\n'
#define PRALL(v) if(DB)for(auto it : v)cout<<v<<' '; NL;
#define NL cout<<'\n';
#define FND(S,x) (S.find(x)!=S.end())
#define bit(x,y) (!!(x&(1<<y)))
typedef long long ll;
typedef long double ld;

int X, N;
bool has[105];

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

    cin>>X>>N;
    int Ai;
    FOR(i,1,N)
    {
        cin>>Ai;
        has[Ai] = 1;
    }

    int d = 0;
    while(1)
    {
        if( !has[X-d] )
        {
            cout<<X-d<<'\n';
            return 0;
        }
        if( !has[X+d] )
        {
            cout<<X+d<<'\n';
            return 0;
        }
        d++;
    }

    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b;
    cin >> a >> b;
    string s = a+b;
    ll N = atol(s.c_str());
    rep(i,1,1000){
        if(N == i*i){
            print("Yes");
            return 0;
        }
    }
    print("No");

}

Measured memory_bytes: 256
from collections import deque
import copy

def main():
    h, w = map(int, input().split())
    a = [[j == "#" for j in input()] for _ in range(h)]


    # スタート地点をqueueに追加
    que = deque([(i, j) for i in range(h) for j in range(w) if a[i][j]])

    count = 0
    while True:
        count += 1
        nque = deque()
        while que:
            y, x = que.popleft()
            if x > 0 and not a[y][x-1]:
                a[y][x-1] = True
                nque.append((y,x-1))
            if x < w-1 and not a[y][x+1]:
                a[y][x+1] = True
                nque.append((y,x+1))
            if y > 0 and not a[y-1][x]:
                a[y-1][x] = True
                nque.append((y-1,x))
            if y < h-1 and not a[y+1][x]:
                a[y+1][x] = True
                nque.append((y+1,x))

        if nque:
            que = copy.copy(nque)
        else:
            break

    print(count - 1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 115568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;  
  cin >> n >> k ;

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

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

int main()
{
    int N, D, A;
    cin >> N >> D >> A;
    vector<pint> XH(N);
    rep(i,N) {
        cin >> XH[i].first >> XH[i].second;
    }
    ssort(XH);
    ll ans  = 0;
    queue<pll> que;
    ll accum = 0;
    rep(i,N) {
        int x = XH[i].first;
        int h = XH[i].second;
        while (!que.empty() && que.front().first < x) {
            accum -= que.front().second;
            que.pop();
        }
        h -= accum;
        if (h > 0) {
            int num = (h-1)/A + 1;
            h -= num*A;
            accum += num*A;
            que.emplace(x+2*D,num*A);
            ans += num;
        }
    }
    cout << ans << "\n";
    return 0;
}


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

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

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

    int t = sqrt(a);
    for (int j=2; j<=t; j++) {
      if (a % j == 0) {
        cnt++;
        break;
      }
    }
  }

  cout << n - cnt << endl;

  return 0;
}



Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;
long long dp[200000];
int main(void){
	
    int N;cin>>N;
	  
	for(int i=0;i<200000;i++)dp[i]=INF;
	long long h[N];
    for(int i=0;i<N;i++)cin>>h[i];
    dp[0]=0;
    for(int i=1;i<N;i++){
        chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        if(i>1){
        	chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
        }
    }
    cout<<dp[N-1]<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    vector<pair<pair<int, int>, int>> s, t;
    for (int i = 0; i < N; i++) {
        int x, y, h;
        cin >> x >> y >> h;
        if (h) {
            s.push_back(make_pair(make_pair(x, y), h));
        }
        else {
            t.push_back(make_pair(make_pair(x, y), h));
        }
    }
    for (int CX = 0; CX <= 100; CX++) {
        for (int CY = 0; CY <= 100; CY++) {
            bool flag = true;
            int H = 0;
            for (auto x: s) {
                int HH = x.second + abs(x.first.first - CX) + abs(x.first.second - CY);
                if (H && H != HH) {
                    flag = false;
                    break;
                }
                else {
                    H = HH;
                }
            }
            if (!flag) continue;
            for (auto x: t) {
                if (H - abs(x.first.first - CX) - abs(x.first.second - CY) > 0) {
                    flag = false;
                    break;
                }
            }
            if (!flag) continue;
            printf("%d %d %d\n", CX, CY, H);
        }
    }
}

Measured memory_bytes: 256
#include<set>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int g,h,i,j;
  int a[4][13],b[9],n,f,s,l,m,t;
  char p[14]={"A23456789TJQK"},q[5]={"SCHD"};
  pair<int,int> c[5];
  g=0;
  while(cin>>n){
    if(g)
      cout<<endl;
    else
      g=1;
    for(i=0;i<4;i++)
      for(j=0;j<13;j++)
	cin>>a[i][j];
    for(i=0;i<9;i++)
      cin>>b[i];
    for(h=0;h<n;h++){
      for(i=0;i<5;i++){
	char s,t;
	cin>>s>>t;
	for(j=0;j<13;j++){
	  if(p[j]==s)
	    c[i].first=j;
	}
	for(j=0;j<4;j++){
	  if(q[j]==t)
	    c[i].second=j;
	}
      }
      sort(&c[0],&c[5]);
      f=s=l=m=1;
      for(i=1;i<5;i++){
	if(c[i-1].second!=c[i].second)
	  f=0;
	if(c[i-1].first+1!=c[i].first)
	  s=0;
      }
      if(c[0].first==0&&c[1].first==9&&c[2].first==10&&c[3].first==11&&c[4].first==12)
	s=2;
      for(i=0;i<5;i=j){
	for(j=i;j<5&&c[i].first==c[j].first;j++);
	if(m<j-i){
	  l=m;
	  m=j-i;
	}else if(l<j-i){
	  l=j-i;
	}
      }
      t=0;
      for(i=0;i<5;i++)
	t+=a[c[i].second][c[i].first];
      if(0){
      }else if(s==2&&f==1){
	t*=b[8];
      }else if(s==1&&f==1){
	t*=b[7];
      }else if(m==4){
	t*=b[6];
      }else if(m==3&&l==2){
	t*=b[5];
      }else if(f==1){
	t*=b[4];
      }else if(s!=0){
	t*=b[3];
      }else if(m==3){
	t*=b[2];
      }else if(m==2&&l==2){
	t*=b[1];
      }else if(m==2){
	t*=b[0];
      }else{
	t=0;
      }
      cout<<t<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
    #include <algorithm>
    using namespace std;
    int main() {
    	long long N, A, B, C, D, E;
    	cin >> N >> A >> B >> C >> D >> E;
    	cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E })  + 5 << endl;
    	return 0;
    }

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // exit()
#include <stdbool.h>

#define MAX_V 100
#define INF -1
#define QUE_SIZE 100

bool g[MAX_V][MAX_V];
int d[MAX_V];
int V;

int queue[QUE_SIZE];
int que_in;
int que_out;

void
cleanup(int ecode)
{
	exit(ecode);
}

int
que_size()
{
	if (que_in >= que_out)
		return que_in - que_out;

	return que_in + QUE_SIZE - que_out;
}

void
que_push(int x)
{
	queue[que_in] = x;
	que_in = (que_in + 1) % QUE_SIZE;
	if (que_in == que_out)
	{
		fprintf(stderr, "Queue overflow. size:%d\n", QUE_SIZE);
		cleanup(1);
	}
}

void
que_pop()
{
	if (que_out == que_in)
	{
		fprintf(stderr, "Queue underflow\n");
		cleanup(1);
	}

	que_out = (que_out + 1) % QUE_SIZE;
}

int
que_front()
{
	return queue[que_out];
}

void
solve()
{
	int u, v;

	for (u = 0; u < V; ++u)
		d[u] = INF;

	d[0] = 0;
	que_push(0);	
	while (que_size() >= 1)
	{
		u = que_front(); que_pop();
		for (v = 0; v < V; ++v)
		{
			if (g[u][v] && d[v] == INF)
			{
				d[v] = d[u] + 1;
				que_push(v);
			}
		}
	}

	for (u = 0; u < V; ++u)
		printf("%d %d\n", u + 1, d[u]);
}

int
main(int argc, char** argv)
{
	int u, v;
	int k;
	int i, j;

	que_in = 0;
	que_out = 0;

	scanf("%d", &V);
	for (i = 0; i < V; ++i)
	{
		scanf("%d", &u);
		for (v = 1; v <= V; ++v)
			g[u - 1][v - 1] = false;

		scanf("%d", &k);
		for (j = 0; j < k; ++j)
		{
			scanf("%d", &v);
			g[u - 1][v - 1] = true;
		}
	}

	solve();
	return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>
#include <cstdio>

int main() {
	long long n;

	std::cin >> n;

	std::map<std::string, long long> m;

	for (long long i = 0; i < n; i++)
	{
		std::string s;

		std::cin >> s;

		m[s]++;
	}
	
	std::cout << m.size() << std::endl;

	return 0;
}

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

const ll mod = 1000000007;
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M) % M;
}

int main() {
    ll N, K; cin >> N >> K;
    ll R = N - K;
    for (int i = 1; i <= K; i++){
        ll ans = 1;
        ll rb = i-1;
        ll rn = R-i+1;
        if(rb > R){
            cout << 0 << endl;
            continue;
        }
        
        ll k = K-1;
        for (int j = 1; j <= rb; j++){
            ans *= k;
            ans %= mod;
            k--;
        }
        for (int j = rb; j > 1; j--){
            ans *= RepeatSquaring(j, mod-2, mod);
            ans %= mod;
        }

        ll l = R+1;
        for (int j = 1; j <= i; j++){
            ans *= l;
            ans %= mod;
            l--;
        }
        for (int j = i; j > 1; j--){
            ans *= RepeatSquaring(j, mod-2, mod);
            ans %= mod;
        }

        cout << ans << endl;



    }

    return 0;
}

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


using namespace std;

#define endl '\n'
#define PB push_back
#define MP make_pair
#define LL long long
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

typedef long long ll;

bool file=0,rt=1;
clock_t tStart ;
void FAST_IO();
////////////////////////
int b[21], a[21];
int main() {

    //FAST_IO();
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout << setprecision(5);
    cout << fixed;

    int n, m, c;

    cin >> n >> m >> c;



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

        cin >> b[i];
    }

    int j = 0;
    ll sum = 0;
    int ans = 0;
    while(j < n) {


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

            cin >> a[i];
        }

        sum = 0;
        for(int i = 0; i < m; i++) {


            sum += b[i] * a[i];
        }

        sum += c;


        if(sum > 0) {

            ans++;
        }
        j++;
    }

    cout << ans << endl;


    return 0;
}

void FAST_IO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    //cout.tie(NULL);
    //cout.setf(ios::fixed);
    //cout.precision(2);
    if(rt && file){ tStart = clock(); }
    if(file){
    #ifndef _offline
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    }
}



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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		char[] n = stdIn.next().toCharArray();
		
		
		if(n[n.length-1]=='2' || n[n.length-1]=='4'|| n[n.length-1]=='5' || n[n.length-1]=='7' || n[n.length-1]=='9') {
			System.out.println("hon");
		}else if(n[n.length-1]=='0'||n[n.length-1]=='1'||n[n.length-1]=='6'||n[n.length-1]=='8') {
			System.out.println("pon");
		}else {
			System.out.println("bon");
		}
		
		
		
		
	}

}


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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> ans(N);
  int a,b;
  for(int i = 0; i < M; ++i){
    cin >> a >> b;
    for(int j = 1; j <= N; ++j){
      if(j == a) ans.at(j - 1)++;
      if(j == b) ans.at(j - 1)++;
    }
  }
  for(int i = 0; i < N; ++i){
    cout << ans.at(i) << endl;
  }
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> d = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			d.add(stdIn.nextInt());
		}
		
		Collections.sort(d);
		Collections.reverse(d);
		
		int ans = 1;
		int base = d.get(0);
		
		for(int i = 1; i < d.size(); i ++) {
			if(d.get(i) < base) {
				base = d.get(i);
				ans ++;
			}else if(d.get(i) == base){
				// Do nothing
			}else {
				break;
			}
		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 21972
import sys
n,y=map(int,input().split())
for i in range(0,n+1):
    for j in range(0,n+1):
        if 10000*i+5000*j+1000*(n-i-j)==y and n-i-j>=0 :
                print(i,j,n-i-j)
                sys.exit()
else:
    print('-1 -1 -1')

Measured memory_bytes: 3060
a=gets.chomp
s=[]
for i in 3..a.size
  [3,5,7].repeated_permutation(i).to_a.each{|j|
    s << j.join.to_i if j.uniq.size==3
  }
end
s.sort!
puts s.bsearch_index{|x| x>a.to_i} || s.size


Measured memory_bytes: 19848
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f

using namespace std;

const int N = 302;

double dp[N][N][N];

int n;


double solve(int a, int b, int c) {
    if(a == 0 && b == 0 && c == 0) return 0.0;
    if(dp[a][b][c] > -0.5) return dp[a][b][c];
    double ans = 0.0;
    double kt = (double) n / (a + b + c);
    if(a > 0) ans += (solve(a - 1, b, c) + kt) * ((double) a / (a + b + c));
    if(b > 0) ans += (solve(a + 1, b - 1, c) + kt) * ((double) b / (a + b + c));
    if(c > 0) ans += (solve(a, b + 1, c - 1) + kt) * ((double) c / (a + b + c));
    return dp[a][b][c] = ans;
}



int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int counter[4] = {0};
    for(int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        ++counter[x];
    }
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            for(int k = 0; k < N; ++k) {
                dp[i][j][k] = -1.0;
            }
        }
    }
    printf("%.12lf\n", solve(counter[1], counter[2], counter[3]));
    return 0;
}



Measured memory_bytes: 215552
import sys
import copy
import math
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial

from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)


stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

mod = 10 ** 9 + 7
n = ni()
st, sa = 1, 1
for i in range(n):
    t, a = na()
    k = max((st - 1) // t, (sa - 1) // a) + 1
    st = t * k
    sa = a * k
print(st + sa)


Measured memory_bytes: 5264
#include <cstdio>

int main()
{
    int n, m, d, p, r[11];
    
    while(true)
    {
        scanf("%d", &n);
        scanf("%d", &m);
        
        if(n == 0 && m == 0) { break; }
        
        for(int i = 0; i < 11; i++)
        {
            r[i] = 0;
        }
        
        for(int i = 0; i < n; i++)
        {
            scanf("%d", &d);
            scanf("%d", &p);
            
            r[p] += d;
        }
        
        for(int i = 10; i >= 0; i--)
        {
            if(m >= r[i])
            {
                m -= r[i];
                
                r[i] = 0;
            }
            else
            {
                r[i] -= m;
                
                break;
            }
        }
        
        int sum = 0;
        
        for(int i = 0; i <= 10; i++)
        {
            sum += i * r[i];
        }
        
        printf("%d\n", sum);
    }
    
    return 0;
}

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


int main()
{

//道具
    int x,a,b, ans = 0;

//入力

    cin >> x;

//計算
    a = x / 500;

    b =( x - 500 * a )/ 5;


    ans = 1000 * a + 5*b;


//出力

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        
        if(A<B&&A<C&&C<B||A>B&&A>C&&C>B){
            System.out.println("Yes");
            
        }else{
            System.out.println("No");
        }
        
    }
}


Measured memory_bytes: 35752
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq as hq
import itertools as its
import operator as op


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    n = get_int()
    ga, sa, ba = get_li()
    gb, sb, bb = get_li()
    dp1 = [0] * (n + 1)
    dp1[0] = n
    for i in range(1, n + 1):
        _max = dp1[i-1]
        if i - ga >= 0:
            _max = max(_max, dp1[i-ga] + gb - ga)
        if i - sa >= 0:
            _max = max(_max, dp1[i-sa] + sb - sa)
        if i - ba >= 0:
            _max = max(_max, dp1[i-ba] + bb - ba)
        dp1[i] = _max
    n = dp1[n]
    dp2 = [0] * (n + 1)
    dp2[0] = n
    for i in range(1, n + 1):
        _max = dp2[i-1]
        if i - gb >= 0:
            _max = max(_max, dp2[i-gb] + ga - gb)
        if i - sb >= 0:
            _max = max(_max, dp2[i-sb] + sa - sb)
        if i - bb >= 0:
            _max = max(_max, dp2[i-bb] + ba - bb)
        dp2[i] = _max
    print(dp2[n])
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()


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

point_t = 0
point_h = 0
for i in range(N):
    t, h = input().split()
    if t > h:
        point_t += 3
    elif t < h:
        point_h += 3
    else:
        point_t += 1
        point_h += 1  

print(point_t, point_h)


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
char s[110];
int main()
{
    int n,maxn=0,sum=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=='I')
        {
            sum++;
        }
        else
        {
            sum--;
        }
        if(sum>=maxn)
        {
            maxn=sum;
        }
    }
    cout<<maxn<<endl;
    return 0;
}

Measured memory_bytes: 256
N = input()
A = list(map(int, input().split()))
newA = sorted(A,reverse=True)
num = 1
if 0 in A:
  num = 0
else:
  for i in newA:
    if num > 1000000000000000000:
      break
    num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Measured memory_bytes: 89340
package main

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

const pi = math.Pi

func solve() {
	a, b, x := getFloat(), getFloat(), getFloat()
	m := b - (x / (a * a))

	ans := 0.0
	if 2*m <= b {
		ans = math.Atan(2*m/a) * 180 / pi
	} else {
		p := 2 * x / a / b
		ans = math.Atan(b/p) * 180 / pi
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getFloat() float64 {
	f, err := strconv.ParseFloat(getString(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    int sl=s.length();
    for(int i=1; i<sl; i++) {
        int j=i;
        while(j>=1 && s[j-1]>s[j]) {
            char tmp = s[j];
            s[j] = s[j-1];
            s[j-1] = tmp;
            j--;
        }
    }

    int tl=t.length();
    for(int i=1; i<tl; i++) {
        int j=i;
        while(j>=1 && t[j-1]<t[j]) {
            char tmp = t[j];
            t[j] = t[j-1];
            t[j-1] = tmp;
            j--;
        }
    }

    if(s<t) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]

[n,k]=i2()

if k>(n-1)*(n-2)/2:
 print(-1)
else:
 c=(n-1)*(n-2)//2-k
 print(n-1+c)
 for i in range(n-1):
  print(1,i+2)
 
 for i in range(2,n+1):
  if c<=0:
     break
  for j in range(2,n+1):
    if i<j and c>0:
      print(i,j)
      c-=1
    if c<=0:
       break

Measured memory_bytes: 42988
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  int a;
  int ans=1,count=0;
  cin>>n>>x;
  for(int i=0;i<n;i++){
    cin>>a;
    count+=a;
    if(count<=x){
      ans++;
    }
  }
  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;
using ll = long long;
using pii = pair<int,int>;
ll MOD=1000000007;
const double PI = acos(-1);

int main(){
  double a,b,h,m; cin>>a>>b>>h>>m;
  double thetaH = double(h*30+(m/2));
  double thetaM = double(6*m);
  double rad = PI * abs(thetaH-thetaM) / (double)180;
  double ans = double(sqrt(a*a + b*b - 2.0*a*b*cos(rad)));
  cout << setprecision(10) << ans << endl;
}

Measured memory_bytes: 4188
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
const int N = 10000;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int k, x;
	cin >> k >> x;
	if (k * 500 >= x) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}


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

const int INF = ~(1 << 31);

class Edge{
public:
	int source, dist, cost;
	Edge() : source(-1), dist(-1), cost(INF) {}
};

int main(){
	int v, e, r, s, t, d;
	vector< int > min_cost;
	vector< Edge > edge;
	bool negative = false;
	
	cin >> v >> e >> r;
	edge.resize(e);
	min_cost.resize(v);
	
	for(int i = 0; i < v; ++i){
		min_cost[i] = INF;
	}
	
	for(int i = 0; i < e; ++i){
		cin >> s >> t >> d;
		edge[i].source = s;
		edge[i].dist = t;
		edge[i].cost = d;
	}
	
	min_cost[r] = 0;
	
	for(int i = 0; i < v; ++i){
		for(int k = 0; k < e; ++k){
			int source = edge[k].source;
			int dist = edge[k].dist;
			int cost = min_cost[source] + edge[k].cost;
			if(min_cost[source] != INF && min_cost[dist] > cost){
				min_cost[dist] = cost;
			}
		}
	}
	
	for(int k = 0; k < e; ++k){
		if(min_cost[edge[k].source] != INF && min_cost[edge[k].source] + edge[k].cost < min_cost[edge[k].dist]){
			negative = true;
			break;
		}
	}
	
	if(negative){
		cout << "NEGATIVE CYCLE" << endl;
	}else{
		for(int i = 0; i < v; ++i){
			if(min_cost[i] == INF) cout << "INF" << endl;
			else cout << min_cost[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1224
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  if((b-a)%2==0){
    cout << "Alice" << endl;
  }else{
    cout << "Borys" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {
  public static int MOD = 1_000_000_007;

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt(), X = in.nextInt();
    int[] L = new int[N];
    for (int i = 0; i < N; i++) {
      L[i] = in.nextInt();
    }
    int ans = 1, pos = 0;
    for (int i = 0; i < N; i++) {
      pos += L[i];
      if (X < pos) {
        break;
      }
      ans++;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 23252