akhauriyash/Code-Regression huggingface dataset:
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] w = sc.next().toCharArray();
        Map<Character, Integer> alphabets = new HashMap<>();
        
        for (int i = 0; i < w.length; i++) {
            int current = 0;
            if (alphabets.containsKey(w[i])) {
                current = alphabets.get(w[i]);
            }
            alphabets.put(w[i], current + 1);
        }
        
        for (Character c : alphabets.keySet()) {
            if (alphabets.get(c) % 2 != 0) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


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

int find(int n){
 int sum = 0;
  while(n > 0){
   sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
 int N, A, B;
  cin >> N >> A >> B;
  int total = 0;
  for(int i = 0; i <= N; i++){
    int sum = find(i);
    if(A <= sum && sum <= B){
     total += i; 
    }
  }
  cout << total <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
const int MAXN = 200000;
ll A[MAXN];
int main(){
    map<ll,ll> Ma;
    int N;cin >> N;
    rep(i,N) {
        cin >> A[i];
        Ma[A[i]]++;
    }

    ll sum = 0;
    bool che[MAXN+1] = {false};
    rep(i,N) {
        if(!che[A[i]]) {
            sum += (Ma[A[i]] * (Ma[A[i]]-1))/2;
            che[A[i]] = true;
        }
    }

    // cout << sum << endl;
    rep(i,N) {
        cout << sum - ((Ma[A[i]] * (Ma[A[i]]-1))/2) + ((Ma[A[i]]-1) * (Ma[A[i]]-2))/2 << endl;
    }

    return 0;

}

Measured memory_bytes: 13252
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int ans;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	string s,t;
	cin>>s>>t;
	for(int i=0;i<=s.size()-1;i++)
	{
		if(s[i]!=t[i])
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 3816
s = input()
n = len(s)
answer = [1] * n
for i in range(0,n-2):
	if s[i] == 'R' and s[i+1] == 'R':
			answer[i+2] += answer[i]
			answer[i] = 0
for i in range(n-1,-1,-1):
	if s[i] == 'L' and s[i-1] == 'L':
			answer[i-2] += answer[i]
			answer[i] = 0
print(*answer)


Measured memory_bytes: 6400
def se(c, x, h, l):
    if h == l:
        return l
    t = (h+l)//2
    if c[t] <= x:
        a = se(c,x,h,t+1)
    else:
        a = se(c,x,t,l)
    return a
        
    
import numpy as np
n = int(input())
a = [int(input()) for i in range(n)]
c = [a[-1]]
diff = np.diff(a)
tmp = np.sum(diff<=0)
if tmp == len(diff):
    print(len(a))
elif tmp == 0:
    print(1)
else:
    for i in a[::-1][1:]:
        if c[-1] <= i:
            c.append(i)
        else:
            c[se(c,i,len(c),0)] = i
    print(len(c))




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

typedef long long int lli;

const lli maxn = 16, inf = lli(1e17)+5;

lli A[maxn], maxi[maxn];

int main(void)
{
	lli n, k;
	scanf("%lld%lld", &n, &k);
	for(lli i = 0;i < n;i++) scanf("%lld", &A[i]);

	for(lli i = 0;i < n;i++)
	{
		maxi[i] = max(maxi[i], A[i]);
		if(i) maxi[i] = max(maxi[i], maxi[i-1]);
	}

	lli res = inf;
	for(lli mask = 0;mask < (1<<n);mask++)
	{
		if(__builtin_popcount(mask) == k)
		{
			lli cost = 0, maxiyet = -1;
			for(lli i = 0;i < n;i++)
			{
				if(mask&(1<<i))
				{
					lli newht = maxiyet+1;
					if(i) newht = max(maxi[i-1]+1, newht);
					cost += max(0ll, newht-A[i]);
					maxiyet = newht;
				}
			}
			res = min(res, cost);
		}
	}
	printf("%lld\n", res);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include <bits/stdc++.h>

using namespace std;

typedef pair<long long,bool> Pair;
const long long INF = 1LL<<60;

int main(){

long long x,y,z;

cin >> x >> y >> z;

cout << z << " " << x << " " << y << endl;

return 0;

}   


Measured memory_bytes: 256
s=int(input())
a=s
num=[s]
if a==4 or a==1 or a==2:
  print(4)
  exit()
for i in range(2,10**7+1):
  if a%2==0:
    a=a//2
  else:
    a=3*a+1
  if a==4 or a==1 or a==2:
    ans=i+3
    break
print(ans)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		ABC178A solver = new ABC178A();
		solver.solve(1, in, out);
		out.close();
	}
	
	static class ABC178A {
	
		public void solve(int testNum, FastInput in, PrintWriter out) {
	
			int x = in.nextInt();
			if(x == 1) {
				out.println(0);
			}
			else {
				out.println(1);
			}
		}
		

}
static class FastInput{
	private final BufferedReader in;
	private String[] buff;
	private int index = 0;
	
	public FastInput(InputStream is) {
		in = new BufferedReader(new InputStreamReader(is));
	}
	String nextLine() {
		try {
			return in.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
	String next() {
		while (buff == null || index >= buff.length) {
			buff = nextLine().split(" ");
			index = 0;
		}
		return buff[index++];
	}
	int nextInt() {
		return Integer.parseInt(next());
	}
	
	long nextLong() {
		return Long.parseLong(next());
	}
	
	Double nextDouble() {
		return Double.parseDouble(next());
	}
	
	BigInteger nextBigInteger() {
		return new BigInteger(next());
	}
	
	BigDecimal nextBigDecimal() {
		return new BigDecimal(next());
	}
	
	public int[] nextIntArray(final int n) {
		final int[] res = new int [n];
		
		for(int i = 0 ; i < n ;i++) {
			res[i] = nextInt();
		}
		return res;
	}
	
	public long[] nextLongArray(final int n) {
		final long[] res= new long [n];
		
		for(int i = 0 ; i < n ;i++) {
			res[i] = nextLong();
		}
		return res;
	}
	
	public double[] nextDoubleArray(final int n ) {
		final double[] res = new double [n];
		
		for(int i = 0 ; i < n ;i++) {
			res[i] = nextDouble();
		}
		return res;
	}
	
	
	public int[][] nextInt2DArray(final int n , final int m){
		int [][]res = new int [n][m];
		
		for(int i = 0 ; i < n ;i++) {
			for(int j = 0 ; j < m ;j++) {
				res[i][j] = nextInt();
			}
		}
		return res;
	}
	public long[][] nextLong2DArray(final int n , final int m){
		long [][]res = new long [n][m];
		
		for(int i = 0 ; i < n ;i++) {
			for(int j = 0 ; j < m ;j++) {
				res[i][j] = nextLong();
			}
		}
		return res;
	}
	
	public char[][] nextChar2DArray(final int n){
		char [][]res = new char [n][];
		
		for(int i = 0 ; i < n ;i++) {
			String s = next();
			res[i] = s.toCharArray();
		}
		
		return res;
	}
}
}


Measured memory_bytes: 32996
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();

        char[] S = sc.next().toCharArray();

        S[K-1] = (char) (S[K-1] + 32);

        for(int i=0; i<N; i++){
            System.out.print(S[i]);
        }

    }
}


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

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

typedef long long lint;

using namespace std;

lint gcd(lint m,lint n){
  if(n==0)return m;
  return gcd(n,m%n);
}

lint lcm(lint n,lint m){
  return n*m/gcd(m,n);
}

int main(){
  int A,B;
  cin>>A>>B;
  cout<<lcm(A,B)<<endl;
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**9
for l in range(n - k + 1):
    r = l + k - 1
    ans = min(ans, abs(x[r]) + abs(x[r]-x[l]), abs(x[l]) + abs(x[r]-x[l]))

print(ans)


Measured memory_bytes: 20076
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  ll N,K;
  cin >> N >> K;
  
  print(N - K + 1);

 return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	string N;
	void ans() {
		cin >> N;
		int res = 0;
		REP(i, 4) {
			if (N[i] == '2') res++;
		}
		cout << res << "\n";
	}
};

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

	question q;
	q.ans();

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd				double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll				vector<long long>
#define vpii			vector<pair<int,int>>
#define vpll			vector<pair<long long,long long>>
#define vvi				vector<vector<int>>
#define vvl				vector<vector<long long>>
#define mii             map<int,int>
#define mll  			map<long long,long long>
#define umii			unordered_map<int,int>
#define umll			unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)		for(int i=0;i<n;i++)
#define rep2(i,a,b)		for(int i=a;i<b;i++)
#define rev(i,n)		for(int i=n;i>=0;i--)
#define rev2(i,a,b)		for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define fio				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl			'\n'
#define all(x)			x.begin(),x.end()
#define d0(x)			cout <<x<<" "
#define d1(x)			cout <<x<<endl
#define d2(x,y)			cout <<x<<" "<<y<<endl
#define d3(x,y,z)		cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)		cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
const ll mod=1e9+7;
void i_o()
{
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
} 
ll MOD=998244353;
ll pow2[100005]={0};
ll fre[100005]={0};
int main()
{
	fio
   // i_o();
	dd r;
	cin>>r;
	cout << 2*r*M_PI;    


    
	return 0;
}



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

int main()
{
long long int a,b,c,d;
long long int ans;
  cin >> a >> b >> c >> d;
  ans = a*c;
  if(ans<a*d){
    ans = a*d;
  }
  if(ans<b*c){
    ans = b*c;
  }
  if(ans<b*d){
    ans = b*d;
  }
  
  cout << ans;
}

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

int lcm(int x,int y)
{
    return (x*y)/__gcd(x,y);
}
int main()
{
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
 return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
using namespace std;
long h,w,n,a,b,c,d,dx[]={-1,-1,-1,0,0,0,1,1,1},dy[]={-1,0,1,-1,0,1,-1,0,1},cnt[10],i,j;
map<pair<long,long>,long>m;
main()
{
	cin>>h>>w>>n;*cnt=(h-2)*(w-2);
	for(;i<n;i++)
	{
		cin>>a>>b;
		for(j=0;j<9;j++)
		{
			c=a+dx[j];
			d=b+dy[j];
			if(c<2||d<2||c>=h||d>=w)continue;
			cnt[m[make_pair(c,d)]++]--;
			cnt[m[make_pair(c,d)]]++;
		}
	}
	for(i=0;i<10;i++)cout<<cnt[i]<<endl;
}

Measured memory_bytes: 56448
#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;

//b以上の最初の要素の位置を返す。ない場合(すべてがb未満の場合)はv.size()を返す
//vはソート済であること。あと、&v でなくvだと引数コピーが発生するので遅い。
//戻り値は b未満の要素の数である。
int lbound(vector<long long>&v, long long b){
	int s = 0, e = v.size() - 1;
	int l = v.size();
	int m;
	while(e - s > 1){
		m = (s + e) / 2;
		if(v[m] >= b){
			e = m;
		}
		else{
			s = m;
		}
	}
	if(v[max(s - 1, 0)] >= b) return max(s - 1, 0);
	else if(v[s] >= b) return s;
	else if(v[min(s + 1, l - 1)] >= b) return min(s + 1, l - 1);
	else return v.size();
}

//bより大きいの最初の要素の位置を返す。ない場合(すべての要素がb以下の場合)はv.size()を返す
//vはソート済であること。あと、&v でなくvだと引数コピーが発生するので遅い。
//戻り値は b以下の要素の数である。
int ubound(vector<long long>&v, long long b){
	int s = 0, e = v.size() - 1;
	int l = v.size();
	int m;
	while(e - s > 1){
		m = (s + e) / 2;
		if(v[m] <= b){
			s = m;
		}
		else{
			e = m;
		}
	}
	if(v[max(s - 1, 0)] > b) return max(s - 1, 0);
	else if(v[s] > b) return s;
	else if(v[min(s + 1, l - 1)] > b) return min(s + 1, l - 1);
	else return v.size();
}


long long N;
string S;
vector<long long> R, G, B;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N ;
	cin >> S ;

	for(long long i=0; i<S.size(); i++){
		char c = S[i];
		if(c == 'R') R.push_back(i);
		if(c == 'G') G.push_back(i);
		if(c == 'B') B.push_back(i);
	}

	if(R.size() == 0 || G.size() == 0 || B.size() == 0){
		printf("0\n");
		return 0;
	}

	//jを軸に考える
	long long ans = 0;
	for(long long j = 1; j < N - 1; j++){
		char c = S[j];
		long long na, nb;
		if(c == 'R'){
			na   = lbound(G, j);
			nb   = B.size() - ubound(B, j);
			ans += na * nb;
			na   = lbound(B, j);
			nb   = G.size() - ubound(G, j);
			ans += na * nb;
		}
		if(c == 'G'){
			na   = lbound(R, j);
			nb   = B.size() - ubound(B, j);
			ans += na * nb;
			na   = lbound(B, j);
			nb   = R.size() - ubound(R, j);
			ans += na * nb;
		}
		if(c == 'B'){
			na   = lbound(G, j);
			nb   = R.size() - ubound(R, j);
			ans += na * nb;
			na   = lbound(R, j);
			nb   = G.size() - ubound(G, j);
			ans += na * nb;
		}
		//jがiとkの中点になっているものを数えて引く。
		for(int i=1; ; i++){
			if(j - i < 0 || j + i >=N) break;
			char c1 = S[j - i];
			char c2 = S[j + i];
			if(c1 != c && c2 != c && c1 != c2){
				ans--;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3876
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	ll a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	ll x = v - w;
	if (a == b) {
		cout << "YES" << "\n";
		return 0;
	}

	if (x <= 0) {
		cout << "NO" << "\n";
		return 0;
	}

	if (abs(a - b) <= x * t) {
		cout << "YES" << "\n";
	}
	else {
		cout << "NO" << "\n";
	}

	return 0;
}

Measured memory_bytes: 3656
#include <iostream>

using namespace std;
int n;
string s;
int main() {
  cin >> n >> s;
  int ans = 0;
  for(int i = 1; i < s.size(); i++) {
    if(s[i] == 'E') ans++;
  }
  int tmp = ans;
  for(int i = 1; i < s.size(); i++) {
    if(s[i] == 'E') ans--;
    if(s[i-1] == 'W') ans++;
    tmp = min(tmp,ans);
  }
  cout << tmp << endl;
}
  


Measured memory_bytes: 900
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=II()
    st=[input().split() for _ in range(n)]
    x=input()
    total=0
    flag=False
    for s,t in st:
        if flag:total+=int(t)
        if s == x: flag = True
    print(total)
main()

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

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

	int N, R;
	cin >> N >> R;
	int ans;

	if (N >= 10)
	{
		ans = R;
	} else {
		ans = R+100*(10-N);
	}
	cout << ans << "\n";
}

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

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

    vector< pair<int64_t, int64_t> > same_dir;
    int64_t ans = 0;
    int64_t count = 0;
    int64_t id = 0;
    char pre, next;
    cin >> pre;
    for(int64_t i = 0; i < n - 1; i++) {
        cin >> next;
        if(pre == next) count++;
        else {
            same_dir.push_back({count, id});
            ans += count;
            count = 0;
            id++;
        }
        pre = next;
    }
    same_dir.push_back({count, id});
    ans += count;

    int64_t s = same_dir.size() - 2;
    bool even = true;
    if(s >= 0) {
        if(s % 2 == 0) s = s / 2;
        else {
            s = s / 2 + 1;
            even = false;
        }

        if(s >= k) {
            ans += 2 * k;
        } else {
            ans += 2 * s;
            if(even) ans += 1;
            // else     ans += 2;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2420
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

const int MXN = 2e5, IINF = 1e9 + 10, INF = 1e18 + IINF + 10, MOD = 1000000007;
const ld PI = 4.0 * atanl(1.0), PREC = .000001;
const char nl = '\n';

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.end(), x.begin()
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define ins insert

int n, m, t, a[MXN];

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }

int main() {
  fast();
  string s;
  cin >> s;
  if (s[0] != 'A') {
    cout << "WA";
    return 0;
  }
  if (s[0] == 'C' or s[s.length() - 1] == 'C') {
    cout << "WA";
    return 0;
  }
  int x = 0;
  for (int i = 2; i <= s.length() - 1; ++i) {
    if (s[i] == 'C') ++x;
  }
  if (x > 1 or x == 0) {
    cout << "WA";
    return 0;
  }
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] != 'A' and s[i] != 'C' and isupper(s[i])) {
      cout << "WA";
      return 0;
    }
  }
  cout << "AC";
  return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int N,A,B;cin>>N>>A>>B;
  int ans=0;
  for(int i=1;i<=N;i++){
    string st=to_string(i);
    int l=st.size();
    int su=0;
    for(int j=0;j<l;j++){
      su+=st[j]-48;
    }
    if(su>=A && su<=B)ans+=i;
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
s = input()
MOD = 10**9 + 7

dd = defaultdict(int)
for c in s:
    dd[c] += 1
ans = 0
for c in s:
    dd[c] -= 1
    tmp = 1
    for k, v in dd.items():
        if k == c:
            continue
        else:
            tmp *= v + 1
    ans = (ans + tmp) % MOD

print(ans)


Measured memory_bytes: 9548
def solve(X,Y):
    res=''
    n,m=len(X),len(Y)
    dp=[[0]*(m+1) for i in range(n+1)]
    for i in range(n):
        for j in range(m):
            if(X[i]==Y[j]):
                dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1)
            dp[i+1][j+1]=max([dp[i+1][j+1],dp[i][j+1],dp[i+1][j]])
    i,j=i+1,j+1
    while(i>0 and j>0):
        if(dp[i][j]==dp[i-1][j]):
            i-=1
        elif(dp[i][j]==dp[i][j-1]):
            j-=1
        else:
            i-=1;j-=1
            res+=X[i]
    return res[::-1]

def main():
    X=input()
    Y=input()
    print(solve(X,Y))

if __name__=='__main__':
    main()

Measured memory_bytes: 112604
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a>b){
    printf("a > b\n");
  }
  if(a<b){
    printf("a < b\n");
  }
  if(a==b){
    printf("a == b\n");
  }
  return 0;
}

Measured memory_bytes: 2584
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

		final Scanner stdin = new Scanner( System.in );

		while ( true ) {

			final int n = stdin.nextInt();
			if ( n == 0 ) break;
			final int[] array = new int[ n ];
			for ( int i = 0; i < n; i++ ) {
				array[ i ] = stdin.nextInt();
			}
			Arrays.sort( array );

			int sum = 0;
			for ( int i = 1; i < array.length - 1; i++ ) {
				sum += array[ i ];
			}
			sum /= ( n - 2 );
			System.out.println( sum );
		}	
    }    
}

