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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int A,B;
    cin >> A >> B;
    if(abs(A-B)%2==1){
        P("IMPOSSIBLE");
    }else if(A-B>0){
        P(B+abs(A-B)/2);
    }else{
        P(A+abs(A-B)/2);
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



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

	for (int i = 1; i < 4; i++) {
		if (s[i] == s[i - 1]) {
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
	return 0;
}


Measured memory_bytes: 3624
x, n = map(int, input().split())
p = list(map(int, input().split()))
r = 10**9 + 7

primeset = list(range(-1, 2*x))
trial = list(range(-1, 2*x))
for i in range(len(trial)):
    if trial[i] in p:
        trial[i] = r
    else:
        trial[i] = abs(x - trial[i])

ans = r + 100
trynow = r
for i in range(len(trial)):
    if trial[i] < trynow:
        trynow = trial[i]
        ans = primeset[i]

print(ans)


Measured memory_bytes: 9208
#include<stdio.h>
int main(void){
    int m,f,b;
    scanf("%d %d %d",&m,&f,&b);
    if(m>=b){
        printf("0\n");
    }else if(m+f>=b){
        printf("%d\n",b-m);
    }else{
        printf("NA\n");
    }
    return 0;
}


Measured memory_bytes: 2148
#include<bits/stdc++.h>
        #define ll long long
        #define rep(i,a,b) for(i=a;i<b;i++)
        #define pb push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define hell 1000000007
        using namespace std;

        void solve()
        {
         int i,j,k,n,m;
         int x,y;
         cin>>x>>y;
         for(i=0;i<1000;i++)
         {
             if((y-2*i)>=0 and (y-2*i)%4==0 and i+(y-2*i)/4==x)
             {
                 cout<<"Yes"; return;
             }
         }cout<<"No";
    }

        int main()
        {
            ios::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            int t=1;
           // cin>>t;
            while(t--)
            solve();
        }


Measured memory_bytes: 3648
#include"iostream"
#include"stdio.h"
#include"vector"
#include"stdlib.h"

using namespace std;

class branch
{
private:
public:
  int id;
  int p;
  int depth;
  vector<int> c;
  branch()
  {
  }
  void print()
  {
    cout<<"node "<<id<<": parent = "<<p<<", depth = "<<depth<<", ";
    if(p==-1)
      {
        cout<<"root, [";
      }
    else if(!c.size())
      {
        cout<<"leaf, [";
      }
    else
      {
        cout<<"internal node, [";
      }
    if(0<c.size())
      {
        cout<<c[0];
        for(int i=1;i<c.size();i++)
          {
            cout<<", "<<c[i];
          }
      }
    cout<<"]"<<endl;
  }
};
vector<branch> tree;
int countDepth(int id)
{
  if(tree[id].p!=-1)return 1+countDepth(tree[id].p);
  return 0;
}

int main()
{
  branch buf;
  int n;
  cin>>n;
  buf.p=-1;
  for(int i=0;i<n;i++)
    {
      tree.push_back(buf);
    }
  for(int i=0;i<n;i++)
    {
      int id;
      int k;
      cin>>id;
      tree[id].id=id;
      cin>>k;
      for(int j=0;j<k;j++)
        {
          int c;
          cin>>c;
          tree[id].c.push_back(c);
          tree[c].p=id;
        }
    }
  for(int i=0;i<tree.size();i++)
    {
      tree[i].depth=countDepth(tree[i].id);
      tree[i].print();
    }
  return 0;
}


Measured memory_bytes: 7964
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        sc.close();
        if(a >= 30){
          System.out.println("Yes");
        }else{
          System.out.println("No");
        }
    }
}

