akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

class Main {

    public static void main(String[] args) {

	Scanner stdin = new Scanner(System.in);
	
	HashMap<String, ArrayList<Integer>> map = new HashMap<String, ArrayList<Integer>>();

	while ( stdin.hasNext() ) {
	    final String in = stdin.nextLine();
	    final String[] splits = in.split(" ");
	    final String word = splits[0];
	    final int page = Integer.parseInt(splits[1]);

	    if ( !map.containsKey( word ) ) {
		map.put( word, new ArrayList<Integer>() );
	    }
	    map.get( word ).add( page );
	}
	ArrayList<String> keys = new ArrayList<String>();
	keys.addAll( map.keySet() );
	Collections.sort( keys );

	for ( String key : keys ) {
	    System.out.println( key );
	    ArrayList<Integer> pages = map.get( key );
	    Collections.sort( pages );
	    System.out.print(pages.get(0));
	    for ( int i = 1; i < pages.size(); i++ ) {
		System.out.print( " " + pages.get( i ) );
	    }
	    System.out.println();
	}
    }
    
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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; }

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    ll lcm_CD = C * D / gcd(C, D);

    ll ans_sub;
    ans_sub = (B/C + B/D - B/lcm_CD) - ((A-1)/C + (A-1)/D - (A-1)/lcm_CD);

    cout << ((B-A+1) - ans_sub) << endl;


    return 0;
}



Measured memory_bytes: 256
N=int(input())
S=input()

tree_1=[]
tree_2=[]
tree_3=[]

for i in range(0,N):
    for e2 in tree_2:
        tree_3.append(e2+S[i])
    for e1 in tree_1:
        if len(tree_2)!=0:
            if (e1+S[i] in tree_2)!=True:
                tree_2.append(e1+S[i])
        else:
            tree_2.append(e1+S[i])
    if len(tree_1)!=0:
        if (S[i] in tree_1)!=True:
            tree_1.append(S[i])
    else:
        tree_1.append(S[i])
print(len(set(tree_3)))


Measured memory_bytes: 227104
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=200000+19;

struct info{
	int l,r;
	bool operator < (const info &B) const{
		return l<B.l||l==B.l&&r>B.r;
	}
} s[N];

priority_queue<int,Vi,greater<int> > Q;

int n,m,c,ans;

int main(){
	n=IN(),m=IN();
	For(i,1,n+1) s[i]=(info){IN(),IN()};
	sort(s+1,s+n+1);
	c=1;
	For(i,1,m+1){
		for (;c<=n&&s[c].l<i;c++) Q.push(s[c].r);
		if (c<=n){
			ans++;
			c++;
		} lf (!Q.empty()&&Q.top()<=i){
			Q.pop();
			ans++;
		}
	}
	printf("%d\n",n-ans);
}

Measured memory_bytes: 2936
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u){
  int v;
  
  color[u] = GRAY;
  d[u] = ++tt;
  for(v = 0; v < n; v++){
    if(M[u][v] == 0)
      continue;
    if(color[v] == WHITE)
      dfs_visit(v);
  }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs(){
  int u;

  for(u = 0; u < n; u++)
    color[u] = WHITE;
  tt = 0;

  for(u = 0; u < n; u++){
    if(color[u] == WHITE)
      dfs_visit(u);
  }
  for(u = 0; u < n; u++)
    printf("%d %d %d\n", u+1, d[u], f[u]);
}

int main(){
  int u, v, k, i, j;

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

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

  return 0;
}



Measured memory_bytes: 2052
s = input()

left = 0
right = 0
for i in range(len(s)):
    if s[i] == 'A':
        left = i
        break
for i in range(len(s) - 1, -1, -1):
    if s[i] == 'Z':
        right = i
        break
print(right - left + 1)

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

int main()
{
	int a, b;
	cin >> a >> b;

	if( a == b ) {
		cout << "a == b" << endl;
	}
	else if( a < b ) {
		cout << "a < b" << endl;
	}
	else {
		cout << "a > b" << endl;
	}
}



Measured memory_bytes: 3092
a = int(input())
lim = a // 2
soma_lista = []
menor = 100000
for i in range(a - 1, lim, -1):
    b = str(a - abs(i)) + str(abs(i))
    soma = 0
    for digit in b:
        soma += int(digit)
    if soma < menor:
        menor = soma
if a == 2:
    print(a)
else:
    print(menor)


Measured memory_bytes: 3060
import sys
S = input()

if len(S)<4:
    print('No')
    sys.exit()


if S[0] == 'Y':
    if S[1] == 'A':
        if S[2] == 'K':
            if S[3] == 'I':
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (n); i < (a); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  string s;cin>>s;
  cout<<(s[0]==s[1] ||s[1]==s[2] ||s[2]==s[3] ? "Bad":"Good")<<endl;
}