Measured memory_bytes: 20984
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
	typedef long long int lli;
	const int MaxN=55;
	#define fst first
	#define snd second
	set <string> seti;
int main(){
	lli N,i;
	string aux;
	cin>>N;
	for(i=0;i<N;i++){
		cin>>aux;
		seti.insert(aux);
	}
	cout<<seti.size();
}

Measured memory_bytes: 15652
N = int(input())
a = []
b = []
for _ in range(N):
    s = input().split()
    a.append(s[0])
    b.append(int(s[1]))
ind = list(range(1, N+1))
so = list(zip(a, b, ind))
so.sort(key=lambda x: x[1], reverse=True)
so.sort(key=lambda x: x[0], )
for s in so:
    print(s[2])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
#define ll long long
#define X first
#define Y second
#define MP make_pair
 
using namespace std;

const int N = 1e5 + 123;
const ll mod = 1e9 + 7;             

int n, k;
ll dp[N];
ll t[2][N], f[N], a[N];

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

    cin >> n >> k;
    for(int i = 1;i <= n;i++)
    	cin >> a[i];
    for(int i = 0;i <= k;i++)
    	f[i] = 1;
    t[1][0] = 1, t[0][0] = 1;
    for(int i = 1;i <= n;i++){
    	for(int j = 0;j <= k;j++){
    		int l = max(0LL, j - a[i]), r = j;
    		t[1][j] = ((f[r] - f[l] + mod) % mod + t[0][l]) % mod;	
    	}
    	for(int j = 0;j <= k;j++){
    		if(j == 0){
    			f[j] = 1;
    		}
    		else{
    			f[j] = f[j - 1];
    			f[j] = (f[j] + t[1][j]) % mod;
    		}
    		t[0][j] = t[1][j];
    	}
    }
    cout << t[0][k]; 
}

