akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int n, i;
	long long ans = 1;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		ans *= i;
		if (ans >= 1000000007) {
			ans %= 1000000007;
		}
	}
	printf("%d", ans);
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main{

  public static void main(String[] args){
  
  Scanner scan = new Scanner(System.in);
  
  int secAll = scan.nextInt();
  
  int hour = secAll / 3600;
  int min = secAll / 60 - hour * 60;
  int sec = secAll - ((hour * 3600) + (min * 60));
  
  System.out.println(hour + ":" + min + ":" + sec);
  }
}

Measured memory_bytes: 26036
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    print(N**3)



if __name__ == "__main__":
    main()

Measured memory_bytes: 61556
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S.at(i);

  vector<int> dx(8);
  dx = {-1, -1, -1, 0, 0, 1, 1, 1};
  vector<int> dy(8);
  dy = {-1, 0, 1, -1, 1, -1, 0, 1};

  rep(i, H) {
    rep(j, W) {
      int cnt = 0;
      char c = S.at(i).at(j);
      if (c == '.') {
        rep(k, 8) {
          int x = i + dx.at(k);
          int y = j + dy.at(k);
          if (x >= 0 && x < H) {
            if (y >= 0 && y < W) {
              char ca = S.at(x).at(y);
              if (ca == '#') cnt++;
            }
          }
        }
        S.at(i).at(j) = char(cnt + '0');
      }
    }
  }
  rep(i, H) cout << S.at(i) << endl;
}


Measured memory_bytes: 256
N, x = map(int, input().split())
a = [0] + list(map(int, input().split()))

ans = 0
for i in range(N):
    if a[i] + a[i + 1] > x:
        tmp = a[i] + a[i + 1] - x
        ans += tmp
        a[i + 1] -= tmp
print(ans)


Measured memory_bytes: 14540
#include <stdlib.h>
#include <stdio.h>
#define MAX_SIZE 45
static int fib(int n, int *m) {
  if (!m[n]) {
    m[n - 2] = fib(n - 2, m);
    m[n - 1] = fib(n - 1, m);
    m[n] = m[n - 2] + m[n - 1];
  }
  return m[n];
}

int main(int argc, char **argv) {
  int n, i;
  int m[MAX_SIZE];
  for (i = 0; i < MAX_SIZE; ++i) m[i] = 0;
  m[0] = m[1] = 1;
  scanf("%d", &n);
  printf("%d\n", fib(n, m));
  exit(0);
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = (1e5) + 5;
int n;
char s[N];
vector<int> partitions;

void partition(char arr[], int n) {
  partitions.clear();
  int len = 1;
  for (int i = 1; i <= n; ++i) {
    if (i < n and arr[i - 1] == arr[i]) {
      ++len;
    } else {
      partitions.push_back(len);
      len = 1;
    }
  }
}

int main() { // claudio van
  scanf("%d", &n);
  scanf("%s", s);
  partition(s, n);
  printf("%d\n", (int) partitions.size());
  return 0;
}

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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

const long long mod = 1000000007;
long long dp[100001];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    int N, M;
    cin >> N >> M;

    int a;
    for (int i=0; i<M; ++i) {
        cin >> a;
        dp[a] = -1;
    }

    dp[0] = 1;
    for (int i=0; i<N; ++i) {
        if (dp[i] == -1) continue;
        if (dp[i+1] != -1) {
            dp[i+1] += dp[i];
            dp[i+1] %= mod;
        }
        if (dp[i+2] != -1) {
            dp[i+2] += dp[i];
            dp[i+2] %= mod;
        }
    }

    cout << dp[N] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

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

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        for (int i = 0; i < K / 2; i++) {
            if (A % 2 == 0) {
                B = B + (A / 2);
                A = A / 2;
                
            } else {
                A = A - 1;
                B = B + (A / 2);
                A = A / 2;
                
            }
            if (B % 2 == 0) {
                A = A + (B / 2);
                B = B / 2;
                
            } else {
                B = B - 1;
                A = A + (B / 2);
                B = B / 2;
                
            }
            
        }
        if(K % 2 != 0){
            if (A % 2 == 0) {
                B = B + (A / 2);
                A = A / 2;
                
            } else {
                A = A - 1;
                B = B + (A / 2);
                A = A / 2;
                
            }
        }
        System.out.println(A + " " + B);
    }
}