Measured memory_bytes: 256
n,a,b,*h=map(int,open(0).read().split());i,j=0,max(h)
while j-i>1:
 k=c=(j+i)//2
 for t in h:c+=min(0,(b*k-t)//(a-b))
 if c<0:i=k
 else:j=k
print(j)

Measured memory_bytes: 14092
#include<bits/stdc++.h>
	#include <ext/pb_ds/assoc_container.hpp> 
	#include <ext/pb_ds/tree_policy.hpp> 
	#define ll long long
	#define MP make_pair
	#define PB push_back
	#define PF push_front
	#define F first
	#define S second
	#define endl "\n"
	#define pi 3.14159265358979323846264338327950288
	#define MOD 1000000
	#define INF -100000000000000
	#define ordered_set tree<pair< ll int ,ll  int>, null_type,less<pair<ll int, ll int>>, rb_tree_tag,tree_order_statistics_node_update> 
	#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	using namespace std;
	#define lld long double
	using namespace __gnu_pbds;
	ll int setbits(ll int n) 
	{ 
	    ll int count = 0; 
	    while (n) { 
	        count += n & 1; 
	        n >>= 1; 
	    } 
	    return count; 
	} 
	int main()
	{
	    fast;
	  //  #ifndef ONLINE_JUDGE
	  //  freopen("input.txt", "r", stdin);
	  //  freopen("output.txt", "w", stdout);
	  //  #endif
	  	ll int n;
	  	cin>>n;
	  	string s;
	  	cin>>s;ll int i,c=0,less,more,w,val1=0,val2=0,temp,ans;
	  	for(i=0;i<s.size();i++)
	  	{
	  		if(s[i]=='1')
	  			c++;
	  	}
	  	ll int pwr[n],pwr1[n];
	  	less=c-1;ll int f=0;
	  	if(less==0)
	  	{
	  		f=1;less=INT_MAX;
	  	}
	  	more=c+1;
	  	pwr[0]=1;pwr1[0]=1;
	  	//cout<<less<<" "<<more<<endl;
	  	for(i=1;i<n;i++)
	  	{
	  		pwr[i]=(pwr[i-1]*2)%less;
	  		pwr1[i]=(pwr1[i-1]*2)%more;
	  	}
	  	for(i=0;i<n;i++)
	  	{
	  		if(s[i]=='1')
	  		{
	  			val1=(val1+pwr[n-1-i])%less;
	  			val2=(val2+pwr1[n-1-i])%more;
	  		}
	  	}
	  	//cout<<val1<<" "<<val2<<endl;

	  	for(i=0;i<n;i++)
	  	{
	  		if(s[i]=='0')
	  			temp=(val2+pwr1[n-1-i])%more;
	  		else
	  			temp=(val1-pwr[n-1-i]+less)%less;
	  		if(s[i]=='1' && f==1)
	  		{
	  			cout<<0<<endl;continue;
	  		}
	  		ans=1;
	  		while(temp!=0)
	  		{
	  			w=setbits(temp);
	  			temp=temp%w;
	  			ans++;
	  		}
	  		cout<<ans<<endl;
	  	}
	  //	ll int z=5%(-2);cout<<z<<endl;
	  }

	  	


Measured memory_bytes: 6860
using System;
namespace test
{
class program
    {
        static void Main()
        {
            while (true)
            { 
                string[] str = Console.ReadLine().Split(' ');
                int a = int.Parse(str[0]);
                int b = int.Parse(str[2]);
                char op = char.Parse(str[1]);
                int ans = 0;
                if (op == '?') break;
                if (op == '+') ans = a + b;
                if (op == '-') ans = a - b;
                if (op == '*') ans = a * b;
                if (op == '/') ans = a / b;
                if (op == '%') ans = a % b;
                Console.WriteLine(ans);
            }
        }
    }
}

Measured memory_bytes: 9172
import itertools


N, K = map(int, input().split())
d = []
A = []
ls = [i for i in range(1,N+1)]

for i in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

A = list(itertools.chain.from_iterable(A))

#print(A, ls)
print(len(set(A)^set(ls)))

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

int main()
{
    int n;
    scanf("%d", &n);
    int *a = (int*)malloc(n * sizeof(int));
    int *b = (int*)malloc(n * sizeof(int));
    int i;
    int max = 0;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
        b[i] = 0;
    }
    for(i=n-1; i>0; i--) {
        if(a[i-1] >= a[i]) {
            b[i-1] = b[i] + 1;
        }
    }

    for(i=0; i<n; i++) {
        if(b[i] > max) {
            max = b[i];
        }
    }
    printf("%d\n", max);
    free(a);
    free(b);
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
struct ToLower
{
  char operator()(char c){return tolower(c);}
};
int main()
{
  int N,K;
  string S;
  cin>>N>>K>>S;
  transform(S.begin()+K-1,S.begin()+K,S.begin()+K-1,ToLower());
  cout<<S<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int t;
    REP(i,5){
        cin >> t;
        if(t==0){
            COUT(i+1);
        }
    }
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>
#include <bitset>

#define mod 1e9+7
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, a, b;
    string ans = "No";
    cin >> n >> a;
    if(n == a) ans = "Yes";
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
def main():
    n = input()
    if len(n) == 1:
        print(n)
        exit()
    else:
        ans = (len(n) - 1) * 9
        t = 0
        for i in range(len(n)):
            t += int(n[i])
        ans = max(ans, t)
        k = int(n)
        for i in range(len(n)-1):
            nn = str(k)
            m = int(nn[len(n) - i - 1:]) + 1
            k -= m
            t = 0
            for j in range(len(str(k))):
                t += int(str(k)[j])
            ans = max(ans, t)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;


const ll MAX = 510000;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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()
{
    string s;
    cin >> s;
    ll ans=0;
    REP(i,s.size()){
        ans+=(s[i]-'0');
    }
    if(ans%9==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3720
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,m,data[1001];
  while(cin>>n>>m&&n|m){
    int sum=0;
    for(int i=0;i<n;i++){
      cin>>data[i];
      sum+=data[i];
    }
    sort(data,data+n,greater<int>());
    for(int i=m-1;i<n;i+=m)sum-=data[i];
    cout << sum << endl;
  }
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main() {
    int N,M;
    while(scanf("%d %d",&N,&M),N) {
        priority_queue<P> Q;
        for(int i=0;i<N;i++) {
            int d,p;
            scanf("%d %d",&d,&p);
            Q.push(P(p,d));
        }
        int sum=0;
        while(!Q.empty()) {
            P p=Q.top();Q.pop();
            int d=min(p.second,M);
            M-=d;
            p.second-=d;
            sum+=p.second*p.first;
        }
        printf("%d\n",sum);
    }
}

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

bool comp(pair<long,long> a, pair<long,long> b){
  if(b.second==a.second){
    return a.first<b.first;
  }
  else{
    return a.second<b.second;
  }
}


int main(void){
  long n;
  cin>>n;
  vector< pair<long,long> > times;
  long _s,_t;
  long Max_S=0;
  for(long i=0;i<n;i++){
    cin>>_s>>_t;
    times.push_back(make_pair(_s,_t));
    Max_S=max(Max_S,_s);
  }
  sort(times.begin(),times.end(),comp);

  long retval=0;
  long t=0;
  for(long i=0;i<n;i++){
    if(times[i].first<=t){
      ;
    }
    else{
      t=times[i].second;
      retval++;
    }
  }
  cout<<retval<<endl;

  return 0;
}



Measured memory_bytes: 4916
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;

int main(int argc, char* argv[])
{

	int A,B,X;

	cin >> A >> B >> X;

	cout << ((X>=A && X<=A+B) ? "YES" : "NO") << endl;

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int MAX=1e5+5;
int main(int argc, char *argv[])
{
	int n;
	int t[MAX],x[MAX],y[MAX];
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>t[i]>>x[i]>>y[i];
	x[0]=0,y[0]=0,t[0]=0;
	bool T=true;
	for(int i=1;i<=n;i++)
	{
		if(abs(x[i]-x[0])+abs(y[i]-y[0])>t[i]-t[i-1])
		{
			T=false;
			break;
		}
		if(((t[i]-t[i-1])-(abs(x[i]-x[0])+abs(y[i]-y[0])))%2==1)
		{
			T=false;
			break;
		}
		x[0]=x[i];y[0]=y[i];
	}
	if(T)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main(){
    int N; cin >> N;
    int acc = 40;
    for (int i = 0; i < N; ++i){
        int x; cin >> x;
        acc = min(acc, __builtin_ffsll(x)-1);
    }
    cout << acc << endl;
    return 0;
}

Measured memory_bytes: 256
ar = [[0]*14 for _ in range(14)]

while(True):
    try:
        x,y,s = map(int,input().split(","))
        if s == 3:
            for x1,y1 in [[-2,0],[0,2],[2,0],[0,-2],[-1,-1],[0,-1],[1,-1],[-1,0],[0,0],[1,0],[-1,1],[0,1],[1,1]]:
                ar[y1+y+2][x1+x+2] += 1
        elif s == 2:
            for x1,y1 in [[-1,-1],[0,-1],[1,-1],[-1,0],[0,0],[1,0],[-1,1],[0,1],[1,1]]:
                ar[y1+y+2][x1+x+2] += 1
        elif s == 1:
            for x1,y1 in [[0,-1],[-1,0],[0,0],[1,0],[0,1]]:
                ar[y1+y+2][x1+x+2] += 1
    except:
        break
br = [ a[2:12] for a in ar[2:12] ]
print(sum([b.count(0) for b in br]))
print(max([max(b) for b in br]))


Measured memory_bytes: 5616
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,e;
    while(~scanf("%d%d%d",&a,&b,&e))
    {
         if(e>=a&&e<=b)
            printf("Yes\n");
        else
           printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
N = int(input())
h = list(map(int, input().split()))

# #大きな値
INF = 10**10
#
# # DPtable
dp = [INF]*100000

# dp = [10**10 for _ in range(N)]


#初期条件
dp[0] = 0
dp[1] = abs(h[1]-h[0])

#ループ
for i in range(N):
    if i == 0 or i == 1:
        continue
    else:
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i]-h[i-2]))


print(dp[N-1])



Measured memory_bytes: 13928
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		if(n <1200) {
			System.out.println("ABC");
		}else if(n>=1200 && n < 2800) {
			System.out.println("ARC");
		}else if(n >= 2800) {
			System.out.println("AGC");
		}
	}
}


Measured memory_bytes: 21716
N, M = map(int, input().split())

#UnionFind木を使う

p = [-1] * N

def find(x):
    #print(x)
    if p[x] < 0:
        return x
    else:
        p[x] = find(p[x])
        return p[x]

def union(x, y):
    x = find(x)
    y = find(y)

    if x == y:
        return
    p[y] += p[x] #木のサイズをマイナスの方向に増やして記録していく
    p[x] = y
    return

def size(x):
    return -p[p[x]]

for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1

    union(a, b)

#print(p)
# xが子の場合，p[x] = 親（根，root）
# xが親の場合，p[x] = -1 * 木のサイズ

ans = max(map(size, range(N)))

print(ans)

Measured memory_bytes: 16852
#include<stdio.h>
int main(void)
{
	int a,b,c,x,y,i;
	scanf("%d %d %d",&a,&b,&c);
	x=b-a;
	if(c<a){
		printf("NO\n");
	}
	else if(c==a){
		printf("YES\n");
	}
	else if(c>a){
		y=a+b;
		if(y>=c){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

vvc<int> v;
int N,M,Q;
void dfs(int n,vi &A){
    if(n==N) {
        v.eb(A);
        return;
    }
    if(n!=0){
        rng(i,A[n-1],M+1){
            vi T=A;
            T.eb(i);
            dfs(n+1,T);
        }
    } else {
        rng(i,1,M+1){
            vi T=A;
            T.eb(i);
            dfs(n+1,T);
        }
    }
}
signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    cin >> N >> M >> Q;
    int A[Q],B[Q],C[Q],D[Q];
    rep(i,Q) {
        cin >> A[i] >> B[i] >> C[i] >> D[i];
        A[i]--; B[i]--;
    }
    vi P;
    dfs(0,P);
    int ans=0;
    for(auto a:v){
        int sum=0;
        rep(i,Q){
            if(a[B[i]]-a[A[i]]==C[i]) sum+=D[i];
        }
        chmax(ans,sum);
    }
    cout << ans << endl;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int sign(int x) { return (x > 0) - (x < 0); }
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int cdiv(int a, int b) { return (a - 1 + b) / b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T> T sq(T x) { return x * x; }
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const deque<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const set<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    int K;
    cin >> K;
    rep(i, K) { cout << "ACL"; }
    cout << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef pair<ll, ll> PLL;

#define REP(i, j) for(int i=0;i<j;i++)
#define DREP(i, j) for(int i=j;i>=0;i--)
#define FOR(i, b, e) for(int i=b; i<=e; i++)
#define FORD(i, b, e) for(int i=b; i>=e; i--)
#define SIZE(x) ((int)x.size())
#define LAST(x) (x[SIZE(x)-1])
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sp ' '
#define ent '\n'

ll dp[1005][1005];
char grid[1005][1005];
int h, w;

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

    cin >> h >> w;

    REP(i, h){
        REP(j, w){
            cin >> grid[i+1][j+1];
        }
    }
    dp[1][1]=1;
    REP(i, h){
        REP(j, w){
            if(grid[i+1][j+1]=='.'){
                dp[i+1][j+1]+=(dp[i+1][j]+dp[i][j+1]);
                dp[i+1][j+1]%=(1000000007);
            }
        }
    }

    cout << dp[h][w];

    return 0;
}


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

#define ll long long
#define de double
#define ri register int

de wat = 0, sug = 0, val = 0, ba = 100.0;
ll A, B, C, D, E, F;
ll a, b;

int main() {

    cin >> A >> B >> C;
    cin >> D >> E >> F;
    
    for(ri i = 0; 100 * i * A <= F; i ++) {
    ll res = 100 * i * A;
        for(ri j = 0; 100 * j * B + res <= F; j ++) {
        ll res2 = res + 100 * j * B;
            for(ri k = 0; k * C + res2 <= F; k ++) {
            ll res3 = res2 + k * C;
                for(ri l = 0; l * D + res3 <= F; l ++) {
                    if((i * A + j * B) * E < k * C + l * D) continue;
                    de wa = ba * i * A + ba * j * B;
                    de su = k * C + l * D;
                    if(val <= ba * su / (wa + su))
                    val = ba * su / (wa + su), wat = wa, sug = su;
                }
            }
        }
    }
    
    printf("%.0lf %.0lf\n", (wat + sug), sug);
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int N,M,X,x=0,y=0;
    cin>>N>>M>>X;
    int a[M];
    for(int i=0;i<M;i++){
        cin>>a[i];
    }
    for(int i=X;i<N;i++){
        for(int j=0;j<M;j++){
            if(i==a[j]){
                x++;
            }
        }
    }
    for(int i=X;i>0;i--){
        for(int j=0;j<M;j++){
            if(i==a[j]){
                y++;
            }
        }
    }
    cout<<min(x,y)<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    ll n,m,k; cin>>n>>m>>k;
    vector<ll> a(n),b(m);
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];

    vector<ll> s(n+1), t(m+1);
    rep(i,n) s[i+1] = s[i]+a[i];
    rep(i,m) t[i+1] = t[i]+b[i];

    ll ans = 0;
    for (int i = 0; i <= n; ++i) {
        ll tmp = i;
        if (s[i] > k) continue;
        ll rest = k-s[i];

        auto itr = upper_bound(t.begin(), t.end(), rest);
        int idx = itr-t.begin();
        tmp += idx-1;
        chmax(ans, tmp);
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 9584
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define all(v) (v).begin(),(v).end()
#define sz(v) (v).size()
// #define int long long
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
bool desc_sort(const int & lhs,const int & rhs)
{
    return lhs>rhs;
}
bool desc_pii_sort(const pii & lhs , const pii & rhs)
{
    return lhs>rhs;
}
bool second_sort(const pii & lhs , const pii & rhs)
{
    pii a,b;
    a.F = lhs.S;
    a.S = lhs.F;
    b.F = rhs.S;
    b.S = rhs.F;
    return a<b;
}
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
#else
    #define trace(...)
#endif


// #define int long long
#define modd 1e0



inline ll fast_expo(ll base,ll power,ll modulo=modd){
    base%=modulo;
    if (base<0LL) base+=modulo;
    ll x=base,cnt=power,ans=1LL;
    while(cnt){
        if (cnt&1LL) ans=(ans*x)%modulo;
        x=(x*x)%modulo;
        cnt>>=1LL;
    }
    // int tmp=ans;
    return ans;
}
inline ll inv(ll base,ll modulo=modd){
    return fast_expo(base,modulo-2LL,modulo);
}



signed main()
{
    #ifdef _SUBLIME
    ifstream cin("input.txt");
    ofstream cout("output.txt");
    #endif
    fio;
    int t;
    cin>>t;
    cout<<1-t<<endl;
    return 0;
}

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

int main(){
  int N,M;
  bool f = false;
  vector<string> s;

  cin >> N;

  s.resize(N);

  string work;
  for(int i=0;i<N;++i){
    cin >> work;
    s.emplace_back(work);
  }

  cin >> M;
  
  for(int ix=0;ix<M;++ix){
    cin >> work;

    for(int i=0;i<s.size();++i){
      if(s[i] == work){
	f = !f;
	if(f){
	  cout << "Opened by " << work << endl;
	}else{
	  cout << "Closed by " << work << endl;
	}
	break;
      }
      if(i == s.size() - 1){
	cout << "Unknown " << work << endl;
      }
    }
  }
  
  return 0;
}



Measured memory_bytes: 3200
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    A,B,C,D = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    
    c1=(A-1)//C
    d1=(A-1)//D
    c2=(B)//C
    d2=(B)//D
    
    lca=C*D//math.gcd(C,D)
    x1=(A-1)//lca
    x2=(B)//lca

    ans=B-A+1-(c2-c1)-(d2-d1)+(x2-x1)

    print(ans)



if __name__ == "__main__":
    main()

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

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

    int N; cin >> N;
    int d[N]; for (int i = 0; i < N; ++i) cin >> d[i];

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N; ++j) {
            ans += d[i]*d[j];
        }
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

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

a, b = na()
s = ns().strip()
import re
if re.match("^[0-9]{" + str(a) + "}-[0-9]{" + str(b) + "}$", s):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3188
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
const int maxn=2e5+7;
struct Edge{
	int to;
	int last;
}a[maxn<<1];
int n,m;
int tot;
int d[maxn];
int head[maxn];
inline void HA(int x,int y){
	a[++tot]=(Edge){y,head[x]};head[x]=tot;
	a[++tot]=(Edge){x,head[y]};head[y]=tot;
}
#define y a[i].to
inline void Dfs(int x,int prt){
	for(int i=head[x];i;i=a[i].last)
		if(y!=prt)d[y]=d[x]+1,Dfs(y,x);
	if(d[x]>d[m])m=x;
}
#undef y
int main(){
	scanf("%d",&n);
	for(int i=1,x,y;i<n;++i)
		scanf("%d%d",&x,&y),HA(x,y);
	m=0,Dfs(1,0);
	int temp=m;d[m]=0;
	m=0,Dfs(temp,0);
	puts(d[m]%3==1 ? "Second" : "First");
	return 0;
}


Measured memory_bytes: 9472
N = int(input())
T,A = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
mi = 1000
ans = 0
for i in range(N):
  t=T-H[i]*0.006
  if mi>abs(A-t):
    mi = abs(A-t)
    ans = i
print(ans+1)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 

int n,m,k,arr[N];

inline int mul(int a,int b){return (a*1ll*b)%MOD;}
inline int add(int a,int b){a+=b;if(a>=MOD)a-=MOD;return a;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,MOD-2);}

map<int,int>reall;
void get(int x)
{
	map<int,int>ans;
	for(int i = 2 ; i*i<=x ; i++)
	{
		int p = 0;
		while(x%i == 0)
		{
			x/=i;
			p++;
		}
		reall[i] = max(reall[i],p);
	}
	reall[x] = max(reall[x],1LL);
}


void solve()
{
    cin>>n;
    int g = 0;
    int x = 1;
    
    forn(i,1,n)
    {
    	cin>>arr[i];
    	get(arr[i]);
    }
    
    for(auto i : reall)
    {
    	x = mul(x,power(i.X,i.Y));
    	//cout<<i.X<<" "<<i.Y<<"\n";
    }
   // cout<<x;nl;
    int ans = 0;
    forn(i,1,n)
    {
    	ans = add(ans,mul(x,inv(arr[i])));
    }
    cout<<ans;
}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        solve();
        nl;
    }



    return 0;

}

//       clang++ c.cpp ; ./a.out < a.txt ;  

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    string s;
    cin>>s;
    bool ok=false;
    rep(i,3){
        if(s[i]=='7') ok=true;
    }
    cout<<(ok?"Yes": "No")<<endl;
}

Measured memory_bytes: 3624
def setup_combination_map(idx, seq, sum):
    if idx >= len(seq):
        ans_map[sum] = True
        return

    setup_combination_map(idx+1, seq, sum)
    setup_combination_map(idx + 1, seq, sum+seq[idx])
    return

n_num = int(input())
n_seq = [int(s) for s in input().split()]
q_num = int(input())
q_seq = [int(s) for s in input().split()]
ans_map = [False] * 2048
setup_combination_map(0, n_seq, 0)

for q in q_seq:
    if ans_map[q]:
        print("yes")
    else:
        print("no")



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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;


ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

int bins[70];
ll N;



/******************************************
** A main function is start from here  ****
*******************************************/
int main(){
  cin >> N;
  rep(i, N){
    ll tmp; cin >> tmp;
    int j=0;
    while(tmp>=1){
      bins[j] += tmp%2;
      tmp=tmp/2;
      j++;
    }
  }

  ll ans = 0;
  ll two = 1;
  rep(i, 61){
    ans = mod(ans + mod(mod((bins[i]*(N-bins[i])), MOD)*two, MOD), MOD);
    two = mod(two * 2, MOD);
  }

  cout << ans;
  
  return 0;
}


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

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}

