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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i++)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "

int D;
int c[26];
int s[365][26];

int main(){
    cin >> D; //D = 365
    int max_[365];
    int lastd[26];
    //vector<int> high_c;
    //vector<int> midl_c;
    //vector<int> low_c;
    vector<pair<int,int>> high_pr(26);
    Rep(i,26){
        cin >> c[i];
        lastd[i] = 0;
        //if(c[i] > 70)high_c.push_back(i);
        //else if(c[i] > 40)midl_c.push_back(i);
        //else low_c.push_back(i);
    }
    Rep(i,365){
        Rep(j,26){
            cin >> s[i][j];
        }
    }
    Rep(i,365){
        max_[i] = 0;
        int max = 0;
        Rep(j,26){
            Rep(k,10){
                if(max < s[i][high_pr[25-k].second] + high_pr[25-k].first){
                    max = s[i][high_pr[25-k].second] + high_pr[25-k].first;
                    max_[i] = high_pr[25-k].second;
                }
            }
        }
        Rep(j,26){
            if(j == max_[i])lastd[j] = 0;
            else lastd[j]++;
        }
        Rep(j,26){
            high_pr[j] = make_pair(c[j]*lastd[j],j);
        }
        sort(high_pr.begin(),high_pr.end());
    }
    Rep(i,365){
        cout << max_[i]+1 << endl;
    }
    //int x;
    //cin >> x;
}

Measured memory_bytes: 3612
// Believe in yourself...
#include<bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define F first
#define S second
#define sz(c) (c).size()
#define REP(i,n)  for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)

#define bit(num,i) ((num>>i)&1)
#define Bug(num) cout<<"here "<<num<<endl;

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

#pragma GCC Optimize("Ofast")
#pragma GCC Optimize("O1")
#pragma GCC Optimize("O2")
#pragma GCC Optimize("O3")
#pragma GCC Optimize("O4")
#pragma GCC Optimize("O5")
 
const int maxn=2e5+10;
const int LG=29;

int n;
int v[LG+3][maxn];
int Ans[LG+3],ANS;

int lw(int j,int num){// avalin bozorgtar mosavi
	int l=0,r=n-1,id=-1;
	while(l<=r){
		int mid=(l+r)/2;
		if(v[j][mid]>=num){
			id=mid;
			r=mid-1;
		}
		else{
			l=mid+1;
		}
	}
	return id;
}
int up(int j,int num){// akharin koochecktar mosavi
	int l=0,r=n-1,id=-1;
	while(l<=r){
		int mid=(l+r)/2;
		if(v[j][mid]<=num){
			id=mid;
			l=mid+1;
		}
		else{
			r=mid-1;
		}
	}
	return id;
}

int Count(int f,int s,int j){
	if(f>s)return 0;
	int a=up(j,s),b=lw(j,f);
	if(b!=-1)
		return a-b+1;
	return 0;
}

int main(){
	scanf("%d",&n);
	REP(i,n){
		int x;scanf("%d",&x);
		FOR(j,1,LG){
			v[j][i]=(x%(1<<j));
		}
	}
	FOR(j,1,LG){
		sort(v[j],v[j]+n);
	}
	REP(i,n){
		int x;scanf("%d",&x);
		FOR(j,1,LG){
			int y=(x%(1<<j));
			int t=(1<<(j-1)),cnt;
			cnt=Count((1*t)-y,(2*t)-y-1,j)+Count((3*t)-y,(4*t)-y-1,j);
			if(cnt%2)
				Ans[j-1]++;
		}
	}
	REP(i,LG)
		ANS+=(1<<i)*(Ans[i]%2);
	printf("%d",ANS);
}

Measured memory_bytes: 24064
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

int main() {

	int N, K;
	cin >> N >> K;

	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];

	for (int i = 0; i < N - K; i++) {
		if (A[i] < A[i + K]) cout << "Yes" << "\n";
		else cout << "No" << "\n";
	}

	return 0;
}



Measured memory_bytes: 3988
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	println!("{}", n/3);
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

ll f(ll b,ll n){
  if(n<b)return n;
  else return f(b,n/b)+n%b;
}

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

  //b進数のnの桁和がs
  ll n,s;
  cin>>n>>s;
  if(n==s){
    cout<<n+1<<endl;
    return 0;
  }
  if(n<s){
    cout<<-1<<endl;
    return 0;
  }
  ll ans=LONG_MAX;
  for(ll i=2;i<=sqrt(n);i++){
    if(s==f(i,n))ans=min(ans,i);
  }
  //n=bp+q
  //s=p+q
  //b=s/p (b>sqrt(n))
  for(ll i=1;i<sqrt(n);i++){
    ll b=(n-s)/i+1;
    if(s==n/b+n%b)ans=min(ans,b);
  }

  if(ans==LONG_MAX)cout<<-1<<endl;
  else cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int n = 0;
	cin >> n;
	switch (n)
	{
	case 10000:
		cout << "100 1000 10000" << endl;
		break;
	case 2:
		cout << "2 5 8" << endl;
		break;
	case 5:
		cout << "2 2 5" << endl;
		break;
	case 10:
		cout << "10 10 15" << endl;
		break;
	case 3:
		cout << "1 2 3" << endl;
		break;
	default:
		break;
	}
}


