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

using namespace std;

#define forn(i,n) for(int i=0;i<(int)(n); i++)
#define forsn(i,s,n) for(int i=(s);i<(int)(n); i++)
#define debug(x) cout << #x << " = "  << x << endl
#define pb push_back
#define mp make_pair
typedef long long tint;
int toNumber (string s)
{
	int Number;
	if ( ! (istringstream(s) >> Number) ) Number = 0; // el string vacio lo manda al cero
	return Number;
}
string toString (int number)
{
    ostringstream ostr;
    ostr << number;
    return  ostr.str();
}

tint ele(tint a, tint b){
	if(b==0)return 1;
	if(b%2==0){
		return ele((a*a), b/2);
	}else{
		return a*ele((a*a), b/2);
	}
}

tint mcd(tint a, tint b){
	if(a==0)return b;
	return mcd(b%a, a);
}

double d_abs(long a, long b){
	if(a>b){
		return a-b;
	}
	return b-a;
}

int main(){
	int n, m, k;
	cin>>n>>m>>k;
	forn(i, n+1){
		forn(j, m+1){
			if(i*m+j*n-2*i*j==k){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No";
}


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

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

    int sum = 0;
    for(int i = 1; i <= n; i++)
    {
        sum += (k >= i) ? x : y;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Map.Entry;

public class Main{
	
	public static void main(String[] args) throws IOException{
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		
		for(int i = 0; i < N; i++){
			int a = in.nextInt();
			Integer count = map.get(a);
			if(count == null) map.put(a, 1);
			else map.put(a, count+1);
		}
		
		List<Entry<Integer, Integer>> listEntries = new ArrayList<Entry<Integer, Integer>>(map.entrySet());
        
		int ans = 0;
        for(int i = 0; i < listEntries.size(); i++){
        	Entry e = listEntries.get(i);
        	int k = (int)e.getKey();
        	int v = (int)e.getValue();
        	if(k < v) ans += v - k;
        	else if(k > v) ans += v;
        }
        
        System.out.println(ans);
	}
}


Measured memory_bytes: 61044
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

h = 0
w = 0
k = 0
a = []
num = 0
cnt = []
c = []

def main():
    global h, w, k, a, num, cnt, c
    h, w, k = list(map(int, input().strip().split()))
    c = [[0] * w for _ in range(h)]
    a = [[0] * w for _ in range(h)]
    cnt = [0] * h
    for i in range(h):
        c[i] = input().strip()
        cnt[i] = sum(1 if v == '#' else 0 for v in c[i])

    v = []
    for i in range(h):
        if cnt[i] >= 1:
            v.append(i)
    for i in range(len(v)):
        if i == 0:
            cl = 0
        else:
            cl = v[i-1]+1
        if i == len(v)-1:
            cr = h-1
        else:
            cr = v[i]
        solve(cl, cr)
    for i in range(h):
        print(" ".join(str(c) for c in a[i]))

def solve(cl, cr):
    global a, num
    p = []
    for i in range(cl, cr+1):
        for j in range(w):
            if c[i][j]== '#':
                p.append(j)
    p.sort()
    for i in range(len(p)):
        if i == 0:
            vl = 0
        else:
            vl = p[i-1]+1
        if i == len(p)-1:
            vr = w-1
        else:
            vr = p[i]
        num += 1

        for j in range(cl, cr+1):
            for k in range(vl, vr+1):
                a[j][k] = num

if __name__ == '__main__':
    main()


Measured memory_bytes: 46556
#include <iostream>
#include <cstring>

using namespace std;


int main(){
	char ch[1024];
	int len;
	
	cin.getline(ch, sizeof(ch));
	len = strlen(ch);
	
	for (int i=0; i<len; i++) {
		if (ch[i]>='a' && ch[i]<='z') {
			ch[i]-=32;
		}
	}
	cout << ch << endl;
	
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
char s[100];

int main(){
    scanf("%s",s);
    int n = strlen(s);
    ll ans = 0;
    rep(i,0,1<<(n-1)){
        vi a;a.pb(0);
        rep(j,0,n-1) if(i>>j&1) a.pb(j + 1);
        a.pb(n);
        rep(i,0,sz(a)-1){
            ll tmp = 0;
            for(int k=a[i];k<a[i+1];++k) tmp = tmp * 10 + s[k] - '0';
            ans += tmp;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define repi(i,a,b) for(int i = (a); i<= (b); i++)
#define repA(i,n) for(int i = (n); i>=0; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (int)(a.size())

typedef long long ll;
typedef long double ld;
const ll mod = (ll)(1e9+7);//998244353;
const int N = (int)(1e5+5);

void pre() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  #endif
}

void solve() {
  int n;  cin>>n;
  if(n>=30) cout<<"Yes";
  else  cout<<"No";
}

int main() {
  pre();
  int t = 1;
  //cin>>t;
  rep(i,t)  {
    //cout<<"Case #"<<(i+1)<<"\n";
    solve();
    cout<<'\n';
  }
  return 0;
}


Measured memory_bytes: 3644
n=int(input())
ans=[]
import math
if n==1:
    print(1)
    exit()
for i in range(1,int(math.sqrt(n))+1):
    for j in range(1,int(math.sqrt(n))+1):
        if i**j<=n:
            ans.append(i**j)
print(max(ans))


Measured memory_bytes: 3060
process.stdin.setEncoding('utf-8');
process.stdin.on('data', input => {
  var whrxy = input.split(' ').map(Number);
  const w = whrxy[0];
  const h = whrxy[1];
  const x = whrxy[2];
  const y = whrxy[3];
  const r = whrxy[4];

  const a = x >= r;
  const b = x <= w - r;
  const c = y >= r;
  const d = y <= h - r;


  if (a && b && c && d) {
    console.log('Yes');
  } else {
    console.log('No');
  }
})


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

int main(){
	int N;
	cin >> N;
	int n = 0;
	for(int i=2; i<=N; i*=2){
		 n++;
	}
	
	if(n == 0){ cout << 1 << endl;
	}else{
		cout << pow(2, n) << endl;
		}
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace id_0074cs
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var vs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                var t = vs[0];
                var h = vs[1];
                var s = vs[2];
                if (t == -1 && h == -1 && s == -1)
                {
                    break;
                }
                TimeSpan allTimeSpan = new TimeSpan(2, 0, 0);
                TimeSpan gotTimeSpan = new TimeSpan(t, h, s);
                TimeSpan answerTimeSpan = allTimeSpan - gotTimeSpan;
                Console.WriteLine("{0:00}:{1:00}:{2:00}", answerTimeSpan.Hours, answerTimeSpan.Minutes, answerTimeSpan.Seconds);
                TimeSpan threetimes = answerTimeSpan + answerTimeSpan + answerTimeSpan;
                Console.WriteLine("{0:00}:{1:00}:{2:00}", threetimes.Hours, threetimes.Minutes, threetimes.Seconds);

            }
        }
    }
}



Measured memory_bytes: 9580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
struct edge { ll s, t, x; };
typedef pair<int, int> P;
typedef pair<ll,P> event;
const ll MAX = 510000;
const ll MOD = 1000000007;
#define INF (ll)1000000000000

int main() {
  int N;
  cin>>N;
  if(N%1000==0){cout<<0;}
  else{
   int g=1000-(N%1000);
    cout<<g;
  }
}



Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map> 
#include<bits/stdc++.h> 
typedef long long ll ; 
#define el '\n' 
#define fr(n) for(ll i =0 ; i<n ; i++) 
using namespace std ;
ll a[100005] ; ll dp[100005] ;
ll k  ; 
ll solve(ll n){
    if (n < 1 ) return 0 ; 
    if (dp[n] != -1 )
    {
        return dp[n] ; 
    }
    
    //ll min = INT64_MAX ;
    //return min(abs(solve(n-1) - solve(n)) , abs(solve(n - 2) - solve(a[n])) ) ;
    ll left , right ;
    left = solve(n-1) + abs(a[n] - a[n-1])  ;
    right = INT64_MAX ;
    if(n - 2 >= 0 ){
        right = solve(n-2) + abs(a[n]  - a[n-2]) ; 
    }
    return dp[n] =  min(right , left ) ; 
    
}
int main() 
{ 
    ios_base::sync_with_stdio(0) ;
    cin.tie(0) ;
    cin >> k ;
    dp[0] = - 1  ;
    fr(k){
        cin >> a[i+1] ;
        dp[i + 1 ] = - 1 ; 
    }
    a[0] = a[1] ;
    cout << solve(k) << el ;
    return 0; 
} 

Measured memory_bytes: 4992
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void){
	int i,sum=0,pa1=0,pa2=0,ans;
	
	int n;
	scanf("%d",&n);
	
	int w[n+1];
	
	for(i=1;i<=n;i++){
		scanf("%d",&w[i]);
	}
	
	for(i=1;i<=n;i++){
		sum+=w[i];
	}
	
	for(i=1;i<=n;i++){
		pa2=pa1;
		pa1+=w[i];
		if(pa1*2>=sum){
			break;
		}
	}
	
	if((pa1*2-sum)<=(sum-pa2*2)){
		printf("%d\n",pa1*2-sum);
	}else{
		printf("%d\n",sum-pa2*2);
	}
	
	return 0;
}

Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10**6)

def dfs(base, n):
    global K, cnt, ans, flag
    if flag:
        return
    if n == 0:
        cnt += 1
        if cnt == K:
            ans = int(base)
            flag = True
            return
    else:
        last = int(base[-1])
        for l in range(max(0, last-1), min(10, last+2)):
            nextbase = base + str(l)
            dfs(nextbase, n-1)


def main():
    global K, ans, cnt, flag
    K = int(input())
    if K < 10:
        print(K)
        return
    leftK = int(str(K)[0])
    cnt = 9; ans = 0
    flag = False
    for keta in range(1, 10):
        for i in range(1, 10):
            dfs(str(i), keta)
    print(ans)

if __name__ == "__main__":
    main()


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

#define ll long long
#define pb push_back
#define vi vector<int>
#define sz(a) (int((a).size()))
#define mp make_pair
#define f first
#define s second
#define pii pair<int, int>

using namespace std;

const int N = 100100;
int n, k;
int a[N];
ll total;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		total += a[i];
	}
	
	if (total % (n * 1ll *(n + 1) / 2) != 0) {
		cout << "NO\n";
		return 0;
	}
	
	int k = total / (n * 1ll * (n + 1) / 2);
	
	for (int i = 2; i <= n; i++) {
		int d = a[i] - a[i - 1];
		if (k - d < 0 || (k - d) % n != 0) {
			cout << "NO\n";
			return 0;
		}
	}
	
	cout << "YES\n";
	
	
	return 0;
}

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

