akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(k,i,n) for(int i = (k); i < (int)(n); i++)
typedef long long ll;
typedef pair<int,int> Pii;

int main() {
    int n;cin>>n;
    vector<Pii> qa(n);
    vector<Pii> qb(n);
    rep(i,n){
        int a,b;cin>>a>>b;
        qa[i]=Pii(a,b);
    }rep(i,n){
        int a,b;cin>>a>>b;
        qb[i]=Pii(a,b);
    }
    sort(qa.begin(), qa.end());
    sort(qb.begin(), qb.end());
    int ans=0;
    vector<bool> ex(n,true);
    rep(i,n){
        int c=qb[i].first,d=qb[i].second;
        int ma=-1,mk=-1;
        rep(k,n){
            int a=qa[k].first,b=qa[k].second;
            
            if(c>a&&d>b&&b>ma&&ex[k]){
                mk=k;
                ma=b;
            }
            else if(c<a) break;   
        }
        if(mk<0) continue;
     //   cout<<c<<" "<<d<<" "<<qa[mk].first<<" "<<qa[mk].second<<endl;
        ex[mk]=false;
        ans++;
    }

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

Measured memory_bytes: 256
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<time.h>
#include<iostream>
#include<queue>
#include<stack>
#include<map>
#include<cmath>
#include<ext/rope>
#define ll long long
#define oo 0x7fffffff
using namespace std;
using namespace __gnu_cxx;
inline ll read()
{
	ll out=0,fh=1;
	char cc=getchar();
	while ((cc>'9'||cc<'0')&&cc!='-')
		cc=getchar();
	if (cc=='-')
		{
			fh=-1;
			cc=getchar();
		}
	while (cc>='0'&&cc<='9')
		{
			out=out*10+cc-'0';
			cc=getchar();
		}
	return out*fh;
}
const int MAXN=2e5+10;
ll a[MAXN];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n=read();
	for(register int i=1;i<=n;++i)
		a[i]=read()-i;
	sort(a+1,a+1+n);
	ll mid=a[(n+1)/2];
	ll sum=0;
	for(register int i=1;i<=n;++i)
		sum+=abs(mid-a[i]);
	printf("%lld",sum);
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){
    ll n, d, a; cin >> n >> d >> a;
    vector<pll> monster(n);
    rep(i, n){
        ll x, h; cin >> x >> h;
        monster[i] = {x, h};
    }
    sort(all(monster));

    vector<ll> right, S(n+1);
    rep(i, n){
        ll X = monster[i].first, H = monster[i].second;
        ll r = X + d*2;//爆風の東端
        if(i==0){
            right.push_back(r);
            S[i+1] = S[i] + (H+a-1)/a;
        }else{
            int index = lower_bound(all(right), X) - right.begin(); //爆風が届く最初の爆破
            //cout << "index:" << index;
            int num = right.size() - index; //num個の爆発に巻き込まれている
            //cout << " num:" << num;
            ll b_dam = (S[i] - S[i - num]) * a;//他の爆発に巻き込まれて受けたダメージ
            //cout << " b_dam:" << b_dam;
            H -= b_dam;
            ll cnt = H>0 ? (H+a-1)/a : 0;
            S[i+1] = S[i] + cnt;
            right.push_back(r);
        }
        //cout << ln;
    }
    cout << S.back() << ln;
    //for(ll tmp: S)cout << tmp << " "; cout << ln;
}

Measured memory_bytes: 9940
fun main(args: Array<String>) = panasonic2020b()

fun panasonic2020b() {
    val (h, w) = readLine()!!.split(' ').map { it.toLong() }

    if (h == 1L || w == 1L) return println(1)

    val answer = (h * w / 2) + if (h % 2 != 0L && w % 2 != 0L) 1 else 0

    println(answer)
}


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

#define ll long long
#define pb push_back
#define int ll

const int maxn = 2e5 + 20;
const int maxm = 2e3 + 20;
const int mod = 1e9 + 7;

int dp[2 * maxm][2 * maxm] , a[maxn] , b[maxn] , fac[maxn] , caf[maxn];

void mkay(int &a)
{
	a %= mod;
	if(a < 0)
		a += mod;
}

int bpw(int a , int b)
{
	if(!b)
		return 1;

	int x = bpw(a , b / 2);

	x = 1LL * x * x % mod;
	if(b&1)
		x = 1LL * x * a % mod;

	return x;
}

