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

using namespace std; 

#define pb push_back
#define fi first
#define se second
#define all(vec) vec.begin(),vec.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=a;i>=b;i--)
#define fp(i,a,b,p) for(int i=a;i<b;i+=p)
#define SZ(x) (int)x.size()

typedef  vector<string> vs;
typedef  vector<int> vi;
typedef  vector<long long> vl;	


struct data{

	int x,y,a,b;

};

// 12341234

int main(){

	
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif

	string s , t;

	cin >> s >> t; 

	int n = SZ(t); 
	int n2 = SZ(s);
	vector<vector<int>> dp(n);

	vector<vector<data>> m(n);

	f(i,0,n){
		f(j,0,n2){
			dp[i].pb(0);
			m[i].pb({0,0,0,0});
		}
	}

	int ans = 0;

	f(i,0,n){
		f(j,0,n2){
			if(i==0 || j==0){
				if(s[j]==t[i]){
					dp[i][j] = 1;
					m[i][j].x = i;
					m[i][j].y = j;
					m[i][j].a = i;
					m[i][j].b = j;
				}else{
					if(j!=0){
						dp[i][j] = dp[i][j-1];	
						m[i][j].x = m[i][j-1].x;
						m[i][j].y = m[i][j-1].y;
						m[i][j].a = m[i][j-1].a;
						m[i][j].b = m[i][j-1].b;
					}

					if(i!=0){
						dp[i][j] = dp[i-1][j];
						m[i][j].x = m[i-1][j].x;
						m[i][j].y = m[i-1][j].y;
						m[i][j].a = m[i-1][j].a;
						m[i][j].b = m[i-1][j].b;
					}

				}
			}else{
				if(s[j]==t[i]){
					dp[i][j] = dp[i-1][j-1] + 1;
					m[i][j].x = i;
					m[i][j].y = j;
					m[i][j].a = m[i-1][j-1].x;
					m[i][j].b = m[i-1][j-1].y;
				}else{
					dp[i][j] = max(dp[i][j-1],dp[i-1][j]);

					if(dp[i][j-1]>=dp[i-1][j]){

						m[i][j].x =  m[i][j-1].x;
						m[i][j].y =  m[i][j-1].y;
						m[i][j].a =  m[i][j-1].x;
						m[i][j].b =  m[i][j-1].y;

					}else{

						m[i][j].x =  m[i-1][j].x;
						m[i][j].y =  m[i-1][j].y;
						m[i][j].a =  m[i-1][j].x;
						m[i][j].b =  m[i-1][j].y;
					}

					
				}
			}
		}
	}
	int idx = 0;
	f(i,0,n2){
		
		if(dp[n-1][i]>ans){
			idx = i;
		}

		ans = max(ans,dp[n-1][i]);
	}


	/*f(i,0,n){
		f(j,0,n2){
			cout << m[i][j].x << ","<< m[i][j].y << ","<< m[i][j].a <<","<< m[i][j].b<<") ";
		}
		cout << endl;
	}*/

	string ret =""; 

	if(ans==0){
		cout << ret << endl;
		return 0;
	}

	int z = n-1;

	while(1){

		ret=s[idx]+ret;

		if(SZ(ret)==ans) break;

		
		int zz = 0;

		if( m[z][idx].y == m[z][idx].b){

			zz = m[m[z][idx].a][m[z][idx].b].a;
			idx = m[m[z][idx].a][m[z][idx].b].b;
			z = zz;	
			 
		}else{
			
			zz= m[z][idx].a;
			idx = m[z][idx].b;
			z = zz;			
		}

		

	}

	cout << ret << endl;

}

Measured memory_bytes: 249088
#include<iostream>
using namespace std;
int main(void)
{
	int A;
	int B;
	int C;
	int d=0;
	int i;

	cin >> A;
	cin >> B;
	cin >> C;



	for (i = 0; i < B; i++) {
		if (i*A%B == C) {
			cout << "YES" << endl;
			d = 1;
				break;
		}
	
	}
	if (d == 0)cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string w;
  cin>>w;
  if(w == "RRR")
    cout<<3<<endl;
  if(w == "RRS"||w =="SRR" )
    cout<<2<<endl;
  if(w == "RSS"|| w=="RSR"||w=="SSR"||w=="SRS")
    cout<<1<<endl;
  if(w=="SSS")
    cout<<0<<endl;
  
}

Measured memory_bytes: 3620
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

using namespace std;

struct Point
{
  int64_t x, y;
  Point(int64_t x, int64_t y) : x(x), y(y) {}
  int64_t operator-(const Point &p) const {
    return abs(x - p.x) + abs(y - p.y);
  }
};