Measured memory_bytes: 27084
n, m, k =map(int, input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
ta=sum(a)
a.append(0)
tb=0
ans=0
j=0
for i in range(n+1):
    ta -= a[n-i]
    if ta>k:
        continue
    while tb + ta<=k:

        if j ==m:
            ans=max(ans,n-i+j)
            break
        ans=max(ans,n-i+j)
        tb += b[j]
        j +=1

print(ans)


Measured memory_bytes: 40384
import sys
from collections import deque
from functools import lru_cache
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class Comb:
    def __init__(self, N):
        F = [1] * (N + 1)
        for i in range(N):
            F[i + 1] = (i + 1) * F[i] % mod

        self.d_inv = {}
        self.d_comb = {}
        self.F = F

    def inv(self, a):
        if a not in self.d_inv:
            self.d_inv[a] = pow(a, mod - 2, mod)
        return self.d_inv[a]

    def comb(self, a, b):
        if (a, b) not in self.d_comb:
            self.d_comb[(a, b)] = (self.F[a] * self.inv(self.F[a - b]) * self.inv(self.F[b])) % mod
            self.d_comb[(a, a - b)] = self.d_comb[(a, b)]
        return self.d_comb[(a, b)] 



def main():
    S = int(input())
    res = 0
    C = Comb(S)
    for k in range(1, S // 3 + 1):
        res += C.comb(S - 2 * k - 1, k - 1)
        res %= mod
    print(res)
        

if __name__ == "__main__":
    main()



Measured memory_bytes: 68256
f = list(input())
s = list(input())
t = list(input())

a = [f[i: i+1] for i in range(0, len(f), 1)]
b = [s[i: i+1] for i in range(0, len(s), 1)]
c = [t[i: i+1] for i in range(0, len(t), 1)]
d = ''.join(a[0] + b[1] + c[2])
print(d)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <limits.h>
 
using namespace std;
typedef pair<int,int> P;
P seg[1111111];
int n;
void update(int a,int b);
P pamax(P a,P b);
int b;
int main(){
  int r,l;
  int team[100000]={0};
   
  cin >> n >> r >> l;
  b=1;
  while(b<n)b*=2;
  for(int i=0; i<n; i++) {
    update(i,0);
  }
  int now=0,top=0;
  
  for (int i=0;i<r;i++){
    int d,t,x;
    cin >> d >> t >> x;
    team[top]+=t-now;
    update(d-1,x);
    top=seg[0].second-1;
    now=t;
  }
  team[top]+=l-now;
  
  int ans = 0;
  for (int i=1;i<n;i++){
    if(team[ans]<team[i]) ans=i;
  }
  cout << ans+1 << endl;
}
 
 
 
void update(int k, int x){
  int id = k + 1;
  k += b - 1;
  seg[k].first += x;
  seg[k].second = id;
   
  while (k>0){
    k = (k - 1) / 2;
    if (seg[k * 2 + 1].first > seg[k * 2 + 2].first){
      seg[k] = seg[k * 2 + 1];
    }
    else if (seg[k * 2 + 1].first < seg[k * 2 + 2].first){
      seg[k] = seg[k * 2 + 2];
    }
    else {
      seg[k] = seg[k * 2 + 1];
    }
  }
  /*while(k>0){
    k=(k-1)/2;
    seg[k]=pamax(seg[k*2+1],seg[k*2+2]);
    }*/
}

P pamax(P a,P b){
  int x,y;
  x=a.second;
  y=b.second;
  if(x<y)return b;
  else return a;
}
  

Measured memory_bytes: 10236
H = int(input())
W = int(input())
N = int(input())

M = 0
L = 0
if H >= W:
    M = W
    L = H
else:
    M = H
    L = W

P = 0
ans = 0
for i in range(1, M+1):
    P += L
    ans += 1
    if P >= N:
        break

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
static const int INFTY = (1 << 30);
int n;
void search(vector<vector<int> > &G1, vector<vector<int> > &G2, int *d, bool *v)
{
    int mini, minv;
    while (1)
    {
        bool iscomp = true;
        minv = INFTY;
        rep(i, 0, n)
        {
            if (!v[i] && d[i] < minv)
            {
                mini = i;
                minv = d[i];
                iscomp = false;
            }
        }
        if (iscomp)
            break;
        v[mini] = true;
        rep(i, 0, G1[mini].size())
        {
            int tmp = G1[mini][i];
            if (!v[tmp])
            {
                int tmptime = minv + G2[mini][i];
                if (tmptime < d[tmp])
                    d[tmp] = tmptime;
            }
        }
    }
}
int main()
{
    cin >> n;
    vector<vector<int> > G1(n, vector<int>(0)), G2(n, vector<int>(0));
    int d[n];
    bool v[n] = {};
    rep(i, 0, n) d[i] = INFTY;
    int utmp, ktmp, vtmp, ctmp;
    rep(i, 0, n)
    {
        cin >> utmp >> ktmp;
        rep(j, 0, ktmp)
        {
            cin >> vtmp >> ctmp;
            G1[utmp].push_back(vtmp);
            G2[utmp].push_back(ctmp);
        }
    }
    d[0] = 0;
    search(G1, G2, d, v);
    rep(i, 0, n)
    {
        printf("%d %d\n", i, d[i]);
    }
}


Measured memory_bytes: 7548
N = int(input())
A = [int(input()) for i in range(N)]
M = max(A)
c = A.count(M)
a = list(set(A))
a.sort(reverse=True)
 
for i in range(N):
  if A[i] != M:
    print(M)
  else:
    if c >= 2:
      print(M)
    else:
      print(a[1])

Measured memory_bytes: 17188
#!/usr/bin/env python3
import sys


def solve(N: int):
    if N % 2 == 0:
        print(N)
    else:
        print(N*2)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef vector<int> VI;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {
	int n;
	cin >> n;
	int p;
	if (n % 111 == 0) {
		cout << n << endl;
		return 0;
	}
	else {
		p = n / 111;
		cout << (p + 1) * 111 << endl;
	}

	

	return 0;
}



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

int main() {
        int n;
        scanf("%d", &n);
        vector<int> a(n + 1);
        int x = 0;
	for (int i = 1; i <= n; i ++) {
		scanf("%d", &a[i]);
		x ^= a[i];
                a[i] ^= a[i] - 1;
	}
        vector<bool> ok(100);
	for (int i = 1; i <= n; i ++) {
		for (int j = 1; j < 31; j ++) {
			if ((1 << j) - 1 == a[i]) ok[j - 1] = true;
                }
	}
	int ans = 0;
	for (int i = 30; i >= 0; i --) {
		if (x & (1 << i)) {
			if (!ok[i]) {
				return !printf("-1\n");
			} else {
				x ^= (1 << (i + 1)) - 1;
				ans ++;
			}
		}
	}
	printf("%d\n", ans);
        return 0;
}



Measured memory_bytes: 640
#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main(void)
{
	int i=0,count=0;
	char W[11],T[1001];
	scanf("%s",W);
	while(1)
	{
		W[i]=tolower(W[i]);
		if(W[i]=='\0'){break;}
		i++;
	}
	while(1)
	{
		scanf("%s",T);
		if(strstr(T,"END_OF_TEXT")){break;}
		i=0;
	    while(1)
	    {
	    	T[i]=tolower(T[i]);
	        if(T[i]=='\0')break;
	        i++;
	    }
		if(!strcmp(T,W)){count++;}
	}
	printf("%d\n",count);

	return 0;
}

Measured memory_bytes: 988
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int in(){
    int x=0;bool f=0; char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
int a[105],vis[105],dep,n,sum,mn=0x7fffffff,mx;
int main()
{
	n=in();
	for (int i=1;i<=n;++i) a[i]=in(),mn=min(mn,a[i]),mx=max(mx,a[i]),++vis[a[i]];sort(a+1,a+n+1);
	for (int i=((a[n]>>1)+1);i<=a[n];++i) if (vis[i]<2) {printf("Impossible");return 0;}else vis[i]-=2;
	if (!(a[n]&1)&&vis[a[n]>>1]<1) {printf("Impossible");return 0;}else --vis[a[n]>>1];
	for (int i=mn;i<=((a[n]+1)>>1);++i) 
	if (vis[i]) {printf("Impossible");return 0;}
	printf("Possible");return 0;
}

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

int main() {
  int x;
  cin >> x;
  if(x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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 d = sc.nextInt();
    int sq1=a*b;
    int sq2=c*d;
    if (sq1 >= sq2){
      System.out.println(sq1);
    } else {
      System.out.println(sq2);
    }
  }
}

Measured memory_bytes: 21332
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

void dfs(int i, int from, int from_c, vector<vector<pair<int, int>>>& g, vector<int>& ans){
    int ki=0;
    for(auto& adj : g[i]){
        if(adj.first==from) continue;
        ++ki;
        if(ki==from_c) ++ki;
        ans[adj.second]=ki;
        dfs(adj.first, i, ki, g, ans);
    }
}

int main(){
    int n; cin >> n;
    vector<vector<pair<int, int>>> g(n, vector<pair<int, int>>());
    for(int i=0; i<n-1; ++i){
        int a, b; cin >> a >> b; --a; --b;
        g[a].push_back({b, i});
        g[b].push_back({a, i});
    }
    int begin=0;
    for(int i=1; i<n; ++i){
        if(g[i].size()>g[begin].size()){
            begin=i;
        }
    }
    vector<int> ans(n-1);
    dfs(begin, -1, -1, g, ans);
    cout << g[begin].size() << endl;
    for(auto c : ans){
        cout << c << endl;
    }
    return 0;
}


Measured memory_bytes: 8320
N, M = (list)(map(int, input().split()))
a = []
b = []
c = []

inf = 10**4
for _ in range(M):
    tmp = (list)(map(int, input().split()))
    a.append(tmp[0]-1)
    b.append(tmp[1]-1)
    c.append(tmp[2])

mat = [[inf] * N for _ in range(N)]
for i in range(N):
    mat[i][i] = 0

edges = [False] * M

for i in range(M):
    mat[a[i]][b[i]] = c[i]
    mat[b[i]][a[i]] = c[i]

for i in range(N):
    for j in range(N):
        for k in range(N):
            mat[j][k] = min(mat[j][k], mat[j][i] + mat[i][k])

ans = M
for i in range(M):
    s = False
    for j in range(N):
        if mat[j][a[i]] + c[i] == mat[j][b[i]]:
            s = True
    if s:
        ans -= 1
print(ans)


Measured memory_bytes: 3400
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	int n;
	while(scanf("%d", &n),n){
		int ans = -1; double dif = 1000000.0;
		for(int i = 0; i < n; i++){
			int x, h, w; scanf("%d%d%d",&x,&h,&w);
			if(dif > abs(22.0-(double)w*100.0*100.0/(double)h/(double)h)){
				dif = abs(22.0-(double)w*100.0*100.0/(double)h/(double)h);
				ans = x;
			} else if(dif==abs(22.0-(double)w*100.0*100.0/(double)h/(double)h)&&ans > h){
				ans = x;
			}
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1028
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
    int h, w;
    while(1){ 
        cin >> h >> w ; 
        if(h == 0 & w == 0)
            break; 
        for(int j = 0; j < h; j ++){ 
            if(j==0||j==h-1){
                for(int i = 0; i < w; i ++){
                    cout << "#";
                }
            }else{
                for(int i = 0; i < w; i ++){
                    if(i==0||i==w-1){
                        cout << "#";
                    }else{ 
                        cout << ".";
                    }
                }
            }cout << "\n";
        }cout << "\n";
    }return 0;
}

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

using namespace std;

#define FAST_IO() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define USE_DB() cout << fixed; cout.precision(10);

#define pqu priority_queue
#define que queue
#define stk stack
#define vec vector

typedef long long ll;
typedef double db;
typedef string str;

#define IN(x) cin >> x
#define INI(x) int x; cin >> x
#define INL(x) ll x; cin >> x
#define INS(x) str x; cin >> x

#define FI first
#define SE second
#define PB push_back
#define SZ(x) x.size()
#define ALL(x) x.begin(), x.end()

#define FORN(i, s, e) for (int i = s; i < e; i++)
#define FORR(i, s, e) for (int i = s; i >= e; i--)
#define FORD(i, s, e, d) for (int i = s; i < e; i += d)
#define FORS(i, n) for (int i = 1; i*i <= n; i++)

int main() {
	FAST_IO();

	INI(n); INI(k);
	if (n / 2 + n % 2 >= k) cout << "YES" << '\n';
	else cout << "NO" << '\n';
		
	return 0;	
}


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

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main (){
    int n, minj, s, p, ans;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i ++ ){
        cin >> a[i];
    }
    for (int i = 0; i < (n - 1); i ++ ){
        minj = a[i];
        int flag = 0;
        for (int k = i; k < n; k ++){
            if (minj > a[k]){
                minj = a[k];
                s = k;
                flag ++;
            }
        }
        if (flag != 0){
            a[s] = a[i];
            a[i] = minj;
            ans ++;
        }
    }
    for (int k = 0; k < n; k ++){
        if (k == 0)cout << a[k];
        else cout << " " << a[k];
    }
    cout << endl << ans << endl;
}


Measured memory_bytes: 3088
var lines: string[] = [];
var reader: any = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on("line", function(line: string) {
  lines.push(line);
});

reader.on("close", function() {
  // A B C
  var numbers: number[] = lines[0].split(" ").map(x => {
    return Number(x);
  });
  var maxNum: number = Math.max(...numbers);
  var sumOfSub: number =
    maxNum * 3 - numbers.reduce((prev, current) => prev + current);
  if (sumOfSub % 2 == 0) {
    console.log(sumOfSub / 2);
  } else {
    console.log((sumOfSub + 1) / 2 + 1);
  }
});


Measured memory_bytes: 7628
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define SIZE 1000111
#define BC 50
#define BS 5000
#define MOD 1000000007LL
#define MAXV 555
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef vector<vector<long long> > mat;

ll n, t, p, ret;

int main () {
	scanf("%lld%lld",&n,&t);
	for(int i=0;i<n;i++) {
		ll h;	scanf("%lld",&h);
		if(h >= p)	p = h + t, ret += t;
		else		ret = ret - (p - h) + t, p = h + t;
	}
	printf("%lld",ret);
}

Measured memory_bytes: 256
import sys
from collections import deque

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W = map(int, input().split())
    sh, sw = map(lambda x: int(x) - 1, input().split())
    gh, gw = map(lambda x: int(x) - 1, input().split())
    grid = [list(input().rstrip()) for _ in range(H)]

    maze = [[f_inf] * W for _ in range(H)]
    maze[sh][sw] = 0
    que = deque([[sh, sw]])
    while que:
        h, w = que.popleft()
        for dh, dw in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            next_h, next_w = h + dh, w + dw
            if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:
                continue
            if grid[next_h][next_w] == ".":
                if maze[next_h][next_w] > maze[h][w]:
                    maze[next_h][next_w] = maze[h][w]
                    que.appendleft([next_h, next_w])
        for dh in range(-2, 3):
            for dw in range(-2, 3):
                next_h, next_w = h + dh, w + dw
                if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:
                    continue
                if grid[next_h][next_w] == ".":
                    if maze[next_h][next_w] > maze[h][w] + 1:
                        maze[next_h][next_w] = maze[h][w] + 1
                        que.append([next_h, next_w])
    print(maze[gh][gw] if maze[gh][gw] != f_inf else -1)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 165396
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <cctype>
#include <vector>
#include <string>
#include <limits.h>
#include <set>
#define ll long 
#define lli long long
# define M_PI           3.14159265358979323846
using namespace std;


int main()
{
ios_base::sync_with_stdio(false);
    
 
    int R;
    cin>>R;
    long double c = 2*M_PI*R;
    cout<<fixed<<setprecision(20);
    cout<<c;
    return 0;
}





Measured memory_bytes: 3800
H,W=list(map(int, input().split()))
A=[list(input()) for _ in range(H)]
S={i for i in range(H)}
T={j for j in range(W)}
for i in range(H):
  if set(A[i])=={'.'}:
    S-={i}
for j in range(W):
  for i in range(H):
    if A[i][j]=='#':
      break
  else:
    T-={j}
S=sorted(list(S))
T=sorted(list(T))
for i in S:
  ans=[]
  for j in T:
    ans.append(A[i][j])
  print(''.join(ans))

Measured memory_bytes: 67916
n, c = list(map(int, input().split()))

s = [0] * n
t = [0] * n
chan = [0] * n
for i in range(n):
    s[i], t[i], chan[i] = list(map(int, input().split()))

length_double = 2 * (max(t)+1)

recording_num = [0] * length_double
# tt = [0] * length_double
for i in range(1, c+1):
    tt = [0] * length_double

    for j in range(n):
        if chan[j] == i:
            tt[s[j]*2-1] += 1
            tt[t[j]*2] -= 1
    
    for j in range(1, length_double):
        tt[j] += tt[j-1]
    for j in range(length_double):
        if tt[j] > 0:
            recording_num[j] += 1
    # print(tt)

ans = max(recording_num)
print(ans)
# print(recording_num)



Measured memory_bytes: 125836
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

struct mint {
	ll x;
	mint(ll x = 0) :x(x% mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(200005);

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, k;
	cin >> n >> m >> k;
	//1組につきn*m-2 C k-2 個使われる
	mint ans = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			mint tmp = mint(n - i) * mint(m - j) * mint(i + j);
			if (i && j) tmp *= 2;
			ans += tmp;
		}
	}
	ans *= comb(n * m - 2, k - 2);
	printf("%d\n", ans);
	return 0;
}


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

using namespace std;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define v(d_type) vector<d_type>
#define p(d_type1, d_type2) pair<d_type1, d_type2>
#define F first
#define S second
#define loop(i, s, n) for(int i = s; i < n; i++)
#define nl "\n"
#define fat 1000000007

int main()
{
    boost;
    
    vector<string> v = {"Sunny", "Cloudy", "Rainy"};

    map<string, int> mp;
    mp["Sunny"] = 0;
    mp["Cloudy"] = 1;
    mp["Rainy"] = 2;

    string s;
    cin >> s;

    int num = mp[s] + 1;

    cout << v[num%3] << nl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
void check(void);
int i=0,j=0,count=0;
int h,w,n,m;
char a[102][102]={{'.'}};
int f[102][102] ={{0}};

int main(void){

    for(;;){
        for(n=0;n <= 101;n++){
            for(m=0;m <= 101;m++){
                f[n][m]=0;

            }
        }

        scanf("%d%d",&h,&w);
        if(h==0)break;

        for(i=0;i<h;i++){
            scanf("%s",a[i]);
        }
        i=0,j=0;
        for(;;){
            check();
            if(f[i][j]==1){
                printf("LOOP\n");
                break;
                }

            if(a[i][j]=='.'){
              printf("%d %d\n",j,i);

               break;


            }
           // a[i][j]='0';

        }
    }
    return 0;
}


void check(void){
    if(a[i][j]=='>'){
        f[i][j]=1;
        j++;

        }
    else if(a[i][j]=='<'){
        f[i][j]=1;
        j--;

        }
    else if(a[i][j]=='v'){

        f[i][j]=1;
        i++;
        }
    else if(a[i][j]=='^'){

        f[i][j]=1;
        i--;
        }
    else if(a[i][j]=='.'){
       // printf("%d %d\n",j,i);
        }
    }

Measured memory_bytes: 664
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);


int main(){
  int n;
  string s;
  cin >> n >> s;
  vector<int>alp(26);
  rep(i,n)alp[s[i]-'a']++;
  ll ans=1;
  rep(i,26){
    if(alp[i]){
      ans*=(alp[i]+1);
      ans%=MOD;
    }
    
  }
  cout <<(ans-1+MOD)%MOD<<endl;
  
    
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
typedef long long ll;

using namespace std;
using Graph = vector<vector<int>>;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;

const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000


void Main() {
    string a;

    cin >> a;

    if (a == "ABC") {
       COUT("ARC");
    }
    else {
        COUT("ABC");
    }
}
 
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}



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

const string X = "Christmas";
const string E[4] = { "", " Eve", " Eve Eve", " Eve Eve Eve" };

int main(void) {
	int D;
	cin >> D;
	int id = 25 - D;
	
	cout << X + E[id] << '\n';
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N, M, P;
	while (true) {
		cin >> N >> M >> P;
		if (N == 0 && M == 0 && P == 0) break;
		vector<int> X(N + 1, 0);
		int Sum = 0;
		for (int i = 1; i <= N;i++) {
			cin >> X[i]; Sum += X[i];
		}
		if (X[M] == 0) {
			cout << 0 << endl;
			continue;
		}
		Sum = Sum *100 - Sum * P;
		cout << Sum / X[M] << endl;
	}
}

Measured memory_bytes: 3136
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstdio>
#include<iomanip>
#include<map>
#include<cstring>
using namespace std;
long long n,m;
int main()
{
    cin>>n>>m;
    if(n*2>m) cout<<m/2;
    else if(n*2==m) cout<<n;
         else
		 {
             m-=n*2;
             m/=4;
             cout<<n+m;
         }
    return 0;
}

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    ll n; cin >> n;

    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);

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

    ll dp[100010][5];

    for (int i = 0; i < n; ++i) {
        dp[i+1][0] = max(dp[i][1] + a[i], dp[i][2] + a[i]);
        dp[i+1][1] = max(dp[i][0] + b[i], dp[i][2] + b[i]);
        dp[i+1][2] = max(dp[i][0] + c[i], dp[i][1] + c[i]);
    }

    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

Measured memory_bytes: 6528
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum += A[i];
  }
  ll f = sum - N;
  cout << f << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#define ll long long int
