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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  string s, t; cin >> s >> t;
  s += t;
  int val = atoi(s.c_str());
  int a = sqrt(val);
  printf("%s\n", (a * a == val) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

class Main{
	static int n;
	static long ans = 1000000000;
	static int[] memo;
	static int[] dp;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] P = new int[M];
		int[] Y = new int[M];
		int[] count = new int[N];				//県ごとの市の生まれた順番を記憶
		Map<Integer, Integer> map = new TreeMap<>();
		for(int i = 0;i < M;i++){
			P[i] = sc.nextInt();
			Y[i] = sc.nextInt();
			map.put(Y[i], i);
		}
		int num;
		for(Integer index :map.values()){
			num = P[index]-1;					//index調整
			if(count[num] == 0){				//もしその県にまだ何も生まれてなかったら
				count[num] = 1;
				Y[index] = count[num];			//順番(1番目)を記憶
			}else{
				count[num]++;
				Y[index] = count[num];			//順番を記憶
			}
		}
		
		for(int i = 0;i < M;i++){
			System.out.println(String.format("%06d%06d", P[i],Y[i]));
		}


	}
}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}


Measured memory_bytes: 152128
#include <stdio.h>
#define DATA_SIZE 3000
int main(void)
{
  int x[DATA_SIZE];
  int y[DATA_SIZE];
  int i, j;
  int tmp;
  
  for(i = 0; i < DATA_SIZE; i++) {
	scanf("%d %d", &x[i], &y[i]);

	if (x[i] > y[i]) {
	  tmp = x[i];
	  x[i] = y[i];
	  y[i] = tmp;
	}
	
	if(x[i] == 0 && y[i] == 0)
	  break;
  }

  if (i < DATA_SIZE) {
	for (j = 0; j < i; j++) {
	  printf("%d %d\n", x[j], y[j]);
	}
  }

  else {
	for (j = 0; j < DATA_SIZE; j++) {
	  printf("%d %d", x[j], y[j]);
	}
  }

	return 0;
}

Measured memory_bytes: 624
#include<bits/stdc++.h>
using namespace std;
unsigned long long N, K;

unsigned long long mysum(unsigned long long x){
  return (N + 1) * x * (x + 1) / 2 + x - x * (x + 1) * (2 * x + 1) / 6;
}

int main()
{
  cin >> N >> K;
  cout << (mysum(N + 1) - mysum(K - 1)) % 1000000007 << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define ll long long int
#define pii pair<int,int>
#define N 1005
using namespace std;
string s[N];
int num[N][N],vis[N*N],dist[N*N];
vector<pii>adj[N*N];
int main()
{
    int n,m,sx,sy,dx,dy;
    cin>>n>>m>>sx>>sy>>dx>>dy;
    sx--;sy--;dx--;dy--;
    for(int i=0;i<n;i++) cin>>s[i];
    int c=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++) num[i][j]=c++;
    }
    for(int i=0;i<N*N;i++) dist[i]=INT_MAX;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(s[i][j]=='#') continue;
            int cur=num[i][j];
            //cout<<cur<<" ";
            if(i>0 && s[i-1][j]=='.') adj[cur].push_back({0,num[i-1][j]});
            if(i<n-1 && s[i+1][j]=='.') adj[cur].push_back({0,num[i+1][j]});
            if(j<m-1 && s[i][j+1]=='.') adj[cur].push_back({0,num[i][j+1]});
            if(j>0 && s[i][j-1]=='.') adj[cur].push_back({0,num[i][j-1]});
            for(int x=max(0,i-2);x<=min(n-1,i+2);x++){
                for(int y=max(0,j-2);y<=min(m-1,j+2);y++){
                    if(x==i && y==j) continue;
                    if(s[x][y]=='#') continue;
                    adj[cur].push_back({1,num[x][y]});
                   // cout<<num[x][y]<<" ";
                }
            }
         //   cout<<"\n";
        }
    }
    priority_queue<pii,vector<pii>,greater<pii>>q;
    int S=num[sx][sy];
    int D=num[dx][dy];
    dist[S]=0;
    q.push({0,S});
    while(!q.empty()){
        pii p=q.top();
        q.pop();
        int x=p.first;
        int y=p.second;
        if(vis[y]==1) continue;
        vis[y]=1;
        for(int i=0;i<adj[y].size();i++){
            pii nd=adj[y][i];
            if(nd.first+x<dist[nd.second]){
                dist[nd.second]=nd.first+x;
                q.push({dist[nd.second],nd.second});
            }
        }
    }
    if(vis[D]==0) cout<<-1;
    else cout<<dist[D];
    return 0;
}


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