Measured memory_bytes: 2560
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr ll INF = 1ll << 55;

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

// multi-dimensional vector (require c++14)
template <typename T, typename U>
static inline vector<U> make_nd_vector(T &&n, U &&val) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<U>(forward<T>(n), forward<U>(val));
}
template <typename T, typename... Args>
static inline decltype(auto) make_nd_vector(T &&n, Args &&... args) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<decltype(make_nd_vector(forward<Args>(args)...))>(
      forward<T>(n), make_nd_vector(forward<Args>(args)...));
}
//
// Print from Iterator
template <typename ite>
void print_ite(ite start, ite end, char sp = ' ', char en = '\n') {
  for (auto i = start; i != end; i++)
    cout << *i << sp;
  cout << en;
}
//
inline void Yes(bool condition) { cout << (condition ? "Yes\n" : "No\n"); }

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0; i < n; i++)
    cin >> p[i];
  sort(all(p));
  int ans = 0;
  for (int i = 0; i < k; i++) {
    ans += p[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3172
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	int a, b; cin >> a >> b;
	Cout((b + a - 1) / a);
}


Measured memory_bytes: 3084
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
long long ans=0,a[200100],n;
int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	if(a[1]!=0){
		printf("-1");
		return 0;
	}
	for(int i=1;i<=n;i++){
		if(a[i]>=i){
			printf("-1");
			return 0;
		}
		if(a[i]-a[i-1]>=2){
			printf("-1");
			return 0;
		}
		if(a[i]==a[i-1]+1)
			ans++;
		else
			ans+=a[i];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>
 
int i, t, y = 1, d[10000] = {1};
long long r;
char s[200002];
 
int main(n, p) {
  scanf("%d%d%s", &n, &p, s + 1);
  if (10 % p == 0) {
    while(i++<n) {
      if((s[i] - '0') % p == 0)
        r += i;
    }
  }
  else {
    for(; n; n--) {
      t = (t + (s[n] - '0') * y) % p;
      d[t]++;
      y = y * 10 % p;
    }
    for(i = 0; i < p; i++)
      r += (long long) d[i] * (d[i] - 1);
    r /= 2;
  }
  printf("%lld\n", r);
  return 0;
}


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

std::vector<long> solve(
    long n,
    long k,
    long q,
    const std::vector<long>& passers)
{
  std::vector<long> points(n, k - q);
  for (auto p : passers) {
    ++points[p];
  }
  return points;
}

std::string to_s(long point) {
  return point <= 0 ? "No" : "Yes";
}

int main()
{
  long n, k, q;
  std::cin >> n >> k >> q;

  std::vector<long> passers(q);
  for (auto& p : passers) {
    std::cin >> p;
    --p;
  }

  const auto result = solve(n, k, q, passers);

  for (auto p : result) {
    std::cout << to_s(p) << std::endl;
  }
}


Measured memory_bytes: 2176
#include<stdio.h>
int main(){
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if(r <= x && x <= W-r && r <= y && y <= H-r){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq  priority_queue<double, std::vector<double>, std::greater<double>>

    int lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

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

int main()
{
    int N;
    cin >> N;
    vector<double> V(N);
    for (int i = 0; i < N; i++)
    {
        cin >> V[i];
    }

    sort(V.begin(), V.end());
    double ans = V[0];
    for (int i = 1; i < N;i++)
    {
        ans = (V[i] + ans) / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		if(a < b) {
			System.out.println("a < b");
		} else if(a > b) {
			System.out.println("a > b");
		} else {
			System.out.println("a == b");
		}
	}
}


Measured memory_bytes: 26332
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] argst)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String str = br.readLine();
        double n = Double.parseDouble(str);

        double sq = n * n * Math.PI;
        String ans1 = String.format("%.5f",sq);

        double len = n * 2 * Math.PI;
        String ans2 = String.format("%.5f",len);

        System.out.println(ans1 + " " + ans2);


    }
}