int main()
{
  uint64_t H, W, D;
  cin >> H >> W >> D;

  vector<Point> A(H * W, Point(0, 0));
  N_TIMES(h, H) {
    N_TIMES(w, W) {
      uint64_t a;
      cin >> a;
      A[a - 1] = Point(w, h);
    }
  }

  uint64_t N = ((H * W) / D) + 1;
  vector<vector<uint64_t>> cumsum(D);
  N_TIMES(i, D) {
    cumsum[i] = vector<uint64_t>(N, 0);
    N_TIMES(n, N - 1) {
      uint64_t k = i + n * D;
      if (k + D >= H * W) { break; }
      cumsum[i][n + 1] = (A[k + D] - A[k]) + cumsum[i][n];
    }
  }

  uint64_t Q;
  cin >> Q;

  N_TIMES(q, Q) {
    uint64_t L, R;
    cin >> L >> R;
    --L, --R;

    uint64_t i = L % D;
    uint64_t n = (L - i) / D, m = (R - i) / D;
    cout << (cumsum[i][m] - cumsum[i][n]) << endl;
  }

  return 0;
}

Measured memory_bytes: 6784
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

char Sign(bool x) {
    if (x) return '-';
    return '+';
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    char ca, cb, cc, cd;
    cin >> ca >> cb >> cc >> cd;
    int a = ca-'0', b = cb-'0', c = cc-'0', d = cd-'0';
    for (int bb = 0; bb < 8; bb++) {
        int res = a+b+c+d;
        if (bb & 1) res -= 2*b;
        if (bb & 2) res -= 2*c;
        if (bb & 4) res -= 2*d;
        if (res == 7) {
            cout << a << Sign(bb&1) << b << Sign(bb&2) << c << Sign(bb&4) << d << "=" << 7 << "\n";
            break;
        }
    }
}



Measured memory_bytes: 256
using System;

namespace ConsoleApp37
{
    class Program
    {
        static void Main(string[] args)
        {
            var x =int.Parse( Console.ReadLine());
            if (x >= 30)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 27476
import itertools
x = 10**9 + 7
n = int(input())
a = list(map(lambda i: i % x , map(int, input().split(" "))))
sum_a = []
prev = 0
for i in a:
    sum_a.append(prev + i)
    prev = prev + i

ans = 0
for i in range(n):
    ans += (a[i] * (sum_a[n-1] - sum_a[i] )) % x
print(ans % x)

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

int f(int n){
	return n>=3&&(n%10==3||f(n/10));
}


int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(i%3==0||f(i)) cout<<" "<<i;
	}
	cout<<endl;
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  bool res = false;
  