using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;

int main(){
    int N, sum = 0;
    int rate[4800], rateFlg[9];
    cin >> N;

    rep(i, N) cin >> rate[i];

    rep(i, N){
        for(int j = 0; j < 8; j++){
            if(rate[i] >= 400 * j && rate[i] < 400 * (j + 1) ){
                rateFlg[j] = 1;
            }
        }
        if(rate[i] >= 3200 && rate[i] <= 4800){
            rateFlg[9]++;
        }
    }

    rep(i, 8){
        sum += rateFlg[i];
    }
    if(sum == 0){
        cout << 1 << " " << rateFlg[9] << endl;
    }else{
        cout << sum << " " << (sum + rateFlg[9]) << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
vll divisor(ll n)
{
    vll div;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            div.push_back(i);
            if (i * i != n)
            {
                div.push_back(n / i);
            }
        }
    }
    return div;
}
int main()
{
    ll N;
    cin >> N;
    if (N == 1)
    {
        cout << 1;
        return 0;
    }
    auto Divisor = divisor(N);
    long double dif = N;
    ll div = 0;
    for (auto i : Divisor)
    {
        if (abs((double)i - sqrt(N)) < dif)
        {
            dif = abs(i - sqrt(N));
            div = i;
        }
    }
    cout << (int)max(log10(div) + 1, log10(N / div) + 1);
    return 0;
}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;
const int INF = 2147483647;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
    bool ret = true;
    if (x < 2) {
        ret = false;
    }
    for (LL i = 2; i <= sqrt(x); i++) {
        if (x%i == 0) {
            ret = false;
        }
    }
    return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//main code

int main(int argc, char const* argv[])
{
    string s;
    cin >> s;
    int c_count = 0;
    dump(int('a'));
    dump(int('Z'));
    if(s[0] != 'A') {
        cout << "WA" << endl;
        return 0;
    }
    for (int i = 1; i < s.size(); i++) {
        if (s[i] == 'C') {
            c_count++;
            if (c_count > 1 || i < 2 || i == s.size()-1) {
                cout << "WA" << endl;
                return 0;
            }
        } else if (s[i] <= 'Z') {

            cout << "WA" << endl;
            return 0;
        }
    }
    if (c_count == 0) {
        cout << "WA" << endl;
    }
    else {
        cout << "AC" << endl;
    }
    return 0;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n, a, b;
	cin >> n >> a >> b;
	int answer = 0;
	for(int i = 0; i < n; ++i){
		int t;
		cin >> t;
		if(t < a || b <= t){ ++answer; }
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        long a=sc.nextLong(),b=sc.nextLong(),k=sc.nextLong();
        long adif=k-a;
        if(a<k){
            a=0;
        }else{
            a=a-k;
        }
        if(adif>0){
            if(b<adif){
                b=0;
            }else{
                b=b-adif;
            }
        }
        System.out.println(a +" " +b);
    }
}


Measured memory_bytes: 22868
import java.util.*;

public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        boolean ans=false;
        for(int i=1;i<=100;i++){
            if((a*i-c)%b==0){
                ans=true;
                break;
            }
        }
        if(ans)System.out.println("YES");
        else System.out.println("NO");
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,S,x=0,i,j;
  cin >> K >> S;
  
  for(i=0; i<=K; i++)
    for(j=0; j<=K; j++)
      if(S-i-j>=0 && S-i-j<=K)
        x++;
  
  cout << x << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 500001

void maxHeapify(int *,int);
void buildMaxHeap(int *);
void temp(int *,int *);
int H;

int main(){
  int i,A[MAX];

  scanf("%d",&H);
  for(i=1;i<=H;i++) scanf("%d",&A[i]);
    
  buildMaxHeap(A);
  
  for(i=1;i<=H;i++) printf(" %d",A[i]);
  printf("\n");

  return 0;
}

void maxHeapify(int *A,int i){
  int l,r,largest;

  l=i*2;
  r=i*2+1;

  if(l<=H&&A[l]>A[i])
    largest=l;
  else largest=i;

  if(r<=H&&A[r]>A[largest])
    largest=r;

  if(largest!=i){
    temp(&A[i],&A[largest]);
    maxHeapify(A,largest);
  }
}

void buildMaxHeap(int *A){
  int i;

  for(i=H/2;i>=1;i--) maxHeapify(A,i);
}

void temp(int *a,int *b){
  int temp;

  temp=*a;
  *a=*b;
  *b=temp;
}