Measured memory_bytes: 24612
//ITP1_7_B
#include<iostream>
using namespace std;

int main()
{
	int n,x,i,j,k,kumi;
	
	for(;;){
		kumi = 0;
		cin>>n>>x;
		if(n==0&&x==0)
			break;
		for(i=1;i<=n;i++){
			if(i>100)break;
			for(j=i+1;j<=n;j++){
				if(j>100)break;
				for(k=j+1;k<=n;k++){
					if(k>100)break;
					if(i+j+k==x){
						kumi++;
					}
				}
			}
		}
		cout<<kumi<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
   string S[2];
   cin >> S[0];
   cin >> S[1];if(S[0][0]==S[1][2]&&S[0][1]==S[1][1]&&S[0][2]==S[1][0])cout<<"YES"<<endl;else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          163577857
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -1e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

 typedef tree<pii, null_type, less<pii>, rb_tree_tag,  
            tree_order_statistics_node_update>  odst; 


void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
   
    #endif
}


vector<vii> gp;
vii par,dis;
void solve()
{
 
int n,m;
cin >> n >> m;


gp.assign(n+1,vii());
par.assign(n+1,-1);
dis.assign(n+1,big);

forf(j,0,m)
{
  int u,v;
  cin >> u >> v;
  gp[u].pb(v);
  gp[v].pb(u);
}

queue<int>nd;
nd.push(1);
dis[1]=0;
par[1]=1;

while(sz(nd))
{
 int u = nd.front();
 nd.pop();
 for(auto x:gp[u])
  if(dis[x] > dis[u]+1)
  {
    dis[x] = dis[u]+1;
    par[x] = u;
    nd.push(x);
  }
}
int is=1;
for(int i=2;i<=n;i++)
{
  if(par[i]==-1)is=0;
}
if(!is)
{
  cout<<"No\n";
  return ;
}
cout<<"Yes\n";
for(int i=2;i<=n;i++) cout<<par[i]<<endl;

 
}

int32_t main()
{
 pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    // cout << "Time taken by function: "
    //      << duration.count() << " microseconds" << endl; 

 }

Measured memory_bytes: 13692
function main(input) {
    const [n, m, k] = shaping(input[0]);
    const a = shaping(input[1]);
    const b = shaping(input[2]);
    if (a[0] > k && b[0] > k) { return console.log(0); }
    let timeA = [0];
    let timeB = [0];
    let ans = 0;
    let sumTime = 0;
    for (let i = 0; i < n; i++){
        sumTime += a[i];
        timeA.push(sumTime);
    }
    sumTime = 0;
    for (let i = 0; i < m; i++){
        sumTime += b[i];
        timeB.push(sumTime);
    }
    let i = 0;
    let j = timeB.length-1;
    while (i < timeA.length) {
        while (j > -1) {
            if (timeB[j] <= k - timeA[i]) {
                if(ans<i+j){ans = i + j};
                break;
            } else {
                j--;
            }
        }
        i++;
    }
    console.log(ans);
}    
function shaping(arr) { 
    return arr.split(' ').map(Number);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));


