akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

bool judge(vp ls,int p,int N) {
  reverse(rng(ls));
  int l=1,r=N;
  rep(i,sz(ls)) {
    int x = ls[i].second;
    if(ls[i].first) {
      if(x==1) {
        l = max(1,l-1);
      } else {
        r = min(N,r+1);
      }
    } else {
      if(x==1) {
        r--;
      } else {
        l++;
      }
    }
    if(l>r) {
      return false;
    }
  }
  return l<=p&&p<=r;
}
  
int main() {
  int H,W,N;
  cin >> H >> W >> N;
  int sr,sc;
  cin >> sr >> sc;
  string taka,aoki;
  cin >> taka >> aoki;
  vp h,w;
  rep(i,N) {
    switch (taka[i]) {
      case 'L':
        w.push_back(P(0,-1));
        break;
      case 'R':
        w.push_back(P(0,1));
        break;
      case 'U':
        h.push_back(P(0,-1));
        break;
      case 'D':
        h.push_back(P(0,1));
        break;
    }
    switch (aoki[i]) {
      case 'L':
        w.push_back(P(1,-1));
        break;
      case 'R':
        w.push_back(P(1,1));
        break;
      case 'U':
        h.push_back(P(1,-1));
        break;
      case 'D':
        h.push_back(P(1,1));
        break;
    }
  } 
  if(judge(h,sr,H) && judge(w,sc,W)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 7148
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <time.h>
#include <string>
#include <fstream>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <assert.h>
#include <list>
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define pdd pair<double,double>
#define pii pair<ll,ll>
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD2 1000000009
#define INF ((ll)1e+18)
#define x1 fldgjdflgjhrthrl
#define x2 fldgjdflgrtyrtyjl
#define y1 fldggfhfghjdflgjl
#define y2 ffgfldgjdflgjl
#define N 131072
#define SUM 377
#define MAG 33554431
#define RED 0
#define BLUE 1
#define ALP 26
typedef long long ll;
typedef long double ld;
using namespace std;
ll i,j,n,k,l,m,r,x,y,K,tot,h;
string s,t,s1;
ll a[100500];
int main() {
	//freopen("input.txt","r",stdin);
 	//freopen("output.txt","w",stdout);
    cin >> n >> m >> k;
    for (i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a+n);
    i = 0;
    while (i < n)
    {
        x++;
        ll tmp = a[i], y = 0;
        while (a[i] <= tmp + k && i < n && y < m)
            i++, y++;

    }
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    string S;
    int i, j, n, judge=1;

    cin >> S;

    n = S.size();

    for(i=0; i<n-1; i++){
        for(j=i+1; j<n; j++){
            if(S[i] == S[j]){
                judge = 0;
            }
        }
    }

    if(judge == 1){
        cout << "yes" << endl;
    }

    else{
        cout << "no" << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long ll;

/// The definitions in this library are as below.
#define rI readInt
#define rL readLong
#define rC readChar
#define rC2 readChar2
#define rS readString

#define pb push_back

#define acc accumulate

#define FOR(i, a, b) for(int i=(a); i<=(b); i++)
#define FOR0(i, a, b) for(int i=(a); i<(b); i++)
namespace __library_79brue{
    /// This is a C++ library which improves the programming speed by \
        defining frequently used data structures or algorithms.       \
        This library can be freely used without any copyrights,       \
        but I recommend not to change the name of this library.       \
        Made by 79brue                                                \
        2019

    /// The functions or structures in this library are as below.
    /// quit()
    /// readInt() readLong() readChar() readChar2() readString()

    /// terminates the program
    inline void quit(){
        exit(0);
    }

    /// reads an integer
    inline void readInt(int& _x){
        scanf("%d", &_x);
    }

    /// reads a long-long integer
    inline void readLong(ll& _x){
        scanf("%lld", &_x);
    }

    /// reads a character
    inline void readChar(char& _x){
        scanf(" %c", &_x);
    }

    /// reads a character, the character may be space or line-break, etc...
    inline void readChar2(char &_x){
        scanf("%c", &_x);
    }

    inline void readString(char* _x){
        scanf("%s", _x);
    }

    inline int readLine(char* _x, int limit){
        if(!fgets(_x, limit, stdin)) quit();
        int _y = strlen(_x);
        while(_x[_y-1] == '\n' or _x[_y-1] == '\r') _y--;
        return _y;
    }
}
using namespace __library_79brue;

int n;
int arr[2002];
int sum[2002][2002];
int ans;

int main(){
    rI(n);
    FOR(i, 1, n) rI(arr[i]);
    sort(arr+1, arr+n+1);
    for(int i=n; i>=1; i--){
        for(int j=1; j<=2000; j++){
            sum[i][j] = sum[i+1][j];
        }
        for(int j=arr[i]; j<=2000; j++) sum[i][j]++;
    }
    for(int i=n; i>=1; i--){
        for(int j=i+1; j<=n; j++){
            ans += sum[j+1][arr[i] + arr[j] - 1];
        }
    }
    printf("%d", ans);
}


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

int main() {
    while (1) {
        string S;
        cin >> S;
        if (S == "-") break;
        int N;
        cin >> N;
        for (int i = 0; i < N; i++) {
            int H;
            cin >> H;
            S += S.substr(0, H);
            S.erase(0, H);
        }
        cout << S << endl;
    }
}


Measured memory_bytes: 3216
group1=set([1,3,5,7,8,10,12])
group2=set([4,6,9,11])
group3=set([2])
x,y=map(int,input().split())
if x in group1 and y in group1:
    print('Yes')
elif x in group2 and y in group2:
    print('Yes')
elif x in group3 and y in group3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
    using namespace std;
    typedef long long int lli;
    #define MAX 200005
    #define INF 1000005
    #define endl "\n"
    bool p[INF];
    int main(){
    	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
    	lli f[INF];
		memset(f,0ll,INF*sizeof(lli));
		lli n;
    	cin>>n;
    	lli arr[n+5];
		for(lli i = 0; i<n; i++){
    		cin>>arr[i];
    		f[arr[i]]++;
    	}
    	lli c = 0;
    	bool flag = false;
    	for(lli i = 0; i<n; i++){
    		flag = false;
    		f[arr[i]]--;
    		for(lli j = 1; j*j <= arr[i]; j++){
    			if(arr[i]%j == 0){
    				if(f[j] || f[arr[i]/j]){
    					flag = true;
    					break;
    				}
    			}
    		}
    		if(!flag){
    			c++;
    		}
    		f[arr[i]]++;
    	}
    	cout<<c<<endl;
    }

Measured memory_bytes: 13016
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int f=0;
     string s;
     cin>>s;
     for(int i=0;i<s.size();i++)
     {
       if(s[i]=='A'&&s[i+1]=='C')
       {f=1;break;}
       else
       {f=0;}

     }
     if(f)
        printf("Yes\n");
     else
        printf("No\n");
}


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

void sort(int ary[], int n);

int main(void)
{		
	int ary[3];
	for (int i = 0; i < 3; i++) {
		cin >> ary[i];
	}
	
	sort(ary, 3);
	
	cout << ary[0] << " " << ary[1] << " " << ary[2] << endl;
	
	return 0;
}

void sort(int ary[], int n)
{
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < i; j++) {
			if (ary[i] < ary[j]) {
				int temp = ary[i];
				for (int k = i; k > j; k--) {
					ary[k] = ary[k-1];
				}
				ary[j] = temp;
				break;
			}
		}
	}
}

Measured memory_bytes: 3104
N = int(input())
h = [int(_) for _ in input().split()]
dp = [0]*(N)
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, N):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])