Measured memory_bytes: 2552
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
//#define T_ int
using namespace std;
//struct bit{T_ arr[1000005];int lowbit(int x){return x&(-x);}void add(int x,T_ y){for (int i=x;i<=n;i+=lowbit(i)) arr[i]+=y;}T_ query(int x){T_ s=0;for (int i=x;i>0;i-=lowbit(i)) s+=arr[i];return s;}};
//struct seg{struct treedot{int l,r;T_ sum,add;void update(T_ x){sum+=(r-l+1)*x; add+=x;}}c[800005];void pushdown(int id){if (c[id].add){c[id*2].update(c[id].add);c[id*2+1].update(c[id].add);c[id].add=0;}}void pushup(int id){c[id].sum=c[id*2].sum+c[id*2+1].sum;}void build(int id,int l,int r){if (l>r) return;c[id].l=l;c[id].r=r;c[id].sum=0;c[id].add=0;if (l==r) c[id].sum=0;else{int mid=l+(r-l)/2;build(id*2,l,mid);build(id*2+1,mid+1,r);pushup(id);}}void update(int id,int le,int ri,T_ x){if (le>c[id].r||ri<c[id].l) return;if (le<=c[id].l&&c[id].r<=ri) c[id].update(x);else{pushdown(id);update(id*2,le,ri,x);update(id*2+1,le,ri,x);pushup(id);}}T_ query(int id,int le,int ri){if (ri<c[id].l||c[id].r<le) return 0;if (le<=c[id].l&&c[id].r<=ri) return c[id].sum;T_ ans=0;pushdown(id);ans+=query(id*2,le,ri);ans+=query(id*2+1,le,ri);pushup(id);return ans;}};
//struct bit_2d{T_ a[2005][2005];int lowbit(int x){return x&(-x);}void add(int x,int y,T_ z){int i,j;for (i=x;i<=2000;i+=lowbit(i)){for (j=y;j<=2000;j+=lowbit(j)){a[i][j]+=z;}}}T_ query(int x,int y){int i,j;T_ s=0;for (i=x;i;i-=lowbit(i)){for (j=y;j;j-=lowbit(j)){s+=a[i][j];}}return s;}T_ query(int x,int y,int xx,int yy){return query(xx,yy)-query(x-1,yy)-query(xx,y-1)+query(x-1,y-1);}};
int n,m,i,j,a,b,c;
int main()
{
	cin>>a>>b>>c>>n;int s=0;
	fz0g(i,n) fz0g(j,n){
		int k=(n-a*i-b*j)/c;
		if (k>=0&&a*i+b*j+c*k==n) s++;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int N = Integer.parseInt(sc.next());
        final int K = Integer.parseInt(sc.next());
        final int R = Integer.parseInt(sc.next());
        final int S = Integer.parseInt(sc.next());
        final int P = Integer.parseInt(sc.next());
        final String T = sc.next();
        sc.close();

        char A[] = new char[N];
        for (int i=0; i<N; i++) {
            if ("r".equals(T.substring(i,i+1))) {
                A[i] = 'p';
            } else if ("s".equals(T.substring(i,i+1))) {
                A[i] = 'r';
            } else {
                A[i] = 's';
            }
        }
        for (int i=0; i<N-K; i++) {
            if (A[i]==A[i+K]) {
                A[i+K] = 'x';
            }
        }
        long sum = 0;
        for (int i=0; i<N; i++) {
            if (A[i]=='p') {
                sum += P;
            } else if (A[i]=='r') {
                sum += R;
            } else if (A[i]=='s') {
                sum += S;
            }
        }
        
        System.out.println(sum);
    }
}

Measured memory_bytes: 33736
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

void solve()
{
	int count[4] = {0};
	int num;
	string blood;
	while(scanf("%d,", &num) != EOF)
	{
		cin >> blood;
		if(blood == "A")
		{
			++count[0];
		}
		else if(blood == "B")
		{
			++count[1];
		}
		else if(blood == "AB")
		{
			++count[2];
		}
		else
		{
			++count[3];
		}
	}
	cout << count[0] << endl;
	cout << count[1] << endl;
	cout << count[2] << endl;
	cout << count[3] << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1236
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		sc.close();

		int mod = 998244353;
		long[][] dp1 = new long[c + 1][d + 1];
		long[][] dp2 = new long[c + 1][d + 1];
		for (int i = 1; i <= b; i++) {
			dp1[a][i] = 1;
		}
		for (int i = b + 1; i <= d; i++) {
			dp1[a][i] = dp1[a][i - 1] * a % mod;
		}

		for (int i = a + 1; i <= c; i++) {
			for (int j = 1; j <= d; j++) {
				dp1[i][j] = (dp1[i - 1][j] + dp2[i - 1][j]) * j % mod;
				if (j > b) {
					dp2[i][j] = (dp2[i][j - 1] * i + dp1[i][j - 1]) % mod;
				}
			}
		}
		System.out.println((dp1[c][d] + dp2[c][d]) % mod);
	}
}