Measured memory_bytes: 67068
N = int(input())
A = list(map(int, input().split()))

cnt = 0
flag = True
while flag:
  flag = False
  for i in reversed(range(1, N)):
    if A[i] < A[i-1]:
      A[i], A[i-1] = A[i-1], A[i]
      flag = True
      cnt += 1

print(" ".join(map(str, A)))
print(cnt)


Measured memory_bytes: 5600
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

template<typename T>
T upmin(const T& l, const T& r) {//SegmentTreeのupdate関数
    T res;
    res = min(l,r);
    return res;
}
template<typename T>
T upmax(const T& l, const T& r) {//SegmentTreeのupdate関数
    T res;
    res = max(l,r);
    return res;
}

template<typename T>
class SegmentTree {
public:
	using F = function<T(T&, T&)>;
	vector<T> seg;
	int sz = 1;
	T unit;
	F up;
	//T (*up)(const T& l,const T& r);
	SegmentTree(int n, F up, T unit = 0):up(up),unit(unit) {
		//this->unit = unit;
		//int sz = 1;
		while (sz < n) sz <<= 1;
		seg.resize(sz * 2, unit);
		//this->up = up;
	}
	void set(const int& k, const T& x) {//左からk番目の葉にxを代入する
		seg[sz - 1 + k] = x;
	}
	T get(const int& k) {//左からk番目の葉を得る
		return seg[sz - 1 + k];
	}
	void update(int k, const T& v) {// k 番目の値をvに変更
		k += sz - 1;
		seg[k] = v;
		while (k > 0) {
			k = (k - 1) / 2;
			seg[k] = up(seg[2 * k + 1], seg[2 * k + 2]);
		}
	}
	T query(int a, int b) {//[a,b)のupの合成を求める
		int k = 0, l = 0, r = sz;
		if (r <= a || b <= l) {
			return unit;
		}
		if (a <= l && r <= b) {
			return seg[k];
		}
		else {
			T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
			T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
			return up(vl, vr);
		}
	}
	T query(int a, int b, int k, int l, int r) {//[a,b)のupの合成を求める(a,b,0,0,sz)のように使う
		if (r <= a || b <= l) {
			return unit;
		}
		if (a <= l && r <= b) {
			return seg[k];
		}
		else {
			T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
			T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
			return up(vl, vr);
		}
	}
};