  for(int i = 0; i<=25; i++){
    for(int j = 0; j<15; j++){
      int total = 4*i + 7*j;
      if(total == n){
        res = true;
        break;
      }
    }
    if(res)
      break;
  }
  if(res)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

using namespace std;

int n, m, q, maxn;

int a[55], b[55], c[55], d[55], e[55];

void per(int* e, int cur, int minn) {
	if (cur == n + 1) {
		int score = 0;
		for (int j = 1; j <= q; j++) {
			if(e[b[j]] - e[a[j]] == c[j]) {
				score += d[j];
			}
		}
		maxn = max(maxn, score);
	}
	else {
		for (int j = minn; j <= m; j++) {
			e[cur] = j;
			per(e, cur + 1, j);
		}
	}
}

int main() {
	cin >> n >> m >> q;
	for (int i = 1; i <= q; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	maxn = 0;
	memset(e, 0, sizeof(e));
	per(e, 1, 1);
	cout << maxn;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

string invJ(string s){//???????????????
	rotate(s.rbegin(),s.rbegin() + 1,s.rend());
	return s;
}

string invC(string s){//left????????????
	rotate(s.begin(),s.begin() + 1,s.end());
	return s;
}

string invE(string s){
	if((s.size() + 1) & 1)
		rotate(s.begin(),s.begin() + s.size()/2,s.end());
	else{
		string tmp;
		tmp = s;
		s.replace(0,s.size()/2,s.substr(s.size()/2 + 1,s.size()/2));
		s.replace(s.size()/2 + 1,s.size()/2,tmp.substr(0,s.size()/2));
	}
	return s;
}

string invA(string s){
	reverse(s.begin(),s.end());
	return s;
}

string invP(string s){
	REP(i,s.size()){
		if(s[i] == '0')
			s[i] = '9';
		else if(s[i] > '0' && s[i] <= '9')
			s[i]--;
	}
	return s;
}

string invM(string s){
	REP(i,s.size()){
		if(s[i] == '9')
			s[i] = '0';
		else if(s[i] >= '0' && s[i] < '9')
			s[i]++;
	}
	return s;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n;
	cin >> n;
	while(n--){
		string command,s;
		cin >> command >> s;
		for(int i = command.size()-1;i>=0;i--){
			if(command[i] == 'J')s = invJ(s);
			else if(command[i] == 'C')s = invC(s);
			else if(command[i] == 'E')s = invE(s);
			else if(command[i] == 'A')s = invA(s);
			else if(command[i] == 'P')s = invP(s);
			else if(command[i] == 'M')s = invM(s);
		}
		cout << s << endl;
	}
  return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  double BTC=380000.0;
  int N;
  cin>>N;
  double ans=0;
  REP(i,N){
    double x;
    string u;
    cin>>x>>u;
    if(u=="JPY")ans+=x;
    else ans+=x*BTC;
  }
  //固定小数点
  cout<<fixed;
  //桁数固定
  cout<<setprecision(6);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

size_t count_mountains(std::vector<uint64_t>& mountains)
{
    assert(mountains.size() >= 1);

    std::vector<uint64_t> max_heights(mountains.size(), 0);
    for(size_t i = 1; i < mountains.size(); ++i)
    {
        max_heights[i] = max(max_heights[i-1], mountains[i-1]);
    }
    
    size_t count = 1; // 一番西の山は必ず見られる.
    for(size_t i = 1; i < mountains.size(); ++i)
    {
        if (max_heights[i] <= mountains[i]) {
            count++;
        }
    }

    return count;
}

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

    size_t count = 0;
    cin >> count;

    std::vector<uint64_t> mountains(count, 0);
    for(size_t i = 0; i < count; ++i)
    {
        cin >> mountains[i];
        assert(1 <= mountains[i] && mountains[i] <= 100);
    }

    cout << count_mountains(mountains) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int a = 0;
        for (int i = 0; i < n; i++) {
            a += (Math.abs(in.nextInt() - in.nextInt()) + 1);
        }
        System.out.println(a);
    }
}












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

const ll INF = 1LL << 60;

ll A, B, K;
int main() {
    cin >> A >> B >> K;
    // if (A + B <= K) {
    //     cout << 0 << " " << 0 << endl;
    //     return 0;
    // }

    ll a_rest = max(0LL, A - K);
    ll b_rest = B;
    if (A - K < 0) {
        b_rest += A - K;
    } 
    b_rest = max(0LL, b_rest);
    cout << a_rest << " " << b_rest << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main(int argc, char const* argv[])
{
    long a, b;
    std::cin >> a >> b;
    long x = a * b;
    if (a < b) {
        long tmp = b;
        b = a;
        a = tmp;
    }
    long r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    std::cout << x / b << std::endl;
    return 0;
}


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

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] array = new int[n];
		int i, max, semiMax;
		max = semiMax = 0;
		for(i=0; i<n; i++){
			array[i] = Integer.parseInt(br.readLine());
			if( max < array[i] ){
				semiMax = max;
				max = array[i];
			}else if( semiMax < array[i] ){
				semiMax = array[i];
			}
		}
		
		for(i=0; i<n; i++)
			if( array[i] == max )
				System.out.println(semiMax);
			else
				System.out.println(max);
	}
}


Measured memory_bytes: 56384
# coding: utf-8
n, y = map(int, input().split())

tmp = y
n_10000 = tmp // 10000
tmp = tmp - 10000 * n_10000

n_5000 = tmp // 5000
tmp = tmp - 5000 * n_5000

n_1000 = tmp // 1000
tmp = tmp - 1000 * n_1000

pure_list = [n_10000, n_5000, n_1000]
output_list = [-1, -1 ,-1]
if tmp == 0:
    if sum(pure_list) <= n:
        dif_10000 = n - sum(pure_list)
        if dif_10000 % 9 == 0 and pure_list[0] >= dif_10000 / 9:
            output_list = [int(pure_list[0] - dif_10000 / 9), pure_list[1], int(pure_list[2] + dif_10000 / 9 * 10)]
        else:
            for i in range(pure_list[0] + 1):
                now_list = [pure_list[0]-i, pure_list[1]+2*i, pure_list[2]]
                dif_5000 = n - sum(now_list)
                if dif_5000 % 4 == 0:
                    if now_list[1] >= dif_5000 / 4:
                        output_list = [now_list[0], int(now_list[1] - dif_5000 / 4), int(now_list[2] + dif_5000 / 4 * 5)]
                        break
print(str(output_list[0])+" "+str(output_list[1])+" "+str(output_list[2]))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;
typedef long long ll ;

char b;

int main(){
	fastio;
	cin>>b;
	if(b=='A') cout<<"T\n";
	if(b=='C') cout<<"G\n";
	if(b=='G') cout<<"C\n";
	if(b=='T') cout<<"A\n";	 	
	return 0;
}


Measured memory_bytes: 256
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
//typedef long long int LL;
//typedef __int64 LL;

int r, c;
char board[12][12];

int possible() {
	if (board[0][0] != '#') return 0;
	if (board[r - 1][c - 1] != '#') return 0;
	int now = 0;
	for (int i = 0; i < r; i++) {
		if (board[i][now] != '#') return 0;
		for (int j = now; j < c; j++) {
			if (board[i][j] == '#') {
				board[i][j] = '.';
				now = j;
			}
			else break;
		}
	}

	for (int i = 0; i < r; i++) for (int j = 0; j < c; j++) if (board[i][j] == '#') return 0;
	return 1;
}

int main()
{
	scanf("%d %d", &r, &c);
	for (int i = 0; i < r; i++) {
		scanf("%s", board[i]);
	}

	if (possible()) printf("Possible\n");
	else printf("Impossible\n");

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
long D[10][10];
int main() {
    int N; cin >> N;
	for(int i=1; i<=N; i++) {
		int x = i;
		while(x >= 10) x /= 10;
		D[x][i%10]++;
	}
	long ans=0;
	for(int i=0;i<10;i++)
        for(int j=0;j<10;j++)
            ans += D[i][j] * D[j][i];
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 1000002
#define pie 3.14159265358979323
#define minuss 1e-6
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll s1=(a-1)/c;
    ll s2=(a-1)/d;
    ll s3=b/c;
    ll s4=b/d;
    ll sum1=s3-s1;
    ll sum2=s4-s2;
    ll sum=sum1+sum2;
    ll an=b-(a-1);
    ll ans=an-sum;
    ll gg=__gcd(c,d);
    ll ss=(c*d)/gg;
    ll c1=(a-1)/ss;
    ll c2=b/ss;
    ll total=c2-c1;
    cout<<ans+total<<endl;
}


Measured memory_bytes: 256
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ');
  const a = Number(s[0]);
  const b = Number(s[1]);
  const c = Number(s[2]);

  const ans = ((a + b) >= c) ? 'Yes' : 'No';
  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 22964
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int X, N; cin >> X >> N;
    set<int> ps; 
    for (int i = 0; i < N; ++i)
    {
        int pi; cin >> pi; ps.insert(pi);
    }
    int dist = 100000;
    int ans = -1;
    for (int t = 0; t <= 101; ++t)
    {
        if (ps.count(t) == 0 && abs(X - t) < dist)
        {
            dist = abs(X - t);
            ans = t;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<map>
using namespace std;
int main(){
    string G[8]={
        "AAA",
        "AA",
        "A",
        "B",
        "C",
        "D",
        "E",
        "NA",
    };
    double a,b;
    while(cin>>a>>b){
        int p=(int)(a*1000),q=(int)(b*1000);
        int gp,gq;
        if(p<35500)gp=0;
        else if(p<37500)gp=1;
        else if(p<40000)gp=2;
        else if(p<43000)gp=3;
        else if(p<50000)gp=4;
        else if(p<55000)gp=5;
        else if(p<70000)gp=6;
        else gp=7;

        if(q<71000)gq=0;
        else if(q<77000)gq=1;
        else if(q<83000)gq=2;
        else if(q<89000)gq=3;
        else if(q<105000)gq=4;
        else if(q<116000)gq=5;
        else if(q<148000)gq=6;
        else gq=7;
        int g=max(gp,gq);
        cout<<G[g]<<endl;
    }

}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
#define MAX 5002
#define pb push_back
#define For(i,s,e) for (int i=(s); i<(e); i++)
#define Debug_array(a,n) for (int i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (int i=(s); i<=(e); i++)
#define Fod(i,s,e) for (int i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second

using namespace std;

typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	
	ll a,b;cin>>a>>b;
	if(b<a){
		ll temp = a;
		a = b;
		b = temp;
	}
	bool flag = false;
	For(c,a,b+1){
		if((a*b*c)%2!=0) flag=true;
	}
	if(flag)cout<<"Yes";
	else cout<<"No";
}

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

int main() {
  int N;
  int flag=false;
  cin >> N;
  for (int i = 0; i < N; i++) {
    string x;
    cin >> x;
    if(x=="Y"){
      flag=true;
     break;
    }
  }
  if(flag){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" <<endl;
  }
}


Measured memory_bytes: 256
/*=============================================================================================================================/*
                                               Bismillahir Rahmanir Rahim

      _     ____  ___  ____   _   _  _         ___  ____   _         _     __  __
     / \   / ___||_ _|| __ ) | | | || |       |_ _|/ ___| | |       / \   |  \/  |
    / _ \  \___ \ | | |  _ \ | | | || |        | | \___ \ | |      / _ \  | |\/| |
   / ___ \  ___) || | | |_) || |_| || |___     | |  ___) || |___  / ___ \ | |  | |
  /_/   \_\|____/|___||____/  \___/ |_____|   |___||____/ |_____|/_/   \_\|_|  |_|

   _   __           __  __  __
  |_) (_  _  o__   /   (_  |_
  |_)o__)(_  || |  \__ __) |__

    ___                    _   _      _                _ _               __   ___                 _         _        _
   / __|_ _ ___ ___ _ _   | | | |_ _ (_)_ _____ _ _ __(_) |_ _  _   ___ / _| | _ ) __ _ _ _  __ _| |__ _ __| |___ __| |_
  | (_ | '_/ -_) -_) ' \  | |_| | ' \| \ V / -_) '_(_-< |  _| || | / _ \  _| | _ \/ _` | ' \/ _` | / _` / _` / -_|_-< ' \
   \___|_| \___\___|_||_|  \___/|_||_|_|\_/\___|_| /__/_|\__|\_, | \___/_|   |___/\__,_|_||_\__, |_\__,_\__,_\___/__/_||_|
                                                            |__/                           |___/


   FB: https://facebook.com/SIAsibul
   Gmail: asibulislam8@gmail.com

/*=============================================================================================================================*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;
typedef vector<pll> vll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,n) for(ll i=0;i<(n);i++)
#define f1(i,n) for(ll i=1;i<=(n);i++)
#define f2(i,a,n) for(ll i=(a);i<=(n);i++)
#define fr(i,n,a) for(ll i=(n);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))
#define nl "\n"


const int INF = 1e9 + 5;
const int MXN = 2e5 + 5;
const int MOD = 1e9 + 7;


void solve(){
    int n, k; cin >> n >> k;
    queue<ll> q;
    f0(i, n){
        ll x; cin >> x;
        if(i < k) q.push(x);
        else{
            q.push(x);
            if(x > q.front()) cout << "Yes\n";
            else cout << "No\n";
            q.pop();
        }
    }
}

int main(){
    ll t;
    //cin >> t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
 }


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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (n - 1); i > (a - 1); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define Unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define updiv(a, b) ((a + b - 1) / b)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, 1, -1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main(void) {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<int> x(27, 0);
  string s;
  cin >> s;
  int ans = 1;
  rep(i, 0, n) x[s[i] - 'a']++;

  rep(i, 0, 26) {
    if (x[i] != 0) {
      ans *= (x[i] + 1);
      ans %= mod1;
    }
  }
  cout << ans - 1 << '\n';
  return 0;
}


Measured memory_bytes: 3708
N_sw, N_ball = map(int, input().split())

switches = [list(map(int, input().split())) for i in range(N_ball)]
P = list(map(int, input().split()))
cnt = 0

def judge_OK(state_2):
    flag = True
    
    for i in range(N_ball):
        S = switches[i]
        count = 0
        
        for j in range(1, len(S)):
            index = S[j] - 1
            count += state_2[index]
        
        if (count % 2 != P[i]):
            flag = False
            break
    
    return(flag)


for state in range(2 ** N_sw):
    state_2 = []
    
    for i in range(N_sw):
        tmp = int((state & 1 << i) == 1 << i)
        state_2.append(tmp)
    
    cnt += judge_OK(state_2)

print(cnt)

Measured memory_bytes: 3064
import java.util.*;
import java.lang.*;

public class Main {
    
    public static void main (String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        y = y/1000;
        
        if (check(n, y) == 0) {
            System.out.println(-1 + " " + -1 + " " + -1);
        }
    }
    
    static int check(int n, int y) {
        for (int i = 0; i <= y; i ++) {
            for (int j = 0; j <= y / 5; j ++) {
                int k = n - i - j;
                if (k >= 0) {
                    if (10 * k + 5 * j + i == y) {
                        System.out.println(k + " " + j + " " + i);
                        return 1;
                    }
                }
            }
        }
        return 0;
    }
}


Measured memory_bytes: 25556
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn = 1e2 + 5;
typedef long long ll;
 int main(){
 	 int N,x,y,z,flag = 0;
 	 ll Y;
 	 scanf("%d %lld",&N,&Y);
 	 Y /= 1000;
	 	 for( int i = 0; i <= N; i++){
	 	 	 for( int j = 0; j <= N; j++){
			 	 if ( 4 * i + 9 * j == Y - N ){
			 	 y = i;
			 	 x = j;
			 	 z = N - i - j;
			 	 if ( z >= 0 ){
	 	 	 	 printf("%d %d %d\n",x,y,z);
	 	 	 	 flag = 1;
	 	 	 	 goto end;
				 }
				 }
			 }
	 	 	 /*if (( Y - 1000 * N - 9000 * i ) / 4000 >= 0 && ( Y - 1000 * N - 9000 * i ) / 4000 <= N ){
	 	 	 	 z = i;
	 	 	 	 y =( Y - 1000 * N - 9000 * i ) / 4000 ;
	 	 	 	 x = N - y - z;
	 	 	 	 if ( z >= 0 && x >= 0 && y >= 0 ){
	 	 	 	 printf("%d %d %d\n",z,y,x);
	 	 	 	 flag = 1;
	 	 	 	 break;
				 }
			 }*/
		 }
end:	 if( !flag )printf("-1 -1 -1\n");
	 return 0;
 }

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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 (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    string S;
    cin >>S;
    N=S.size();
    ll G=0,P=0;
    rep(i,N){
        if(S[i]=='g'){
            G++;
        }else{
            P++;
        }
    }
    cout<<N/2-P<<endl;
    /*if(N%2==0){
        cout<<N/2-P<<endl;
    }else{
        cout<<N/2-P-1<<endl;
    }*/



    return 0;
    

}

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

using namespace std;
long long i,n,f=0;
string s[107];
set <string > p;
int main()
{cin>>n;
cin>>s[0];
p.insert(s[0]);
for(i=2;i<=n;i++)
{cin>>s[i-1];
    if(p.count(s[i-1])!=0)f=1; else p.insert(s[i-1]);
        if(s[i-2][s[i-2].length()-1]!=s[i-1][0])f=1;
}
if(f==0)cout<<"Yes"<<endl; else cout<<"No"<<endl;
        return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    int n = s.size();
    ll ans=0;
    rep(i,1<<(n-1)){
        ll now=s[0]-'0';
        rep(j,n-1){
            if (i>>j&1) ans += now, now=0;
            ll c = s[j+1]-'0';
            now = now*10+c;
        }
        ans+=now;
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
Ans = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Ans[a] += 1
    Ans[b] += 1

for a in Ans:
    if a % 2 != 0:
        print('NO')
        exit()
print('YES')


Measured memory_bytes: 44632
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  if(S == "Sunny")cout << "Cloudy" << endl;
  if(S == "Cloudy")cout << "Rainy" << endl;
  if(S == "Rainy")cout << "Sunny" << endl;
  
}

Measured memory_bytes: 256
/*Lower_Rating*/
/*AGC040 B*/
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;

#define LL long long
#define MAXN 800000
#define MOD 998244353
#define Pr pair<int,int>
#define X first
#define Y second
#define INF 2000000000
#define mem(x,p) memset(x,p,sizeof(x))

LL read(){
  LL x=0,F=1;char c=getchar();
  while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
  while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
  return x*F;
}
int add(int x,int y){return (x+y>=MOD)?x+y-MOD:x+y;}
int dec(int x,int y){return (x-y<0)?x-y+MOD:x-y;}
int mul(int x,int y){return 1LL*x*y%MOD;}

int n,mn,id;
struct Seg{
	int l,r;
}p[MAXN+5];
bool cmp(Seg s1,Seg s2){
	if(s1.l==s2.l)return s1.r<s2.r;
	return  s1.l<s2.l;
}
int bin(int l1,int r1,int l2,int r2){
	return max(min(r1,r2)-max(l1,l2)+1,0);
}
int main()
{
	n=read();mn=INF;
	for(int i=1;i<=n;i++)
		p[i].l=read(),p[i].r=read();
    sort(p+1,p+n+1,cmp);
	int l1=p[1].l,r1=p[1].r,l2=p[2].l,r2=p[2].r;
	for(int i=2;i<=n;i++){
		int val1=max(r2-l2+1,0)+bin(l1,r1,p[i].l,p[i].r);
		int val2=max(r1-l1+1,0)+bin(l2,r2,p[i].l,p[i].r);
        int val3=max(p[i].r-p[i].l+1,0)+bin(l1,r1,l2,r2);
		if(val1>=val2&&val1>=val3){
			l1=max(l1,p[i].l);
			r1=min(r1,p[i].r);
		}else if(val2>=val1&&val2>=val3){
			l2=max(l2,p[i].l);
			r2=min(r2,p[i].r);
		}else{
            l1=max(l1,l2);
			r1=min(r1,r2);
            l2=p[i].l,r2=p[i].r;
        }
	}
	printf("%d",max(r1-l1+1,0)+max(r2-l2+1,0));
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define mod 998244353
#define ll  long long int
long long int power(long long int a,long long int b )
{
    long long int res=1;
    a=a%mod;
    while(b>0)
    {
        if(b&1)
        res=(res*a)%mod;
        b=b>>1;
        a=(a*a)%mod;
    }
    return res;
}
int main()
{
   ll x;
   cin>>x;
   ll ans=x/500;ans*=1000;
   x%=500;
   ans+=(x/5)*5;
   cout<<ans;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    double r,i,n,m;
	scanf("%lf",&r);
	m=3.14159265358979323846;
	i=2*r*m;
	n=r*r*m;
	printf("%lf %lf\n",n,i);
	return 0;
}

Measured memory_bytes: 2724
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)

#define repv(values) for (auto v : values)

#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0)
#define srt(vec) sort(vec_all(vec))

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

// --- notice ---
// intの和はllにしろ

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    int tmp = 0;
    rep(i, n) {
        cin >> a[i];
        tmp += a[i];
    }

    int av;
    av = round((double) tmp / (double) n);
    int cost = 0;
    rep(i, n) {
        cost += pow(av - a[i], 2);
    }

    cout << cost << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
void DFS(void);
void visit(int);
int n;
int A[100][100];
int c[100],f[100],d[100];
int t=1;

int main(){
  int i,j,l;
  int u,v,k;
  int B[100][100];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(l=0;l<k;l++){
      scanf("%d",&B[i][l]);
    }
    for(j=0;j<n;j++){
      A[i][j]=0;
      for(l=0;l<k;l++){
	if(B[i][l]==j+1){
	  A[i][j]=1;
	}
      }
    }
  }
  DFS();
  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
  return 0;
}
void DFS(void){
  int i;
  for(i=0;i<n;i++){
    c[i]=0;
  }
  for(i=0;i<n;i++){
    if(c[i]==0){
      visit(i);
    }
  }
}
void visit(int i){
  int j;
  c[i]=1;
  d[i]=t;
  t++;
  for(j=0;j<n;j++){
    if(A[i][j]==0) continue;
    if(c[j]==0){
      visit(j);
    }
  }
  c[i]=2;
  f[i]=t;
  t++;
}



Measured memory_bytes: 2112
from sys import stdin
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

xmax = max(x)
ymin = min(y)

if X <= Y:
    for Z in range(X+1,Y+1,1):
        if xmax < Z <= ymin:
            print('No War')
            exit()
    print('War')
else:
    print('War')


Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
int main()
{
	int i,t,j,s=0;
	char S[210],T[210];
	char d;
	scanf("%s",S);
	scanf("%s",T);
	t=strlen(S);
	for(i=0;i<t;i++)
	{
		if(strcmp(S,T)==0)
		{
			s=1;
			break;
		}
		d=S[t-1];
		for(j=t-2;j>=0;j--)
		{
			S[j+1]=S[j];
		}
		S[0]=d;
	}
	if(s==0)
		printf("No");
	else
		printf("Yes");
	return 0;
}

Measured memory_bytes: 128
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();
            if (A >= 3200)
            {
                Console.WriteLine(s);
            }
            else
            {
                Console.WriteLine("red");
            }
        }
    }
}


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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int N,M; cin >> N >> M;
  string ans;
  if(N==M) ans = "Yes";
  else ans = "No";
  cout << ans << endl;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int tmp=0;

		for (int i=0; i<n; i++){
			tmp += sc.nextInt();
		}

		System.out.println(tmp - n);
	}
}

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