using namespace std;

int main(){
    string str;
    stack<int> S;


    while( cin >> str ){
        if ( str[0] == '+' ){
            int a = S.top();
            S.pop();
            int b = S.top();
            S.pop();
            S.push(a+b);
        } else if ( str[0] == '-' ){
            int b = S.top();
            S.pop();
            int a = S.top();
            S.pop();
            S.push(a-b);
        } else if ( str[0] == '*' ){
            int a = S.top();
            S.pop();
            int b = S.top();
            S.pop();
            S.push(a*b);
        } else {
            int x = stoi(str);
            S.push(x);
        }
    }
    cout << S.top() << endl;
    return 0;
}


Measured memory_bytes: 3224
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws java.io.IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String buffer;
        Pattern p = Pattern.compile("this|that|the");
        while ((buffer = br.readLine()) != null) {
            String ans = "";
            for (int i = 0; i < 26; i++) {
                char[] tmp = buffer.toCharArray();
                for (int j = 0; j < tmp.length; j++)
                    if (tmp[j] != '.' && tmp[j] != ' ')
                        tmp[j] = (char) ('a' + (tmp[j] - 'a' + i) % 26);
                ans = String.valueOf(tmp);
                Matcher m = p.matcher(ans);
                if (m.find()) {
                    i = 26;
                    break;
                }
            }
            System.out.println(ans);
        }
    }

}

