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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT2_WITHOUT_SPACE(vector<vector<ll>> V)
{
    ll Vsize = V.size();
    ll Visize = V[0].size();
    for(ll i=0;i<Vsize;i++)
    {
        for(ll j=0;j<Visize;j++)
        {
            cout << V[i][j];
        }
        cout << endl;
    }
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

pair<ll,ll> Graph(ll H, ll W, ll A, ll B)
{
    for(ll i=H;i>=0;i--)
    {
        for(ll j=W;j>=0;j--)
        {
            if(A*H + (W-2*A)*i == B*W + (H-2*B)*j)
            {
                return make_pair(i,j);
            }
        }
    }
    return make_pair(-1,-1);
}

void Ans_OUT(ll H, ll W, ll A, ll B, pair<ll,ll> notA_notB)
{
    if(notA_notB.first == -1)
    {
        OUT0("No");
    }
    else
    {
        vector<ll> tate(H,A);
        for(ll i=0;i<notA_notB.first;i++)
        {
            tate[i] = W-A;
        }
        vector<ll> yoko(W,B);
        for(ll i=0;i<notA_notB.second;i++)
        {
            yoko[i] = H-B;
        }
        vector<vector<ll>> graph(H,vector<ll>(W,0));
        for(ll i=0;i<H;i++)
        {
            for(ll j=0;j<W;j++)
            {
                if(tate[i]>0 && yoko[j]>0)
                {
                    graph[i][j] = 1;
                    tate[i]--;
                    yoko[j]--;
                }
            }
        }
        /*
        for(ll i=0;i<H;i++)
        {
            if(tate[i]!=0)
            {
                OUT0("-1");
                return;
            }
        }
        for(ll i=0;i<W;i++)
        {
            if(yoko[i]!=0)
            {
                OUT0("-1");
                return;
            }
        }*/
        ALLOUT2_WITHOUT_SPACE(graph);
    }
}

int main()
{
    ll H,W,A,B;
    cin >> H >> W >> A >> B;

    pair<ll,ll> notA_notB = Graph(H,W,A,B);

    Ans_OUT(H,W,A,B,notA_notB);
    
    return 0;
}

Measured memory_bytes: 16896
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb push_back
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

int N, M;
const int mod = 998244353;
ll F[500050], IF[500050];
ll pw(ll x, ll y = mod - 2) {
	ll res = 1;
	while(y) {
		if(y & 1) res = res * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}

ll nCr(int n, int r) {
	if(r < 0 || r > n) return 0;
	return F[n] * IF[r] % mod * IF[n-r] % mod;
}

ll f[500050];

int main() {
	scanf("%d%d", &N, &M);
	F[0] = 1; for(int i=1;i<500050;i++) F[i] = i * F[i-1] % mod;
	IF[500049] = pw(F[500049]);
	for(int i=500048;i>=0;i--) IF[i] = (i+1) * IF[i+1] % mod;
	if(N > M) swap(N, M);
	int ans = 0;
	for(int k=0;k<=N;k++) {
		ans = (ans + pw(mod-1, k) * nCr(N, k) % mod * nCr(M, k) % mod * F[k] % mod * pw(M+1, N-k) % mod * pw(N+1, M-k)) % mod;
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 9984
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

// 重み付きUnion-Find
struct UnionFind {
  vector<int> par;
  vector<int> rnk;
  vector<int> diff_weight;
  int n;
  UnionFind(int n):n(n){
    par.resize(n);rnk.resize(n);diff_weight.resize(n);
    for(int i=0; i<n; i++){par[i] = i;rnk[i] = 0;diff_weight[i]=0;}
  }
  int find(int x){
      if(par[x] == x) return x;
      int r = find(par[x]);
      diff_weight[x] += diff_weight[par[x]];
      return par[x] = r;
  }
  // y - x = w
  bool unite(int x, int y, int w){
      w += weight(x);
      w -= weight(y);
      x = find(x);
      y = find(y);
      if(x == y) return false;
      if(rnk[x] < rnk[y]) swap(x, y), w = -w;
      if(rnk[x] == rnk[y]) rnk[x]++;
      par[y] = x;
      diff_weight[y] = w;
      return true;
  }
  bool isSame(int x, int y){return find(x) == find(y);}
  int weight(int x){
    find(x);
    return diff_weight[x];
  }
  int diff(int x, int y){
    return weight(y) - weight(x);
  }
};


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,q;
  cin>>n>>q;
  UnionFind UF(100005);
  FOR(i,0,q){
    int a;
    cin>>a;
    if(a==0){
      int x,y,z;
      cin>>x>>y>>z;
      UF.unite(x,y,z);
    } else {
      int x,y;
      cin >> x >> y;
      if(UF.isSame(x, y)) cout << UF.diff(x, y) << endl;
      else cout << "?" << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 4172
N = int(input())
p = list(map(float,input().split()))
# dp[i][j] コインiまで投げて表の個数がjとなる確率
dp = [[0] * (N+1) for i in range(N+1)]
dp[1][1] = p[0]
dp[1][0] = 1 - p[0]
for i in range(2,N+1):
    dp[i][0] = dp[i-1][0] * (1 - p[i-1])
    for j in range(1,N+1):
        dp[i][j] = dp[i-1][j-1] * p[i-1] + dp[i-1][j] * (1 - p[i-1])
ans = sum(dp[N][(N+1)//2:])
print(ans)

Measured memory_bytes: 259848
MAX_N = 10**5

N = int(input())

dp = [MAX_N]*(N+1)
dp[0] = 0
dp[1] = 1

MONEY_LIST = [6**i for i in range(7)]
MONEY_LIST.extend([9**i for i in range(1,6)])
MONEY_LIST.sort()

for i in range(N+1):
    for m in MONEY_LIST:
        if m>i:
            break
        
        dp[i] = min(dp[i],dp[i-m]+1)
        
print(dp[N])

Measured memory_bytes: 3828
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

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

type Job struct {
	A, B int
}

func main() {
	defer stdout.Flush()
	N := readInt()
	J := make([]Job, N)
	for i := range J {
		J[i].A = readInt()
		J[i].B = readInt()
	}

	pq := new(PriorityQueue)

	for _, x := range J {
		// push(x)
		heap.Push(pq,x)
	}
	t := 0
	for pq.Len() != 0  {
		j := heap.Pop(pq).(Job)
		t += j.A
		if j.B < t {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")

}

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

type PriorityQueue []Job

func (pq PriorityQueue) Len() int {
	return len(pq)
}

func (pq PriorityQueue) Less(i, j int) bool {
	return pq[i].B < pq[j].B
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

func (pq *PriorityQueue) Push(x interface{}) {
	old := *pq
	*pq = append(old, x.(Job))
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old) - 1
	x := old[n]
	*pq = old[:n]
	return x
}

Measured memory_bytes: 20096
#include <stdio.h>
 
int main(void){
    long long n = 0;
    int temp;
    
    while((temp = getchar()) != '\n'){
        n += temp - '0';
    }
 
    if((n % 9) == 0){
        printf("Yes");
    } else {
        printf("No");
    }
 
    
    return 0;
}

Measured memory_bytes: 1576
#include "bits/stdc++.h"
using namespace std;


int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h.at(i);
	}

	sort(h.begin(), h.end());
	int64_t ans = 0;
	if (k >= n) {
		ans = 0;
	} else {
		for (int i = 0; i < n - k; i++) {
			ans += h.at(i);
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 1024
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    cout << t << s << '\n';
    return 0;
}


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

class Main{
  public static void main(String[] a){
    Scanner sc = new Scanner(System.in).useDelimiter("\n");
    ArrayList<String> alstr = new ArrayList<String>();
    while(sc.hasNext()){
      alstr.add(sc.next());
    }

    char[] chararray = null;
    int strlen = 0;

    for (String str : alstr) {
      for(int offset = 0; offset<26; offset++){
        chararray = str.toCharArray();
        strlen = str.length();
        for (int iter = 0; iter < strlen; iter++) {
          if(chararray[iter] < 'a' || 'z' < chararray[iter]) {
            continue;
          }
          chararray[iter]++;
          if(chararray[iter] > 'z') chararray[iter]-=26;
        }

        str = String.valueOf(chararray);
        String[] strarr = str.split(" ");
        if(Arrays.asList(strarr).contains("the") || Arrays.asList(strarr).contains("that") || Arrays.asList(strarr).contains("this")){
          System.out.println(str);
          break;
        }
      }
    }
  }
}

Measured memory_bytes: 16320
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

int main() {
  int a, b, t;
  cin >> a >> b >> t;
  cout << t / a * b << endl;
}


Measured memory_bytes: 256
from collections import deque
def D():
    n, m = map(int, input().split())
    G = {}
    for i in range(n+1):
        G[i] = []
    for _ in range(m):
        a, b = map(int, input().split())
        G[a].append(b)
        G[b].append(a)
    visited = [False] * (n+1)
    visited[1] = True
    mark = [0] * (n+1)
    dq = deque()
    for node in G[1]:
        mark[node] = 1
        visited[node] = True
        dq.append(node)
    while len(dq) != 0:
        node = dq.popleft()
        for next_node in G[node]:
            if not visited[next_node]:
                mark[next_node] = node
                visited[next_node] = True
                dq.append(next_node)
    print("Yes")
    for i in range(n-1):
        print(mark[i+2])
D()


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

import sys
import os
import math

x_per_liter = int(input())
y_base_cost = int(input())
y_limit = int(input())
y_addition = int(input())
liter = int(input())

x_cost = x_per_liter * liter
if liter <= y_limit:
    y_cost = y_base_cost
else:
    y_cost = y_base_cost + y_addition * (liter - y_limit)

print(min(x_cost, y_cost))

Measured memory_bytes: 7648
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i <= (int)n; i++)

using namespace std;

int main() {
  int N = 0;
  char C;
  bool flag = false;
  cin >> N;
  
  
  rep(i, N) {
    cin >> C;
    if (C == 'Y') {
      flag = true;
      break;
    }
  }
  if (flag) {
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
const int MAXN = 1e5 + 10;

int N, K, X[MAXN];

namespace FastIO {
	template <typename T>
	void read(T & x) {
		x = 0; register char ch = getchar(); register int f = 0;
		for (; ch < '0' || ch > '9'; f |= ch == '-', ch = getchar());
		for (; ch >= '0' && ch <= '9'; x = (x << 3) + (x << 1) + (ch ^ '0'), ch = getchar());
		if (f) x = ~x + 1;
	}
}

int main() {
	using FastIO::read;
	read(N), read(K);
	int ans = 0x7f7f7f7f;
	for (int i = 0; i < N; i++) read(X[i]);
	for (int i = N - 1; i + 1 >= K; i--) {
		// printf("i=%d, i-K+1=%d\n", i, i-K+1);
		int l = X[i - K + 1], r = X[i];
		if (l <= 0 && r >= 0) ans = std::min(ans, std::min(-l * 2 + r, r * 2 - l));
		else ans = std::min(ans, std::max(std::abs(l), std::abs(r)));
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;
int main()
{
    ll a, b;
    cin >> a >> b;
    if (a % b == 0)
        cout << -1 << endl;
    else
        cout << a * (b - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define mod 1000000007
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	int p,q,r;
	scanf("%d%d%d",&p,&q,&r);
	int ans=MIN(p+q,MIN(p+r,q+r));
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, M, A, B, t[700], res;
bool C[700][700], D[702];
vector<int>v[700];

int T(int x) {
	if (t[x] < 0)return x;
	else return t[x] = T(t[x]);
}

int U(int x, int y) {
	x = T(x);
	y = T(y);
	if (x == y)return -1;
	if (x < y) {
		t[x] += t[y];
		t[y] = x;
		for (int i : v[y]) {
			v[x].push_back(i);
		}
		return x;
	}
	else {
		t[y] += t[x];
		t[x] = y;
		for (int i : v[x]) {
			v[y].push_back(i);
		}
		return y;
	}
}

int main() {
	cin >> N >> M;
	if (M == N*(N - 1) / 2) {
		cout << (N / 2)*(N / 2 - 1) / 2 + ((N + 1) / 2)*((N + 1) / 2 - 1) / 2 << endl;
		return 0;
	}
	for (int i = 0; i < M; ++i) {
		cin >> A >> B;
		--A;
		--B;
		C[A][B] = C[B][A] = true;
	}
	for (int i = 0; i < N; ++i) {
		t[i] = -1;
		for (int j = 0; j < N; ++j) {
			if (i == j)continue;
			if (!C[i][j]) {
				v[i].push_back(j);
			}
		}
	}
	bool f = true;
	while (f) {
		f = false;
		for (int i = 0; i < N; ++i) {
			if (t[i] < 0) {
				while (v[i].size() >= 2) {
					int u = U(v[i].back(), v[i][v[i].size() - 2]);
					v[i].pop_back();
					if (u != -1) {
						v[i].back() = u;
						f = true;
					}
				}
			}
		}
	}
	for (int i = 0; i < N; ++i) {
		if (t[i] < 0) {
			if(!v[i].empty()){
				v[i][0] = T(v[i][0]);
			}
		}
	}
	D[0] = true;
	for (int i = 0; i < N; ++i) {
		if (t[i] < 0) {
			if (v[i].size()) {
				if (v[i].front() == i) {
					cout << -1 << endl;
					return 0;
				}
				for (int j = N; j >= 0; --j) {
					if (D[j]) {
						D[j] = false;
						D[min(j - t[i], N + 1)] = true;
						D[min(j - t[v[i].front()], N + 1)] = true;
					}
				}
				t[v[i].front()] = 0xE869120;
			}
			else {
				for (int j = N + t[i]; j >= 0; --j) {
					if (D[j]) {
						D[j - t[i]] = true;
					}
				}
			}
		}
	}
	res = intmax;
	for (int i = 0; i <= N; ++i) {
		if (D[i]) {
			res = min(res, i*(i - 1) / 2 + (N - i)*(N - i - 1) / 2);
		}
	}
	cout << res << endl;
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  set<int> st;
  for (int i = 0; i < N; i++) {
    int d;
    cin >> d;
    st.insert(d);
  }
  
  cout << st.size() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<chrono>
#include<typeinfo>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds; 
#define lli long long int
#define fr(i,a,b) for(lli i=a;i<b;i++)
#define bfr(i,a,b) for(lli i=a;i>=b;i--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
#define tc int t;cin>>t;while(t--)
#define mod 1000000007LL
#define mod2 998244353LL
#define all(vec) vec.begin(),vec.end()  
#define ld long double
#define pb push_back
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update> 

lli power(lli x,lli y)
{
     lli res=1;
     while(y>0)
     {
        if(y&1)res = ((res%mod)*(x%mod))%mod;
        y>>=1;
        x= ((x%mod)*(x%mod))%mod;
     }
     return res;
}

int main()
{
    
         

    fio

    string s;
    cin>>s;
    if(s[s.length()-1]=='s')s.append("es");
    else s.append("s");

    cout<<s<<'\n';
    


  
    

    


  
     

    


     

     


    
      




 

return 0;}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	int n, cnt = 1;
	cin >> n;
	int A[n];
	vector<int> a;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		if (i == 0 || A[i - 1] != A[i]) {
			a.push_back(A[i]);
		}
	}
	for (int i = 1; i < (int)a.size() - 1; i++) {
		if (a[i - 1] < a[i] && a[i] > a[i + 1]) {
			cnt++, i++;
			//cout << "i: " << i << " cnt: " << cnt << endl;
		} else if (a[i - 1] > a[i] && a[i] < a[i + 1]) {
			cnt++, i++;
			//cout << "i: " << i << " cnt: " << cnt << endl;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1148
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
	public static void main(String[] args)throws IOException{
	
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		
		while(true){
			String line = br.readLine();
			String[] str = line.split(" ");
			int m = Integer.parseInt(str[0]);
			int f = Integer.parseInt(str[1]);
			int r = Integer.parseInt(str[2]);
			
			if((m == -1) || (f == -1)){
				if((m == -1) && (f == -1) && (r == -1)){
					break;
				}
				else{
					sb.append("F\n");
				}
			}
			else if(80 <= m + f){
				sb.append("A\n");
			}
			else if((65 <= m + f) && (m + f < 80)){
				sb.append("B\n");
			}
			else if((50 <= m + f) && (m + f < 65)){
				sb.append("C\n");
			}
			else if((30 <= m + f) && (m + f < 50)){
				if(50 <= r){
					sb.append("C\n");
				}
				else{
					sb.append("D\n");
				}
			}
			else if(m + f < 30){
				sb.append("F\n");
			}
		}
		System.out.print(sb);
	}
}

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

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

const ll mod =  1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

int dx[2] = {0,1};
int dy[2] = {1,0};

int main()
{
    int n;
    cin >> n;
    bool s = true;
    rep(i,n){
        int a; cin >> a;
        if(a % 2 != 0) s = false;
    }
    if(s){
        cout << "second";
    }else{
        cout << "first";
    }
}


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

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		for(int j=i+1;j<s.size();j++){
			if(s[i]==s[j]){
				cout<<"no"<<endl;
				return 0;
			}
		}
	}
	cout<<"yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;
typedef long long lint;

int main(){
    string s; cin >> s;
    int n = s.size();
    if(n < 26){
        bool used[26];
        rep(i, 26) used[i] = false;
        rep(i, n) used[s[i] - 'a'] = true;
        string a = "abcdefghijklmnopqrstuvwxyz";
        rep(i, 26)if(!used[a[i] - 'a']){
            cout << s + a[i] << endl;
            return 0;
        }
    }
    else{
        int cur = -1;
        rep(i, 25)if(s[i] < s[i+1]) cur = i;
        if(cur < 0){
            cout << -1 << endl;
            return 0;
        }
        char a = '#';
        For(i, cur+1, 26)if(s[i] > s[cur]) a = s[i];
        s[cur] = a;
        cout << s.substr(0, cur+1) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n;
string s;
int32_t main(){
CODE_START;
cin>>s;
if(s[0]=='A'&&s[1]=='A'&&s[2]=='A'){
    cout<<"No"<<endl;
}else if(s[0]=='B'&&s[1]=='B'&&s[2]=='B'){
cout<<"No"<<endl;
}else cout<<"Yes"<<endl;
}







Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <array>
#define mp make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF (1<<30)
#define LLINF (1LL<<60)
//#define MOD 998244353
#define MOD 1000000007
#define PI 3.14159265358979
using ll = long long;
using namespace std;

int main(){
    int n, l[105], ans=0;
    cin >> n;
    rep(i,n){
        cin >> l[i];
    }
    for (int i = 0; i < n;i++){
        for (int j = i + 1; j < n;j++){
            for (int k = j + 1; k < n;k++){
                int maxlen = max(max(l[i], l[j]), l[k]);
                int sum = l[i] + l[j] + l[k];
                if (l[i] != l[j] && l[j] != l[k] && l[k] != l[i] && maxlen < sum - maxlen){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
// "header" {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <tuple>
#include <iomanip>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int int64_t
#define Fixed fixed << setprecision(10)
#define moke_pair make_pair
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class T,class U> using umap = unordered_map<T,U>;

inline int64_t updiv(int64_t n,int64_t d){
    return ((n + d -1) / d);
}
/*
inline double Sqrt( const double &x) 
{
	double         xHalf = 0.5 * x;
	int64_t  tmp   = 0x5FE6EB50C7B537AAl - ( *(int64_t*)&x >> 1);
	double         xRes  = * (double*)&tmp;

	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	return xRes * x;
}
*/
// }}}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s,t;
    cin >> s >> t;
    int n = s.size(),m = t.size();

    vector<vector<int> > dp(n+1,vector<int>(m+1));
    
    reps(i,n){
        reps(j,m){
            if(s[i-1] == t[j-1]) dp[i][j] = dp[i-1][j-1] + 1;
            else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    }

    int y = n,x = m;
    string res;

    while(dp[y][x]){
        if(dp[y-1][x] == dp[y][x]) --y;
        else if(dp[y][x-1] == dp[y][x]) --x;
        else{
            res += s[y-1];
            --y;
            --x;
        }
    }

    reverse(all(res));
    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 70784
/*
Author : N_o_o_B
Created : June 13 2020 17:32:53 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    string s;
    cin >> s;
    cout << s.substr(0,3) << endl;



    time_taken();
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  ll ans =0;
  for (ll i = 1; i <= n ; ++i){
    ans += i*(n/i)*(1+n/i)/2;
    
  }
  cout << ans << endl;
 
  return 0;
}

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

using namespace std;

int main() {
	int N;
	string S;
	cin >> N >> S;
	int a = 0;
	for (int i = 0; i < N; i++) {
		if ((int)S[i] == 65 && (int)S[i+1] == 66 && (int)S[i+2] == 67) a++;
	}
	cout << a << endl;
}

Measured memory_bytes: 256
n = int(input())
s = []
for _ in range(n):
    s.append(input()) 
    
ac = str(s.count("AC"))
wa = str(s.count("WA"))
tle = str(s.count("TLE"))
re = str(s.count("RE"))

print("AC x " + ac)
print("WA x " + wa)
print("TLE x " + tle)
print("RE x " + re)

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

namespace ABC109A
{
    class Program
    {
        static void Main(string[] args)
        {


            var word = Console.ReadLine().Split();
            int a = int.Parse(word[0]);
            int b = int.Parse(word[1]);
            var max = new int[3] { 1, 2, 3 };
            int c,d,e;

            c = a * b * max[0];
            d = a * b * max[1];
            e = a * b * max[2];
            if (c % 2 == 0 && d % 2 == 0 && e %2 == 0)
            {


                Console.WriteLine("No");
            }
            else
                Console.WriteLine("Yes");




                Console.ReadKey();



            }
        }
    }




Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
using namespace std;
int N;
int gx,gy,p;
int x_1,y_1,x_2,y_2;
int Vert[16][16],Horiz[16][16];
int T[16][16];

int max(int a,int b){
    if(a>b)return a;
    else return b;
}
void init(){
    for(int a=0;a<16;a++)
        for(int b=0;b<16;b++){
            Vert[a][b]=1;
            Horiz[a][b]=1;
        }
    for(int a=0;a<16;a++){
        Vert[a][0]=0;
        Horiz[0][a]=0;
    }
    
}

void solve(){
    for(int p=0;p<16;p++){
        for(int q=0;q<16;q++){
            if(p==0&&q==0) T[p][q]=1;
            else if(p>gx||q>gy) T[p][q]=0;
            else if(Vert[p][q]==0&&Horiz[p][q]==0) T[p][q]=0;
            else if(Vert[p][q]!=0&&Horiz[p][q]==0) T[p][q]=T[p][q-1];
            else if(Vert[p][q]==0&&Horiz[p][q]!=0) T[p][q]=T[p-1][q];
            else if(Vert[p][q]!=0&&Horiz[p][q]!=0) T[p][q]=T[p-1][q]+T[p][q-1];
        }
    }
    
    if(T[gx][gy]==0)cout<<"Miserable Hokusai!"<<endl;
    else cout<<T[gx][gy]<<endl;
}

int main(){
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>gx>>gy;
        cin>>p;
        init();
        for(int j=0;j<p;j++){
            cin>>x_1>>y_1>>x_2>>y_2;
            if(x_1==x_2) Vert[x_1][max(y_1,y_2)]=0;
            if(y_1==y_2) Horiz[max(x_1,x_2)][y_1]=0;
        }
        solve();
    }
    return 0;
}





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

int main() {
  string s;
  cin >> s;
  
  if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]){
    cout << "Yes" << endl;
  }
  else if(s[0] == s[2] && s[1] == s[3] && s[0] != s[3]){
    cout << "Yes" << endl;
  }
  else if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

int main() {
  string S; cin >> S;
  int n = S.size();
  string T = S;
  for(int i=n-2; i>0; i-=2){ 
    
    string T1 = T.substr(0,i/2);
    string T2 = T.substr(i/2, i/2);
    if(T1 == T2){ cout << i << endl; return 0; }
  }   
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int X, Y;
    cin >> X >> Y;
    for (int i = 0; i < X+1; i++) {
        if(i * 2 + (X - i) * 4 == Y){
            Yes(); return 0;
        }
    }
    No();
}

Measured memory_bytes: 3640
/*in the name of Allah the most beneficent the most merciful.*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define out(x) cout << #x << " -> " << x << endl;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FILE   freopen("input.txt", "r", stdin);  freopen("out.txt", "w", stdout);
using namespace std;
const int B = 16, N = 100010, M = 5000010;
ll n, d, x, y, res;
int solve()
{
    in1(n);
    ll val=7;
    for(ll i=1;i<=10000000;i++)
    {
        val=val%n;
        if(val==0)
        {
            printf("%lld\n", i);
            return 0;
        }
        val=(((val*(10%n)))%n + (7%n))%n;
    }
    printf("-1\n");
    return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    return solve();
}
/*

*/

Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int N, X, Y; cin >> N >> X >> Y;
    X--; Y--;
    vector<int> ans(N);
    rep(i, N-1) {
        // cout << "i " << i << endl;
        // iが基本の点
        // i+1以降でペアを探し、そのときの距離でansにプラス
        queue<P> q;
        q.emplace(make_pair(i, 0));
        // 到達管理
        vector<int> t(N);
        t[i] = 1;

        while(!q.empty()) {
            P now = q.front(); q.pop();
            if (now.first + 1 < N && t[now.first + 1] == 0) {
                t[now.first + 1] = 1;
                q.push(make_pair(now.first+1, now.second+1));
                ans[now.second+1] += 1;
                // cout << now.second + 1 << endl;
            }
            if (now.first - 1 >= 0 && t[now.first - 1] == 0) {
                t[now.first - 1] = 1;
                q.push(make_pair(now.first-1, now.second+1));
                if (now.first -1 >= i) {
                    ans[now.second+1] += 1;
                }
                // cout << now.second + 1 << endl;
            }
            if (now.first == X && t[Y] == 0) {
                t[Y] = 1;
                q.push(make_pair(Y, now.second+1));
                ans[now.second+1] += 1;
                // cout << now.second + 1 << endl;
            }
        }
        /*
        vector<int> dp(N);
        // iからjまでの距離をdpに入れる
        repr(j, i+1, N) {
            if (j == Y) {
                dp[j] = dp[X] + 1;
                ans[dp[j]] += 1;
            } else {
                dp[j] = dp[j-1]+1;
                ans[dp[j]] += 1;
            }
        }
        cout << "i " << i << endl;
        rep(j, N) {
            cout << dp[j] << " ";
        }
        cout << endl;
        */
    }
    repr(i, 1, N) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

using namespace std;

void Insert(const string&, int&, map< int, map<string, int> >*);
void Print(map< int, map<string, int> >&);

int main(){
  int i, n, x;
  string str;
  map< int, map<string, int> > data;

  cin >> n;
  for(i=0; i<n; ++i){
    cin >> str >> x;
    Insert(str, x, &data);
  }

  Print(data);
  return 0;
}

void Insert(const string& str, int& x, map< int, map<string, int> >* data){
  map< int, map<string, int> >::iterator i;
  i = data->find(str.size());
  if(i == data->end()){
    map<string, int> data_;
    data_.insert(make_pair(str, x));
    data->insert(make_pair(str.size(), data_));
    return;
  }
  map<string, int>::iterator j;
  j = i->second.find(str);
  if(j == i->second.end())
    i->second.insert(make_pair(str, x));
  else
    j->second += x;
}

void Print(map< int, map<string, int> >& data){
  map< int, map<string, int> >::iterator i;
  map<string, int>::iterator j;
  for(i=data.begin(); i!=data.end(); ++i){
    for(j=i->second.begin(); j!=i->second.end(); ++j){
      cout << j->first << " " << j->second << endl;
    }
  }
}

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


int main() {
  int n;
  cin>>n;
  vector<vector<int>> to(n),cost(n);
  for(int i=0;i<n-1;i++){
    int a,b,w;
    cin>>a>>b>>w;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
    cost[a].push_back(w);
    cost[b].push_back(w);
  }
    vector<int> ans(n,-1);
    queue<int> q;
    ans[0]=0;
    q.push(0);
    while(!q.empty()){
    int v=q.front();
    q.pop();
    for(int i=0;i<to[v].size();i++){
      int u=to[v][i];
      int w=cost[v][i];
      if(ans[u]!= -1) continue;
      ans[u]=(ans[v]+w)%2;
      q.push(u);
    }
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 11904
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var hashSet = new HashSet<int>();

            var days = int.Parse(Console.ReadLine());

            var scoreDownCoefficients = Console.ReadLine().Split(" ")
                .Select((x, i) => (score: int.Parse(x), dayNumber: i + 1))
                .OrderByDescending(x => x.score)
                .ToArray();

            foreach (var i in Enumerable.Range(2, days))
            {
                var scoreUpNumber = Console.ReadLine().Split(" ")
                    .Select((x, i) => (score: int.Parse(x), dayNumber: i + 1))
                    .OrderBy(x => hashSet.Contains(x.dayNumber))
                    .OrderByDescending(x => x.score)
                    .First();

                hashSet.Add(scoreUpNumber.dayNumber);

                if (hashSet.Count == 26)
                {
                    hashSet.Clear();
                }

                Console.WriteLine(scoreUpNumber.dayNumber);
            }
        }
    }
}

Measured memory_bytes: 29576
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 1000005
using namespace std;
namespace runzhe2000
{
	int n, q[N], head = N-1, tail = N-1, ans;
	char s[N], t[N];
	void main()
	{
		scanf("%d%s%s",&n,s+1,t+1); int tag = 0;
		if(!strcmp(s+1,t+1)){puts("0");return;}
		for(int l = n+1, r = n, pl = n+1, pr = n+1; r; r = l - 1)
		{
			for(; t[l-1] == t[r]; l--);
			for(pr = pl-1; s[pl-1] == s[pr]; pl--);
			for(; (pl > l || s[pr] != t[r]) && pr; )
				for(pr = pl-1; s[pl-1] == s[pr] && pr; pl--);
			if(!pr){puts("-1");return;}
			pl = max(pl, min(l,pr));
			for(; tail-head && q[tail-1]+tag > r; --tail);
			tag--; q[--head] = pl-tag;
			ans = max(ans, tail-head);
		}
		printf("%d\n",ans);
	}
}
int main()
{
	runzhe2000::main();
}

Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define all(v) v.begin(),v.end()
#define PI acos(-1)
#define EPS 1e-15


int main() {
	ll n;
	cin >> n;
	ll s = sqrt(n);
	cout << s * s << endl;
		
	return 0;
}





Measured memory_bytes: 256
/*
g++ code.cpp
./a.out
*/

#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

int main() {
    int64_t r;
    cin >> r;
    printf("%.12lf\n",r * 6.28318530717958623200);
}

Measured memory_bytes: 3764
#include<stdio.h>
#include<string.h>

#define N 1046527
#define NIL -1
#define L 14
char H[N][L];


int get(char mo)
{
  if( mo == 'A' )return 1;
  else if( mo == 'C')return 2;
  else if( mo == 'G' )return 3;
  else if ( mo == 'T') return 4;
  else return 0;
}
//文字列から数値へ変換してkey作成
long long getkey(char str[])
{
  long long sum = 0, p = 1, i;
  for( i = 0 ; i < strlen(str) ; i++ ){
    sum += p*(get(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key)
{
  return key % N;
}

int h2(int key)
{
  return 1+(key % (N-1));
}


int find(char str[])
{
  long long key,i,h;
  key = getkey(str);//文字列を数値に
  for( i = 0;;i++){
    h = (h1(key)+i*h2(key))%N;
    if(strcmp(H[h],str) == 0)return 1;
    else if( strlen(H[h])==0)return 0;
  }
 
}

int insert(char str[])
{
  long long key,i,h;
  key = getkey(str);
  for( i = 0 ; ; i++ ){
    h = (h1(key) + i * h2(key)) % N;
    if( strcmp(H[h],str) == 0 )return 1;
    else if( strlen(H[h]) == 0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}


int main()
{
  int i;
  int n;
  int h;
  char str[L],aaa[9];

  for( i = 0 ; i < N; i++ )H[i][0] = '\0';
  scanf("%d",&n);
  for( i = 0 ; i < n; i++ ){
    scanf("%s %s",aaa,str);

    if( aaa[0] == 'i' ){
      insert(str);
    }
    else{
      if( find(str) ){
	printf("yes\n");
      }
      else{
	printf("no\n");
      }
    }
  }
  return 0;
}



Measured memory_bytes: 16104
import java.util.*;

public class Main {
 	public static void main (String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Work[] arr = new Work[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = new Work(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(arr);
		int now = 0;
		for (int i = 0; i < n; i++) {
		    now += arr[i].time;
		    if (now > arr[i].deadLine) {
		        System.out.println("No");
		        return;
		    }
		}
		System.out.println("Yes");
	}
	
	static class Work implements Comparable<Work> {
	    int time;
	    int deadLine;
	    public Work(int time, int deadLine) {
	        this.time = time;
	        this.deadLine = deadLine;
	    }
	    
	    public int compareTo(Work w) {
	        return deadLine - w.deadLine;
	    }
	}
}


Measured memory_bytes: 105340
mod = 10 ** 9 + 7

n, k = gets.split.map(&:to_i)

a = [1] * (k+1)
b = Array.new(k+1){|i| i }

(k/2).downto(1) do |i|
  cnt = ( k/i ).pow( n, mod )
  (i*2).step(k, i){|j| cnt = ( cnt - a[j] ) % mod }
  a[i] = cnt
  b[i] = i * cnt % mod
end

ans = 0
(1..k).each do |i|
  ans += b[i]
  ans %= mod if ans >= mod
end

puts ans

Measured memory_bytes: 15808
#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include <stack>
#include<set>
#include<cstring>
#include<iterator>
#include <map>
using namespace std;

int main() {
    long long i, n, ch;
    cin >> n;
    if (n >= 30)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int s = sc.nextInt();
        int w = sc.nextInt();
        if (w >= s) {
            System.out.println("unsafe");
        } else {
            System.out.println("safe");
        }
    }
}


Measured memory_bytes: 35796
S = input()
alp = "abcdefghijklmnopqrstuvwxyz"
alpC = "abcdefghijklmnopqrstuvwxyzC"

ans = "AC"
if S[0] != "A":
    ans = "WA"
countC = 0
for i in S[2:-1]:
    if i == "C":
        countC += 1
    if not i in alpC:
        ans = "WA"
if countC != 1:
    ans = "WA"
if not S[1] in alp:
    ans = "WA"
if not S[-1] in alp:
    ans = "WA"
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
// const ll MAXN = 

ll n,k;
/********** Good Luck :) **********/
int main()
{
    IOS();
    cin >> n >> k;
    if (k > (n-1)*(n-2)/2) {
        cout << -1 << endl;
    } else {
        ll dec = (n-1) * (n-2) / 2 - k;
        vector<pii> ans;
        REP1 (i,n-1) {
            ans.eb(i,n);
        }


        REP1 (i,n-1) {
            for (ll j=i+1;j<n;j++) {
                if (dec > 0) {
                    ans.eb(i,j);
                    dec--;
                }
            }
        }

        cout << SZ(ans) << endl;
        for (auto p : ans) {
            cout << p.X << " " << p.Y << endl;
        }
    }
    return 0;
}


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

#define REP(i,s,N) for(int i=s;i<N;++i)

int main() {
	int n;
	cin >> n;
	unordered_set<string> set;
	vector<string> ans;
	REP(i,0,n) {
		string cmd, val;
		cin >> cmd >> val;
		if (cmd == "insert") {
			set.insert(val);
		} else if (cmd == "find") {
			ans.push_back((set.end() == set.find(val)) ? "no" : "yes");
		}
	}
	REP(i,0,ans.size()) cout << ans[i] << endl;
	return 0;
}



Measured memory_bytes: 55172
#include <stdio.h>
#define N 2000

int A[N],n;

int solve(int i,int ans){
  int res;
  if(ans==0)return 1;
  if(i>=n)return 0;
  res = (solve(i+1,ans)+solve(i+1,ans-A[i]));
  return res;

}

int main(){
  int i,q,m;

  scanf("%d",&n);

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

  for(i=0;i<q;++i){
    scanf("%d",&m);

    if(solve(0,m)!=0) printf("yes\n");
    else printf("no\n");
  }


}



Measured memory_bytes: 2084