using namespace std;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

int main() {
	string a, b;
	cin >> a >> b;
	string complete = "";
	for(int i = 0; i < a.length() + b.length(); i++) {
		if(i % 2 == 0) {
			complete = complete + a[i / 2];
		} else {
			complete = complete + b[i / 2];
		}
	}
	cout << complete << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int num[5][110];
int main(){
    cin>>n;
    for(int i=1;i<=2;++i){
        for(int j=1;j<=n;++j){
            cin>>num[i][j];
            num[i][j]+=max(num[i-1][j],num[i][j-1]);
        }
    }
    cout<<num[2][n];
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int cnt=1;
int oya[500010];
int ko[2][500010];
int val[500010];

int f(int v,int mode){
    if(mode==0)printf(" %d",val[v]);
    if(ko[0][v])f(ko[0][v],mode);
    if(mode==1)printf(" %d",val[v]);
    if(ko[1][v])f(ko[1][v],mode);
    if(mode==2)printf(" %d",val[v]);
}
void push(int v,int va){
	//初回
	if(cnt==1){
		val[cnt]=va;
		cnt++;
		return;
	}
	if(ko[val[v]<va][v])push(ko[val[v]<va][v],va);
	else{
		ko[val[v]<va][v]=cnt;
		oya[cnt]=v;
		val[cnt]=va;
		cnt++;
	}
}

int find(int v,int va){
	if(val[v]==va)return 1;
	if(ko[val[v]<va][v])return find(ko[val[v]<va][v],va);
	return 0;
}

int main(){
	int q;
	scanf("%d",&q);
	while(q--){
		char s[10];
		scanf("%s",s);
		if(s[0]=='p'){
			f(1,1);
			puts("");
			f(1,0);
			puts("");
		}else if(s[0]=='i'){
			int t;
			scanf("%d",&t);
			push(1,t);
		}else{
			int t;
			scanf("%d",&t);
			puts(find(1,t)?"yes":"no");
		}
	}
}


Measured memory_bytes: 7944
open Core

let n = Scanf.scanf "%d" ident

let plans =
  List.init n (fun _ -> Scanf.scanf " %d %d %d" (fun t x y -> (t, x, y)))
  |> List.rev

let reachable np p =
  let nt, nx, ny = np in
  let t, x, y = p in
  let d1 = abs (nx - x) + abs (ny - y) in
  let dt = nt - t in
  if d1 <= dt && d1 mod 2 = dt mod 2 then true else false

let rec solve p = function
  | [] ->
      true
  | np :: rest ->
      if reachable np p then solve np rest else false

let str = if solve (0, 0, 0) plans then "Yes" else "No"

let () = print_endline str


Measured memory_bytes: 21752
#include <iostream>
#include <string>
#include <unordered_set>

using namespace std;

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

    unordered_set<string> ids;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ids.insert(s);
    }

    int m;
    cin >> m;
    bool open = false;
    for (int i = 0; i < m; ++i) {
        string t;
        cin >> t;
        if (ids.find(t) != end(ids)) {
            if (open) {
                cout << "Closed by " << t << endl;
            }
            else {
                cout << "Opened by " << t << endl;
            }
            open = !open;
        }
        else {
            cout << "Unknown " << t << endl;
        }
    }
}