int c(int s , int r)
{
	if(r < 0 || r > s)
		return 0;

	return 1LL * (1LL * fac[s] * caf[r] % mod) * caf[s - r] % mod;
}

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

	fac[0] = 1;
	for(int i = 1; i < maxn; i++)
		fac[i] = 1LL * fac[i - 1] * i % mod;

	caf[maxn - 1] = bpw(fac[maxn - 1] , mod - 2);

	for(int i = maxn - 1; i > 0; i--)
		caf[i - 1] = 1LL * caf[i] * i % mod;

	int n;
	cin >> n;

	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i] , dp[-a[i] + maxm][-b[i] + maxm]++;

	for(int i = 1; i < 2 * maxm; i++)
		for(int j = 1; j < 2 * maxm; j++)
			mkay(dp[i][j] += dp[i - 1][j] + dp[i][j - 1]);

	int res = 0;
	for(int i = 0; i < n; i++)
	{
		mkay(res += dp[a[i] + maxm][b[i] + maxm]);
		mkay(res -= c((a[i] + b[i]) * 2 , 2 * a[i]));
	}

	res = 1LL * res * bpw(2 , mod - 2) % mod;

	cout << res << endl;
}









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

int main()
{
    int N, K;
    cin >> N;
    cin >> K;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int pos;
        cin >> pos;
        ans += 2 * min(pos, K - pos);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  std::string S, T; std::cin >> S >> T;

  std::string N = T + T;
  if ( N.find(S) == std::string::npos ) std::cout << "No" << std::endl;
  else std::cout << "Yes" << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>

using namespace std;

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

	int a[1000] = {0};
	int n = 0;
	for (int i = 0; i < s.length(); i++)
	{
		n = (int)s[i];
		if (a[n] == 0)
		{
			a[n] = 1;
		}
		else
		{
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << 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));
		String line;
		

		while(true){
			line = br.readLine();
			int num = Integer.valueOf(line);
			if(num == 0){
				break;
			}

			line = br.readLine();
			String[] nums = line.split(" ");
			boolean NA = true;
			int zeros = 0;
			for(int i = 0; i < num; i++){
				int k = Integer.valueOf(nums[i]);
				if(k == 0){
					zeros++;
					continue;
				}
				if(k >= 2){
					NA = false;
					continue;
				}
			}
			if(NA){
				System.out.println("NA");
			}else{
				System.out.println(num + 1 - zeros);
			}
		}
	}

}

Measured memory_bytes: 63256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
      Scanner scn = new Scanner(System.in);
      int k=scn.nextInt();
      int a=scn.nextInt();
      int b=scn.nextInt();
      for(;a<=b;a++){
          if(a%k==0){
            System.out.printf("OK\n");
            return;
          }
      }
      System.out.printf("NG\n");
    }
}


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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    int m=n/2;
    int l=v[m-1],r=v[m];
    cout<<r-l<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
typedef long long ll;
using namespace std;

int main() {
	ll a, b, c; scanf("%lld%lld%lld", &a, &b, &c);
	bool all_odd = true;
	if ((a & 1) == 0 || (b & 1) == 0 || (c & 1) == 0) {
		all_odd = false;
	}

	ll ans;
	if (all_odd) {
		ans = min({a * b, a * c, b * c});
	}
	else ans = 0;

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(2e5)+5;

ll ar[ms]={0};
ll br[ms]={0};


ll go(ll x,ll r)
{
    ll l=1;
    ll md;
    ll a=0;
    while(l<=r)
    {
        md=(l+r)>>1;
        if(br[md]<=x)
        {
            a=max(a,md);
            l=md+1;
        }
        else r=md-1;
    }
    return a;
}

int main()
{
    idfc;
    ll n,m,k;
    cin>>n>>m>>k;
    ll i;
    for(i=1;i<=n;i++)
    {
        cin>>ar[i];
        ar[i]+=ar[i-1];
    }
    for(i=1;i<=m;i++)
    {
        cin>>br[i];
        br[i]+=br[i-1];
    }
    ll ans=0;
    ll t;
    for(i=0;i<=n;i++)
    {
        if(ar[i]<=k)
        {
          t=k-ar[i];
          ans=max(ans,i+go(t,m));
        }
        else break;
    }
    cout<<ans;


    return 0;
}

Measured memory_bytes: 6748
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = InputNumList();
            int n = a[0];
            int k = a[1];

            long ans = k;
            for(int i = 0; i < n-1; i++)
            {
                ans *= k - 1;
            }
            WriteLine(ans);
        }

        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}

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

public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();

		if(a > b){
			a--;
		}
		
		System.out.println(a);
	}
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
 