Measured memory_bytes: 179068
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public int M;
        public int[,] A;
        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                M = line[1];
            }

            A = new int[N, M];

            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                for (int j = 0; j < M; j++)
                {
                    // (j + 1) 番目に好きなスポーツは A[i, j] - 1
                    A[i, line[j] - 1] = j + 1;
                }
            }

            int ret = int.MaxValue;

            for (int a = 0; a < M; a++)
            {
                var count = new int[M];

                for (int i = 0; i < N; i++)
                {   
                    for (int j = 0; j < M; j++)
                    {
                        if (A[i, j] == 1) count[j]++;
                    }
                }

                var s_mx = -1;
                var mx = -1;
                for (int j = 0; j < M; j++)
                {
                    if (count[j] > mx)
                    {
                        s_mx = j;
                        mx = count[j];
                    }
                }

                ret = Math.Min(ret, mx);

                for (int i = 0; i < N; i++)
                {
                    int priority = A[i, s_mx];
                    A[i, s_mx] = -1;

                    for (int j = 0; j < M; j++)
                    {
                        if (A[i, j] > priority) A[i, j]--;
                    }
                }
            }

            Console.WriteLine(ret);

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 15576
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long


signed main()
{
    FAST;
    
    int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
    int temp1=0,temp2=0,temp3=0,temp4=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,anss=0,start=0,end=0,r=0,q=0,total=0;
    int maxx=-1,minn=1e10,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,z=0,d=0,val=0;
    
    cin>>n>>m;
    
    cout<<min(n%m , abs(m - n%m))<<endl;
    
    
    
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (ll)((v).size())
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 


#define M 100010


int main(){
    IOS;
    tihs;
    
    ll x;cin>>x;
    ll now=100,cnt=0;
    while(1){
    	if(now>=x)break;
    	now+=(now/100),cnt++;
    }
    cout<<cnt;
   
    return 0;
}

Measured memory_bytes: 3652
import unittest


class TestA(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(10, 4), 3)

    def test_2(self):
        self.assertEqual(think(1, 10000), 1)

    def test_3(self):
        self.assertEqual(think(10000, 1), 10000)


def solve():
    h, a = read()
    result = think(h, a)
    write(result)


def read():
    return read_int(2)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(h, a):
    if h % a == 0:
        return h // a
    return h // a + 1


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

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

// Template Headers {{{
using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long; using vll = vector<long long>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
constexpr int INF = 0x3f3f3f3f; constexpr ll BINF = 0x3f3f3f3f3f3f3f3fLL;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}

int solve() {
	using pli = pair<ll, int>;
	using vpli = vector<pli>;
	int n, m, r; cin >> n >> m >> r;
	vector<vpli> g(n);
	for (int i=0;i<m;i++) {
		int u, v; ll l; cin >> u >> v >> l;
		g[u].emplace_back(v, l);
	}
	vll dist(n, BINF); vi vis(n);
	priority_queue<pli, vpli, greater<pli>> q;
	dist[r] = 0; q.emplace(dist[r] = 0, r);
	while (!q.empty()) {
		int u = q.top().second; q.pop();
		if (vis[u]) continue;
		vis[u] = 1;
		for (auto p : g[u]) {
			int v = p.first; ll t = dist[u] + p.second;
			if (t < dist[v]) q.emplace(dist[v] = t, v);
		}
	}
	for (ll d : dist) if (d != BINF)
		cout << d << endl;
	else
		cout << "INF" << endl;
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0);
	// precompute();
	// int t; cin >> t; for (int i=1;i<=t;i++)
	solve();
	// cout << (solve() ? "YES" : "NO") << endl;
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