Measured memory_bytes: 3212
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>

class carr {
	int** c;
	int level;
public:
	carr(int n, int t = 0) {
		for (int i = 0; i < 30; i++) {
			if (1 << i >= n) {
				level = i + 1;
				break;
			}
		}
		c = new int*[level];
		for (int i = 0; i < level; i++) {
			c[i] = new int[1 << (level - 1 - i)];
			for (int j = 0; j < 1 << (level - 1 - i); j++) {
				if (i == 0) {
					c[0][j] = j < n ? t : 0;
				}
				else {
					c[i][j] = c[i - 1][j << 1] + c[i - 1][(j << 1) + 1];
				}
			}
		}
	}
	carr(int n, int *t) {
		for (int i = 0; i < 30; i++) {
			if (1 << i >= n) {
				level = i + 1;
				break;
			}
		}
		c = new int*[level];
		for (int i = 0; i < level; i++) {
			c[i] = new int[1 << (level - 1 - i)];
			for (int j = 0; j < 1 << (level - 1 - i); j++) {
				if (i == 0) {
					c[0][j] = j < n ? t[j] : 0;
				}
				else {
					c[i][j] = c[i - 1][j << 1] + c[i - 1][(j << 1) + 1];
				}
			}
		}
	}
	void cadd(int n, int a = 1) {
		for (int i = 0; i < level; i++) {
			c[i][n >> i] += a;
		}
	}
	void csub(int n, int a = 1) {
		for (int i = 0; i < level; i++) {
			c[i][n >> i] -= a;
		}
	}
	int prev(int n) {
		//if (c[0][n])return n;
		for (int i = 0; i < level; i++) {
			if (n&(1 << i) && c[i][(n >> i) - 1]) {
				int r = (n >> i) - 1;
				for (int j = i - 1; j >= 0; j--) {
					r <<= 1;
					if (c[j][r | 1])r |= 1;
				}
				return r;
			}
		}
		return -1;
	}
	int next(int n) {
		//if (c[0][n])return n;
		for (int i = 0; i < level; i++) {
			if ((n&(1 << i)) == 0 && c[i][(n >> i) + 1]) {
				int r = (n >> i) + 1;
				for (int j = i - 1; j >= 0; j--) {
					r <<= 1;
					if (c[j][r] == 0)r |= 1;
				}
				return r;
			}
		}
		return -1;
	}
};