use std::cmp::{max, min};

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

    if (a * a * b) - x < (a * a * b / 2.0) {
        let ans = (2.0 * ((a * a * b) - x)) / (a * a * a);
        let abs_difference = ans.atan().to_degrees();
        println!("{}", abs_difference);
    } else {
        let ans = (a - (a - ((2.0 * x) / (a * b)))) / b;
        let abs_difference = ans.atan().to_degrees();
        println!("{}", 90.0 - abs_difference);
    }
}


Measured memory_bytes: 4352
n = input()
n = list(n)
if n[0] == "1":
    print(9, end='')
if n[0] == str(9):
    print(1, end="")
if n[1] == str(1):
    print(9, end="")
if n[1] == str(9):
    print(1, end="")
if n[2] == str(1):
    print(9)
if n[2] == str(9):
    print(1)


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

int main() {
	int N, K;
	string S;
	cin >> N >> S >> K;
	char check = S.at(K - 1);
	for (int i = 0; i < N; i++) {
		if (S.at(i) != check) {
			S.at(i) = '*';
		}
	}
	cout << S << endl;
}

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



int main(){
    int n, x, y;
    cin >> n >> x >> y;
    vector<vector<int>> to(n);
    rep(i, n-1) {
        to[i].push_back(i+1);
        to[i+1].push_back(i);
    }
    x--; y--;
    to[x].push_back(y);
    to[y].push_back(x);

    vector<vector<int>> dist(n, vector<int>(n, -1));
    rep(start, n) {
        queue<int> q;
        q.push(start);
        dist[start][start] = 0;
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            for (int i = 0; i < to[v].size(); ++i) {
                int nv = to[v][i];
                if (dist[start][nv] >= 0) continue;
                q.push(nv);
                dist[start][nv] = dist[start][v] + 1;
            }
        }
    }

    vector<int> cnt(n);
    rep(start, n) {
        rep(i, n) {
            cnt[dist[start][i]] += 1;
        }
    }
    rep(i, n-1) {
        cout << cnt[i+1] / 2 << endl;
    }
}