int main(){
    int n;
    cin >> n;
    vector<P> p(n);
    REP(i,n){
        cin >> p[i].first;
        p[i].second = i;
    }
    sort(all(p));
    
    SegmentTree<int> sgmin(n,upmin<int>,n);
    SegmentTree<int> sgmax(n,upmax<int>,-1);
    ll res = 0;
    int sz = sgmin.sz;
    Rep(i,n){
        int t = p[i].second-sgmax.query(0,p[i].second);
        int t2 = sgmin.query(p[i].second+1,sz)-p[i].second;
        res+=(double)t*t2*(i+1);
        sgmax.update(p[i].second,p[i].second);
        sgmin.update(p[i].second,p[i].second);
    }
    put(res);
    return 0;
}


Measured memory_bytes: 5888
#include <iostream>
#include <vector>
#include <array>
#include <limits>

using namespace std;
typedef long long ll;

vector<array<array<bool, 2>, 5>> f;
vector<array<ll, 11>> p;
array<array<bool, 2>, 5> sch;

ll calc(){
    ll ret = 0;
    for(int i = 0; i < f.size(); ++i){
        ll count = 0;
        for(int j = 0; j < 5; ++j){
            count += f.at(i).at(j).at(0) && sch.at(j).at(0);
            count += f.at(i).at(j).at(1) && sch.at(j).at(1);
        }
        ret += p.at(i).at(count);
    }
    return ret;
}