const int mod = 1000000007;

int main() {
	int n;
	scanf("%d", &n);
	int N = 1 << n;
	int *S = new int[N];
	for (int i = 0; i < N; i++) scanf("%d", S + i);
	std::sort(S, S + N);
	int id = -1;
	int cur = -1;
	for (int i = 0; i < N; i++) {
		if (S[i] != cur) {
			id++;
			cur = S[i];
			S[i] = id;
		}
		else {
			S[i] = id;
		}
	}
	carr c(id + 1);
	for (int i = 0; i < N; i++) {
		c.cadd(S[i]);
	}
	int *t = new int[N];
	t[0] = S[N - 1];
	c.csub(S[N - 1]);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 1 << i; j++) {
			int a = c.prev(t[j]);
			if (a < 0) {
				printf("No");
				return 0;
			}
			t[j + (1 << i)] = a;
			c.csub(a);
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    map<int, int> freq;
    bool f = 1;
    for(int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        freq[temp] += 1;
        if(f)
            f = freq[temp] > 1 ? 0 : 1;
    }
    if(f)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (a > 0 && c > 0) {
        c -= b;
        a -= d;
    }
    if (c <= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

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

Measured memory_bytes: 256
import java.util.*;

public class Main {
    private class Cake {
        long x, y, z;

        public Cake(long x, long y, long z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }
    }

    public void main(Scanner sc) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        Cake cake[] = new Cake[n];
        for (int i = 0; i < n; i++) {
            cake[i] = new Cake(sc.nextLong(), sc.nextLong(), sc.nextLong());
        }

        long ans = 0;
        long sums[] = new long[n];
        for (int i = 0; i < 8; i++) {
            int a = (i % 2) * 2 - 1;
            int b = ((i >> 1) % 2) * 2 - 1;
            int c = ((i >> 2) % 2) * 2 - 1;
            for (int j = 0; j < n; j++) {
                sums[j] = cake[j].x * a + cake[j].y * b + cake[j].z * c;
            }

            Arrays.sort(sums);
            long sum = 0;
            for (int j = 0; j < m; j++) {
                sum += sums[n - j - 1];
            }
            ans = Math.max(ans, sum);
        }

        System.out.println(ans);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 25172
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#pragma warning( disable:4996 )
using namespace std;
typedef long long LL;
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int dat[100000];
/*
LL mini = 1e12;
map<LL, LL> m;
vector<LL> list;
LL n, cnt = 0;
*/
LL mypow(LL n, LL m) {
	while (m >= 1) {
		n *= n;
		m--;
	}
	return n;
}

/*void rec(LL now, vector<LL>::iterator it) {
	if (it != list.end()) {
		for (int i = 0; i < m.count((*it)); i++) {
			vector<LL>::iterator it2 = it;
			LL newn = now * mypow((*it2), i);
			rec(newn, it2);
		}
	}
	else {
		if (mini > now + n / now - 2) {
			mini = now + n / now - 2;
		}
	}
	
}*/

double to_deg(double r) {
	return r * 180.0 / (atan(1.0) * 4.0);
}


int main(void) {
	/*int a, b;
	scanf("%d %d", &a, &b);
	if (1 <= a && a <= 9 && 1 <= b && b <= 9) {
		printf("%d\n", a * b);
	}
	else {
		printf("-1\n");
	}

	int n;
	scanf("%d", &n);
	for (int i = 9; i >= 1; i--) {
		
		if (n % i == 0) {
			if (n / i <= 9) {
				printf("Yes\n");
				return 0;
			}
			else {
				printf("No\n");
				return 0;
			}
		}
	}
	printf("No\n");*/

	
	
	//scanf("%lld", &n);
	/*
	for (int i = 2; i <= sqrt(n)+1; i++) {
		if (n % i == 0) {
			dat[cnt] = i;
			n = n / i;
			i = 1;
			cnt++;
		}
	}
	
	for (int i = 0; i < cnt; i++) {
		if (m.count(dat[i])==0) {
			m.insert(make_pair(dat[i], 1));
			list.push_back(dat[i]);
		}
		else {
			m.at(dat[i])++;
		}
	}
	LL all = 1;
	/*for (vector<LL>::iterator it = list.begin(); it != list.end(); it++) {
		all *= m.count((*it)) + 1;
	}*/
	//rec(1, list.begin());
	//printf("%lld\n", mini);
	/*for (LL i = 1; i <= sqrt(n) + 1; i++) {
		if (n % i == 0 && mini > n / i + i - 2) {
			mini = n / i + i - 2;
		}
	}

	printf("%lld\n", mini);*/

	double a, b, x;
	scanf("%lf %lf %lf", &a, &b, &x);
	double ans;
	if (x >= a * a * b / 2) {
		ans = atan(2 * (a * a * b - x) / a / a / a);
	}
	else {
		ans = atan(a * b * b / 2 / x);
	}
	printf("%lf\n", to_deg(ans));

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
  int n,a,b,p=0,num;
  scanf("%d %d %d",&n, &a, &b);
  for(int i=1;i<=n;i++){
    int sum=0;
    num=i;
    while(num){
     sum += num % 10;
     num /= 10;
    }
    if(a<=sum&&sum<=b) p+=i;
  }  
  printf("%d\n", p);
  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 r = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();

		for(int i=1;i<=10;i++){
			x=r*x-d;
			System.out.println(x);
		}
	}
}

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

int main() {
    int N, D;
    cin >> N >> D;
    if ( N % (2 * D + 1) == 0)
        cout << N / ( 2 * D + 1) << endl;
    else
        cout << N / ( 2 * D + 1) + 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;
bool comp2(lpair p1, lpair p2){
    if(p1.first == p2.first){
        return (p1.second < p2.second);
    }
    return (p1.first < p2.first);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    ll P[100010], Y[100010];
    cin >> N >> M;
    rep(i,0,M){
        cin >> P[i] >> Y[i];
    }
    vector<lpair> lp;
    map<lpair, ll> mp;
    rep(i,0,M){
        lpair lp1 = make_pair(P[i], Y[i]);
        lp.push_back(lp1);
        mp[lp1] = i;
    }
    sort(lp.begin(), lp.end(), comp2);
    vector<lpair> ans(100010);
    ll rank = 1;
    rep(i,0,M){
        ll pre_num = lp[i].first;
        if(i != 0){
            if(pre_num == lp[i-1].first){
                rank++;
            }else{
                rank = 1;
            }
        }
        ll n = mp[lp[i]];
        ans[n].first = pre_num;
        ans[n].second = rank;

    }
    rep(i,0,M){
        cout << setfill('0') << right << setw(6) << ans[i].first;
        cout << setfill('0') << right << setw(6) << ans[i].second << endl;
    }
}


Measured memory_bytes: 13424
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>

#define INT unsigned long long int
#define FOR1(n) for(int i=0;i<n;i++)
#define FOR2(j, n) for(int j=0;j<n;j++)
#define FOR3(i, m, n) for(int i=m;i<=n;i++)
#define MOD 1000000007
#define MAX_N 100000

using namespace std;

long long int l;
long long int ans = 0;
vector<bool> perm;
vector<long long int> s;

void dfs(long long int n){
	if(n == 0){
		long long int sum = 0;
		long long int start, end = -1;
		FOR1(l-1){
			if(perm[i]){
				start = end + 1;
				end = i;
				long long int tmp = 0;
				FOR3(j, start, end){
					tmp *= 10;
					tmp += s[j];
				}
				ans += tmp;
			}
		}
		start = end + 1;
		end = l - 1;
		long long int tmp = 0;
		FOR3(j, start, end){
			tmp *= 10;
			tmp += s[j];
		}
		ans += tmp;
	}else{
		perm.push_back(true);
		dfs(n-1);
		perm.pop_back();
		perm.push_back(false);
		dfs(n-1);
		perm.pop_back();
	}
}

main(){
	string tmp;
	cin >> tmp;
	FOR1(tmp.length()){
		s.push_back(tmp[i] - 48);
	}
	l = s.size();
	
	dfs(l-1);
	cout << ans;
}



Measured memory_bytes: 256
#include <iostream>//数据输入输出流
#include <cstring>//字符串操作函数
#include <cstdio>//C的输入输出
#include <cstdlib>//定义杂项函数及内存分配函数
#include <cmath>//C中的数学函数
#include <string>//c++中的string类 他不能用strcpy等c函数去操作
#include <vector>//STL vetor
#include <list>//STL list
#include <map>// STL map
#include <queue>// STL queue
#include <stack>//sTL stack
#include <bitset>//bitset可按位定义串
//比如：bitset <1000> all;定义一个1000位的串
#include <algorithm>//STL各种算法 比如 swap sort merge max min 比较
#include <numeric>//常用数字操作 一般和algorithm搭配使用
#include <functional>//STL定义运算函数（代替运算符）
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int,int> PII;
#define fi first
#define se second
#define LOCAL
#define zeros(a,n) memset(a,0,(n)*sizeof(a[0]))
const int modn = 1e9+7;
int mod(int x) { return x<0?x+modn:x<modn?x:x-modn; }
//inv [ i ] = (modn - modn/i)*inv[ modn%i ] %modn;
map<int,int>m;
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    string s;
    cin>>s;
    LL ans=0;
    int n =(int)s.size();
    LL res = 0, t = 1;
    m[0] = 1;
    for(int i = n-1; i>=0; --i){
        res = ((t * (s[i]-'0')) % 2019 + res)%2019;
        t = t * 10 % 2019;
        ans += m[res];
        m[res]++;
    }
    cout<<ans<<"\n";
    return 0;
}



Measured memory_bytes: 3336
N = int(input())
A = [int(s) for s in input().split()]

def main():
    b = 400
    limit = 8
    rates = list(map(lambda n: min(limit, n // b), A))
    min_count = 0
    for i in range(limit):
        min_count += 1 if rates.count(i) else 0
    print(max(1, min_count), min_count + rates.count(limit))

if __name__ == '__main__':
    main()

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }
    int ans = 0;

    rep(i, n) {
        while (data[i] % 2 == 0) {
            data[i] /= 2;
            ans++;
        }
    }
    cout << ans << endl;


    return 0;
}




Measured memory_bytes: 384
#coding: utf-8
import math
import heapq
import bisect

MOD = 10**9+7

N,K = map(int, input().split())

# 複数個の数値を、intの配列として取得
S = input()

bck=0
for i in range(1,N):
    if(S[i]==S[i-1]):
        bck+=1

print(min(N-1,bck+K*2))

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;


int main(){
    string s;cin >>s;
    string r=s;
    reverse(all(s));
    if(r==s)puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 3552
#!/usr/bin/env python3
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K > 41:
    K = 41

for k in range(K):
    D = [0]*N

    for i in range(N):
        left = max(i - A[i], 0)
        right = min(i + A[i], N-1)
        D[left] += 1
        if right + 1 < N: D[right+1] -= 1
    

    for i in range(1, N):
        D[i] += D[i-1]
    A = D


print(' '.join(map(str,A)))

    


Measured memory_bytes: 172560