Measured memory_bytes: 52464
N, A, B = map(int, input().split())


def func(x):
    ans = 0
    while x > 0:
        ans += x % 10
        x = x // 10

    return ans


ans = 0
for i in range(1, N + 1):
    if A <= func(i) <= B:
        ans += i

print(ans)


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

int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  for(int i = 0; i < N; i++){
    cin >> H.at(i);
  }
  int counter = 0;
  int highest;
  for(int i = 0; i < N; i++){
    if(i == 0 || H.at(i) >= highest){
      counter++;
      highest = H.at(i);
    }
  }
  cout << counter << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
////@formatter:on
//endregion


int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    make(int, h, n);
    vector<PII> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i].first >> a[i].second;
    }
    VI dp(h + 1, M7* M7);
    dp[0] = 0;
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < n; ++j){
            dp[min(h, i + a[j].first)] = min(dp[min(h, i + a[j].first)], dp[i] + a[j].second);
        }
    }
    cout << dp[h];

    return 0;
}

Measured memory_bytes: 384
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <regex>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const int INF =  999999999;

int dp[1000005][2];

int main(){
  string s;
  cin>>s;
  reverse(s.begin(),s.end());
  s+='0';
  int n=s.length();
  rep(i,n+1)rep(j,2)dp[i][j]=INF;
  dp[0][0]=0;
  rep(i,n)rep(j,2){
    int y=s[i]-'0';
    y+=j;
    rep(a,10){
      int ni=i+1,nj=0;
      int b=a-y;
      if(b<0){
        b+=10;
        nj=1;
      }
      dp[ni][nj]=min(dp[ni][nj],dp[i][j]+a+b);
    }
  }
  int ans=dp[n][0];
  cout<<ans<<endl;
}

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