int main() {
    int n, buf, cnt, ans1, ans2;
    cnt = 0;
    int b[9];
    for (int i = 0; i < 9; i++) {
        b[i] = 0;
    }
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> buf;
        if (buf < 400) {
            b[0]++;
        } else if (buf < 800) {
            b[1]++;
        } else if (buf < 1200) {
            b[2]++;
        } else if (buf < 1600) {
            b[3]++;
        } else if (buf < 2000) {
            b[4]++;
        } else if (buf < 2400) {
            b[5]++;
        } else if (buf < 2800) {
            b[6]++;
        } else if (buf < 3200) {
            b[7]++;
        } else if (buf >= 3200) {
            b[8]++;
        }
    }
    for (int i = 0; i < 8; i++) {
        if (b[i] != 0) cnt++;
    }
    ans1 = cnt;
    ans2 = cnt + b[8];
    ans1 = max(1, ans1);
    cout << ans1 << " " << ans2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(ll i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;
int f (int a) {
	if (a == 1) return 300000;
	else if (a == 2) return 200000;
	else if (a == 3) return 100000;
	else return 0;
}
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	cout << f(a) + f(b) + ((a == 1) && (b == 1) ? 400000 : 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long n;
    string S;
    cin>>S;
    if(S=="SUN"){
        n=7;
    }
    if(S=="MON"){
        n=6;
    }
    if(S=="TUE"){
        n=5;
    }
    if(S=="WED"){
        n=4;
    }
    if(S=="THU"){
        n=3;
    }
    if(S=="FRI"){
        n=2;
    }
    if(S=="SAT"){
        n=1;
    }
    cout<<n<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

void trace(int a[], int n){
    for(int i=0;i<n;i++){
        if(i>0)printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
}

void insertionSort(int a[], int n){
    for(int i=1;i<n;i++){    // current immigrant cadidate 
        int now=a[i];
        int j=i-1;
        while(j>=0 &&a[j]>now){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=now;
        trace(a,n);
    }
}

int main(){

    int n, i, j;

    int a[100];

    scanf("%d", &n);
    for(int i=0;i<n;i++){
        scanf("%d", &a[i]);
    }
    trace(a,n);
    insertionSort(a,n);

    return 0;
}



Measured memory_bytes: 2664
#include <stdio.h>

int main(void){
	int h,w;
	while(1){
		int i,j;
		scanf("%d %d",&h,&w);
		if(!h&&!w) break;
		for(j=0;j<h;j++){
		for(i=0;i<w;i++){
			printf("#");
		}
		printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
n=int(input())
a=[int(i)-1 for i in input().split()]
N=10**5+19
b=[0 for i in range(N)]
for i in a:
  b[i]+=1
ans=0
for i in range(N-2):
  ans=max(b[i]+b[i+1]+b[i+2],ans)
print(ans)

  

Measured memory_bytes: 13964
import java.util.Scanner;
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();
int d=sc.nextInt();
System.out.println(a*b>=c*d?a*b:c*d );
 }
  }


Measured memory_bytes: 23508
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,A[100],ans=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>A[i];
  for(int i=0;i<n-1;i++){
    for(int j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
    swap(A[j],A[j-1]);
    ans++;
      }
    }
  }
  for(int i=0;i<n;i++){
    if(i)cout<<' ';
    cout<<A[i];
  }
  cout<<endl<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pii;
const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;
template<typename T>
inline void read(T&x){
    x=0;int f=1;char ch = getchar();
    while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
    while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    x*=f;
}
 
void solve(){
	string s, t;
	int n;
	cin >> n;
	cin >> s >> t;
	int r = 0;
	for(int i = 0; i < n; i++) {
		cout << s[i] << t[r++];
	}
}
 
int main(){
    OP
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    for(int i = 1; i <= t; i++) {
        solve();
    }
    return 0;
}

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

int N, ans = 0, p, res;
int a = 1,b = 1;
vector<int> P, Q;
vector<int> R;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int compTwoVector(const vector<int>& l, const vector<int>& r) {
    // printVector(l);
    // printVector(r);
    // for (int value_l : l) {
    for (int i = 0; i < N; ++i) {
        // cout << l[i] << " " << r[i] << endl;
        for (int j = 0; j < N; ++j) {
            if (l[i] == r[i]){
                break;
            } else if (l[i] > r[i]) {
                return 1;
            } else {
                return -1;
            }
        }
    }
    return 0;
}

int main() {
    cin >> N;
    P.resize(N);
    Q.resize(N);
    
    for (int i = 0; i < N; i++) {
        cin >> P[i];
    }  
    for (int i = 0; i < N; i++) {
        cin >> Q[i];
    }

    R.resize(N);
    iota(R.begin(), R.end(), 1);
    do {
        res = compTwoVector(P, R);
        if (res != 0) {
            a++;
        } else if (res == 0) {
            break;
        }
    } while (next_permutation(R.begin(), R.end()));

    iota(R.begin(), R.end(), 1);
    do {
        res = compTwoVector(Q, R);
        if (res != 0) {
            b++;
        } else if (res == 0) {
            break;
        }
    } while (next_permutation(R.begin(), R.end()));
    // cout << a << " " << b << endl;

    cout << abs(a - b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  set<int> S;
  for(auto i = 0; i < N; ++i) {
    int A;
    cin >> A;
    if(S.count(A)) S.erase(A);
    else           S.emplace(A);
  }
  cout << S.size() << endl;
}


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

int w(long long x)
{
	int ans;
	ans=0;
	while (x!=0)
	{
		ans+=x%10;
		x/=10;
	}
	return ans;
}

int main()
{
	int n;
	cin>>n;
	int i,s1,s2,maxv,sum;
	maxv=100000000;
	for (i=1;i<=n-1;i++)
	{
		sum=0;
		s1=i;
		s2=n-i;
		sum=w(s1)+w(s2);
		if (sum<maxv)
		{
			maxv=sum;
		}
	}
	cout<<maxv<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define pb push_back
    #define mk make_pair
    #define ft first
    #define sc second
    #define ppb pop_back
    #define sz size
    #define forn(i,a,n) for(i=a;i<n;i++)
    #define M 1000000007
    #define inf 2e18
    
    int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll x; cin>>x;
    ll arr[] = {100,101,102,103,104,105};
    ll dp[100005];
    memset(dp,0,sizeof dp);
    dp[0]=1;
    
    ll i,j;
    for(i = 0; i<6; i++){
        for(j = arr[i]; j<=100000;j++){
            dp[j] += dp[j-arr[i]] ;
        }
    } 
    if(dp[x])cout<<"1";
    else
        cout<<"0";

    return 0;
    } 

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
   // freopen("in.txt", "r", stdin);
    double N, k;
    cin>>N>>k;
    double ans = 0;

    for (int i=1;i<=N;++i){
        if (i<=k-1){
            double nbr = (log(k/i)/log(2));
            int n = floor(nbr);
            if (nbr - n > 0) n++;

            double res = pow(0.5, n);
            res *= 1/N;
            ans += res;
        }
        else ans += 1/N;
    }

    printf ("%.12lf\n", ans);

    return 0;
}

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

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

int main(){
    double R;
    cin >> R;
    printf("%.10f\n", 2 * PI * R);
    return 0;
}


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


int main(){
    bool flag1 = false,flag2 = false,flag3 = false;

    string s; cin >> s;
    int n = s.size();
    string t="";
    for(int i=s.size()-1;i>=0;i--) t+=s[i];
    if(s==t) flag1 = true;
    string s_n1 = "";
    for(int i=0;i<(n-1)/2;i++) s_n1+=s[i];
    string s_n1r = "";
    for(int i=(n-1)/2-1;i>=0;i--) s_n1r+=s[i];
    if(s_n1 == s_n1r) flag2 = true;
    
    string s_n3 = "";
    for(int i=(n+3)/2-1;i<n;i++) s_n3+=s.at(i);
    string s_n3r = "";
    for(int i=s_n3.size()-1;i>=0;i--) s_n3r+=s_n3[i];
    if(s_n3 == s_n3r) flag3 = true;
    
    if(flag1 && flag2 && flag3) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;  
}


Measured memory_bytes: 256
// mod 組み合わせ計算　縦列も
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

// 自動でmodを取ってくれる整数型
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const { //pow(a, b) aのb乗
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) { // コロン以下は初期化子リスト
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv(); // fact[i]の逆元
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

mint choose(int n,int a){ // 組み合わせ　nCa
    mint x=1,y=1;
    rep(i,a){
        x*=n-i;
        y*=i+1;
    }
    return x/y;
}

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}


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

//  mint ans=pow(2,n)-1; // n=63以上で値がおかしい
  mint ans = f(n)-1;
  mint m;
  ans-=choose(n,a);
  ans-=choose(n,b);
  cout<<ans.x<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define INF (1e8+1)
#define MAX_M 10000
int M,N;
int t[10001];
int a[501],b[501];
int dp[501][10001];
 
int main(){
  cin>>M>>N;
  for(int i=1;i<=M;i++)cin>>t[i];
  for(int i=1;i<=N;i++)cin>>a[i]>>b[i];
  sort(t+1,t+M+1,greater<int>());
  t[0]=0;
  for(int i=1;i<=M;i++)t[i]+=t[i-1];
 
  for(int i=0;i<=N;i++)
    for(int j=0;j<=MAX_M;j++)
      dp[i][j]=(j==0?0:INF);
   
  for(int i=1;i<=N;i++){
    for(int j=MAX_M;j>=0;j--){
      if( j-a[i]>=0) dp[i][j]=min(dp[i][j],dp[i-1][j-a[i]]+b[i]);
      dp[i][j]=min(dp[i][j],dp[i-1][j]);
      if(j+1<=MAX_M)dp[i][j]=min(dp[i][j],dp[i][j+1]);
    } 
  }
   
  int ans = 0;
  for(int i=0;i<=MAX_M;i++){
    if(dp[N][i]==INF)continue;
    int a = (i<=M?t[i]:t[M]);
    ans=max(ans,a-dp[N][i]);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 20800
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        if (S.equals("Sunny")) {
            System.out.println("Cloudy");
        } else if (S.equals("Cloudy")) {
            System.out.println("Rainy");
        } else if (S.equals("Rainy")) {
            System.out.println("Sunny");
        }
        sc.close();
    }
}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
#define N 50
#define mod
#define inf 
#define rg register
typedef double db;
typedef long long ll;

using namespace std;

inline int gi(){
	int w=0,q=0; char c=getchar();
	while((c<'0'||c>'9')&&(c!='-')) c=getchar();
	if(c=='-') q=1,c=getchar();
	while (c>='0'&&c<='9') w=w*10+c-'0',c=getchar();
	return q?-w:w;
}

int n,m,p[N];

int main(){
	//freopen (".in","r",stdin);
	//freopen (".out","w",stdout);
	n=gi(),p[1]=gi(),m=1;
	if (n==1) puts("1"),exit(0);
	for (int i=2;i<=30;++i){
		p[i]=p[i-1]*p[1];
		if (p[i]<=0) break;
	}
	for (int i=30;i;--i){
		if (p[i]<=0) continue;
		if (p[i]<=n) printf ("%d\n",i+1),exit(0);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  sort(A.begin(),A.end());
  cout<<A.at(N-1)-A.at(0)<<endl;
}


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

int main() {
  int n;
  int t;
  int sum = 0;
  cin >> n;
  
  t = n;

  while (t > 0){
    sum += t % 10;
  	t = t / 10;
  }
  
  if(n % sum == 0){cout << "Yes" << endl;} 
  else{cout << "No" << endl;}

}

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

int main()
{
  lli n,k;
  cin>>n>>k;
  lli W[n],V[n];
  for(lli i=0;i<n;i++)
  {
   cin>>W[i]>>V[i];
  }
  lli dp[100001];
  for(lli i=0;i<100001;i++) dp[i]=-1;
  dp[0]=0;
  for(lli i=0;i<n;i++)
  {
  	for(lli j=100000;j>=0;j--)
  	{
     if(dp[j]!=-1)
     { if(dp[V[i]+j]==-1)
     	dp[V[i]+j]=W[i]+dp[j];
     	else
     	dp[V[i]+j]=min(W[i]+dp[j],dp[j+V[i]]);
     }
  	}
  }
  for(lli i=100000;i>=0;i--)
  {
  	if(dp[i]!=-1 && dp[i]<=k)
  	{
  		cout<<i<<endl;
  		break;
  	}
  }
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
 
int moji_to_num(char c){
    if('A' <= c && c <= 'Z') c += 'a' - 'A';
    if('a' <= c && c <= 'z') return (c-'a');
    return 27;
}
int main(){
    string str;
    int cnt[26]={0};
     
    while(getline(cin,str)){
        for(int i = 0 ; i < str.size() ; i++){
            cnt[moji_to_num(str[i])]++;
        }
    }
        char c = 'a';
     
    for(int i = 0 ; i < 26 ; i++){
        cout << c++ << ' '  << ':' << ' ' << cnt[i] << endl;
    }
     
    return 0;
}



Measured memory_bytes: 3152
from bisect import bisect_right as br


def main():
    n, m, k = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    tmp = 0
    a = 0
    b = 0
    Sb = [B[0]]
    for i in range(1, m):
        Sb.append(Sb[-1] + B[i])
    Sa = [A[0]]
    for i in range(1, n):
        Sa.append(Sa[-1] + A[i])
    mx = 0
    for j in range(n):
        index = br(Sb, k - Sa[j]) - 1
        tmp = Sa[j] + Sb[index] if index > 0 else Sa[j]
        if tmp <= k:
            mx = max(mx, j + index + 2)
    li = br(Sb, k)
    mx = max(li, mx)
    print(mx)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 47556
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int r;
    cin >> r;
    if(r < 1200) cout << "ABC" << endl;
    else if(r < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  ll H;
  int N;
  while (cin >> H >> N) {
    vector<ll> A(N);
    for (auto& x : A) cin >> x;
    ll sum = accumulate(A.begin(), A.end(), 0ll);
    cout << (sum >= H ? "Yes" : "No") << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;
int main()
{
	int n = 0;
	int v[50] = {}, c[50] = {};
	int a = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	for (int i = 0; i < n; i++) {
		if ((v[i] - c[i]) > 0) {
			a += (v[i]-c[i]);
		}
	}
	cout << a;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
long long N;


int main()
{
    cin>>N;
    if (N%2==0)
    {
       cout<<N<<endl;
    }
    else
    {
       cout<<2*N<<endl;
    }
    return 0;
} 


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>

using namespace std;
typedef long long ll;

int main(){
  ll n,temp,ans=0;
  scanf("%lld",&n);
  for(ll i=(ll)sqrt((double)n);i>0;i--){
    if(i*(n/i)==n){
      temp=n/i;
      break;
    }
  }

  while(temp!=0){
    temp=temp/10;
    ans++;
  }

  printf("%lld\n",ans);

  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class ARoundOne {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int a, b; cin >> a >> b;
      cout << (a^b) << endl;
    }
};

signed main() {
  ARoundOne solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
N=int(input())
S=list(input())
x=list(map(str,list(range(10))))
cnt=0
for i in x:
  if i in S:
    p=S.index(i)
    S1=S[p+1:]
    for j in x:
      if j in S1:
        q=S1.index(j)
        S2=S1[q+1:]
        for k in x:
          if k in S2:
            cnt+=1
print(cnt)

Measured memory_bytes: 10312
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int n, d;

bool isok(vector<int> &a, vector<int> &b)
{
    int sum = 0;
    rep(i, d)
    {
        sum += (a[i] - b[i]) * (a[i] - b[i]);
    }
    //  cerr << sum << endl;
    int pow = 1;
    while (pow * pow < sum)
        pow += 1;
    return pow * pow == sum;
}

int main(int argc, char const *argv[])
{
    cin >> n >> d;
    vector<vector<int>> v(n, vector<int>(d, 0));
    rep(i, n) rep(j, d) cin >> v[i][j];
    int ans = 0;
    rep(i, n) rep(j, i + 1, n)
    {
        if (isok(v[i], v[j]))
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
int x,y;
cin >> x>> y;
if(x+y>=10){
    cout << "error" << endl;
}else{
    cout << x+y << endl;
}
return 0;
}

Measured memory_bytes: 256
import math
n,m = map(int, input().split())

num_b = max([n,m]) #多い方
num_l = min([n,m]) #少ない方
ans = 0
if num_b - num_l >= 2: #差が2以上あると、隣接なしでは並べられない
  ans = 0
elif num_b - num_l == 1:
  #差が1匹の場合
  #多い方が(num_b)!通り、少ない方が(num_l)!通りの並び方なので、その積をとる
  ans = math.factorial(num_b) * math.factorial(num_l) % (10 ** 9 + 7)
else:
  #差が0匹の場合
  #一方を先に並べる。(num_b)!通り。もう一方をまず間に入れる。(num_l - 1)匹選ぶ方法がnum_l通りで並べ方が(num_l - 1)!通り残りを左右のどちらに置くかで2通り
  ans = math.factorial(num_b) * num_l * math.factorial(num_l - 1) * 2 % (10 ** 9 + 7)
  
print(ans)

Measured memory_bytes: 5184
# -*- coding: utf-8 -*-
s = sorted(map(ord, set(input())))
alp = ord('a')

for c in s:
    if c == alp:
        if c == ord('z'):
            print('None')
            quit()
        else:
            alp += 1
            continue
    else:
        print(chr(alp))
        quit()
print(chr(alp))

Measured memory_bytes: 3188
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

h,m,H,M,k=MI()
l=(M-m)+60*(H-h)
print(l-k)

Measured memory_bytes: 9396
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K; //整数N, K進数
  cin >> N >> K;
  int Keta=0; //桁数
  int D; //割った後の数

  D=N;

  while(D>0){
    if(D/K==0){break;
    }

    D=D/K;
    Keta++;

  }

  cout << Keta+1 <<endl;

  return 0;
}

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

typedef uint32_t u32;
typedef uint64_t u64;
typedef std::pair<int, int> pii;

int main() {

  for(;;) {
    int w, h;
    int tate[64][64] = {{}};
    int yoko[64][64] = {{}};
    std::cin >> w >> h;
    if( w == 0 and h == 0 ) break;
    for(int i = 0; i < 2 * h - 1; ++i) {
      if( i % 2 == 0 ) {
        for(int j = 0; j < w - 1; ++j) {
          std::cin >> tate[i / 2][j];
        }
      }
      else {
        for(int j = 0; j < w; ++j) {
          std::cin >> yoko[i / 2][j];
        }
      }
    }
    int dist[64][64] = {{}};
    for(int i = 0; i < 64; ++i) for(int j = 0; j < 64; ++j) dist[i][j] = 100000000;
    std::queue<pii> q;
    q.push(pii(0, 0));
    dist[0][0] = 1;
    while( not q.empty() ) {
      pii t = q.front(); q.pop();
      int x = t.first, y = t.second;
      if( not ( 0 <= x and x < w and 0 <= y and y < h ) ) continue;
      if( 0 <= x + 1 and x + 1 < w ) {
        if( tate[y][x] == 0 ) {
          if( dist[y][x+1] > dist[y][x] + 1 ) {
            dist[y][x+1] = dist[y][x] + 1;
            q.push(pii(x+1, y));
          }
        }
      }
      if( 0 <= x - 1 and x - 1 < w ) {
        if( tate[y][x-1] == 0 ) {
          if( dist[y][x-1] > dist[y][x] + 1 ) {
            dist[y][x-1] = dist[y][x] + 1;
            q.push(pii(x-1, y));
          }
        }
      }
      if( 0 <= y + 1 and y + 1 < h ) {
        if( yoko[y][x] == 0 ) {
          if( dist[y+1][x] > dist[y][x] + 1 ) {
            dist[y+1][x] = dist[y][x] + 1;
            q.push(pii(x, y+1));
          }
        }
      }
      if( 0 <= y - 1 and y - 1 < h ) {
        if( yoko[y-1][x] == 0 ) {
          if( dist[y-1][x] > dist[y][x] + 1 ) {
            dist[y-1][x] = dist[y][x] + 1;
            q.push(pii(x, y-1));
          }
        }
      }
    }
    std::cout << (dist[h - 1][w - 1] == 100000000 ? 0 : dist[h - 1][w - 1]) << std::endl;
  }

  
  return 0;
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
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; }
ll mod= 1e9 + 7;



int main() {
  int n;
  cin >>n;
  int a=n/15;
  cout << 800*n-a*200 << endl;
}

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

int main()
{
  int n,m;
  cin >> n >> m;
  vector<bool>v(n+1,true);
  for(int i=0;i<m;i++){
    int buf;
    cin >> buf;
    v[buf]=false;
  }
  vector<long>dp(n+1);
  dp[0]=1;
  dp[1]=1;
  if(v[1]==false)
    dp[1]=0;
  for(int i=2;i<=n;i++){
    if(v[i]==true)
      dp[i]=dp[i-2]+dp[i-1];
    else
      dp[i]=0;
    dp[i]=dp[i]%1000000007;
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

string s;
bool flag0, flag1;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> s;
    for (int i = 0; i < 3; i++) {
        if (s[i] == 'A') flag0 = true;
        else flag1 = true;
    }
    if (flag0 && flag1) cout << "Yes" << E;
    else cout << "No" << E;
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
x=max(a)
count=0
b=len([a[i] for i in range(len(a)) if a[i]==x])
for j in range(n):
    if b>1:
        print(x)
    else:
        if a[j]==x:
            tmp=a[j]
            a.remove(a[j])
            print(max(a))
            a.insert(j,tmp)
        else:
            print(x)

Measured memory_bytes: 12588
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<(x)<<endl
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll inf=1e18;
const int N=2e5+10;
ll factorial(ll x){//階乗の計算
    if(x==0||x==1) return 1;
    return x*factorial(x-1);
}
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;}//最小公倍数
int num_digit(ll a){//桁数を求める
    int num_dig = 0;
    while(a!=0){
        a /= 10;
        ++num_dig;
    }
    return num_dig;
}
vector<ll> digit(ll a){//桁の数字を求める
    vector<ll> dig(num_digit(a));
    for(int i=num_digit(a)-1; i>=0; --i){
        dig[i] = a%10;
        a /= 10; 
    }
    return dig;
}

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

    int cnt=0;
    for(int i=a; i<=b; ++i){
        vector<ll> dig = digit(i);
        if(dig[4]==dig[0]&&dig[3]==dig[1]) ++cnt;
    }
    cout(cnt);
    return 0;
}

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

int main() {
  
  int N, Ca, Cw, Ct, Cr;
  cin >> N;
  vector<string> S(N);
  Ca = 0;
  Cw = 0;
  Ct = 0;
  Cr = 0;

  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  
  for (int i = 0; i < N; i++) {
    if (S.at(i) == "AC") {
      Ca = Ca + 1;
    }
    else if (S.at(i) == "WA") {
      Cw = Cw + 1;
    }
    else if (S.at(i) == "TLE") {
      Ct = Ct + 1;
    }
    else if (S.at(i) == "RE") {
      Cr = Cr + 1;
    }
  }
  
  cout << "AC x " << Ca << endl;
  cout << "WA x " << Cw << endl;
  cout << "TLE x " << Ct << endl;
  cout << "RE x " << Cr << endl;
  
}

Measured memory_bytes: 6428
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  int cnt[n + 1];
  memset(cnt, 0, sizeof(cnt));
  int v;
  for (int i = 0; i < n - 1; i++) {
    cin >> v;
    cnt[v]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << cnt[i] << endl;
  }

  return 0;
}

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

int main(void){
    int a,b;
    int syou,jyoyo;
    double syousuu;
    cin >> a >> b;
    syou = a / b;
    jyoyo = a % b;
    syousuu = (double)a/b;
    printf("%d %d %f",syou,jyoyo,syousuu);
    //cout << syou << " " << jyoyo << " " << syousuu << endl;
    
    
}



Measured memory_bytes: 3228
def main():
    INF = 10**9
    H,N = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    maxA = max(A for A,B in AB)
    dp = [INF]*(H+maxA)
    dp[0] = 0
    for i in range(1,H+maxA):
        dp[i] = min(dp[i-A]+B for A,B in AB)
    print(min(dp[H:]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3776
#include<stdio.h>
#include<string.h>
 
 
 
void change(char *str){
  int len=strlen(str);
  int i;
  for(i=0;i<len;i++){
    if('a'<=str[i]&&str[i]<='z'){
      str[i]-=32;
    }
  }
}
 
int main(){
  char t[10000];
  char key[10000];
  char eofstr[]={"END_OF_TEXT"};
  int ans=0;
 
  scanf("%s",key);
  change(key);
 
  while(1){
    scanf("%s",t);
    if(strcmp(t,eofstr)==0){
      break;
    }
    change(t);
    if(strcmp(t,key)==0){
      ans++;
    }
  }
 
  printf("%d\n",ans);
  return 0;
}


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}

	inline int tc()
	{
		int c=fetch();
		while(c<=32 && c!=EOF)c=fetch();
		return c;
	}
}
using ae86::ty;
using ae86::tc;

const int _ = 187 , inf = 0x3f3f3f3f;

int H,W,val[_][_],cx[_][_]={0},cy[_][_]={0};
int fx[_][_][_]={0},fy[_][_][_]={0},sfx[_][_][_],sfy[_][_][_];

int main()
{
	H=ty(),W=ty();
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
		{
			val[i][j]=tc()=='#';
			cx[i][j]=(val[i][j]==val[i-1][j])?(cx[i-1][j]+1):1;
			cy[i][j]=(val[i][j]==val[i][j-1])?(cy[i][j-1]+1):1;
		}

	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
		{
			for(int k=i,a=inf;k<=H && val[k][j]==val[i][j];k++)a=min(a,cy[k][j]),fx[i][j][k]=a;
			for(int k=j,a=inf;k<=W && val[i][k]==val[i][j];k++)a=min(a,cx[i][k]),fy[i][j][k]=a;
		}
	
	int now=0;
	while("motherfacker")
	{
		if(fx[1][W][H]>=W || fy[H][1][W]>=H){printf("%d\n",now);return 0;}
		memcpy(sfx,fx,sizeof(fx)),memcpy(sfy,fy,sizeof(fy));
		
		for(int i=1;i<=H;i++)
			for(int j=1;j<=W;j++)
			{
				for(int k=i;k<=H;k++)fx[i][j][k]+=sfx[i][j-sfx[i][j][k]][k];
				for(int k=j;k<=W;k++)fy[i][j][k]+=sfy[i-sfy[i][j][k]][j][k];
			}

		for(int i=1;i<=H;i++)
			for(int j=1;j<=W;j++)
			{
				for(int a=i,len=1;a<=H;a++,len++)
					for(int b=j-fx[i][j][a]+1;b<=j && fy[a][b][j]<len;b++)
						fy[a][b][j]=len;
				for(int a=j,len=1;a<=W;a++,len++)
					for(int b=i-fy[i][j][a]+1;b<=i && fx[b][a][i]<len;b++)
						fx[b][a][i]=len;
			}
		now++;
	}

	puts("fack");
	
	return 0;
}


Measured memory_bytes: 102912
#include <iostream>
using namespace std;

int main(void)
{
	int s;
	int h,m;
	
	cin >> s;
	
	h = s / 3600;
	m = (s - (h * 3600)) / 60;
	s -= (h * 3600) + (m * 60);
	
	cout << h << ":" << m << ":" << s << endl; 
	
	return 0;
}


Measured memory_bytes: 3100
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			switch (sc.nextInt()) {
				case 0:
					int b  = sc.nextInt();
					int e = sc.nextInt();
					System.out.println(Collections.min(list.subList(b, e)));
					break;
				case 1:
					b  = sc.nextInt();
					e = sc.nextInt();
					System.out.println(Collections.max(list.subList(b, e)));
					break;
			}
		}
	}
}



Measured memory_bytes: 33356