Measured memory_bytes: 19760
#include<iostream>
using namespace std;
#define selling true
#define buying false
typedef long long int ll;
int main()
{
    int n;
    cin>>n;
    ll a[n];
    ll money = 1000,stock = 0;
    bool status = buying;
    for(int i=0;i<n;i++)
    cin>>a[i];
    int i=0,j;
    while(i<n)
    {
        j=i;
        if(status==buying)
        {
            while(j<n-1 & a[j]>=a[j+1])
                j++;
            if(j==n-1)
            break;
            //cout<<"Buying at "<<j+1<<endl;
            stock = money/a[j];
            money = money%a[j];
            status=selling;
        }
        else if(status == selling)
        {
            while(j<n-1 && a[j]<=a[j+1])
                j++;
            money = money+a[j]*stock;
            //cout<<"Selling at "<<j+1<<endl;
            status = buying;
        }
        i = j+1;
    }
    cout<<money<<endl;
}

Measured memory_bytes: 3640
r, c = map(int, input().split())
a = []
rsum = []

for i in range(r):
    a.append(list(map(int, input().split())))
    a[i].append(sum(a[i]))

for i in range(r):
    print(" ".join(list(map(str, a[i]))))

csum = []
for j in range(c+1):
    su = 0
    for i in range(r):
        su += a[i][j]
    csum.append(su)

print(" ".join(list(map(str, csum))))


Measured memory_bytes: 5700
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define T pair<int, int>
#define ordered_set tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    if (b==0) return (int)1;
    int x = p(a, b>>1);
    if (b & 1) return m(x*m(a*x));
    return m(x*x);
}
signed main(){
    fast();
    int n;
    cin >> n;
    vector<int> a(n);
    int c[200010] = {0};
    for(int i=0; i<n; i++){
        cin >> a[i];
        c[a[i]]++;
    }
    // for(int i=1; i<=10; i++)    cerr << c[i] << " ";
    // cerr << endl;
    int s = 0;
    for(int i=0; i<200010; i++){
        s += c[i]*(c[i]-1)/2;
    }
    // cerr << s << endl;
    for(int i=0; i<n; i++){
        cout << s-(c[a[i]]-1) << endl;
    }
}

Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 400000;

bool test(int n, string s) {
	if (n % 2 == 1) { return false; }

	rep(i, n / 2) {
		if (s[i] != s[i + n / 2]) { return false; }
	}

	return true;
}




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

	if (test(n, s)) { cout << "Yes"; }
	else { cout << "No"; }
	


	system("PAUSE");

}

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

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