ll search(ll i){
    if(i >= 5){
        ll flg = false;
        for(int i = 0; i < 5; ++i){
            flg = flg || sch.at(i).at(0) | sch.at(i).at(1);
        }
        if(!flg){
            return numeric_limits<ll>::min();
        }else{
            return calc();
        }
    }else{
        ll ret = 0;
        for(int j = 0; j < 4; ++j){
            sch.at(i).at(0) = j % 2;
            sch.at(i).at(1) = j / 2;
            ll tmp = search(i + 1);
            if(j == 0 || ret < tmp){
                ret = tmp;
            }
        }
        return ret;
    }
}

int main(){
    ll n;
    cin >> n;
    f.resize(n);
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < 5; ++j){
            for(int k = 0; k < 2; ++k){
                cin >> f.at(i).at(j).at(k);
            }
        }
    }
    p.resize(n);
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < 11; ++j){
            cin >> p.at(i).at(j);
        }
    }
    cout << search(0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	int N,A[200],kaisuu,i,ninoinsi[200];
	scanf("%d",&N);
	
	
	for(i=0;i<N;i++){
	scanf("%d",&A[i]);
	}
	for(i=0;i<N;i++){
		ninoinsi[i]=0;
	}
	

		for(i=0;i<N;i++){
		while(A[i]%2==0){
			A[i]=A[i]/2;
			ninoinsi[i]++;
		}
	}

	
	kaisuu=ninoinsi[0];
	for(i=1;i<N;i++){
		if(ninoinsi[i]<kaisuu){
		kaisuu=ninoinsi[i];
	}
	}
	
	printf("\n%d\n\n",kaisuu);

	
	return 0;
}

Measured memory_bytes: 128
import math
X=int(input())
Xjiku=float(1)
Yjiku=float(0)
ans=int(1)
thita=int(0)
for _ in range(1000000):
    thita += X
    Xjiku += math.cos(math.radians(thita))
    Yjiku += math.sin(math.radians(thita))
    ans += int(1)
    if abs(Xjiku) < float(10**-10) and abs(Yjiku) < float(10**-10):
        break