Measured memory_bytes: 23380
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long M = sc.nextInt();
		int V = sc.nextInt();
		int P = sc.nextInt();
		List<Long> A = new ArrayList<>();
		for(int i = 0; i < N; i++)
			A.add(sc.nextLong());
		Collections.sort(A, Collections.reverseOrder());
		int ans = P;
		if(P >= V) {
			for(int i = P; i < N; i++) {
				if(A.get(i)+M < A.get(P-1))
					break;
				ans++;
			}
		}
		else {
			long[] sum = new long[N];
			if(P == 1) {
				sum[0] = A.get(0);
				for(int i = 1; i < N; i++) {
					sum[i] = sum[i-1];
					sum[i] += A.get(i);
				}
			}
			else {
				for(int i = P-1; i < N; i++) {	
					sum[i] = sum[i-1];
					sum[i] += A.get(i);
				}
			}
			for(int i = P; i < N; i++) {
				if(A.get(i)+M < A.get(P-1))
					break;
				if((i-(P-1))*(A.get(i)+M)-sum[i-1] < M*(V-(P-1+N-i)))
					break;
				ans++;
			}
		}
		System.out.println(ans);

	}

}

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

int main(){
    int n;
    cin >> n;
    int house[n];
    int min = 0;
    int max = 0;
    for(int i = 0; i < n; i++){
        cin >> house[i];
        if(i == 0){
            min = house[0];
            max = house[0];
        }
        else {
            if(min > house[i]) min = house[i];
            if(max < house[i]) max = house[i];
        }
    }
    cout << max - min << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);

    for(int i = 0; i < 100; i++){
    c -= b;
    if(c <= 0){
        printf("Yes");
        return 0;
    }
    a -= d;
    if(a <= 0){
        printf("No");
        return 0;
    }
    }
}

Measured memory_bytes: 1736
n=int(input())
s=input()
r=0
g=0
b=0
for i in s:
  if i=="R":
    r+=1
  elif i=="G":
    g+=1
  else:
    b+=1
p=r*g*b
for i in range(n-2):
  for j in range(i+1,n-1):
    if s[i]==s[j]:
      continue
    k=2*j-i
    if k<n and s[i]!=s[k] and s[j]!=s[k]:
      p-=1
print(p)

Measured memory_bytes: 73756
#include<bits/stdc++.h>
#define int long long
using namespace std;

int dp[105][5][5];
int mod = 10000;

int N,K;
int day[105];

signed main(){
    cin>>N>>K;
    for(int i=0;i<K;++i){
        int d,p;
        cin>>d>>p;
        day[d]=p;
    }
    dp[0][0][0]=1;
    for(int i=1;i<=N;++i){
        for(int j=0;j<=3;++j){
            for(int k=0;k<=3;++k){
                if(day[i]==0){
                    for(int p=1;p<=3;++p){
                        if(j==p&&k==p)continue;
                        dp[i][p][j]+=dp[i-1][j][k]%mod;
                    }
                }
                else{
                    if(j==day[i]&&k==day[i])continue;
                    dp[i][day[i]][j]+=dp[i-1][j][k]%mod;
                }
            }
        }
    }
    int ans=0;
    for(int i=1;i<=3;++i)for(int j=1;j<=3;++j)ans+=dp[N][i][j]%mod;
    cout<<ans%mod<<endl;
}

Measured memory_bytes: 1176
formula = gets.chomp.split
stack = Array.new
formula.each do |i|
  if i == '+'
    a = stack.pop.to_i
    b = stack.pop.to_i
    stack.push(a + b)
  elsif i == '*'
    a = stack.pop.to_i
    b = stack.pop.to_i
    stack.push(a * b)
  elsif i == '-'
    b = stack.pop.to_i
    a = stack.pop.to_i
    stack.push(a - b)
  else
    stack.push(i)
  end
end
puts stack[0]



Measured memory_bytes: 6872
#include <stdio.h>
#include <math.h>