using P = pair<int, int>;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if(par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }

    bool issame(int x, int y) { return root(x) == root(y); }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y)
            return false;
        if(par[x] > par[y])
            swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) { return -par[root(x)]; }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    vector<int> ans(n, 0);
    vector<vector<int>> g(n);
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
        uf.merge(a, b);
    }
    for(int i = 0; i < n; i++) {
        ans[i] += uf.size(i);
        ans[i] -= ((int)g[i].size() + 1);
    }
    for(int i = 0; i < k; i++) {
        int c, d;
        cin >> c >> d;
        c--;
        d--;
        if(uf.issame(c, d)) {
            ans[c]--;
            ans[d]--;
        }
    }
    for(int i = 0; i < n; i++) {
        cout << ans[i] << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 7544
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>

using namespace std;

int main(void) {
	int N;
	string S;
	cin >> N;
	cin >> S;

	vector<int> cE(N, 0), cW(N, 0);
	for (int i = 1; i < N; i++) {
		cE[i] = cE[i - 1] + (S[i - 1] == 'W' ? 1 : 0);
		cW[N - i - 1] = cW[N - i] + (S[N - i] == 'E' ? 1 : 0);
	}

	int ans = N;
	for (int i = 0; i < N; i++) ans = min(ans, cE[i] + cW[i]);
	
	cout << ans << endl;

	
	system("pause");
	return 0;
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define M 100010
#define LL long long
#define rep(i, x, y) for(int i = (x); i <= (y); ++ i)
inline int read() {
	char ch = getchar(); int x = 0, f = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while('0' <= ch && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
int a[M];
LL l[M], r[M];
int main() {
	//freopen("in.txt", "r", stdin);
	int n = read();
	rep(i, 1, n) a[i] = read();
	rep(i, 1, n) l[i] = l[i - 1] + abs(a[i] - a[i - 1]);
	for(int i = n; i >= 1; -- i) r[i] = r[i + 1] + abs(a[i] - a[i + 1]);
	for(int i = 1; i <= n; ++ i) {
		printf("%lld\n", l[i - 1] + r[i + 1] + abs(a[i + 1] - a[i - 1]));
	}
	return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>

using namespace std;

int main(void) {

    int a, b;
    cin >> a >> b;

//    cout << (a / b) << " "
//         << (a % b) << " "
//         << (static_cast<double>(a) / b)
//         << endl;
    printf("%d %d %lf\n", (a/b), (a%b), (static_cast<double>(a)/b));

//    int d = a / b;
//    int r = a % b;
//    double f = static_cast<float>(a) / b;
//    printf("%d %d %lf\n", d, r, f);

    return 0;
}

Measured memory_bytes: 1188
#include <iostream>

using namespace std;
int main(){
	int K,A,B;
	cin >> K >> A >> B;
	if (B - A <= 1){
		cout << K + 1 << endl;
	}
	else{
		long int sum = 1;
		while(K > 0){
			if (sum >= A && K >= 2){
				sum = sum - A + B;
				K = K-2;
			}
			else {
				sum = sum + 1;
				K = K-1;
			}
		}
		cout << sum << endl;
	}
}


Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;
typedef pair<int, int> II;

int main(int argc, char* argv[]) {
	int n, m, a, b;
	cin >> n >> m;
	vector<vector<int>> e(n);
	for (int i = 0; i < m; ++i) {
		cin >> a >> b;
		--a, --b;
		e[a].push_back(b);
		e[b].push_back(a);
	}
	vector<int> vis(n, -1);
	vis[0] = 0;
	vector<II> q;
	for (int a : e[0]) {
		q.push_back(II(0, a));
	}
	while (q.size() > 0) {
		vector<II> nq;
		for (auto kv : q) {
			int src = kv.first, dst = kv.second;
			if (vis[dst] >= 0) continue;
			vis[dst] = src + 1;
			for (int a : e[dst]) {
				nq.push_back(II(dst, a));
			}
		}
		q = nq;
	}
	cout << "Yes" << endl;
	for (int i = 1; i < n; ++i) {
		cout << vis[i] << endl;
	}
	return 0;
}


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

int main() {
	int H , W;
    cin >> H >> W;
    vector<vector<char>> hyo(H, vector<char>(W));
    for(int i = 0; i < H; i++){
    	for(int j = 0; j < W; j++){
        	cin >> hyo.at(i).at(j);
        }
    }
    int count = 0;
    for(int i = 0; i < W - count; i++){
        bool tate_check = false;
    	for(int j = 0; j < H; j++){
        	if(hyo.at(j).at(i) == '#'){
                tate_check = true;
            	break;
            }
        }
        if(tate_check == false){
          count++;
          for(int j = 0; j < H; j++){
        	for(int k = i; k < W - count; k++){
            	hyo.at(j).at(k) = hyo.at(j).at(k + 1);
            }
          }
          i--;
        }
    }
    for(int i = 0; i < H ; i++){
        bool yoko_check = false;
    	for(int j = 0; j < W - count; j++){
        	if(hyo.at(i).at(j) == '#'){
            	yoko_check = true;
                break;
            }
        }
        if(yoko_check == true){
        	for(int j = 0; j < W - count; j++){
            	cout << hyo.at(i).at(j);
            }
            cout << endl;
        }
    }
}


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

using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()

int main() {
  ll n;
  cin >> n;
  ll k = 1;
  REP(i, 45) {
    if ((1ll << i) > n) {
      k = i;
      break;
    }
  }
  cout << (1ll << k) - 1 << endl;
}


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

int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     int n;
     cin>>n;
     if(n<1200){cout<<"ABC\n";return 0;}
     if(n<2800){cout<<"ARC\n";return 0;}
     cout<<"AGC\n";
return 0;
}


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

int main()
{
	int n;
	cin>>n;
	string stringArray[n];
	for(int i=0;i<n;i++){
		cin>>stringArray[i];
	}
 

  std::map<string, int> count_find;
  int non_unique_count = 0, unique_count =0;

  for(int i=0;i<n;i++) {
  	string s=stringArray[i];
  	int count=0;
     count = ++count_find[s];
    if(count == 1) {         
      ++unique_count;        
    } else if(count == 2) {  
     	
    } else {                 
    }
  }

  std::cout << unique_count << std::endl;
}

Measured memory_bytes: 25476
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 55;
const int INF = 1e9;
const lli MOD = 1e9+7;


vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	vi m(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

lli SUM(lli a, lli b, lli mod=MOD){
	return (a+b+mod)%mod;
}
lli PROD(lli a, lli b, lli mod=MOD){
	a%=mod; b%=mod;
	return a*b % mod;
}
int dx[4]={-1,0,0,1}, dy[4]={0,1,-1,0};

// ---- コーディングはここから！ ('-')7



void solve(){
	int n,m; cin>>n>>m;
	vvi v(n+1);
	fore(i,0,m){
		int a,b;
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	vi vis(n+1,0), who(n+1,0);
	auto f=[&](auto f,int u, int w)->void{
		vis[u]=1;
		who[w]++;
		for(auto i:v[u])if(!vis[i])f(f,i,w);
	};
	int x=0;
	fore(i,1,n+1)if(!vis[i])f(f,i,x++);
	cout<<*max_element(all(who))<<ENDL;
}

int main(){_
	//int t; cin>>t; while(t--)
	solve();
}


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

int main()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i, 3) {
        if (s[i] == t[i]) ans++; 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include<iostream>
#include <stdlib.h>
using namespace std;
int h = 0;

int main()
{
		int N;
		int L;
		int min = 200;
		int sum = 0;
		int r = 0;
		int k = 0;

		cin >> N;
		cin >> L;

		for (int i = 0; i < N; i++)
		{
			r = L + i;
			k = abs(r);
			if (min > k)
			{
				min = k;
				h = i;
			}
			else if (r == 0)
			{
				h = i;
				break;
			}
		}

		for (int j = 0; j < N; j++)
		{
			if (j == h)
			{
				
			}
			else
			{
				sum = sum + L + j;
			}
		}

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

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
          Scanner sc=new Scanner(System.in) ;
            int a[]=new int[3];
            int i,j;
            for(i=0;i<3;i++){
            a[i]=sc.nextInt();
           }
           Arrays.sort(a);
           System.out.println(a[0]+a[1]);
    }
}

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

int n, a[105], b[105];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;i++) {
		scanf("%d",&b[i]);
	}
	for(int i=2;i<=n;i++) {
		a[i] += a[i-1];
		b[n-i+1] += b[n-i+2];
	}
	int ans = 0;
	for(int i=1;i<=n;i++) {
		ans = max(ans, a[i] + b[i]);
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    rep(i, K) {
        if (A >= B) {
            B *= 2;
        } else if (B >= C) {
            C *= 2;
        }
        // cout << A << " " << B << " " << C << endl;

        if (A < B && B < C) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define pb push_back
#define pob pop_back
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
int INF = 1e9 + 1;
int MOD = 1e9+7;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
signed main(){
  int a,b;
  cin >>a>>b;
  if(a<=8&&b<=8)cout<<"Yay!";
  else cout <<":(";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
#define maxn 300005
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
struct op
{
    int x,y;
    bool operator<(const op &b)const
    {return x==b.x?y<b.y:x<b.x;}
}b[maxn];
inline void Max(int &x,int y){x=x>y?x:y;}
inline void Min(int &x,int y){x=x<y?x:y;}
int W,H,n,ans,tot;
struct Seg
{
#define ls k<<1
#define rs k<<1|1
    int val[maxn<<2],tag[maxn<<2];
    inline void clear(){memset(val,0,sizeof val);memset(tag,0,sizeof tag);}
    inline void push_down(int k)
    {
        if(tag[k]==0)return ;
        val[ls]+=tag[k];tag[ls]+=tag[k];
        val[rs]+=tag[k];tag[rs]+=tag[k];
        tag[k]=0;
    }
    inline void modify(int k,int l,int r,int x,int y,int v)
    {
        if(x<=l&&r<=y){tag[k]+=v;val[k]+=v;return ;}
        int mid=(l+r)>>1;push_down(k);
        if(x<=mid)modify(ls,l,mid,x,y,v);
        if(y>mid)modify(rs,mid+1,r,x,y,v);
        val[k]=max(val[ls],val[rs]);
    }
#undef ls
#undef rs
}tr;
int pre[maxn];
struct node{int l,r,val;}up[maxn],down[maxn];
int top0,top1;
inline void solve()
{
    tr.clear();
    top0=top1=0;node tmp;
    reg int i=1,p=0,u,d,mid=H>>1;
    while(i<=tot)
    {
        ++p;pre[p]=b[i].x;
        u=H;d=0;
        tr.modify(1,1,tot,p,p,H-pre[p-1]);
        Max(ans,tr.val[1]+b[i].x);
        if(b[i].y>mid)Min(u,b[i].y);
        else Max(d,b[i].y);
        while(i<tot&&b[i+1].x==b[i].x)
        {
            ++i;
            if(b[i].y>mid)Min(u,b[i].y);
            else Max(d,b[i].y);
        }
        tr.modify(1,1,tot,p,p,u-d-H);
        tmp=node{p,p,u};up[++top0]=tmp;
        while(top0>1&&up[top0-1].val>=u)
        {
            --top0;
            tr.modify(1,1,tot,up[top0].l,up[top0].r,u-up[top0].val);
            up[top0]=node{up[top0].l,p,u};
        }
        tmp=node{p,p,d};down[++top1]=tmp;
        while(top1>1&&down[top1-1].val<=d)
        {
            --top1;
            tr.modify(1,1,tot,down[top1].l,down[top1].r,down[top1].val-d);
            down[top1]=node{down[top1].l,p,d};
        }
        ++i;
    }
}
int main()
{
    W=read(),H=read(),n=read();
    reg int i;tot=n;
    for(i=1;i<=n;++i)
        b[i].x=read(),b[i].y=read();
    b[++tot]=op{0,0};
    b[++tot]=op{W,H};
    sort(b+1,b+1+tot);solve();swap(H,W);
    for(i=1;i<=tot;++i)swap(b[i].x,b[i].y);
    sort(b+1,b+1+tot);solve();
    printf("%d\n",ans*2);
	return 0;
}


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

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

  vector<int> vec(N);

  int ans_a, ans_b;
  int ans = 1;

  for (int i = 0; i < N; i++) {
	ans_a = ans * 2;
	ans_b = ans + K;

	ans = ans_a < ans_b ? ans_a : ans_b;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
N, K = map(int,input().split())
x = list(map(int,input().split()))
ans = float("inf")
for i in range(N-K+1):
    ans = min(ans, abs(x[i])+abs(x[i]-x[i+K-1]))
    ans = min(ans, abs(x[i+K-1])+abs(x[i]-x[i+K-1]))
print(ans)

Measured memory_bytes: 20072
import java.io.*;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

class Match{
    public static long simple(String str, char target){
	    long count = 0;
	    for(char x: str.toCharArray()){
		    if(x == target){
			count++;
		    }
	    }
	    return count;
    }
}

class Main{
    public static void main(String args[]){
        String buf;
        long num;
        long ans = 0;
        long r_num = 0;
        long g_num = 0;
        long b_num = 0;
        char r = 'R';
        char g = 'G';
        char b = 'B';

        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            num = Integer.parseInt( br.readLine() );
            buf = br.readLine();
            r_num = Match.simple( buf , r );
            g_num = Match.simple( buf , g );
            b_num = Match.simple( buf , b );
            ans = r_num * g_num * b_num;

            for(int i = 0; i < num ; i++ ){
                for(int j = i + 1; j <= (num+i) / 2 + 2  ; j++ ){
                    int k = 2 * j - i;
                    if (k < num){
                        String tmp;
                        tmp = String.valueOf( buf.charAt(i) ) + String.valueOf( buf.charAt(j) ) + String.valueOf( buf.charAt(k) );
                        if ( tmp.contains("R") && tmp.contains("G") && tmp.contains("B") ){
                            ans = ans - 1;
                        }
                    }
                }
            }  
            
            
            
        } catch(Exception e) {
        }
        System.out.println(Long.toString(ans));
    }
}


Measured memory_bytes: 55052
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
int min(int a,int b){
    return a < b ? a : b;
}
int main(void){
    int N,M,X;
    cin >> N >> M >> X;
    int C[N];
    int A[N][M];
    for(int i=0;i<N;i++){
        cin >> C[i];
        for(int j=0;j<M;j++){
            cin >> A[i][j];
        }
    }
    int ans = 1000000000;
    bool ac;
    for(int i=1;i<2<<N-1;i++){
        int sum = 0;
        int skill[12] = {0};
        ac = true;
        for(int j=0;j<N;j++){
            if((i >> j) & 1){
                sum += C[j];
                for(int k=0;k<M;k++){
                    skill[k] += A[j][k];
                }
            }
        }
        for(int j=0;j<M;j++){
            if(skill[j] < X){
                ac = false;
                break;
            }
        }
        if(ac){
            ans = min(ans,sum);
        }
    }
    if(ans == 1000000000)ans = -1;
    cout << ans;
}

Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	long long a[100000+10],b[100000+10];
	cin>>n;
	for(int i=1;i<=n;i++){cin>>a[i];b[i]=0;}
	sort(a+1,a+n+1);
	a[0]=0;
	b[0]=0;
	for(int i=1;i<=n;i++)b[i]=b[i-1]+a[i];
	//for(int i=1;i<=n;i++)cout<<b[i]<<" "; 
	for(int i=n;i>=1;i--)
	if(b[i-1]*2<a[i]){
		cout<<n-i+1<<endl;
		return 0;
	}
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 1792