int main() {
	int n,sum=0;
	cin>>n;
	vector<int>vec(n);
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		vec.at(i)=a;
	}
	sort(vec.begin(),vec.end());
	reverse(vec.begin(),vec.end());
	if(n%2==0){
		for(int i=0;i<n/2;i++){
			sum+=vec.at(2*i)-vec.at(2*i+1);
		}
		cout<<sum<<endl;
	}
	else{
			for(int i=0;i<(n-1)/2;i++){
			sum+=vec.at(2*i)-vec.at(2*i+1);
		}
		cout<<sum+vec.at(n-1)<<endl;
	}
	return 0;
}

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

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(int N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {
	const int n = inputVal<int>();
	const vector<int> p = inputVec<int>(n);

	int cnt = 0;
	REP(i, 1, n - 1) {
		if (p[i - 1] < p[i] && p[i] < p[i + 1]) ++cnt;
		else if (p[i - 1] > p[i] && p[i] > p[i + 1]) ++cnt;
	}

	outputVal(cnt);
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << std::fixed << std::setprecision(15);
	Main();

	double tmp;
	cin >> tmp;

	return 0;
}


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

int main() {
	int N, T, A, H,ans;
	double a,minT;
	cin >> N >> T >> A;
	double x = T - A;
	cin >> H;
	minT = x - H * 0.006;
	if (minT < 0)minT = -minT;
	ans = 1;
	for (int i = 1;i < N;++i) {
		cin >> H;
		a =x- H* 0.006;
		if (a < 0)a = -a;
		if (minT > a) {
			ans = i + 1;
			minT = a;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		String S = scan.next();
		scan.close();
		String []a = S.split("");
		int cntrW[] = new int[N];
		int cntrE[] = new int[N];
		int cntlW[] = new int[N];
		int cntlE[] = new int[N];
		int cntW = 0;
		int cntE = 0;
		cntlW[0] = 0;
		cntlE[0] = 0;
		cntrW[N - 1] = 0;
		cntrE[N - 1] = 0;
		for(int i = 0; i < N; i++) {
			if(a[i].equals("W")) {
				cntW ++;
			}
		}
		cntE = N - cntW;
		if(cntW == 0) {
			System.out.println(0);
			System.exit(0);
		}else if(cntE == 0) {
			System.out.println(0);
			System.exit(0);
		}
		if(a[0].equals("W")) {
			cntrW[0] = cntW - 1;
			cntrE[0] = cntE;
		}else {
			cntrW[0] = cntW;
			cntrE[0] = cntE - 1;
		}

		for(int i = 1; i < N - 1; i++) {
			if(a[i].equals("W")) {
				if(cntrW[i - 1] == 0) {
					cntrW[i] = 0;
				}else {
					cntrW[i] = cntrW[i - 1] - 1;
				}
				cntrE[i] = cntrE[i - 1];
			}else if(a[i].equals("E")){
				if(cntrE[i - 1] == 0) {
					cntrE[i] = 0;
				}else {
					cntrE[i] = cntrE[i - 1] - 1;
				}
				cntrW[i] = cntrW[i - 1];
			}
		}

		if(a[N - 1].equals("W")){
			cntlW[N - 1] = cntW - 1;
			cntlE[N - 1] = cntE;
		}else {
			cntlW[N - 1] = cntW;
			cntlE[N - 1] = cntE - 1;
		}
		for(int i = N - 2; i >= 1; i--) {
			if(a[i].equals("W")) {
				if(cntlW[i + 1] == 0) {
					cntlW[i] = 0;
				}else {
					cntlW[i] = cntlW[i + 1] - 1;
				}
				cntlE[i] = cntlE[i + 1];
			}else if(a[i].equals("E")){
				if(cntlE[i + 1] == 0) {
					cntlE[i] = 0;
				}else {
					cntlE[i] = cntlE[i + 1] - 1;
				}
				cntlW[i] = cntlW[i + 1];
			}
		}
		//int []k = new int[N];
		int min = 10000000;
		int k = 0;
		for(int i = 0; i < N; i++) {
			if(a[i].equals("W")) {
				k = cntrE[i] + cntlW[i];
			}else {	// E と等しい
				k = cntrE[i] + cntlW[i];
			}
			if(k <= min) {
				min = k;
			}

		}
//		for(int i = 0; i < N; i++) {
//			int sum = cntrW[i] + cntrE[i] + cntlW[i] + cntlE[i] + 1;
//			if(sum != N) {
//				System.out.println("error");
//			}
//		}
		System.out.println(min);

//		System.out.println(cntW + " " + cntE);
//		for(int i = 0; i < N; i++) {
//			System.out.print(i + " left: E " + cntlE[i] + " / W " + cntlW[i]);
//			System.out.println(" right: E " + cntrE[i] + " / W " + cntrW[i]);
//		}

	}
}


Measured memory_bytes: 54788
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	string s;
	cin >> s;

	long long n = s.length(), i, j, k, ans, x, MOD = 1000000007;
	vector<long long> ll(n + 2), rr(n + 2), llct(n + 2), rrct(n + 2);

	llct[0] = 1;
	ll[0] = 0;
	for (i = 1; i <= n; i++) {
		if (s[i - 1] == 'A') {
			llct[i] = llct[i - 1];
			ll[i] = (ll[i - 1] + llct[i - 1]) % MOD;
		}
		else if (s[i - 1] == '?') {
			llct[i] = (llct[i - 1] * 3) % MOD;
			ll[i] = (ll[i - 1] * 3 + llct[i - 1]) % MOD;
		}
		else {
			llct[i] = llct[i - 1];
			ll[i] = ll[i - 1]; 
		}
	}

	rrct[n + 1] = 1;
	rr[n + 1] = 0;
	for (i = n; i >= 1; i--) {
		if (s[i - 1] == 'C') {
			rrct[i] = rrct[i + 1];
			rr[i] = (rr[i + 1] + rrct[i + 1]) % MOD;
		}
		else if (s[i - 1] == '?') {
			rrct[i] = (rrct[i + 1] * 3) % MOD;
			rr[i] = (rr[i + 1] * 3 + rrct[i + 1]) % MOD;
		}
		else {
			rrct[i] = rrct[i + 1];
			rr[i] = rr[i + 1];
		}
	}

	ans = 0;
	for (i = 2; i <= n - 1; i++) {
		if ((s[i - 1] == 'B') || (s[i - 1] == '?')) {
			x = (ll[i - 1] * rr[i + 1]) % MOD;
			ans = (ans + x) % MOD;
		}
	}

	cout << ans << "\n";

	return 0;
}


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

int main(){
    map<string,int> map{};
    int N;cin>>N;
    for(int i = 0; i < N ;i++){
        string s;cin>>s;
        map[s]++;
    }
    int M;cin>>M;
    for(int i = 0; i < M ;i++){
        string s;cin>>s;
        map[s]--;
    } 
    int ans = 0;
    for(auto e : map){
        ans = max(ans,e.second);
    }  

    cout << ans << endl;    

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;

#ifdef DEBUG
#define debug(var) do{cout << #var << " : ";view(var);}while(0)
#else
#define debug(var)
#endif

template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

namespace adaptor = boost::adaptors;

void Main()
{
    int a,b;
    cin>>a>>b;
    cout<<(b-1+a-2)/(a-1)<<endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


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

int main()
{
  int n, t;
  cin >> n;
  vector<int> a(n, 0);
  for (int i = 0; i < n - 1; i++) {
    cin >> t;
    a[t - 1]++;
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 3964
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

map<int, map<long long, int>> mp;
int P[100000+2] = {0};
long long Y[100000+2] = {0};

int main(int argc, char* argv[]){
	int N, M;

	cin >> N >> M;

	for(int i=1; i<=M; i++){
		int p;
		long long y;
		cin >> p >> y;
		P[i] = p; Y[i] = y;
		if(mp.count(p)==0){
			map<long long, int> m;
			m[y] = -1;
			mp[p] = m;
		}
		else{
			mp[p][y] = -1;
		}
	}

	for(auto itr = mp.begin(); itr != mp.end(); itr++){
		auto& m = itr->second;
		int i = 1;
		for(auto it = m.begin(); it != m.end(); it++){
			auto& k = it->first;
			m[k] = i;
			i++;
		}
	}
	for(int i = 1; i <= M; i++){
		int p = P[i];
		long long y = Y[i];
		printf("%06d%06d\n", p, mp[p][y]);
	}
	return 0;
}

Measured memory_bytes: 18304
def f():
    n=int(input())
    from collections import Counter as co
    p=co(list(map(int,input().split())))
    m=int(input())
    q=co(list(map(int,input().split())))
    for k in q:
        if k not in p or p[k]<q[k]:
            print("NO");break
    else:print("YES")
if __name__ == "__main__":
    f()

Measured memory_bytes: 55392
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

// 各ノードの座標と深さを保持するための構造体
//struct Node{
//    int y;
//    int x;
//    int depth;
//};

int main() {
    long double N,K;
    cin >> N >> K;
    
    vector<long double> N_2(1,K), by2(1,1.0);
    while(N_2[N_2.size()-1]>0) {
        N_2.push_back(N_2[N_2.size()-1]/(long double)2.0);
    }
    
    for (int i=0; i<N_2.size(); i++) {
        by2.push_back(by2[by2.size()-1]*(long double)0.5);
    }
    
    long double ans=0.0;
    for (int n=1; n<=N+0.1; n++) {
        for (int j=0; j<N_2.size(); j++) {
            if (n>=N_2[j]) {
                ans+=by2[j];
                break;
            }
        }
    }
    ans=ans/N;
    cout.precision(12);
    cout << ans << endl;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vll> vvll;
typedef pair<ll ,ll> pii;
typedef pair<string ,ll> psi;
typedef pair<ll,string > pis;
typedef pair<ll , vll> plv;

#define REP(i,a,b) for(ll i=ll(a);i<=ll(b);++i)
#define REPR(i,a,b) for(ll i=ll(a);i>=ll(b);--i)
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()

template <typename T> T absolute(T a,T b){ return a>=0?a:-a; }
template <typename T> T sqr(T a){return a*a;}

ll read(){
    ll res,f=1;register char ch;
    while((ch=getchar())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(res=ch-'0';(ch=getchar())>='0'&&ch<='9';res=res*10+ch-'0');
    return res*f;
}

int main(){
    ll a,b;scanf("%lld%lld",&a,&b);
    if(a>b)swap(a,b);
    cout<<max(a+b,2*b-1)<<endl;
    return 0;
}

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

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

  int64_t sum = 0;
  int addition_number = S.size() - 1;
  int I[S.size()];
  for (int i = 0; i < S.size(); i++) {
    I[i] = S[i] - '0';
  }
  
  for (int bit = 0; bit < (1<<addition_number); bit++) {
    int64_t total = 0;
    int64_t now_int = I[0];
    for (int i = 0; i < addition_number; i++) {
      if (bit & (1<<i)) {
        total += now_int;
        now_int = I[i+1];
      }
      else {
        now_int = now_int * 10 + I[i+1];
      }
    }
    
    total += now_int;
    
    sum += total;
  }

  cout << sum << endl;  
}

Measured memory_bytes: 256
N, M = map(int, input().split())
PY = []
for i in range(M):
    PY.append(list(map(int, input().split())) + [i])
    
PY.sort(key = lambda x:x[1])
PY.sort(key = lambda x:x[0])
    
bef = 0
state = 0
retstr = ''
triple = []
for i in PY:
    if (i[0] != bef):
        bef = i[0]
        state = 1
        triple.append([i[0], i[1], i[2], str(i[0]).rjust(6, '0') + str(state).rjust(6, '0')])
    else:
        state += 1
        triple.append([i[0], i[1], i[2], str(i[0]).rjust(6, '0') + str(state).rjust(6, '0')])
triple.sort(key = lambda x:x[2])
for i in triple:
    print(i[3])

Measured memory_bytes: 44536
#include <stdio.h>
int main (){
int a;
long long int k=1;
  scanf ("%d",&a);
  for (int i=1;i<a+1;i++){
  k=k*i;
  if (k>1000000007){
  k=k%1000000007;
  }
  }
  printf ("%lld",k);
return 0;
}

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

int main()
{
    int N, div = 1;
    cin >> N;

    for (div = 1; div <= 9; div++) {
        if (N % div != 0) {
            continue;
        }
        else if(N / div <= 9){
            cout << "Yes" << endl;
            return 0;
         }
    }

    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 200000
#define LL long long
LL ai[N], n;
LL out[N];
vector <LL> bi[N];
LL fl;
LL dfs(LL t, LL f)
{
    if (bi[t].size() == 1) return ai[t];
    LL tot = 0, mx = 0;
    for (LL i = 0; i < bi[t].size(); ++ i)
        if (bi[t][i] != f)
        {
            LL nw = dfs(bi[t][i], t);
            tot += nw;
            mx = max(nw, mx);
        }
    LL c = tot - ai[t];
    if (c < 0) fl = 1;
    if (tot - 2 * c < 0) fl = 1;
    if (tot - mx < c) fl = 1;
    return tot - 2 * c;
}
int main()
{
    cin >> n;
    for (LL i = 1; i <= n; ++ i)
        cin >> ai[i];
    if (n == 1) {puts("NO"); return 0;}
    if (n == 2) {if (ai[1] == ai[2]) puts("YES"); else puts("NO"); return 0;}
    for (LL i = 1; i < n; ++ i)
    {
        LL a, b;
        cin >> a >> b;
        bi[a].push_back(b);
        bi[b].push_back(a);
        out[a] ++; out[b] ++;
    }
    for (LL i = 1; i <= n; ++ i)
        if (out[i] > 1)
        {
            if (dfs(i, 0)) puts("NO");
            else if (fl) puts("NO");
            else puts("YES");
            return 0;
        }
}


Measured memory_bytes: 16256
#include <stdio.h>
int h[100010];
int dp[100010];
int main ()
{
	int n,i,r=0;
	scanf("%i",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%i",&h[i]);
	}
	dp[n]=0;
	for(i=n-1;i>=1;i--)
	{
		if (h[i]>=h[i+1])
		{
			dp[i]=dp[i+1]+1;
		}
	}
	for(i=1;i<=n;i++)
	{
		if(r<dp[i])
		{
			r=dp[i];
		}
	}
	printf("%i",r);
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int n;
    cin >> n;
    
    string res;
    
   while(n > 0)
   {
       n--; 
       res+=((n%26)+'a');
       n/=26;
   }
    
    reverse(res.begin(),res.end());
    
   cout << res ;
    
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

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

#include "bits/stdc++.h"

using namespace std;
#define int long long


class ARatedForMe {
public:
    void solve(std::istream &in, std::ostream &out) {
      int r;
      in >> r;
      if (r < 1200) {
        out << "ABC" << endl;
      } else if (r < 2800) {
        out << "ARC" << endl;
      } else {
        out << "AGC" << endl;
      }
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  ARatedForMe solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <math.h>
#include<algorithm>
using namespace std;
#define INFTY 1000000001

int A[500000],L[250001],R[250001],co=0;

void argCout(int N){
  cout<<A[0];
  for(int i=1;i<N;i++){
    printf(" %d",A[i]);
  }
  cout<<endl;
}

void merge(int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1]=INFTY;
  R[n2]=INFTY;
  int i=0;
  int j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
    }
    co++;
  }

}

void mergeSort(int left,int right){
  if(left+1<right){
    int mid=(left+right)/2;
    mergeSort(left,mid);
    mergeSort(mid,right);
    merge(left,mid,right);
  }
}

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(0,n);
  argCout(n);
  cout<<co<<endl;

}



Measured memory_bytes: 7200
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;
using llong = long long;

int main(){
  llong x;
  cin >> x;
  if(x%11==0){
    cout << x/11*2 << endl;
  }else{
    cout << x/11*2+x%11/7+1 << endl;
  }
  return 0;
}

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

int main(){

int num = 0;
int data;
int i;
int k;
int count = 0;
int finalans = 0;

while(1){
  scanf("%d",&num);
  if(1 <= num && num <=10000){
    break;
  }
}

for(i = 0;i < num;i++){
  scanf("%d",&data);
if(data > 2 && data % 2 == 0){
  continue;
}
  for(k = 2;k <= sqrt(data);k++){
   if(data % k == 0){
    count = 1;
   }
}
if(count != 1){
  finalans++;
}
count = 0;
}

printf("%d",finalans);
printf("\n");
return 0;
}



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

ll N , M , q ;
ll a[100] , b[100] , c[100], d[100] ;
ll tot ;



int main() {
    ll n , m,t=0 ;
    cin >> n >> m ;
    vector<pair<ll,ll> > v ;
    ll x = n/2 , y = n/2+1 , x1 = 1 , y1 = n-1 ;
    while(m) {



        if (n%2)
        v.pb( {x--,y++} ) ;
        else {
            if (t%2==0) {
                v.pb( {x--,y++} ) ;
            }
            else {
                v.pb( {x1++,y1--} ) ;
            }
        }
        t++ ;
        m-- ;
    }
    for (auto it : v) cout <<it.first << ' ' << it.second << endl ;
    return 0 ;
}


Measured memory_bytes: 5300
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

vector<int> as;
vector<int> bs;

ll solve(const int N) {
    ll ans = 0;

    ll prev_rem = 0;
    for (int i = 0; i < N + 1; i++) {
        ll monsters = as[i];
        ll player = bs[i];
        ans += min(prev_rem, monsters);
        monsters -= min(prev_rem, monsters);
        ans += min(monsters, player);
        prev_rem = max(0LL, player - min(monsters, player));
    }

    return ans;
}

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

    as.resize(N + 1);
    for (int i = 0; i < N + 1; i++) {
        cin >> as[i];
    }

    bs.resize(N + 1, 0);
    for (int i = 0; i < N; i++) {
        cin >> bs[i];
    }

    cout << solve(N) << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const LL oo = 1e9;
const int maxn = 40000 + 5;
const double eps = 1e-10;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int n;
double pos[maxn];
int c[maxn], rk[maxn];

struct Line { LL a, b, c; } L[maxn];

inline bool cmp(int x, int y) { return pos[x] < pos[y]; }
inline bool cmpx(Line x, Line y) { return 1.0 * x.a / x.b > 1.0 * y.a / y.b; }
inline bool cmpy(Line x, Line y) { return 1.0 * x.b / x.a > 1.0 * y.b / y.a; }

inline int lowbit(int x) { return x & (-x); }
void update(int u) {
    while(u <= n) {
        c[u] ++;    
        u += lowbit(u);
    }
}
int query(int u) {
    int res = 0;
    while(u > 0) {
        res += c[u];
        u -= lowbit(u);
    }
    return res;
}

bool chkx(double mid) {
    LL res = 0;
    for(int i = 1; i <= n; ++i) 
        c[i] = 0, rk[i] = i, pos[i] = -(L[i].c + L[i].a * mid) / L[i].b;

    sort(rk + 1, rk + n + 1, cmp);
    for(int i = 1; i <= n; ++i) {
        res += query(rk[i]); update(rk[i]);
    }
    return (res << 2LL) >= 1LL * n * (n-1);
}

bool chky(double mid) {
    LL res = 0;
    for(int i = 1; i <= n; ++i) 
        c[i] = 0, rk[i] = i, pos[i] = -(L[i].c + L[i].b * mid) / L[i].a;

    sort(rk + 1, rk + n + 1, cmp);
    for(int i = 1; i <= n; ++i) {
        res += query(rk[i]); update(rk[i]);
    }
    return (res << 2LL) >= 1LL * n * (n-1);
}

int main() {
#ifdef Wearry 
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif 

    n = read<int>();
    for(int i = 1; i <= n; ++i) {
        L[i].a = read<int>(); 
        L[i].b = read<int>();
        L[i].c = -read<int>();
    }

    int t_lim = 100;
    static double l, r;
    
    l = -oo, r = oo;
    sort(L + 1, L + n + 1, cmpx);

    for(int i = 0; i < t_lim; ++i) {
        double mid = (l + r) / 2.0;
        if(chkx(mid)) r = mid; else l = mid;
    }
    printf("%.10lf ", l);

    l = -oo, r = oo;
    sort(L + 1, L + n + 1, cmpy);

    for(int i = 0; i < t_lim; ++i) {
        double mid = (l + r) / 2.0;
        if(chky(mid)) r = mid; else l = mid;
    }
    printf("%.10lf\n", l);

    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
using namespace std;
long long n,k;
int main()
{
	scanf("%lld%lld",&n,&k);
	long long x=n,y=k;
	while(y!=0LL)
	{
		long long r=x%y;
		x=y;y=r;
	}
	printf("%lld",3LL*(n-x));
	return 0;
}

Measured memory_bytes: 256
class Node:
    def __init__(self, parent, left, right):
        self.parent = parent
        self.left = left
        self.right = right

    def get_type(self):
        if self.parent == -1: return "root"
        elif self.left == -1: return "leaf"
        else: return "internal node"

def set_depth(u,d):
    global D
    global tree
    D[u] = d
    v = tree[u].right
    while not v == -1:
        D[v] = d
        if not tree[v].left == -1:
            set_depth(tree[v].left, d+1)
        v = tree[v].right
    if not tree[u].left == -1:
        set_depth(tree[u].left, d+1)

def print_tree(t,D):
    for i in range(len(t)):
        children = []
        c = t[i].left
        if not c == -1:
            while True:
                children.append(c)
                c = t[c].right
                if c == -1: break
        print "node %s: parent = %s, depth = %s, %s, [%s]" % (i, t[i].parent, D[i], t[i].get_type(), ", ".join(map(str, children)))

n = int(raw_input().strip())

tree = {}
for i in range(n):
    tree[i] = Node(-1, -1, -1)
for _ in range(n):
    entry = map(int, raw_input().strip().split(' '))
    nid = entry[0]
    n_child = entry[1]
    for i in range(n_child):
        if i == 0: tree[nid].left = entry[i+2]
        else: tree[entry[i+1]].right = entry[i+2]
        tree[entry[i+2]].parent = nid

r = -1
for i in range(n):
    if tree[i].parent == -1: r = i

D = {}
set_depth(r, 0)

print_tree(tree, D)

Measured memory_bytes: 65384
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
local function open(...) for _,t in pairs{...} do for k,v in pairs(t) do _G[k]=v end end end
----
open(table, math)
local A = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j"}
local N = read.n()

local ans = {}
local build = {}
local function count(s)
    return #s
end
local function pop(s)
    return remove(s)
end
local function push(s, a)
    insert(s, a)
end
local stack_data = {}
local stack_frame = {}
push(stack_frame, {["a"]="d"})
push(stack_data, {0, 0})
do
    ::entry::
    --print("entry", count(stack_data), count(stack_frame))
    local i, mx = unpack(pop(stack_data))
    --print("i,mx",i,mx)
    local j, lim, f
    if i == N then
        insert(ans, concat(build, ""))
        --print("going to branch_end")
        goto branch_end
    end
    j = 1
    lim = mx + 1
    ::loop_start::
    --print("loop_start")
    if j>lim then
        goto loop_end
    end
    build[i+1] = A[j]
    f = {}
    f.a = "r"
    f.i = i
    f.mx = mx
    f.j = j
    f.lim = lim
    --print("recursive")
    push(stack_frame, f)
    push(stack_data, {i+1, max(j,mx)})
    goto entry
    ::respawn::
    --print("respawn")
    goto loop_start
    ::loop_end::
    ::branch_end::
    --print("#stack_frame", count(stack_frame))
    local upper_frame = pop(stack_frame)
    if upper_frame.a == "d" then
        goto done
    elseif upper_frame.a == "r" then
        i = upper_frame.i
        mx = upper_frame.mx
        j = upper_frame.j
        lim = upper_frame.lim
        j = j + 1
        goto respawn
    end
end
::done::

for i=1,#ans do
    print(ans[i])
end

Measured memory_bytes: 22648
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int> q(N);
  int S = sqrt(N);
  for(int A = 1; A <= S; A++) {
    for(int B = 1; B <= S; B++) {
      for(int C = 1; C <= S; C++) {
        if(A*A+B*B+C*C+A*B+B*C+C*A - 1 < N) {
        q.at(A*A+B*B+C*C+A*B+B*C+C*A - 1)++;
        }
      }
    }
  }
  for(int i = 0; i < N; i++) {
    cout << q.at(i) << endl;
  }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

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

  cout << ((a<c && c<b) || (a>c && c>b)?"Yes":"No") <<endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define lli long long int
#define llu unsigned long long int
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);
 
const long double EPS = 1e-10;
const lli MOD = 1000000007ll;
const lli mod1 = 1000000009ll;
const lli mod2 = 1100000009ll;
int INF = (int)1e9;
lli INFINF = (lli)1e18;
int debug = 0;
 
using namespace std;
 
void print(int a[],int s,int e){for(int i=s;i<=e;i++)cout<<a[i]<<" ";cout<<"\n";}
void print(vector<int> &v,int s,int e){for(int i=s;i<=e;i++)cout<<v[i]<<" ";cout<<"\n";}
void print(vector<int> &v){for(int x:v)cout<<x<<" ";cout<<"\n";}
 
lli bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
lli bit(lli _mask,lli _i){return (_mask&(1<<_i))==0?0:1;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli add(lli a,lli b,lli m=MOD){lli x=a+b;while(x>=m)x-=m;return x;}
lli sub(lli a,lli b,lli m=MOD){lli x=a-b;while(x<0)x+=m;return x;}
lli mul(lli a,lli b,lli m=MOD){lli x=a*b;x%=m;return x;}
 
lli N,x;
lli a[2010];
lli b[2010];
 
int main()
{
    srand (time(NULL));
 
    slli(N);slli(x);
    for(int i=0;i<N;i++){
        slli(a[i]);
    }
 
    lli ans = 0;
    for(int i=0;i<N;i++)ans += a[i];
 
    for(int t=1;t<N;t++){
        for(int i=1;i<N;i++){
            b[i] = min(a[i],a[i-1]);
        }
        b[0] = min(a[0],a[N-1]);
        for(int i=0;i<N;i++)
            a[i] = b[i];
        //for(int i=0;i<N;i++)cout<<a[i]<<" ";cout<<"\n";
 
        lli temp = t*x;
 
        for(int i=0;i<N;i++)temp += a[i];
        ans = min(ans,temp);
       // cout<<temp<<"\n";
    }
 
    cout<<ans;
 
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++){
    cin >> s.at(i);
  }
  int m;
  cin >> m;
  vector<string>t(m);
  for(int i = 0; i < m; i++){
    cin >> t.at(i);
  }

  int ans = 0;
  for(int i = 0; i < n; i++){
    int temp = 0;
    for(int j = 0; j < n; j++)if(s.at(i) == s.at(j))temp++;
    for(int j = 0; j < m; j++)if(s.at(i) == t.at(j))temp--;
    ans = max( ans, temp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;

vector<string> split(const string s, char delim) {
    vector<string> elems;
    stringstream ss(s);
    string item;
    while (getline(ss, item, delim)) {
    if (!item.empty()) {
            elems.push_back(item);
        }
    }
    return elems;
}

int main()
{
  string s;
  cin >> s;
  lint q;
  cin >> q;
  string line;
  getline(cin,line,'\n');  // なんかこれ入れないとおかしくなる
  std::vector<std::vector<string>> query;
  REP(i,q){
    getline(cin,line,'\n');
    query.push_back(split(line, ' '));
  }

  lint cnt = 0;
  REP(i,q){
    if(query[i][0] == "1"){
      cnt++;
    }else{
      if((cnt%2 == 0) == (query[i][1] == "1")){
        s.insert(0, query[i][2]);
      }else{
        s.insert(s.size(), query[i][2]);
      }
    }
  }

  if(cnt%2) reverse(s.begin(), s.end());

  cout << s << "\n";
  return 0;
}


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

int main(void)
{
  int a, b, h, i, m, cl = 0;
  double A, B, C, y, result = 0;
  
  scanf("%d %d %d %d", &a, &b, &h, &m);
  
  cl = 60*h + m;
  
  A = (double)cl*0.5;
  B= m*6;
  if( A - B == 0 ){
    if( a > b ){
      printf("%d", a-b);
    } else {
      printf("%d", b-a);
    }
    return 0;
  }
  
  if( A - B == 180 ){
      printf("%d", a+b);   
    return 0;
  }
  
  if( A - B > 0 ){
      C = A-B;
  } else {
      C = B-A;
  }
  
  //printf("%ld\n", C);
  
  C = (double)C * M_PI/180;
  if( C > 180 ){
      C = 360 - C;
  }
  
  y = cos(C);
  
  result = (a*a) + (b*b) - (2*a*b*y);

  printf("%.15lf\n", pow(result, 0.5));
  return 0;
}

Measured memory_bytes: 2784
import java.util.*;

public class Main {
    static long mod = 1000000007;

    public static long gcd(long a, long b) {
        if (a == 0) {
            return b;
        } else if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();

        if (n % (2 * d + 1) == 0) {
            System.out.println(n / (2 * d + 1));
        } else {
            System.out.println(n / (2 * d + 1) + 1);
        }
    }
}


Measured memory_bytes: 21712
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class  Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        String[] l = reader.readLine().split(" ");
        int s = 0;
        int sumsq = 0;
        for(String t:l){
            int y = Integer.parseInt(t);
            s=s+y;
            sumsq+=y*y;
        }
        int p =  (s/N);
        System.out.println(Math.min((N*p*p-2*p*s+sumsq),(N*(p+1)*(p+1) - 2*(p+1)*s+sumsq)));

    }
}


Measured memory_bytes: 22484
N = int(input())

ans = [0 for i in range(10100)]

for x in range(1,100):
   for y in range(1,100):
      for z in range(1,100):
          n =  x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
          if n < 10100:
            ans[n] += 1

for n in range(N):
   print(ans[n+1])

Measured memory_bytes: 9244
#include<iostream>
using namespace std;
int main(){
    int h,w;
    cin >>h >>w;
    while(h!=0){
        int a,b;
        for(a=0;a<h;a++){
            for(b=0;b<w;b++){
        if(a==0||a==h-1||b==0||b==w-1)
           cout << '#';
        else
           cout << '.';
            }
            cout << endl;
        }
        cout << endl;
        cin >>h >>w;
    }
    return 0;
}


Measured memory_bytes: 3072
import collections


m = int(input())
A = list(map(int,input().split()))[:m]
c = collections.Counter(A)
 
def hoge(n):
    return n * (n - 1) // 2

full = sum([ hoge(i) for i in c.values()])

for a in A:
    print(full - hoge(c[a]) + hoge(c[a]-1))


Measured memory_bytes: 26780
package main

import (
	"fmt"
)

func main() {
	var N, a, output int
	output = 100000000000
	fmt.Scanf("%d", &N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &a)
		tmp := 0
		for a%2 == 0 {
			a = a / 2
			tmp++
		}
		if tmp < output {
			output = tmp
		}
	}

	fmt.Printf("%d", output)
}


Measured memory_bytes: 512