int main() {
	long long int N;
	long long int a[5];
	scanf("%lld",&N);
	for (int i = 0; i < 5; i++) {
		scanf("%lld",&a[i]);
	}
	long long int min;
	min = a[0];
	for (int i = 1; i < 5; i++) {
		if (min > a[i]) min = a[i];
	}
	long double b,c;
	long long int ans;
	b = (long double)N/min;
	c = ceill(b);
	ans = (long long int)(c - 1);
	ans += 5;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>

int main() {
    std::vector<int> numbers;
    for (int i = 0; i < 4; ++i) {
        char N;
        std::cin >> N;
        numbers.push_back(std::stoi(std::string{N}));
    }
    numbers.erase(std::unique(numbers.begin(), numbers.end()), numbers.end());
    std::cout << (numbers.size() == 4 ? "Good" : "Bad") << std::endl;
    return 0;
}


Measured memory_bytes: 888
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val sequence = readLine()!!.split(" ").map { it.toInt() }
    val sortedSequence = sequence.sorted()

    if (sortedSequence == sequence) {
        println("YES")
        return
    }

    var diffCount = 0
    for (i in 0 until N) {
        if (sortedSequence[i] != sequence[i]) {
            diffCount += 1
        }
    }

    if (diffCount > 2) {
        println("NO")
    } else {
        println("YES")
    }
}


Measured memory_bytes: 36036
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	int n, m;
	cin >> n >> m;

	vector<pair<int, string>>s(m);

	vector<int>pr(n, 0);
	vector<int>pl(n, 0);

	for (int i = 0; i < m; i++) {
		cin >> s[i].first >> s[i].second;
		if (s[i].second == "AC") pr[s[i].first-1] = 1;
	}

	int a = 0;

	int b = 0;
	int flag = 0;
	for (int i = 0; i < m; i++) {
		if (s[i].second == "AC") {
			pl[s[i].first - 1] = 1;
		}
		if (s[i].second == "WA" && pr[s[i].first - 1] == 1 && pl[s[i].first - 1] == 0) {
			b++;
		}

	}
	

	REP(i, n) {
		if (pr[i] == 1) {
			a++;
		}
	}

	cout << a << " " << b << endl;

	return 0;

}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a;
  cin >> a;
  vector<double> vec(a);
  for(int i=0; i<a; i++){
    cin >> vec.at(i);
  }
  double ans = 0;
  for(int j=0; j<a; j++){
    ans = ans + 1/vec.at(j);
  }
  cout << setprecision(20) << 1/ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,x;