Measured memory_bytes: 16128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define mkp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;


ll L,R;

ll dp[61][2][2][2];

void add(ll &a,ll b){
    a=(a+b)%MOD;
}

void mul(ll &a,ll b){
    a=a*b%MOD;
}

int main(){
  cin>>L>>R;
  
  dp[60][0][0][0]=1;
  for(int i=59;i>=0;i--){
      int lb=(L>>i)&1;
      int rb=(R>>i)&1;
      rep(j,2)rep(k,2)rep(s,2){

          rep(y,2)rep(x,2){
              if(y==0&&x==1) continue;

              int nj=j,nk=k,ns=s;
              ll cost=1;
              if(lb&&j==0&&x==0) continue;
              if(rb==0&&k==0&&y==1) continue;
              if(s==0&&(y==1&&x==0)) continue;

              if(y==1&&x==1){
                  if(s==0) ns=1;
                  if(lb==0&&j==0) nj=1;
              }

              if(y==1&&x==0){

              }

              if(y==0&&x==0){
                  if(rb&&k==0) nk=1;
              }


              ll val=cost;
              mul(val,dp[i+1][j][k][s]);
              add(dp[i][nj][nk][ns],val);
          }
      }
  }

  ll ans=0;
  rep(j,2)rep(k,2) add(ans,dp[0][j][k][1]);

  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 256
//Robs Code

/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <iomanip>

/***********MACROS***************/
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define pii pair<int,int>

using namespace std;

const int N = 1e5 + 1;
int n,m,i,j,k,l,x,y,z,cnt[3],sum[3];

/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	bool check = true;
	while(a > 0&& c > 0){
		if(check == false)a -= d;
		else c -= b;
		check ^= true;
	}
	if(check){
		cout << "No";
	}else{
		cout << "Yes";
	}
}
//........

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