int main(void) {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        ans += s.at(i) == t.at(i);
    }
    cout << s.size() - ans << endl;
    return 0;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

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

    for (int i = 0; i < s.length(); i = i + 2) {
        ans += s[i];
    }
    print(ans);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const string ans[] = {"No","Yes"};
int main() {
	ll a, b, c, d;
	ios_base::sync_with_stdio(0), cin.tie(0), 
	cin >> a >> b >> c, d = c-a-b, 
	cout << ans[d > 0 and 4*a*b < d*d]; }

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

int main(){
  int N,M;
  cin >> N >> M;
  int K,A;
  vector<int> cnt(M,0);
  for(int i=0;i<N;++i){
    cin >> K;
    for(int j=0;j<K;++j){
    cin >> A; --A;
    ++cnt[A];
  }
}
int ans=0;
for (int i=0;i<M;++i){
  if (cnt[i] == N){
    ++ ans;
  }
}

cout << ans << endl;
}

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

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

    int ans = 1;
    while(n / k) {
        n /= k;
        ans++;
    }

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

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

string s[310];
int ans[310][310];

int main(){
	int H, W, K;
	cin >> H >> W >> K;
	for(int i = 0; i < H; i++){
		cin >> s[i];
	}
	int cnt = 1;
	for(int i = 0; i < H; i++){
		bool flag = false;
		for(int j = 0; j < W; j++){
			if(s[i][j] == '#'){
				flag = true;
			}
		}
		if(flag){
			bool fst = true;
			for(int j = 0; j < W; j++){
				if(s[i][j] == '#'){
					if(fst){
						fst = false;
					}else{
						cnt += 1;
					}
				}
				ans[i][j] = cnt;
			}
			if(!fst){
				cnt += 1;
			}
		}
	}
	for(int i = 1; i < H; i++){
		for(int j = 0; j < W; j++){
			if(ans[i][j] == 0){
				ans[i][j] = ans[i - 1][j];
			}
		}
	}
	for(int i = H - 2; i >= 0; i--){
		for(int j = 0; j < W; j++){
			if(ans[i][j] == 0){
				ans[i][j] = ans[i + 1][j];
			}
		}
	}
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cout << ans[i][j];
			if(j < W - 1){
				cout << " ";
			}else{
				cout << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 1280
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;
const int mx=200005;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,d;
    cin>>n>>d;
    int ans=0;
    rep(i,n){
        ll x,y;
        cin>>x>>y;
        if(x*x+y*y<=d*d)ans++;
    }
    cout<<ans<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int N;
char P[100010];

char M(char a, char b) {
    if (a == 'T' && b == 'F') return 'F';
    return 'T';
}

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

    cin >> N;
    REP(i, N) cin >> P[i];
    char ans = M(P[0], P[1]);
    FOR(i, 2, N) {
        ans = M(ans, P[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3296
import java.util.Arrays;
import java.util.Scanner;



public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int leng = sc.nextInt();
		String[] input = new String[num];
		for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for(String result: input) {
			System.out.print(result);
		}
	}

}


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

int main() {
  char x;
  cin >> x;
  
  if(x == 'A'){
    cout << 'A' << endl;
  }
  else if(x == 'B'){
    cout << 'A' << endl;
  }
  else if(x == 'C'){
    cout << 'A' << endl;
  }
  else if(x == 'D'){
    cout << 'A' << endl;
  }
  else if(x == 'E'){
    cout << 'A' << endl;
  }
  else if(x == 'F'){
    cout << 'A' << endl;
  }
  else if(x == 'G'){
    cout << 'A' << endl;
  }
  else if(x == 'H'){
    cout << 'A' << endl;
  }
  else if(x == 'I'){
    cout << 'A' << endl;
  }
  else if(x == 'J'){
    cout << 'A' << endl;
  }
  else if(x == 'K'){
    cout << 'A' << endl;
  }
  else if(x == 'L'){
    cout << 'A' << endl;
  }
  else if(x == 'M'){
    cout << 'A' << endl;
  }
  else if(x == 'N'){
    cout << 'A' << endl;
  }
  else if(x == 'O'){
    cout << 'A' << endl;
  }
  else if(x == 'P'){
    cout << 'A' << endl;
  }
  else if(x == 'Q'){
    cout << 'A' << endl;
  }
  else if(x == 'R'){
    cout << 'A'  << endl;
  }
  else if(x == 'S'){
    cout << 'A' << endl;
  }
  else if(x == 'T'){
    cout << 'A' << endl;
  }
  else if(x == 'U'){
    cout << 'A' << endl;
  }
  else if(x == 'V'){
    cout << 'A' << endl;
  }
  else if(x == 'W'){
    cout << 'A' << endl;
  }
  else if(x == 'X'){
    cout << 'A' << endl;
  }
  else if(x == 'Y'){
    cout << 'A' << endl;
  }
  else if(x == 'Z'){
    cout << 'A' << endl;
  }
  else{
    cout << 'a' << endl;
  }
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;

int main() {
  int  a,b;
  int num = 0;
  cin >> a >> b;
  // for (size_t i = 0; i < 5; i++) {
  //   /* code */
  //   x += {(int)a[i] - (int) '0'} * pow(10, a.length() - i - 1);
  //   y += {(int)b[i] - (int) '0'} * pow(10, b.length() - i - 1);
  // }
  for (size_t i = a; i <= b; i++) {
    /* code */
    string g = to_string(i);
    if (g[0] == g[4] && g[1] == g[3]) {
      num++;
    }
  }
  cout << num << endl;
}


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

int main() {
string s, t;
cin >> s >> t;
sort(s.begin(), s.end());
sort(t.begin(), t.end(), greater<char>());
if (s < t) cout << "Yes" << endl;
else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys

N,M = list(map(int, input().split()))
SCs = [list(map(int, input().split())) for _ in range(M)]

num_list = list(range(10**(N-1), 10**N))

#print(num_list)
#print(SCs)

if(N == 1):
    num_list.append(0)
    num_list = sorted(num_list)

#print(num_list)

for num in num_list:
    num_hoge = list(str(num))
    num_hoge2 = list(map(int, num_hoge))

    cnt = 0
    for sc in SCs:
        if(num_hoge2[sc[0]-1] == sc[1]):
            cnt += 1
        
    if(cnt == len(SCs)):
        print(num)
        sys.exit()

print(-1)

Measured memory_bytes: 39536
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 1; i <= n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k, x, y, sum = 0;
  cin >> n >> k >> x >> y;
  REP(i,n) {
    if(i <= k) sum += x;
    if(i > k)  sum += y;
  }
  cout << sum << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
# Problem D - I hate Factorization

# input
X = int(input())

# count
ans = [0, 0]
for a in range(-500, 500):
    for b in range(-500, 500):
        if a**5 - b**5 == X:
            ans[0] = a
            ans[1] = b
            break

# output
print(" ".join(list(map(str , ans))))


Measured memory_bytes: 9208