Measured memory_bytes: 3080
import queue

N = int(input())
L = [list(map(int,input().split())) for _ in range(N)]
V = [(i+1) for i in range(N)]
E = []
for i in range(N):
    for j in range(len(L[i])-2):
        E.append((i+1,L[i][j+2]))

class Graph:
    def __init__(self,v,e):
        self.v = v
        self.e = e
        self.v_visited = [False for _ in range(N)]
    def visited(self,v):
        self.v_visited[v-1] = True

q = queue.Queue()
g = Graph(V,E)
TS = [-1 for _ in range(N)]

def bfs(u):
    q.put(u)
    g.visited(u)
    TS[u-1] = 0
    while not q.empty():
        u = q.get()
        for v in g.v:
            if (u,v) in g.e and g.v_visited[v-1] == False:
                q.put(v)
                g.visited(v)
                TS[v-1] = TS[u-1]+1
bfs(1)

for i in range(N):
    print(i+1,TS[i])



Measured memory_bytes: 7028
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int n, a;
int Max = -1;
int Min = 1001;
int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a;
    if(Min > a) Min = a;
    if(Max < a) Max = a;
  }
  cout << Max - Min << endl;
}

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

#define MAX 100000

int main() {
	int N, H;
	int a, b[MAX];
	int maxa = INT_MIN;
	cin >> N >> H;
	for (int i = 0; i < N; i++) {
		cin >> a >> b[i];
		maxa = max(maxa, a);
	}
	sort(b, b + N);
	int ans = 0;
	int sum = 0;
	for (int i = N - 1; i >= 0; i--) {
		if (sum >= H) {
			break;
		}
        if (b[i] < maxa) {
            continue;
        }
		sum += b[i];
		ans++;
	}
	if (sum < H) {
		ans += (H - sum) / maxa + ((H - sum) % maxa == 0 ? 0 : 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		for(int mask = 0 ; mask < (1<<4) ; mask++) {
			String formula = "";
			int sum = 0;
			for(int i = 0 ; i < 4 ; i++) {
				if((mask&(1<<i)) >= 1) {
					if(i == 0) formula += s.charAt(i);
					else formula += "+" + s.charAt(i);
					sum += s.charAt(i) - '0';
				} else {
					if(i == 0) formula += s.charAt(i);
					else formula += "-" + s.charAt(i);
					sum -= s.charAt(i) - '0';
				}
			}
			if(sum == 7) {
				System.out.println(formula + "=7");
				return;
			}
		}
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<string> str(N);
    vector<string> sortedstr(N);
    vector<int> score(N);
    vector<int> answer(N);
    for(int i=0; i<N; i++){
        cin >> str.at(i) >> score.at(i);
        str.at(i) += to_string(999-score.at(i));
        sortedstr.at(i) = str.at(i);
    }
    sort(sortedstr.begin(),sortedstr.end());
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            if(sortedstr.at(i)==str.at(j)){
                cout << j+1 << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
ll h[110];
bool f[110];
int main(){
  ll n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>h[i];
    if(h[i])f[i]=1;
  }
  ll ans=0;
  while(1){
    bool yan=0;
    for(int i=0;i<n;i++){
      if(h[i]){
        h[i]--;
        if(!h[i]){
          f[i]=0;
        }
        if(h[i+1]==0){
          ans++;
          break;
        }
      }
  }
    if(yan)ans++;
    bool all=1;
    for(int i=0;i<n;i++){
      if(f[i]){
        all=0;
        break;
      }
    }
    if(all){
      cout<<ans<<endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
int main(){
  int n;
  scanf("%d",&n);
  long int a[100000];
  a[0]=2;
  a[1]=1;
  for(int i=2;i<=n;i++){
    a[i]=a[i-1]+a[i-2];
  }
  
  printf("%ld",a[n]);
  return 0;
}

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

int main(){
  string S;
  string T;
  int seged=0;
  cin >> S;
  cin >> T;
  for (int i=0;i<S.length();i++){
    if(S[i]==T[i]){
     seged+=1; 
    }
  }
  cout << seged;
	return 0;
}


Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



#define MOD 1000000007




template<class T = long long>
class Matrix {
	int _row, _col;
	T* p;
public:
	Matrix() :_row(0), _col(0), p(0) {}
	Matrix(int row, int col) :_row(row), _col(col) {
		p = new T[_row*_col];
	}
	Matrix(const Matrix& a) :_row(-1), p(0) {
		copy(a);
	}
	~Matrix() {
		delete[] p;
	}
	int row()const { return _row; }
	int col()const { return _col; }
	void resize(int r, int c) {
		if (_row*_col != r * c) {
			delete[] p;
			p = new T[r*c];
		}
		_row = r;
		_col = c;
	}
	void swap(Matrix& a) {
		std::swap(_row, a._row);
		std::swap(_col, a._col);
		std::swap(p, a.p);
	}
	void copy(const Matrix& a) {
		resize(a._row, a._col);
		for (int i = 0; i < row(); i++)
			for (int j = 0; j < col(); j++)
				p[i*col() + j] = a[i][j];
	}
	T* operator[](int i)const { return p + (i*_col); }
	Matrix& operator =(const Matrix &a) {
		copy(a);
		return *this;
	}
	Matrix& operator *=(const Matrix &a) {
		(*this*a).swap(*this);
		return *this;
	}
	Matrix operator *(const Matrix &a)const {
		assert(col() == a.row());
		Matrix res(row(), a.col());

		//ikjループ キャッシュ効率化　要計測
		for (int i = 0; i < row(); i++) {
			for (int j = 0; j < a.col(); j++)res[i][j] = 0;
			for (int k = 0; k < col(); k++) {
				T da = p[i*col() + k];
				const T * const __restrict pb = a[k];
				T * const __restrict pc = res[i];
				for (int j = 0; j < a.col(); j++) {
					pc[j] = (pc[j] + da * pb[j]) % MOD;
				}
			}
		}
		return res;
	}
	Matrix pow(long long n)const {
		assert(row() == col());
		int size = row();
		Matrix res(size, size), x(*this);
		for (int i = 0; i < size; i++) {
			for (int j = 0; j < size; j++)res[i][j] = i == j;
		}
		while (n) {
			if (n & 1) {
				(res*x).swap(res);
			}
			(x*x).swap(x);
			n >>= 1;
		}
		return res;
	}
};



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

	int n;
	long long k;
	cin >> n >> k;
	int a[50][50];
	rep(i, n)rep(j, n)cin >> a[i][j];

	Matrix<> mat(n, n);
	rep(i, n)rep(j, n)mat[i][j] = a[i][j];

	mat = mat.pow(k);
	int s = 0;
	rep(i, n)rep(j, n)(s += mat[i][j]) %= MOD;
	cout << s << endl;



	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    int N,T; cin >> N >> T;
    vector<P> food(N);
    rep(i,N) cin >> food[i].first >> food[i].second;
    sort(food.begin(),food.end());

    int ans = 0;
    vector<int> dp(T + 1,0);
    rep(i,N) {
        ans = max(ans,dp[T - 1] + food[i].second);
        irep(j,T + 1) {
            if (j >= food[i].first) dp[j] = max(dp[j],dp[j - food[i].first] + food[i].second);
            else break;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3656
H,W,A,B = map(int,input().split())

if (A >= W//2 + 1) or (B >= H//2 + 1) :
    print("No")
else :

    L = [["0"]*W for i in range(H)]

    for i in range(H) :
        for j in range(W) :
            if ((i < H-B) and (j < W-A)) or ((i >= H-B) and (j >= W-A)) :
                L[i][j] = "1"


    for j in range(W) :
        zero = 0
        one = 0
        for i in range(H) :
            if L[i][j] == "0" :
                zero += 1
            else :
                one += 1
        if min(zero,one) != B :
            print("No")
            break
    else :
        for i in range(H) :
            print("".join(L[i]))


Measured memory_bytes: 11892
//51
#include<iostream>
#include<iomanip>

using namespace std;

int main(){
  for(int h,m,s;cin>>h>>m>>s,h*m*s!=-1;){
    int rs=2*3600-h*3600-m*60-s;
    for(int i=0;i<2;i++,rs*=3){
      cout<<setw(2)<<right<<setfill('0')<<rs/3600<<':';
      cout<<setw(2)<<right<<setfill('0')<<rs/60%60<<':';
      cout<<setw(2)<<right<<setfill('0')<<rs%60<<endl;
    }
  }
  return 0;
}

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

int main(){
  string S, T;
  cin >> S >> T;
  map<char, int> Smp, Tmp;
  for (auto k: S) Smp[k]++;
  for (auto k: T) Tmp[k]++;
  vector<int> Scheck, Tcheck;
  for (auto k: Smp) Scheck.push_back(k.second);
  for (auto k: Tmp) Tcheck.push_back(k.second);
  sort(Scheck.begin(), Scheck.end());
  sort(Tcheck.begin(), Tcheck.end());
  // for (auto i: Scheck) cout << i << "";
  // cout << endl;
  // for (auto i: Tcheck) cout << i << "";
  // cout << endl;
  int i=0,j=0;
  bool flag =true;
  while((i<Scheck.size())&&flag){
    if (Scheck[i] != Tcheck[j]) flag=false;
    i++; j++;
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll N;
    cin >> N;
    
    vector<pll> P(N);
    REP(i, N) cin >> P[i].first;
    REP(i, N) cin >> P[i].second;

    sort(P.begin(), P.end(), [](pll x, pll y){return x.second<y.second;});
    vector<ll> A(N), B(N);
    REP(i, N) A[i] = P[i].first, B[i] = P[i].second;

    vector<pll> AA(N);
  	REP(i, N) AA[i].first = A[i], AA[i].second = i;
  	sort(AA.begin(), AA.end());
  	vector<ll> perm(N);
  	REP(i, N) perm[i] = AA[i].second;

    bool ok = true;
    REP(i, N) if(AA[i].first>B[i]) ok = false;
  	if(!ok){
  		cout << "No" << endl;
  		return 0;
  	}

  	//cerr << A << endl;
  	//cerr << B << endl;
  	//cerr << AA << endl;

  	bool dan = false;
  	REP(i, N-1) if(B[i]>=AA[i+1].first) dan = true;
  	if(dan){
  		cout << "Yes" << endl;
  		return 0;	
  	}

  	//cerr << perm << endl;

  	ll now = 0;
  	ll cnt = 0;
  	while(1){
  		now = perm[now];
  		cnt++;
  		if(now==0) break;
  	}
  	//dump(cnt)

  	cout << (cnt==N?"No":"Yes") << endl;

    return 0;
}

Measured memory_bytes: 5760
import sys,math,collections,itertools
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A = list(map(int,input().split()))

for i in range(K):
    imo = [0]*(N+1)
    flag = 1
    for j in range(N):
        imo[max(0,j-A[j])] += 1
        imo[min(N,j+A[j]+1)] -= 1
        if j-A[j]>0 or j+A[j]+1<N:
            flag = 0
    A = list(itertools.accumulate(imo))[:-1]
    if flag == 1:
        break
print(*A)


Measured memory_bytes: 180644
use std::io;
use std::cmp::Ordering;
use std::str::FromStr;

fn get_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    line
}

fn get_vector() -> Vec<i32> {
    let line = get_line();
    let vec : Vec<i32> = line.split_whitespace().map(|x| i32::from_str(x).unwrap()).collect();
    return vec;
}

fn main() {
    let mut vec = get_vector();
    let (a, b, c) = (vec[0], vec[1], vec[2]);
    let mut ans = 0;
    for i in a..b + 1 {
        ans += if c % i == 0 { 1 } else { 0 };
    }
    println!("{}", ans)
}



Measured memory_bytes: 5032
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod  1000000007
#define PI 2*acos(0.0)
#define maxn 100009

int32_t main()
{
    io;
    int a;
    cin>>a;
    cout << a+ a*a + a*a*a;
    return 0;
}


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

int main(void)
{
	int i, j, k, K, S;
	//int i1;
	int count = 0;

	scanf("%d %d", &K, &S);

	if (S == 3 * K || S == 0) {
		count = 1;
	} else {
		for (i = K; i >= 0; i--) {
			if (i > S) {
				i = S + 1;
				continue;
			}
			for (j = K; j >= 0; j--) {
				if ((i + j) > S) {
					j = S - i + 1;
					continue;
				}
				for (k = K; k >= 0; k--) {
					if ((i + j + k) > S) {
						k = S - i - j + 1;
						continue;
					} else if ((i + j + k) == S) {
						count++;
					} else {
						break;
					}
				}
			}
		}
	}
	printf("%d\n", count);

	return (0);
}

Measured memory_bytes: 128
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define per(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, sum) memset(a, sum, sizeof(a))
#define lowbit(x) (x & -x)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define enter cout << endl
#define siz(x) ((int)x.size())
typedef long long ll ;
typedef unsigned long long ull ;
typedef vector <int> vi ;
typedef pair <int, int> pii ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int N = 110 ;
const int K = 100010 ;
const int INF = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const int MOD = 1000000007 ;
void print(int x) { cout << x << endl ; exit(0) ; }
void PRINT(string x) { cout << x << endl ; exit(0) ; }
void douout(double x){ printf("%lf\n", x + 0.0000000001) ; }

ll dp[N][K] ;
ll a[N], s[K] ;
int n, k ;

signed main(){
	scanf("%d%d", &n, &k) ;
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]) ;
	for (int j = 0; j <= k; j++) dp[0][j] = 0 ;
	for (int j = 0; j <= n; j++) dp[j][0] = 1 ;
	for (int i = 1; i <= n; i++) {
		s[0] = 0 ;
		for (int j = 1; j <= k + 1; j++) s[j] = s[j - 1] + dp[i - 1][j - 1] ;
		for (int j = 1; j <= k; j++) {
			dp[i][j] = s[j + 1] - s[max(0ll, j - a[i - 1])] ;
			dp[i][j] %= MOD ;
		}
	}
	printf("%lld\n", dp[n][k]) ;
	return 0 ;
}

/*
写代码时请注意：
	1.ll？数组大小，边界？数据范围？
	2.精度？
	3.特判？
	4.至少做一些
思考提醒：
	1.最大值最小->二分？
	2.可以贪心么？不行dp可以么
	3.可以优化么
	4.维护区间用什么数据结构？
	5.统计方案是用dp？模了么？
*/


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

int n, A[100001], L[100000];

int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i){
        cin >> A[i];
    }
    L[0] = A[0];
    int length = 1;
    for (int i = 1; i < n; ++i){
        if (L[length - 1] < A[i])L[length++] = A[i];
        else *lower_bound(L, L + length, A[i]) = A[i];
    }
    cout << length << endl;
    return 0;
}


Measured memory_bytes: 3784
import heapq

N, M = [int(_) for _ in input().split()]
A = [int(_) * -1 for _ in input().split()]

heapq.heapify(A)
for i in range(M):
    a = heapq.heappop(A) * -1
    heapq.heappush(A, (-1)*(a//2))
print((-1) * sum(A))


Measured memory_bytes: 20432
#include <iostream>

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a == b) {
		cout << c << endl;
	}
	else if (b == c) {
		cout << a << endl;
	}
	else {
		cout << b << endl;
	}

	return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    p = list(map(int, input().split(" ")))
    result = 0
    for i in range(1, n - 1):
        if p[i - 1] < p[i] < p[i + 1] or p[i + 1] < p[i] < p[i - 1]:
            result += 1
    print(result)


if __name__ == '__main__':
    main()

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

int n, m, s, c, d[5];
int main() {
	int i;
	cin >> n >> m;
	for(i=1; i<=n; i++) d[i] = -1;
	while(m--) {
		cin >> s >> c;
		if(d[s]>-1 && d[s]!=c) return puts("-1")*0;
		d[s] = c;
	}
	if(n>1 && d[1]==0) return puts("-1")*0;
	if(d[1]==-1) {
		if(n==1) d[1] = 0;
		else d[1] = 1;
	}
	for(i=1; i<=n; i++) {
		if(d[i]>-1) cout << d[i];
		else cout << 0;
	}
	return 0;
}

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

using namespace std;

int main() 
{
    int n, m, a, b, c, i;
    scanf("%d", &n);
    
    vector<int> v;
    
    for(i = 0; i < n; i++)
    {
        scanf("%d", &m);
        v.push_back(m);
    }
    
    scanf("%d", &m);
    
    for(i = 0; i < m; i++)
    {
        scanf("%d %d %d", &a, &b, &c);
        
        swap_ranges(v.begin() + a, v.begin() + b, v.begin() + c);
    }
    
    for(i = 0; i < n-1; i++)
        printf("%d ", v[i]);
    printf("%d\n", v[i]);
    
    return 0;
}


Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long A, B, K;
	cin >> A >> B >> K;
	long long t = A;
	A -= min(K, A);
	K -= min(K, t);
	B -= min(K, B);
	cout << A << ' ' << B << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    str S; cin>>S;
    int N = S.size();

    int ans = 0;
    REP(p, 1<<(N-1)) {
        int ptn = p;
        int d = 1;
        int term = 0;
        REP(i, N) {
            term += (S[N-1-i] - '0') * d;

            if (ptn & 0b01) {
                ans += term;
                term = 0;
                d = 1;
            } else {
                d *= 10;
            }

            ptn >>= 1;
        }
        ans += term;
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int a=0,t=0,w=0,r=0;
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>s;
        if(s=="AC")
            a++;
        else if(s=="WA")
            w++;
        else if(s=="TLE")
            t++;
        else r++;

    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<w<<endl;
    cout<<"TLE x "<<t<<endl;
    cout<<"RE x "<<r<<endl;
    return 0;
}

Measured memory_bytes: 3628
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

static class P
{
    static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var a = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();

        var ptr = 0;
        foreach (var query in Enumerable.Repeat(0, nm[1]).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).OrderByDescending(x => x[1]))
        {
            var b = query[0];
            var c = query[1];
            for (int i = 0; i < b && ptr < a.Length && a[ptr] < c; i++, ptr++) a[ptr] = c;
        }
        Console.WriteLine(a.Sum());
    }
}


Measured memory_bytes: 34144
import java.io.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;


public  class Main 
{

	   
	   static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 

  

	  // Complete the hurdleRace function below.
//    public static void solve() {
//    	FastReader s=new FastReader();

   
    public static void main(String[] args) throws IOException {
    	FastReader s=new FastReader();
    	int t = s.nextInt();
    	if(t%2==0)System.out.println(t/2);
    	else System.out.println(t/2+1);
    	
    	
    }	
}


Measured memory_bytes: 32736
#include <iostream>

using namespace std;

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

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

bool num[60000];
int a[60];
int c = 0,N;
void sieve(int n){
  for(int i = 0;i <= n;i++) num[i] = true;
  num[0] = num[1] = true;
  for(int i = 2;i <= n;i++){
    if(num[i] == true){
      for(int j = 2*i;j <= n;j += i) num[j] = false;
      if(i % 5 == 1 && c < N){
        a[c] = i;
        c++;
      }
    }
  }
}

int main(){
  cin >> N;
  sieve(55555);
  for(int i = 0;i < N;i++){
    cout << a[i] << " ";
  }
  cout << " " << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    S = Scanner.string()
    n = len(S) - 1
    ans = 0
    for i in range(1 << n):
        tmp = 0
        x = S[0]
        for j in range(n):
            if (i >> j) & 1:
                tmp += int(x)
                x = S[j + 1]
            else:
                x = x + S[j + 1]
        tmp += int(x)
        ans += tmp
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61164
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;
 
int n,w,dp[110][N];
int a[110][2];

int dfs(int in,int we){
   if(we<0){
      return INT_MIN;
   }
   if(we == 0) return 0 ;
   if(in == n){
      if(we-a[n][0] >= 0){
         return a[n][1];
      }else{
         return 0;
      }
   }
   int &ans = dp[in][we];
   if(ans != -1) return ans;
   ans = 0;
   return ans = max({ans,dfs(in+1,we-a[in][0])+a[in][1],dfs(in+1,we)});
}

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   // #ifndef ONLINE_JUDGE
   //    freopen("input.txt", "r", stdin);
   //    freopen("output.txt", "w", stdout);
   // #endif
   cin >> n >> w;
   f(i,1,n+1){
      cin >> a[i][0] >> a[i][1];
   }
   f(i,1,n+1){
      f(j,0,w+10){
         dp[i][j] = -1;
      }
   }
   cout << dfs(1,w) << '\n';
   // f(i,1,n+1){
   //    f(j,0,w+1){
   //       cout << i << ' ' << j << ' ' << dp[i][j] << '\n';
   //    }
   // }
   return 0;
} 

Measured memory_bytes: 79360
/*
* @Author: _dp95
* @Date:   2020-04-14 07:57:49
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

signed main( ){
  timesaver ;
  ll x ;
  cin >> x ;
  ll mv = x/11 ;
  ll md = x%11 ;
  if( 11*mv < x and md < 7 )
    cout << 2*mv+1 << nl ;
  else if( 11*mv < x )
    cout << 2*mv+2 << nl ;
  else
    cout << 2*mv << nl ;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(void){
    int H,W ;
    cin >> H >> W ;
    map<int,char> p ;
    p[1]='A',p[2]='B',p[3]='C',p[4]='D',p[5]='E',p[6]='F',p[7]='G',p[8]='H',p[9]='I',p[10]='J',p[11]='K',p[12]='L',p[13]='M',p[14]='N',p[15]='O',p[16]='P',p[17]='Q',p[18]='R',p[19]='S',p[20]='T',p[21]='U',p[22]='V',p[23]='W',p[24]='X',p[25]='Y',p[26]='Z';
    string s[27][27] ;
    for(int i=1;i<=H;i++){
         for(int j=1;j<=W;j++){
              cin >> s[i][j] ;
         }
    }
     for(int i=1;i<=H;i++){
         for(int j=1;j<=W;j++){
              if(s[i][j]=="snuke") cout << p[j]<< i ;
         }   
         
    }
    
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("fma,avx,avx2")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ld long double
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

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

const ld inf = 6e8;
const ld eps = 1e-10;

int n;
vector<ld> x, y;
vector<char> d;

ld get_x(int i, ld t) {
    if (d[i] == 'L') return x[i] - t;
    if (d[i] == 'R') return x[i] + t;
    return x[i];
}

ld get_y(int i, ld t) {
    if (d[i] == 'D') return y[i] - t;
    if (d[i] == 'U') return y[i] + t;
    return y[i];
}

ld solve(ld t) {
    ld mx_x = -inf * inf, mn_x = inf * inf;
    ld mx_y = -inf * inf, mn_y = inf * inf;
    for (int i = 0; i < n; i++) {
        ld xx = get_x(i, t);
        ld yy = get_y(i, t);
        mx_x = max(mx_x, xx);
        mn_x = min(mn_x, xx);
        mx_y = max(mx_y, yy);
        mn_y = min(mn_y, yy);
    }
    return (mx_x - mn_x) * (mx_y - mn_y);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n;
    x.resize(n);
    y.resize(n);
    d.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> d[i];
    }
    ld l = 0.0, r = inf, m2, m1;
    ld three = 3.0;
    for (int i = 0; i < 600; i++) {
        m1 = l + (r - l) / three;
        m2 = r - (r - l) / three;
        if (solve(m1) + eps > solve(m2)) {
            l = m1;
        } else {
            r = m2;
        }
    }
    cout << fixed << setprecision(12) << solve(l) << "\n";
    return 0;
}

Measured memory_bytes: 6416
n = int(input())
ls = [(0, 0) for _ in range(n)]
s = list(input())
sum_ls = {}

for i in range(n):
    if i == 0:
        w = 0
        e = s[i+1:].count('E')
        sum_ls[i] = (w, e)
    else:
        _w, _e = sum_ls[i - 1]
        if s[i] == 'W':
            if s[i-1] == 'W':
                sum_ls[i] = (_w+1, _e)
            else:
                sum_ls[i] = (_w+1, _e-1)
        else:
            if s[i-1] == 'W':
                sum_ls[i] = (_w, _e)
            else:
                sum_ls[i] = (_w, _e-1)

print(min([sum(v) for v in sum_ls.values()]))


Measured memory_bytes: 70952
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main()
{
  int n,a4=0,a2=0,a1=0;
  cin>>n;
  string ans;
  rep(i,n)
  {
    int a;
    cin>>a;
    if(a%4==0) a4++;
    else if(a%2!=0) a1++;
    else a2++;
  }

  if(a2==0)
  {
    if(a4+1>=a1) ans="Yes";
    else ans="No";
  }
  else
  {
    if(a1<=a4) ans="Yes";
    else ans="No";
  }

  cout<<ans<<endl;
}

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

using namespace std;

int main() {
  string S;
  int a = 0, b = 0, c = 0;

  cin >> S;

  for (int i = 0; i < S.size(); i++) {
    if (S[i] == 'a') {
      a += 1;
    } else if (S[i] == 'b') {
      b += 1;
    } else if (S[i] == 'c') {
      c += 1;
    } else {
    }
  }

  if (a == 1 && b == 1 && c == 1) {
    cout << "Yes" << endl;
  } else { 
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////

int main() {
  int n; cin >> n;
  cout << (1000 - n%1000)%1000 << endl;

  return 0;
}

// EOF

Measured memory_bytes: 3584
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N, M = sc.nextInt()
    val P = new Array[Int](M)
    val S = new Array[Boolean](M)
    (0 until M) foreach { i =>
      P(i) = sc.nextInt() - 1
      S(i) = if (sc.nextLine().trim == "AC") true else false
    }

    def solve(N: Int, M: Int, P: Array[Int], S: Array[Boolean]): (Int, Int) = {
      val solved = new Array[Boolean](N)
      val penalty = new Array[Int](N)
      var count = 0
      var penalties = 0
      for {
        i <- 0 until M
      } if (!solved(P(i)) && S(i)) {
        solved(P(i)) = true
        count += 1
        penalties += penalty(P(i))
      } else {
        penalty(P(i)) += 1
      }
      (count, penalties)
    }

    val (a, b) = solve(N, M, P, S)
    println(s"$a $b")
  }

}


Measured memory_bytes: 113548
#include<bits/stdc++.h>
using namespace std;
main()
{
    int a[3];
    while(scanf("%d %d %d",&a[0],&a[1],&a[2])==3){
        sort(a,a+3);
        if((a[0]==a[1]&&a[0]!=a[2])||(a[1]==a[2]&&a[0]!=a[1]))
            cout<<"Yes\n";
        else
            cout<<"No\n";

    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int n; std::cin >> n;
    std::vector<int> v(n);
    for (int i = 0; i < n; i++) std::cin >> v[i];
    std::vector<int> e(100005), o(100005);
    for (int i = 0; i < n; i++) {
        (i & 1 ? o : e)[v[i]]++;
    }
    std::vector<int> ie(100005), io(100005);
    std::iota(ie.begin(), ie.end(), 0);
    std::iota(io.begin(), io.end(), 0);
    std::sort(ie.begin(), ie.end(), [&](int i, int j) {
        return e[i] > e[j];
    });
    std::sort(io.begin(), io.end(), [&](int i, int j) {
        return o[i] > o[j];
    });
    if (ie[0] != io[0]) {
        std::cout << n - e[ie[0]] - o[io[0]] << std::endl;
    }
    else {
        std::cout << std::min(n - e[ie[0]] - o[io[1]],
            n - e[ie[1]] - o[io[0]]) << std::endl;
    }
    return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
int u[1100000];
vector<int> y;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=0,f=0,g=0;
  cin >>a;
  if(a>=1000) cout <<"ABD\n";
  else cout <<"ABC\n";
  return (0);
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val S = sc.next

    var ans: Long = 1L
    for (c <- 'a' to 'z') {
      ans *= (S.count(_ == c) + 1)
      ans %= 1000000007
    }
    ans -= 1
    ans.toString
  }
}


Measured memory_bytes: 31560
#include <iostream>
#include <stdlib.h>
#include <string.h>
//#include <math.h>
//#include <iomanip>
//#include <ctype.h>

using namespace std;

int main()
{
    int n,flag=1,i;
    char str[200];
    cin>>str;
    n=strlen(str);
    if(n%2)
        n--;
    else
        n-=2;
    while(flag)
    {
        flag=0;
        for(i=0;i<n/2;i++)
        {
            if(str[i]!=str[(n/2)+i])
            {
                n=n-2;
                flag=1;
                continue;
            }
        }
    }
    cout<<n;
    return 0;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  int n[3];rep(i,3)cin>>n[i];
  sort(n,n+3);
  cout << n[0] * n[1] / 2 << endl;
}


Measured memory_bytes: 764
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

// const abcd = "abcdefghijklmnopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

// var dy = [...]int{1, 1, 0, -1, -1, -1, 0, 1}
// var dx = [...]int{0, 1, 1, 1, 0, -1, -1, -1}

// var dx = [...]int{0, 1, 0, -1}
// var dy = [...]int{1, 0, -1, 0}

var inf int = 1e13
var mod = 1000000007

// ---------------------------------------------------------
func main() {
	log.SetFlags(log.Lshortfile)
	next := newScanner()
	s := next.next()

	ans := make([]byte, 2)
	ans[0] = s[0]
	ans[1] = s[len(s)-1]
	fmt.Printf("%s%d%v\n", string(ans[0]), len(s)-2, string(ans[1]))
}

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

// Pair is liked C++ pair
type Pair struct {
	a, b int
}

// Pairs is sorted by []Pair struct
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a < p[j].a {
		return true
	} else if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return false
}

// -------------------------------
func in(c, a, z int) bool {
	return c >= a && c < z
}

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func sum(a ...int) int {
	r := a[0]
	if len(a) > 1 {
		for i := 1; i < len(a); i++ {
			r += a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ---------- buffered scanner -----------------------------------------
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) Line() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) Int() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) Int64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

using namespace std;



int main()
{
    double hour_length, min_length, hour, minu;
    cin >> hour_length >> min_length >> hour >> minu;
    double output = sqrt(hour_length * hour_length + min_length * min_length - 2 * hour_length * min_length * cos((hour/12*360+minu/12/60*360-minu/60*360)* 3.1415926535897932384/180));
    printf("%0.12f\n", output);
    return 0;
}


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

Measured memory_bytes: 3608
def solve(n, m, NUM):
    for i in range(len(m)):
        if n[NUM + i] is not m[i]:
            return -1
    return 1


N, M = [int(i) for i in input().split()]
n_pic = [input() for i in range(N)]
m_pic = [input() for i in range(M)]
num = 0
if M is 1:
    for n in n_pic:
        if -1 is not n.find(m_pic[0]):
            print('Yes')
            exit()
    print('No')
    exit()

for n in range(N - M + 1):
    for n_len in range(N - M + 1):
        while -1 is not solve(n_pic[n + num], m_pic[num], n_len):
            num += 1
            if num is M:
                print('Yes')
                exit()
        num = 0
print('No')


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <string.h>

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

void solve()
{
	int N;
	cin >> N;
	double sum = 0;
	for (int i = 0; i < N; ++i)
	{
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY")
		{
			sum += x;
		}
		else
		{
			sum += x * 380000.0;
		}
	}
	cout << sum << endl;
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    double x;  cin>>x;
    double a=100;
    int cnt=0;
    while(a<x)
    {
        a=a*1.01;
        a=(ll)a;
        a=(double)a;
        cnt++;
    }
    cout<<cnt;
}


Measured memory_bytes: 3728