int l[150];
int main()
{
    cin>>n>>x;
    for(int i=1;i<=n;i++){
        cin>>l[i];
    }
    int flag=0,count=0;
    for(int i=1;i<=n+1;i++){
        if(flag>x){
            cout<<count;
            break;
        }
        if(i==n+1) cout<<count+1;
        flag+=l[i];
      //  cout<<flag<<endl;
        count++;
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<string> vs;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int h, w, d;
vi x, y;
int q;
vi l, r;

int main()
{
    cin >> h >> w >> d;
    x.resize(w * h); y.resize(w * h);
    rep(i, h){
        rep(j, w){
            int a; cin >> a;
            x[a - 1] = j; y[a - 1] = i;
        }
    }
    cin >> q;
    l.resize(q); r.resize(q);
    rep(i, q){ cin >> l[i] >>  r[i]; }
    rep(i, q){ l[i]--; r[i]--; }

    vi nums(h * w, 0);
    rep(i, h * w){
        if(i < d) continue;
        else{ nums[i] = nums[i - d] + abs(x[i - d] - x[i]) + abs(y[i - d] - y[i]); }
    }
    rep(i, q) { cout << nums[r[i]] - nums[l[i]] << endl; }

    return 0;
}

Measured memory_bytes: 2944
#include<stdio.h>
int main(void){
	int E,Y;
	scanf("%d %d",&E,&Y);
	if(E==0){
		if(1989<=Y&&Y<=2016){
			printf("H%d\n",Y-1988);
		}
		else if(1926<=Y){
			printf("S%d\n",Y-1925);
		}
		else if(1912<=Y){
			printf("T%d\n",Y-1911);
		}
		else if(1868<=Y){
			printf("M%d\n",Y-1867);
		}
	}
	else if(E==1){
		printf("%d\n",1867+Y);
	}
	else if(E==2){
		printf("%d\n",1911+Y);
	}
	else if(E==3){
		printf("%d\n",1925+Y);
	}
	else if(E==4){
		printf("%d\n",1988+Y);
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    string str;
    cin >> str;
    if (str[2] == str[3] && str[4] == str[5])
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[5];
int x, y;
bool ans = true;
int main()
{
    for (int i = 0; i < 3; i++)
    {
        cin >> x >> y;
        a[x]++;
        a[y]++;
    }
    for (int i = 0; i < 5; i++)
    {
        if (a[i] > 2)
        {
            ans = false;
        }
    }
    if (ans)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.math.BigInteger;

public class Main
{
	public static void main(String[] args)
	{
		Scanner cin = new Scanner(System.in);
		
		long a=1;
		for(int i=cin.nextInt(); i>0; i--)
		{
			a*=i;
		}
		System.out.println(a);
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int t = sc.nextInt();
		int s = sc.nextInt();
		sc.close();


		if(t*s>=d) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}


	}
}


Measured memory_bytes: 35592
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

long long fx(long long x, vector<long long> &a){
  long long sum = 0;
  for(long long i=0; i<(long long)a.size(); i++)
    sum += a[i] ^ x;
  return sum;
}

int main(){
  long long N,K;
  cin >> N >> K;
  vector<long long> A(N);
  vector<int> bit_nums(64);
  vector<int> x_vec(64);
  
  for(int i=0; i<N; i++) cin >> A[i];
  
  for(long long a: A){
    long long t = 0;
    for(int i=0; i<64; i++){
      t = a >> i;
      bit_nums[i] += (int)(t & (long long)1);
    }
  }
  
  for(int i=0; i<64; i++){
    if(N%2!=0){
      if(bit_nums[i]>(N/2)) x_vec[i] = 0;
      else x_vec[i] = 1;
    }else{
      if(bit_nums[i]>=(N/2)) x_vec[i] = 0;
      else x_vec[i] = 1;
    }
  }
  
  long long x = 0;
  for(int i=62; i>=0; i--){
    long long temp = x;
    temp += x_vec[i]*((long long)1<<i);
    if(temp > K) continue;
    else x = temp;
  }
  
  long long ans = fx(x,A);
  
  // cout << "x: " << x << ", ans: "<< ans << endl;
  cout << ans << endl;
}


Measured memory_bytes: 1024
n,m=map(int,input().split())
l=[0]*(m+10)

for _ in range(n):
    ll=list(map(int,input().split()))
    for i in range(ll[0]):
        l[ll[i+1]]+=1

ans=0

for i in range(m+1):
    if l[i]==n:
        ans+=1
print(ans)


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

int main(){
    double d1, d2;
    scanf("%lf %lf", &d1, &d2);
    if (d2 < d1) swap(d1, d2);
    if (d2-d1 < 180) printf("%.4f\n", (d1+d2)/2);
    else {
        d2-=360;
        d1=(d1+d2)/2;
        if (d1 < 0) d1+=360;
        printf("%.4f\n", d1);
    }
    return 0;
}



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

int main() {
    //
    string str;
    long long num;
    long long sum = 0;

    cin >> num;
    str = to_string(num);
    for (int i = 0; i < str.size(); i++) {
        sum += str.at(i) - '0';
    }

    if(num % sum == 0) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 3696
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

LL N, M;
int A[100000];
int main() {
	cin >> N >> M;
	int i = 0;
	while (N <= M) {
		++i;
		N <<= 1;
	}

	cout << i << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    string S, res; cin >> S;
    res = "";
    if (S=="Sunny")
    {
        res = "Cloudy";
    }
    else if (S== "Cloudy")
    {
        res = "Rainy";
    }
    else
    {
        res = "Sunny";
    }
    cout << res << endl;
	return 0;
}

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<ll> h(n);
  for(ll i=0;i<n;i++){
    cin >> h.at(i);
  }
  sort(h.begin(),h.end());
  ll cnt = 0;
  for(ll i=0;i<n-k;i++){
    cnt += h.at(i);
  }
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<utility>
#include<stdbool.h>
using namespace std;
typedef long long ll;
#define N (1000000000+7)

int main(void) {
	string w;
	cin >> w;
	map<char, int>a;
	for (int i = 0;i < w.length();i++) {
		a[w[i]]++;
	}
	for (char x = 'a';x <= 'z';x++) {
		if (a[x] > 0 && a[x] % 2 == 1) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    m,k=map(int,input().split())
    if(m==1):
        if(k>=1):
            print(-1)
            return
        else:
            print(0,0,1,1)
            return
    elif(k>=2**m):
        print(-1)
        return
    n=2**m
    ans=[]
    ans+=list(range(k-1,-1,-1))
    ans.append(k)
    ans+=list(range(k))
    ans+=list(range(k+1,n))
    ans.append(k)
    ans+=list(range(n-1,k,-1))
    print(*ans)
resolve()

Measured memory_bytes: 57068
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
	ll a,b;
	cin>>a>>b;
	if(a-2*b<=0){
		cout<<0<<endl;
		return 0;
	}
	else
		cout<<a-2*b<<endl;
	return 0;
}


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

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}

fn main() {
    let v : Vec<i64> = get_vec();
    let (a,b,c,k) = (v[0],v[1],v[2],v[3]);
    let mut ans = 0;
    if k % 2 == 0 {
        ans = a - b;
    }
    else {
        ans = b - a;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int N, T;
    cin >> N >> T;
    pii p[N];
    rep(i, N){
        int A, B; cin >> A >> B;
        p[i] = pii(B, -A);
    }
    sort(p, p+N);
    //dp[i][j]:=[0,i)の皿でT以内に獲得できる美味しさの合計
    int dp[N+1][T];
    fill(dp[0], dp[N+1], 0);
    rep(i, N){
        int c = p[i].first, t = -p[i].second;
        rep(j, T){
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            if(j+t >= T) continue;
            dp[i+1][j+t] = max(dp[i+1][j+t], dp[i][j]+c);
        }
    }
    int sumt = 0, sumv = 0, ans = 0;
    //最後にi番目の料理を使う
    rep3(i, N-1, 0){
        if(sumt >= T) break;
        sumv += p[i].first;
        ans = max(ans, dp[i][T-1-sumt]+sumv);
        sumt -= p[i].second;
    }
    cout << ans << endl;
}

Measured memory_bytes: 35456
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(a*n, b) << 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-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int N, K;
ll inp[1000001];

vector<ll> dividedNum(ll n){
    //n == 2 && n == 1の時エラー
    vector<ll> res;
	ll lim = sqrt(n)+1;
    for(ll i=1; i<lim; i++){
        if(n%i==0){
            res.push_back(i);
            if(i != n / i && lim <= n/i){
                res.push_back(n/i);
            }
        }
    }
    return res;
}


int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);
	memr(inp, 0);
	cin >> N>> K;
	ll sum = 0;
	rep(i, N){
		cin >> inp[i];
		sum += inp[i];
	}

	vector<ll> divs = dividedNum(sum);

	ll ans = 0;
	for(ll div : divs){
		vector<ll> mp;
		ll tmp = 0;
		ll tmp2 = 0;
		rep(i, N){
			ll num = inp[i] % div;
			mp.push_back(num);
			tmp2 += num;
		}
		sort(ALL(mp));
		int k = 0;
		print(tmp2 / div, tmp2);
		rrep(i, mp.size()){
			if(k == tmp2 / div) break;
			k++;
			tmp += div - mp[i];
		}
		print(tmp);
		if(tmp > K) continue;
		chmax(ans, div);
	}

	cout << ans << endl;



	return 0;
}


Measured memory_bytes: 11488
#include<bits/stdc++.h>
#define N 300000
#define P 1000001
using namespace std;
typedef long long ll;
ll n,m,a,b[N],c[N];
ll dp[P];

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    dp[a]++;
  }
  for(int i=0;i<P;i++)dp[i]=dp[i]*i;
  for(int i=1;i<P;i++)dp[i]=dp[i-1]+dp[i];
  cin>>m;
  for(int i=0;i<m;i++)cin>>b[i];
  for(int i=0;i<m;i++)cin>>c[i];
  for(int i=0;i<m;i++){
    if(dp[b[i]]>=c[i])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

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

#define maxn 200005
#define INF 0x3f3f3f3f
#define mod 1000000007
typedef long long ll;
using namespace std;

int K, N, A[maxn];


void slove()
{
	ll delt = 0, maxd = -INF;
	cin >> K >> N;
	for (int i = 0; i < N; i++)
		cin >> A[i];
		
	maxd = K - A[N - 1] + A[0];
	for (int i = 1; i <= N; i++)
	{
		delt = A[i] - A[i - 1];
		if (delt > maxd)
			maxd = delt;
	}
	cout << K - maxd << '\n';
}

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

	slove();

	return 0;
}

Measured memory_bytes: 1024
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    x = int(input())

    if x >= 30:
        print("Yes")
    else:
        print("No")


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """25"""
        output = """No"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """30"""
        output = """Yes"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


Measured memory_bytes: 70884
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<long long,long long>;
typedef unsigned long long ull;
typedef long long ll;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

  
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int sum=0;
  sort(a.begin(),a.end(),greater<int>());
  rep(i,k)sum+=a[i];
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)1e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
vi v(10);
int check(){
	ll i=0;
	while(!v[i]) i++;i++;
	for(;i<10;i++) if(abs(v[i]-v[i-1])>1) return 0;
	return 1;
}void inc(){
	ll c=1;
	for(ll i=9;i>=0;i--){
		v[i]+=c;
		if(v[i]==10) v[i]=0,c=1; else c=0;
	}
}void dec(){
	ll c=1;
	for(ll i=9;i>=0;i--){
		v[i]-=c;
		if(v[i]==-1) v[i]=9,c=1; else c=0;
	}
}
int main(){
	ll k,i,j;cin>>k;while(k--){
		inc();
		if(!check()){
			dec();j=0;
			while(!v[j]) j++;
			for(i=8;i>j;i--){
				if(v[i]<=v[i-1]&&v[i]<9) break;
			}if(v[i]==9) i--;
			v[i]++;i++;
			for(;i<10;i++) v[i]=max(v[i-1]-1,(ll)0);
		}
//		print(v);
	}
	i=0;while(!v[i]) i++;for(;i<10;i++) cout<<v[i];cout<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

LL fact(LL x)
{
    LL ret = 1;
    for (LL i = 2; i <= x; ++i) {
        ret *= i;
    }
    return ret;
}

bool comp(const vector<int>& x, const vector<int>& y) {
    rep(i, x.size()) {
        if (x[i] != y[i]) return false;
    }
    return true;
}

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

    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    rep(i, N) cin >> P[i];
    rep(i, N) cin >> Q[i];

    vector<int> R(N);
    rep(i, N) R[i] = i+1;

    int p = -1;
    int q = -1;
    int o = 0;
    while (p < 0 || q < 0) {
        if (p < 0 && comp(P, R)) {
            p = o;
        }
        if (q < 0 && comp(Q, R)) {
            q = o;
        }
        ++o;
        next_permutation(R.begin(), R.end()); 
    }

    cout << abs(p-q) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
const int MM = 55;
using ld = double;

int n;
double x[MM], y[MM], ans = 1e16;

double dis(double x1, double y1, double x2, double y2){
    return sqrtl((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}
void check(double cx, double cy){
    double mx = 0;
    for(int i=0; i<n; i++)
        mx = max(mx, dis(x[i], y[i], cx, cy));
    ans = min(ans, mx);
    //cout << cx << ' ' << cy << ' ' << mx << '\n';
}
void cent(int a, int b, int c){
    ld a1 = x[b]-x[a], b1 = y[b]-y[a], c1 = (a1*a1 + b1*b1)/2;
    ld a2 = x[c]-x[a], b2 = y[c]-y[a], c2 = (a2*a2 + b2*b2)/2;
    ld d = a1*b2 - a2*b1;
    if(d != 0)
        check(x[a] + (c1*b2 - c2*b1)/d, y[a] + (a1*c2 - a2*c1)/d);
}

int main(){
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> x[i] >> y[i];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            double cx = (x[i]+x[j])/2, cy = (y[i]+y[j])/2;
            check(cx, cy);
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < i; j++)
            for(int k = 0; k < j; k++)
                cent(i, j, k);
    }
    
    printf("%.9lf\n", ans);
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 1000



int main(){

  int i,j,num,num_1,elem,d;
  int M[N][N];


 scanf("%d",&num);

  for(i=1;i<=num;i++){
    for(j=1;j<=num;j++){

      M[i][j]=0;
    }
  }


 
  for(i=1;i<=num;i++){

    scanf("%d %d",&num_1,&d);
    for(j=1;j<=d;j++){

      scanf("%d",&elem);
      M[i][elem]=1;
    }
  }

 for(i=1;i<=num;i++){
    for(j=1;j<=num;j++){

      printf("%d", M[i][j]);
      if(j < num)printf(" ");

    }
    puts("");
 }

  return 0;
}

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

using namespace std;

const int N = 100005;
set <int> g[N];

int main()
{
  int n;
  scanf("%d", &n);
  
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    g[i].insert(x);
  }
  
  int res = 0;
  
  for (int j = 1; j <= n; ++j) {
    for (int i : g[j]) {
      if (i >= j) continue;
      if (g[i].count(j)) {
        res++;
      }
    }
  }
  
  printf("%d\n", res);
  return(0);
}

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

using namespace std;

int main() {
  int N, M, P;
  cin >> N >> M >> P;
  vector<int> A(M), B(M), C(M);
  for (int i = 0; i < M; i++) {
    cin >> A[i] >> B[i] >> C[i];
    A[i]--;
    B[i]--;
    C[i] = P - C[i];
  }
  const long long inf = 1e12;
  vector<long long> D(N, inf);
  vector<bool> can_goal(N);
  D[0] = 0;
  can_goal[N - 1] = true;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (can_goal[B[j]]) {
        can_goal[A[j]] = true;
      }
      if (D[A[j]] != inf and D[B[j]] > D[A[j]] + C[j]) {
        D[B[j]] = D[A[j]] + C[j];
        if (i == N - 1 and can_goal[B[j]]) {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }
  long long ans = max(0LL, -D[N - 1]);
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 384
# a, b, c, x = map(int, input().split())
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if (500*i + 100*j + 50*k) == x:
        cnt += 1
print(cnt)

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

int main(){
    long long h,n;
    vector<long long> a;
    long long sum=0;
    cin >> h >> n;
    a.resize(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum += a[i];
    }
    if(sum>=h){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a + b) > (c + d)) {
        cout << "Left" << endl;
    } else if ((a + b) < (c + d)) {
        cout << "Right" << endl;
    } else {
        cout << "Balanced" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  while (true) {
    int n, m, a;
    int data[101][1001] = {};

    cin >> n >> m >> a;
    if (n == 0)
      break;

    for (int i = 0; i < m; ++i) {
      int h, p, q;
      cin >> h >> p >> q;
      data[p][h] = q;
      data[q][h] = p;
    }

    int c = a;
    for (int i = 1000; 0 < i; --i)
      c = data[c][i] ? data[c][i] : c;

    cout << c << endl;
  }
}


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

using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(a[i]==a[j] || a[j]==a[k] || a[k]==a[i]){
                    continue;
                }
                int mx=max(a[i],max(a[j],a[k]));
                long long sum=0ll+a[i]+a[j]+a[k];
                if(sum<=2ll*mx){
                    continue;
                }
                ++ans;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
# -*- coding: utf-8 -*-

import sys
import os
import math

for s in sys.stdin:
    a, b = map(float, s.split())

    if a < 35.5 and b < 71:
        print('AAA')
    elif a < 37.5 and b < 77:
        print('AA')
    elif a < 40 and b < 83:
        print('A')
    elif a < 43 and b < 89:
        print('B')
    elif a < 50 and b < 105:
        print('C')
    elif a < 55 and b < 116:
        print('D')
    elif a < 70 and b < 148:
        print('E')
    else:
        print('NA')

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

int main() {
	int ans = 0;
	long long X;
	long long yokin=100;
	cin >> X;
	bool check = true;
	while (check) {
		yokin *= 1.01;
		ans++;
		if (yokin >= X) {
			check = false;
		}
	}
	
	cout << ans;

	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	long long x,k;
	cin >> x >> k;
	if(x>k){
		cout << min(abs((x%k)-k),x%k) << endl;
	}
	else if(x==k) cout << 0 << endl;
	else if(x<k){
		cout << min(x,abs(k-x)) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

ans = [""]*n

for i in range(n):
    ans[a[i]-1] = str(i+1) #aのi番インデックスの値から１引いたものがans配列のインデックスになる。値は出席番号(i+1)

print(" ".join(ans))

Measured memory_bytes: 20904
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n, m; cin >> n >> m;
    vector<vector<ll>> g(n, vector<ll>(n, INF));
    REP(i, n) g[i][i] = 0;
    vector<ll> a(m), b(m), c(m);
    REP(i, m) {
        cin >> a[i] >> b[i] >> c[i];
        --a[i]; --b[i];
        g[a[i]][b[i]] = g[b[i]][a[i]] = c[i];
    }
    REP(k, n) REP(i, n) REP(j, n) {
        chmin(g[i][j], g[i][k] + g[k][j]);
    }

    ll ans = 0;
    REP(k, m) {
        bool used = false;
        if (c[k] > g[a[k]][b[k]]) ans++;
    }
    std::cout << ans << endl;
    
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2000000000;
using namespace std;

const int sqrtN = 512;

class sqdiv{
    public:
        int N, K;
        vector<int> data;
        vector<int> bkt;
        sqdiv(int n){ //?????±???????????????????????´
            N = n;
            K = (N + sqrtN - 1) / sqrtN;
            data.assign(K * sqrtN, 0);
            bkt.assign(K, 0);
        }
        void add(int x, int y){
            int k = x / sqrtN;
            data[x] += y;
            int sum = 0;
            for(int i = k * sqrtN; i < (k + 1) * sqrtN; i++){
                sum += data[i];
            }
            bkt[k] = sum;
        }
        int getSum(int x, int y){
            int sum = 0;
            rep(k,K){
                int l = k * sqrtN, r = (k + 1) * sqrtN;
                if(r <= x || y <= l) continue;
                if(x <= l && r <= y){
                    sum += bkt[k];
                }else{
                    for(int i = max(x, l); i < min(y, r); i++){
                        sum += data[i];
                    }
                }
            }
            return sum;
        }
};

int main(){
    int n,q;
    cin >> n >> q;
    sqdiv ob(n);
    rep(i,q){
        bool com;
        int a, b;
        cin >> com >> a >> b;
        if(com){
            cout << ob.getSum(a,b + 1) << endl;
        }else{
            ob.add(a,b);
        }
    }
}

Measured memory_bytes: 3092
#include<stdio.h>
int a,b,c;
int main(){
	while(scanf("%d%d%d",&a,&b,&c)!=EOF){
		if(a==b)
			printf("%d\n",c);
		else if(a==c)
			printf("%d\n",b);
		else
			printf("%d\n",a);
	}
	return 0;
} 

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<limits.h>
#include<stdbool.h>

typedef  long long ll;

ll int_cmp(const void *a, const void *b) 
{ 
    const int *ia = (const int *)a;
    const int *ib = (const int *)b;
    return *ia  - *ib; 

} 



int max(int a,int b){
	if(a<b)
		a=b;
	return a;	
}

int min(int a,int b){
	if(a>b)
		a=b;
	return a;	
}

int absolu(int n){
	if(n<0)
		n*=-1;
	
	return n;	
}

void solve(){
	int a[100],i,n;
	
	scanf("%d",&n);
	
	for(i=0 ; i<n ; i++){
		scanf("%d",&a[i]);
	}
	int ans=0;
	for(i=0 ; i<n ; i++){
		if(a[i]%2!=0 && (i+1)%2!=0){
			ans++;
		}
	}
	
	printf("%d\n",ans);
}



int main(){
/*int t;
	scanf("%d",&t);
	while(t--)*/
		solve();
	
	return 0;
}	
					


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

struct Problem {

    UL dp[101][10001] = {};

    void Solve() {
        UL N, W; cin >> N >> W;
        rep(i, N) {
            UL v, w, m; cin >> v >> w >> m;
            rep(M, w) {
                deque<UL> Q;
                for (UL t = 0; t * w + M <= W; t++) {
                    if (Q.size()) if (Q.front() + m < t) Q.pop_front();
                    UL p = t * w + M;
                    while (Q.size()) {
                        if (dp[i][Q.back() * w + M] + t * v > dp[i][p] + Q.back() * v) break;
                        Q.pop_back();
                    }
                    Q.push_back(t);
                    dp[i + 1][p] = dp[i][Q.front() * w + M] + v * (t - Q.front());
                }
            }
        }
        cout << dp[N][W] << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    //cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}




Measured memory_bytes: 6692
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < n; i++)
 
using namespace std;
 
int main() {
  int n, m;
  cin >> n >> m;
  cout << ((n * (n - 1)) / 2) + ((m * (m - 1)) / 2) << endl;
  
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
    string s;
    cin>>s;
    V<int> ans(s.size()+1,0);
    int n=s.size();
for(int i=0;i<n;i++){
  if(s[i]=='<')ans[i+1]+=ans[i]+1;
}
for(int i=n-1;i>=0;i--){
  if(s[i]=='>')chmax(ans[i],ans[i+1]+1);
}
ll sum=0;
for(int i=0;i<=n;i++)sum+=ans[i];
cout<<sum<<endl;
}

Measured memory_bytes: 2844