Measured memory_bytes: 9364
n,a,b=map(int,input().split())

a_length=a-1
b_length=n-b

if not (b-a)%2:
    print((b-a)//2)
elif b_length>=a_length:
    print(a+(b-a-1)//2)
elif b_length<a_length:
    print(n-b+1+(b-a-1)//2)

Measured memory_bytes: 3060
N,A,B,C=map(int,input().split())
l=[int(input()) for i in range(N)]
inf=10**9
def dfs(cur,a,b,c):
  if cur==N:
    return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else inf
  ret0 = dfs(cur+1,a,b,c)
  ret1 = dfs(cur+1,a+l[cur],b,c)+10
  ret2 = dfs(cur+1,a,b+l[cur],c)+10
  ret3 = dfs(cur+1,a,b,c+l[cur])+10
  return min(ret0,ret1,ret2,ret3)
print(dfs(0,0,0,0))


Measured memory_bytes: 3064
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

//Organize Your Train part II
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t--!=0){
			String s = sc.next();
			Set<String> set = new HashSet<String>();
			for(int i=1;i<=s.length();i++){
				String s1 = s.substring(0, i);
				String s2 = s.substring(i, s.length());
				String r1 = (new StringBuffer(s1)).reverse().toString();
				String r2 = (new StringBuffer(s2)).reverse().toString();
				set.add(s1+s2);
				set.add(s1+r2);
				set.add(s2+s1);
				set.add(r2+s1);
				set.add(r1+s2);
				set.add(r1+r2);
				set.add(s2+r1);
				set.add(r2+r1);
			}
			System.out.println(set.size());
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <cstring>

using namespace std;

int main () {
  char s[1003];
  cin >> s;
  int s_len = strlen( s );
  
  if ( s[s_len - 1] == 's' ) {
    s[s_len] = 'e'; s[s_len + 1] = 's'; s[s_len + 2] = 0;
  } else {
    s[s_len] = 's'; s[s_len + 1] = 0;
  }
  cout << s << endl;
} 

Measured memory_bytes: 3636
fn main() {
    let n = readln();
    let mut a: Vec<isize> = readln();
    for i in 0..n {
        a[i] = a[i] - (i as isize + 1);
    }
    a.sort();
    let b = a[n / 2];
    let mut answer = 0;
    for i in 0..n {
        answer += (a[i] - b).abs();
    }
    println!("{}", answer);
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(
    String,
    bool,
    f32,
    f64,
    isize,
    i8,
    i16,
    i32,
    i64,
    usize,
    u8,
    u16,
    u32,
    u64
);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);


Measured memory_bytes: 10492
#include <iostream>
#include <cstdint>
#include <unordered_map>

using namespace std;

int main() {
  uint64_t n, x, m;
  cin >> n >> x >> m;
  uint64_t seq[100010] = {};
  uint64_t len;
  uint64_t head;
  {
    uint64_t i = 0;
    unordered_map<uint64_t, uint64_t> map;
    while (map.count(x) == 0) {
      map[x] = i;
      seq[i] = x;
      x = (x * x) % m;
      ++i;
    }
    len = i;
    head = map[x];
  }
  uint64_t sl = 0;
  for (uint64_t i = head; i < len; ++i) {
    sl += seq[i];
  }
  uint64_t s = 0;
  if (n < head) {
    for (uint64_t i = 0; i < n; ++i) {
      s += seq[i];
    }
  } else {
    for (uint64_t i = 0; i < head; ++i) {
      s += seq[i];
    }
    uint64_t cl = (n - head) / (len - head);
    uint64_t tail = (n - head) % (len - head);
    s += sl * cl;
    for (uint64_t i = head; i < head + tail; ++i) {
      s += seq[i];
    }
  }

  cout << s << endl;
}


Measured memory_bytes: 6340
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[list(map(int,input().split())) for _ in range(m)]
bc.sort(key=lambda x: x[1],reverse=True)
#print(bc)
cnt=0
for i in range(n):
    if bc[cnt][0]>0:
        if bc[cnt][1]>a[i]:
            a[i]=bc[cnt][1]
        bc[cnt][0]-=1
    else:
        cnt+=1
        if cnt==len(bc):
            break
        if bc[cnt][1]>a[i]:
            a[i]=bc[cnt][1]
        bc[cnt][0]-=1
    #print(cnt,bc,a)
print(sum(a))

Measured memory_bytes: 32924
#include <stdio.h>

#define MAX_N 100

const int inf = 1<<25;

int n;
int A[MAX_N][MAX_N];
int used[MAX_N];
int mincost[MAX_N];

int main() {
  int i, j;
  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    for(j = 0; j < n; j++) scanf("%d", &A[i][j]);
  }

  int total = 0;
  for(i = 0; i < n; i++) {
    used[i] = 0;
    mincost[i] = inf;
  }
  mincost[0] = 0;
  while(1) {
    int v, u = -1;
    for(v = 0; v < n; v++) {
      if(used[v]) continue;
      if(u == -1 || mincost[v] < mincost[u]) u = v;
    }
    if(u == -1) break;
    used[u] = 1;
    total += mincost[u];
    for(v = 0; v < n; v++) {
      if(used[v]) continue;
      if(~A[u][v] && A[u][v] < mincost[v]) {
	mincost[v] = A[u][v];
      }
    }
  }
  printf("%d\n", total);
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    cout << n / 3 << endl;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

signed main(){
    ll a, b, c;
    cin >> a >> b >> c;
    if(c - a - b < 0){
        PRINT("No");
        return 0;
    }
    if(4 * a * b < (c - a - b) * (c - a - b)){
        PRINT("Yes");
    }else{
        PRINT("No");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    int n;
    string s;
    cin >> n >> s;
    int res = 0;
    rep(i,n-1){
        map<char,int> fro;
        map<char,int> back;
        rep(j,i)fro[s[j]]++;
        repp(j,i,n)back[s[j]]++;
        int tmp = 0;
        for(auto f : fro)if(back.find(f.first) != back.end())tmp++;
        res = max(res,tmp);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;

int main(){
  ll n; cin >> n;
  map<ll,ll> m;
  rep(i,n){
    ll d; cin >> d;
    if(i==0&&d!=0){cout << 0; return 0;}
    if(i!=0&&d==0){cout << 0; return 0;}
    m[d]++;
  }
  if(debug){
    for(auto p:m){
      cout << p.first << ":" << p.second << endl;
    }
  }
  ll ans=1;
  for(ll i=0; i<m.size()-1;i++){
    ll c = m[i];
    ll ne = m[i+1];
    rep(j,ne){
      ans*=(c%mod);
      ans%=mod;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;cin>>s;
  ll cnt = 0;
  for(auto c:s){
    cnt += c-'0';
  }
  ll n = s.size();
  ll cnt2 = n-cnt;
  cout<<n-abs(cnt-cnt2)<<endl;
  return 0;
}


Measured memory_bytes: 512
a, b = map(int, input().split())

#%%
# a, b = 123, 456



#%%
def cum_xor(n):
    if n % 2 == 1:
        n_1 = (n+1) // 2
        if n_1 % 2 == 0:
            return 0
        else:
            return 1
    else:
        n_1 = n // 2
        if n_1 % 2 == 0:
            return n
        else:
            return 1 ^ n



#%%
print(cum_xor(a-1) ^ cum_xor(b))

#%%


Measured memory_bytes: 2940
#include<iostream>
using std::cout; using std::endl;
using std::cin;
int main(){
  int s,h,m;
  cin >> s;
  h = s/ 3600; 
  s = s - h * 3600;
  m = s / 60;
  s = s - m * 60;
  cout << h << ":" << m << ":" << s<< endl;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> C(H, vector<char>(W));
    rep(i, H) rep(j, W) cin >> C[i][j];
    rep(i, H) {
        rep(j, W) cout << C[i][j];
        cout << endl;
        rep(j, W) cout << C[i][j];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
l = len(s) - len(t)
lt = int(len(t))
count = 0
max_count = 100000000000
for i in range(l+1):
  x = s[i:lt+i]
  for i in range(len(x)):
    if x[i] != t[i]:
      count += 1
  if count <= max_count:
    max_count = count
  count = 0
print(max_count)

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

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

	vector<char> s_re;
	for (int i = 0; i < s.size(); i++) {
		if (i % 2 == 0) s_re.push_back(s.at(i));
	}

	for (int i = 0; i < s_re.size(); i++) {
		cout << s_re.at(i);
	}
	cout << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll  long long
#define PR  pair<int, int>

const int N = 5e5 + 10;
const int MOD = 1e9 + 7;
const long long INF = 5e18;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, nulong long_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    while (!s.empty()) {
        if (s[0] == 'R') {
            s.erase(s.begin() + 0);
        } else {
            break;
        }
    }
    while (!s.empty()) {
        if (s.back() == 'W') {
            s.pop_back();
        } else {
            break;
        }
    }
    int r = 0, w = 0;
    for (auto i : s) {
        r += (i == 'R');
        w += (i == 'W');
    }
    int rns = 0, wns = 0;
    for (int i = 0; i < s.size() && i < r; i++) {
        if (s[i] != 'R') {
            rns++;
        }
    }
    for (int i = s.size() - 1, c = 0; i >= 0 && c < w; i--, c++) {
        if (s[i] != 'W') {
            wns++;
        }
    }
    cout << min(rns, wns) << '\n';
    return 0;
}


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define db(x) cout << #x << " = " << (x) << "\n";
using ll = long long;
using ld = long double;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll N;
    cin >> N;
    int a, b, c, x = 0, y = 0, z = 0, m = 0, n = 0, o = 0;
    for (int i = 1; i <= N; i++)
    {
        cin >> a >> b >> c;
        x = max(n, o) + a;
        y = max(m, o) + b;
        z = max(m, n) + c;
        m = x;
        n = y;
        o = z;
    }
    cout << max(z, max(x, y));
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int x[200],y[200];
  int dx[]={-1,0,1,0},dy[]={0,-1,0,1};
  x[0]=y[0]=0;
  while(cin>>N,N){
    int maxx=0,minx=0,maxy=0,miny=0;
    for(int i=1;i<N;++i){
      int n,d;
      cin>>n>>d;
      x[i]=x[n]+dx[d];
      y[i]=y[n]+dy[d];
      maxx=max(maxx,x[i]);
      minx=min(minx,x[i]);
      maxy=max(maxy,y[i]);
      miny=min(miny,y[i]);
    }
    cout<<maxx-minx+1<<" "<<maxy-miny+1<<endl;
  }
  return 0;
}
    

Measured memory_bytes: 2972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int l[MAXn],r[MAXn];
int main(){
    IOS();
    int n;
    cin >> n;
    REP (i,n) cin >> l[i] >> r[i];
    sort(l,l+n+1,greater<int>()), sort(r,r+n+1);
    ll ans = 0;
    ll sum = 0;
    REP (i,n) {
        sum += 2 * (l[i] - r[i]);
        ans = max(ans,sum);
    }
    cout << ans << endl;
}


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

#define endl '\n'
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

typedef long long llong;
typedef pair<int, int> pii;

void solve(){

	string s;
	cin >> s;

	vector<char> arr;

	for(char &c : s){

		if(c != 'B'){
			arr.pb(c);
		}else{
			if(!arr.empty()) arr.pop_back();
		}

	}
	
	for(char &c : arr){
		cout << c;
	}

}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	#ifdef LOCAL
		ifstream in("in");
		cin.rdbuf(in.rdbuf());
	#endif

	solve();

	return 0;
}

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

int main()
{
  int N;
  int d[110];
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> d[i];
  
  set<int> values; //insert するときに重複を取り除く
  for (int i = 0; i < N; ++i)
  {
    //insert コンテナは重複した値を許さない
    // https://cpprefjp.github.io/reference/set/set/insert.html
    values.insert(d[i]);
  }
  
  cout << values.size() << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
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 ll INF = 1LL << 60;


int main(void){
    int k;
    string s;
    cin >> k >> s;
    if(s.size()<=k)
        cout << s;
    else{
        REP(i,k){
            cout << s[i];
        }
        cout << "...";
    }

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <map>
#include <cstring>
#include <cstdio>
using namespace std;

typedef pair<int,int> P;

int n;

P alp2loc(char c) {
  int i, j;
  switch (c) {
    case 'A': {
      i = 0, j = 0; break;
    }
    case 'B': {
      i = 0, j = 1; break;
    }
    case 'C': {
      i = 0, j = 2; break;
    }
    case 'D': {
      i = 1, j = 0; break;
    }
    case 'E': {
      i = 1, j = 1; break;
    }
    case 'F': {
      i = 1, j = 2; break;
    }
    case 'G': {
      i = 2, j = 0; break;
    }
    case 'H': {
      i = 2, j = 1; break;
    }
    case 'I': {
      i = 2, j = 2; break;
    }
  }
  return P(i,j);
}

const int di[4] = {-1, 0, 1, 0};
const int dj[4] = {0, 1, 0, -1};

void solve() {
  char s, t, b;
  cin>>s>>t>>b;
  
  P sp = alp2loc(s), st = alp2loc(t), sb = alp2loc(b);
  
  double org[3][3];
  memset(org, 0, sizeof org);
  
  org[sp.first][sp.second] = 1.0;
  for (int turn = 0; turn < n; turn++) {
    double now[3][3];
    memset(now, 0, sizeof now);
    
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        //
        double add = org[i][j] / 4.0;
        for (int k = 0; k < 4; k++) {
          int ti = i + di[k], tj = j + dj[k];
          if (0 <= ti && ti < 3 && 0 <= tj && tj < 3 &&
              !(sb.first == ti && sb.second == tj)) {
            now[ti][tj] += add;
          } else {
            now[i][j] += add;
          }
        }
      }
    }
    
    for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
    org[i][j] = now[i][j];
  }
  
  //cout<<org[st.first][st.second]<<endl;
  printf("%.8f\n", org[st.first][st.second]);
}

int main(int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
const ll INF = 1LL << 60;
#define MOD 1000000007
#define MAX_V 100010
#define MAX_N 100010
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll junnretu(ll n){
    ll ans=1;
    for (ll i=1;i<=n;i++){
        ans*=i;
    }
    return ans;
}

int main(){
	ll n,ans=1;
	cin >>n;
	ll x[n];
	for (ll i=0;i<n;i++)cin>>x[i];
	ll flag=x[0];
	for (ll i=1;i<n;i++){
		if (x[i]<flag){
			flag=x[i];
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(int argc, const char *argv[]) {
  int N, b;
  int a = 0;
  cin >> N;
  vector<string> S(N);
  vector<string> O(N);
  vector<int> count(N);
  for(int i=0; i<N; i++){
    cin >> S[i];
    count[i] = 0;
  }

  sort(S.begin(), S.end());
  count[0]++;
  O[0] = S[0];
  for (int i = 1; i < N; i++) {
    if(S[i] != S[i-1]){
      a++;
      count[a]++;
      O[a] = S[i];
    } else {
      count[a]++;
    }
  }

  vector<int>::iterator iter = max_element(count.begin(), count.end());
  size_t index = distance(count.begin(), iter);
  cout << O[index] << endl;
  b = count[index];
  count[index] = 0;
  for (int i = 0; i < a + 1; i++) {
    if(count[i] == b){
      cout << O[i] << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int n = s.length();
  vector<int> ans(n);
  int cnt = 0;
  for(int i = 0; i < n; ++i){
    if(s[i] == 'R'){
      cnt++;
    }
    else{
      ans[i - 1] += (cnt + 1) / 2;
      ans[i] += cnt / 2;
      cnt = 0;
    }
  }
  for(int i = n - 1; i >= 0; --i){
    if(s[i] == 'L'){
      cnt++;
    }
    else{
      ans[i + 1] += (cnt + 1) / 2;
      ans[i] += cnt / 2;
      cnt = 0;
    }
  }
  for(int i = 0; i < n; ++i) cout << (i ? " " : "") << ans[i];
  cout << endl;
}

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

long long MOD=1000000007LL;

long long dp[101][64000];

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

	int rN=sqrt(N);
	vector<long long> init;
	int c=0;
	for(int i=0;i<=rN;i++){
		if(i!=rN || i*(i+1)<=N)init.push_back(N-N/(i+1)-c);
		c+=N-N/(i+1)-c;
	}
	for(int i=1;i<=rN;i++)init.push_back(1);
	reverse(init.begin(),init.end());
	
	int M=init.size();
	for(int i=0;i<M;i++)dp[0][i+1]=init[i];
	
	for(int i=0;i<K-1;i++){
		vector<long long> sum(M+1,0);
		for(int j=0;j<M;j++)sum[j+1]=sum[j]+dp[i][j];
		for(auto &k:sum)k%=MOD;
		for(int j=1;j<M;j++)dp[i+1][j]=sum[M-j+1]*init[j-1];
	}
	
	long long ans=0;
	for(int j=1;j<M;j++)ans+=dp[K-1][j];
	cout << ans%MOD << endl;
	
	/*for(int i=0;i<K;i++){
		for(int j=0;j<M;j++)cout << dp[i][j] << " ";
		cout << endl;
	}*/
	return 0;
}

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

typedef long long ll;

ll mod = 1e9+7;

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

    if(n == 1){
        cout << 1 << endl;
        return 0;
    }

    map<int,int> fact;
    for(int i = 2; i <= n; i++){
        int tmp = i;
        for(int j = 2; tmp != 1 && j <= i; j++){
            while(tmp%j == 0){
                fact[j]++;
                tmp /= j;
            }
        }
    }

    ll accum = 1;
    for(pair<int,int> p : fact){
        accum = (accum*(p.second+1)) % mod;
    }

    cout << accum << endl;
    
    return 0;
}

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

if s==r:
    for i in range(int(len(s)/2)):
        if s[i] != s[int(len(s)/2)+i+1]:
            ans = "No"
else:
    ans = "No"

print(ans)


Measured memory_bytes: 2940
from random import randint
D = int(input())
C = [int(T) for T in input().split()]
S = [[] for TD in range(0,D)]
for TD in range(0,D):
    S[TD] = [int(T) for T in input().split()]
SatM = 0
TesM = [1]*D
for TV in range(0,50):
    Type = 26
    Last = [0]*Type
    SatS = 0
    Test = [randint(1,26) for TD in range(0,D)]
    for TD in range(0,D):
        Last[Test[TD]-1] = TD+1
        SatS += S[TD][Test[TD]-1]
        for TC in range(0,Type):
            SatS -= C[TC]*(TD+1-Last[TC])
    if SatS>SatM:
        SatM = SatS
        TesM = Test
print('\n'.join(str(TD) for TD in TesM))

Measured memory_bytes: 78704
import sys

f_i = sys.stdin

n = int(f_i.readline())

adj = [[(int(cost), int(v_n)) for v_n, cost in zip(x.split()[2::2], x.split()[3::2])] for x in f_i]

import heapq

def dijkstra():
    PQ = []
    isVisited = [False] * n
    distance = [999900001] * n

    distance[0] = 0
    heapq.heappush(PQ, (0, 0))
    
    while PQ:
        uc = heapq.heappop(PQ)
        u = uc[1]

        if uc[0] > distance[u]:
            continue

        isVisited[u] = True
        
        for vc in adj[u]:
            v = vc[1]
            if isVisited[v] == True:
                continue
            t_cost = distance[u] + vc[0]
            if t_cost < distance[v]:
                distance[v] = t_cost
                heapq.heappush(PQ, (t_cost, v))

    for v, d in enumerate(distance):
        print(v, d)


dijkstra()

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

#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define ff first
#define ss second

typedef long long ll;

using namespace std;

const int N = 1e5+5;

int f(int k){
	if(k==0) return 0;
	return k%10 + f(k/10);
}

int main(){
	ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	int n;
	
	cin>>n;
	
	int d = f(n);
	
	cout << (n%d == 0? "Yes" : "No");
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    if (x * (double)2 <= a * a * b) {
        double h = x / a / b * (double)2;
        double ang = atan(b/h) * (double)360 / ((double)2 * M_PI);
        printf("%.7lf\n", ang);
    }
    else {
        double h = (double)2 * x / a / a - b;
        double ang = atan((b-h)/a) * (double)360 / ((double)2 * M_PI);
        printf("%.7lf\n", ang);
    }
    return 0;
}


Measured memory_bytes: 4060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }

int main(){
    ll N,M;
    cin >> N >> M;
    deque<ll> A;
    priority_queue<Pll> B;
    ll a, b, c;
    rep(i,N){
        cin >> a;
        A.push_back(a);
    }
    sort(A.begin(), A.end());
    rep(i,M){
        cin >> b >> c;
        B.push(Pll(c,b));
    }
    ll cnt = 0;
    rep(i,M){
        if(cnt > N) break;
        c = B.top().first;
        b = B.top().second;
        cnt += b;
        B.pop();
        rep(j,b){
            auto itr = lower_bound(A.begin(), A.end(), c);
            if(itr == A.begin()){
                break;
            }else if(itr == A.end()){
                A.erase(A.begin());
                A.insert(A.end(), c);
            }else{
                A.erase(A.begin());
                A.insert(itr, c);
            }
        }
    }   
    ll sum = 0;
    rep(i,N){
        //cout << A[i] << " ";
        sum += A[i];
    }
    //cout << endl;
    cout << sum << endl;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a, b) memset((a), (b), sizeof(a))
#define mp(a, b) make_pair(a, b)
#define pi acos(-1)
#define pii pair<int, int>
#define pb push_back
const int INF = 0x3f3f3f3f;
const double eps = 1e-10;
const int maxn = 1e5 + 7;
const int maxm = 5e5 + 10;
const int mod = 1e9 + 7;
vector<int> s[maxn];
int vis[maxn];
int dp[maxn];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    mst(vis, 0);
    mst(dp, 0);
    queue<int> q;
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        int x, y;
        cin >> x >> y;
        vis[y]++;
        s[x].pb(y);
    }
    for (int i = 1; i <= n; ++i)
    {
        if (!vis[i])
            q.push(i);
    }
    while (!q.empty())
    {
        int now = q.front();
        q.pop();
        int len = s[now].size();
        for (int i = 0; i < len; ++i)
        {
            dp[s[now][i]] = max(dp[s[now][i]], dp[now] + 1);
            vis[s[now][i]]--;
            if (vis[s[now][i]] == 0)
                q.push(s[now][i]);
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i)
        ans = max(ans, dp[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6528
#include <cstdio>
#include <iostream>
const int maxn = 2e5+5;
using namespace std;
int n,k;
int a[maxn];
int main(){
	scanf("%d %d",&k,&n);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	a[n+1] = a[1]+k,a[n+2] = a[2] + k;
	int ans = 0x3f3f3f3f;
	for(int i=2;i<=n+1;++i)
		ans = min(ans,min(k-(a[i]-a[i-1]),k-(a[i+1]-a[i])));
	printf("%d",ans);
	return 0;
}



Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <map>

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

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> cnt(N + 1, 0);
    rep(i, N){
        int a;
        cin >> a;
        cnt[a] ++;

    }
    sort(cnt.begin(), cnt.end(), [](int a, int b){return a > b;});
    ll ans = 0;

    for(int i = K; i  < cnt.size(); i ++){
        ans += cnt[i];
        if(cnt[i] == 0){
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


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

struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007


int main() {
    int A, B; cin >> A >> B;
    cout << max(A + B, max(A - B, A * B)) << endl;

}


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

#define N 1000

int lcs(string X,string Y){
	int c[N+1][N+1];
	int m = X.size();
	int n = Y.size();
	X = ' ' + X;
	Y = ' ' + Y;
	for(int i=0;i<=m;i++)c[i][0]=0;
	for(int i=1;i<=n;i++)c[0][i]=0;
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			if(X[i]==Y[j]){
				c[i][j] = c[i-1][j-1]+1;
			}else if(c[i][j-1]>=c[i-1][j]){
				c[i][j] = c[i][j-1];
			}else{
				c[i][j] = c[i-1][j];
			}
		}
	}
	return c[m][n];
}

int main(){
	int n;
	string X,Y;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> X >> Y;
		printf("%d\n",lcs(X,Y));
	}
	return 0;
}



Measured memory_bytes: 7156
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cout<<#x <<": "<< x << "\n"
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; }
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long MOD = 1000000007;

int main() {
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	char X, Y;
	cin >> X >> Y;
	if (X > Y)
	{
		cout << ">\n";
	} else if (X < Y)
	{
		cout << "<\n";
	} else
	{
		cout << "=\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 P =pair<int,int>;

int main(){
	string S;
	cin>>S;
	vector<int>A(1000);
	rep(i,S.size()){
		A.at(int(S.at(i)))++;
	}
	rep(i,A.size()){
		if(A.at(i)>=2){
			cout<<"no"<<endl;
			return 0;
		}else{

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

/*compile
g++ code.cpp
./a.out
run*/

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    sum += num;
    a.at(i) = num;
  }
  for (int i = 0; i < n; i++) {
    if (a.at(i)*2 >= sum) {
      cout << "No" << endl;
      return 0;
    } else continue;
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
 int N,X1,X2;
 scanf("%d",&N);
  X1=(int)N/1.08;
  X2=X1+1;
 if((int)(X1*1.08)==N){printf("%d\n",X1);}
 else if((int)(X2*1.08)==N){printf("%d\n",X2);}
 else{printf(":(\n");}
}

Measured memory_bytes: 128
N = int(input())
a_list = list(input().split())

count = 0

for i in range(0, 30):
    for j in range(N):
        if int(a_list[j]) % 2 == 0:
            a_list[j] = int(int(a_list[j]) / 2)
            count += 1

print(count)


Measured memory_bytes: 4016
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
typedef pair<int,int> pii;
int n,x,ans;
bool p=false;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        if(x==i)
        {
            if(p)p=false;
            else p=true,ans++;
        }
        else p=false;
    }
    printf("%d",ans);
}


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

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

    int mem_num = N - 1;
    vector<int> ans(N);

    for(int i = 0; i < mem_num; i++)
    {
        int count;
        cin>>count;

        ans[count - 1]++;
    }

    for(int i = 0; i < N; i++)
    {
        cout<<ans[i];
        if(i != N - 1)cout<<endl;
    }

    return 0;
}

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

int main() {
  int n, ans=0;
  cin >> n;
  int a[n];
  for(int i=0; i<n; i++)
    cin >> a[i];

  sort(a, a+n);
  for(int i=0; i<n-2; i++)
    for(int j=i+1; j<n-1; j++)
      for(int k=j+1; k<n; k++){
        if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]+a[j]>a[k])
          ans++;
      }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3632