print(ans)


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 100000, mod = 998244353;
int n;
string s;
int cases;
int states[2][2][2];

int32_t main() {

    cin >> n >> s;

    cases = 1;
    states[0][0][0] = n;

    for(int i = 0; i < 3*n; ++i) {
        int mult;
        if(s[i] == 'R') {
            if(states[0][1][1]) {
                mult = states[0][1][1];
                states[0][1][1]--;
            } else if(states[0][0][1]) {
                mult = states[0][0][1];
                states[1][0][1]++;
                states[0][0][1]--;
            } else if(states[0][1][0]) {
                mult = states[0][1][0];
                states[1][1][0]++;
                states[0][1][0]--;
            } else {
                mult = states[0][0][0];
                states[0][0][0]--;
                states[1][0][0]++;
            }
        } else if(s[i] == 'G') {
            if(states[1][0][1]) {
                mult = states[1][0][1];
                states[1][0][1]--;
            } else if(states[0][0][1]) {
                mult = states[0][0][1];
                states[0][1][1]++;
                states[0][0][1]--;
            } else if(states[1][0][0]) {
                mult = states[1][0][0];
                states[1][1][0]++;
                states[1][0][0]--;
            } else {
                mult = states[0][0][0];
                states[0][0][0]--;
                states[0][1][0]++;
            }
        } else {
            if(states[1][1][0]) {
                mult = states[1][1][0];
                states[1][1][0]--;
            } else if(states[1][0][0]) {
                mult = states[1][0][0];
                states[1][0][1]++;
                states[1][0][0]--;
            } else if(states[0][1][0]) {
                mult = states[0][1][0];
                states[0][1][1]++;
                states[0][1][0]--;
            } else {
                mult = states[0][0][0];
                states[0][0][0]--;
                states[0][0][1]++;
            }
        }
        cases = (cases*mult)%mod;
    }

    cout << cases << endl;
    
    return 0;
}


Measured memory_bytes: 900
N = int(input())
V_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

val_list = [V_list[i] - C_list[i] for i in range(N)]
# val_list.sort()
# print(val_list)

ans = 0
for val in val_list:
    if val > 0:
        ans += val

print(ans)


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

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

    ll N; cin >>N;
    vector<ll> A(N); cin >>A;
    vector<ll> B(N); cin >>B;
    vector<ll> C(N); cin >>C;
    sort(ALL(A));
    sort(ALL(B));
    sort(ALL(C));

    ll ans = 0;
    for (int j = 0; j < N; j++) { //B
        auto a_end = upper_bound(ALL(A), B[j]-1);  //cout<<FMT(*a_end)<<endl;
        ll a = a_end - A.begin();
        auto c_begin = lower_bound(ALL(C), B[j]+1); //cout<<FMT(*c_begin)<<endl;
        ll c = C.end() - c_begin;
        ans += a*c;
        //cout<<FMT3(B[j],a,c)<<endl;
    }
    cout << ans << endl;
}


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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    V sum(n), a(n);
    rep(i, 0, n){
        cin>>a[i];
        sum[i] = a[i];
        if(i != 0) sum[i] += sum[i-1];
    }
    VV dp(n, V(n, 0));
    rep(k, 1, n){
//        cout<<"x"<<i;
        rep(i, 0, n-k){
//            cout<<"y"<<j;
            int j = i + k;
            dp[i][j] = sum[j];
            if(i != 0) dp[i][j] -= sum[i-1];
            ll tmp = dp[i][i] + dp[i+1][j];
            rep(p, i+1, j){
                tmp = min(tmp, dp[i][p]+dp[p+1][j]);
            }
            dp[i][j] += tmp;
        }
    }
/*    cout<<"b";
    rep(i, 0, n){
        rep(j, 0, n) cout<<dp[i][j]<<" ";
        cout<<endl;
    }*/
    cout<<dp[0][n-1];
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define rep(n,k) for(int i = (int)n;i<k;i++)
using Int =long long int;
using Graph =vector<vector<int>>;
int main(){
    int N,M;cin>>N>>M;
    vector<set<int>>friends(N);
    vector<bool>seen(N,false);
    queue<int>todo;
    set<int>count;
    int wolfcount=0;
    rep(0,M){
        int a,b;cin>>a>>b;

        friends[a-1].insert(b-1);
        friends[b-1].insert(a-1);
    }
    for(int i=0;i<N;i++){
        int sum=0;
        if(!seen[i]){
            sum++;
            seen[i]=true;
            for(auto a:friends[i])todo.push(a);
            while(!todo.empty()){
                int t = todo.front();
                todo.pop();
                if(!seen[t]){
                    seen[t]=true;
                    sum++;
                    for(auto a:friends[t])todo.push(a);
                }
            }
        }
        count.insert(sum);
    }
    cout<<*rbegin(count)<<endl;

    
}

Measured memory_bytes: 31584