struct edge{
	int to, dist, cost;
	edge() {};
	edge(int a, int b, int c) {to=a, dist=b, cost=c;}
};
vector<edge> e[202020];
int d[101010];

const int cap = 0;

void dijkstra(int s,int n, int m) {
	priority_queue<Pii, vector<Pii>, greater<Pii> > que;
	fill(d, d+n, inf);
	d[s] = 0;
	que.push(Pii(0,s));

	while (!que.empty()) {
		Pii p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;
		rep(i,0,e[v].size()) {
			edge u = e[v][i];
			if (d[u.to] > d[v]+u.dist) {
				d[u.to] = d[v]+u.dist;
				que.push(Pii(d[u.to], u.to));
			}
		}
	}
}

int main()
{
	while (1) {
		int n, m;
		cin >> n >> m;
		if (!n && !m) break;
		memset (e,0,sizeof(e));
		rep(i,0,m) {
			int u, v, d, c;
			scanf("%d %d %d %d", &u, &v, &d, &c);
			u--; v--;
			e[u].pb(edge(v,d,c));
			e[v].pb(edge(u,d,c));
		}
		dijkstra(0,n,m);

		int ans = 0;
		rep(i,1,n) {
			int cur = inf;
			//debug(d[i]);
			rep(j,0,e[i].size()) {
				if (d[i] == d[e[i][j].to] + e[i][j].dist) 
					cur = min(cur, e[i][j].cost);
			}
			//debug(cur);
			ans += cur;
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 13228
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int a,b,c,d,e,f,n;
	cin>>a>>b>>c>>d>>e>>f;
	n=a+5*b+10*c+50*d+100*e+500*f;
	if(n>=1000){
		cout<<'1'<<endl;
	}
	else{
		cout<<'0'<<endl;
	}
	
	return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

int A[200009];
int m1[200009]; // m1[i] : 1からi番目までの数字の最大値
int m2[200009]; // m2[i] : iからN番目までの数字の最大値

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

	int N; cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	m1[1] = A[1]; m1[0] = -INF;
	for (int i = 2; i <= N; i++) m1[i] = max(m1[i - 1], A[i]);
	m2[N] = A[N]; m2[N + 1] = -INF;
	for (int i = N - 1; i >= 1; i--) m2[i] = max(m2[i + 1], A[i]);

	for (int i = 1; i <= N; i++) {
		cout << max(m1[i - 1], m2[i + 1]) << endl;
	}

	return 0;
}

Measured memory_bytes: 3968
n = int(input())
heights = list(map(int,input().split()))

feed_count = 0
while True:
    flower_fed_exists = False
    for i in range(len(heights)):
        if heights[i] > 0:
            heights[i] -= 1
            if flower_fed_exists == False:
                flower_fed_exists = True
                feed_count += 1
        else:
            if flower_fed_exists == True:
                break
    if flower_fed_exists == False:
        print(feed_count)
        break

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
  int a[40]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin>>k;
  cout<<a[k-1];

}


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

int main(){
  std::string s;
  std::cin>>s;
  int i=s.length();
  std::string s1=s.substr(0,(i-1)/2);
  std::string s2=s.substr((i+1)/2,i-1);
  int test=1;
  for (int j=0;j<(i-3)/2;j++){
      if(s1[j]==s1[-j+(i-3)/2] && s1[j]==s2[j] && s1[j]==s2[-j+(i-3)/2]){
          continue;
      }else{
          test=0;
          break;
      }
  }
  if(test==1){
      std::cout<<"Yes"<<std::endl;
  }else{
      std::cout<<"No"<<std::endl;
  }
  return 0;
}

Measured memory_bytes: 256