akhauriyash/Code-Regression huggingface dataset:
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
using namespace std;
//
//int sumr[4001];
//int sumg[4001];
//int sumb[4001];
int iro[4001];
int main()
{
    
    int n;
    int sum = 0;


    string s;
    long long  sumr = 0;
        long long sumb = 0;
        long long sumg = 0;

    cin >> n;
    cin >> s;
   // sumr[0] = sumg[0] = sumb[0] = 0;
    for (int i = 0; i <= n-1; i++) {
        if (s[i] == 'R') {
            sumr++;
            iro[i] = 0;
        }
        else if (s[i] == 'G') {
            sumg++;
            iro[i] = 1;


        }
        else {
            sumb++;
            iro[i] = 2;
        }
    }
    long long cnt = 0;
    for (int k = 1; 2 * k + 1 <= n; k++) {
        for (int i = 0; 2 * k + i <= n-1; i++) {
            if (iro[i] != iro[i + k] && iro[i + k] != iro[i + 2 * k] && iro[i + 2 * k] != iro[i])cnt++;
        }
    }
    long long ans = sumb*sumg*sumr - cnt;

   // cout << sumb << endl;
   // cout << cnt << endl;
    cout << ans << endl;
    //for (int i = 0; i <= n-3; i++) {
    //    //for (int j = i + 1; j <= n - 2; j++) {
    //    //    for (int k = j + 1; k <= n - 1; k++) {
    //    //        if (j - i == k - j)continue;
    //    //        if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k])sum++;
    //    //    }
    //    //}
    //}

   // cout << sum << endl;

    return 0;
}



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

using namespace std;
#define mod 998244353
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<long long>a(n);
    long long ans=1;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[0]>0)ans=0;
    }
    sort(a.begin(),a.end());
    if(ans)
    {
        long long c1=0,c2=0;
        for(int i=1;i<n;i++)
        {
            if(a[i]==1)c1++;
            else if(a[i]!=a[i-1])
            {
                if(a[i]-a[i-1]!=1)
                {
                    ans=0;
                    break;
                }
                c2=c1;
                c1=1;
                ans=((ans%mod)*(c2%mod))%mod;
            }
            else
            {
                c1++;
                ans=((ans%mod)*(c2%mod))%mod;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define N (1<<17)
#define INF 0
using namespace std;
typedef long long ll;
 
class RMQ{
public:
  ll n,dat[2*N-1];
 
  //?????????
  RMQ(){
    n=N;
    for(int i=0;i<n;i++) dat[i]=INF;
  }
   
  //k???????????????a?????????´
  void update(int k,ll a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }
 
  //[a,b)????????°?????????±??????? query(a,b,0,0,n)
  ll query(int a,int b,int k=0,int l=0,int r=N){
    if(r<=a||b<=l)return INF;
    if(a<=l&&r<=b)return dat[k];
    ll vl=query(a,b,k*2+1,l,(l+r)/2);
    ll vr=query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }
};
 
 
int main(){  
  ll n,x[N];
  cin>>n;
  RMQ rmq;
  for(int i=0;i<n;i++) cin>>x[i];
 
  ll sum=n*(1+n)/2,ans=sum;
  for(int i=0;i<n;i++){
    ll mx=-rmq.query(1,x[i])+x[i];
    ans=min(ans,sum-mx);
    rmq.update(x[i],-mx);
  }
  cout <<ans<<endl;
  return 0;
}

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

inline int read(){
  int x = 0; char c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x;
}

const int maxn = 2e5;
const int mod = 1e9 + 7;
int num[maxn];
int a[maxn], pre[maxn], f[maxn] = {1};

int main(){
  srand(time(0));
  memset(num, -1, sizeof(num));
  int n = read();
  for(int i = 0; i < n; i++){
    a[i] = read() - 1;
    pre[i] = num[a[i]];
    num[a[i]] = i;
  }
  for(int i = 1; i < n; i++){
    f[i] = f[i - 1];
    if(pre[i] >= 0 && pre[i] != i - 1) f[i] = (f[i] + f[pre[i]]) % mod;
  }
  printf("%d", f[n - 1]);
  return 0;
}


Measured memory_bytes: 3456
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e3+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,m;
int a[MAXN];
int b[MAXN];

int dp[MAXN][MAXN];

map <int,int> mpa[100*MAXN];
map <int,int> mpb[100*MAXN];

ll rec(int x,int y)
{
	if(x == 0 and y == 0)
		return (a[0] == b[0] ? 1 : 0);
	else if(x == 0 or y == 0)
	{
		if(x==0)
			return mpb[y][a[0]]%MOD;
		return mpa[x][b[0]]%MOD;
	}
	if(dp[x][y] != -1) return dp[x][y];

	ll p1 = ((a[x] == b[y]) ? rec(x-1,y-1) + 1: 0);
	ll p2 = rec(x-1,y);
	ll p3 = rec(x,y-1);
	ll p4 = rec(x-1,y-1);


	return dp[x][y] = (((p1 + p2)%MOD + p3)%MOD - p4 + MOD) % MOD;
}


int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n >> m;


	
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			dp[i][j] = -1;

	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		if(i)	
		{
			mpa[i] = mpa[i-1];
			mpa[i][a[i]]++;
		}
		else
			mpa[i][a[i]]++;

	}
	for (int i = 0; i < m; ++i)
	{
		cin >> b[i];
		if(i)	
		{
			mpb[i] = mpb[i-1];
			mpb[i][b[i]]++;
		}
		else
			mpb[i][b[i]]++;
	}

	rec(n-1,m-1);

	cout << (dp[n-1][m-1] + 1) % MOD << endl;

}

Measured memory_bytes: 172928
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int C = scanner.nextInt();
    char[] S = scanner.next().toCharArray();

    List<Integer> workdays = new ArrayList<>();
    for (int i = 0; i < N; i++) if (S[i] == 'o') workdays.add(i);
    int W = workdays.size();
    int[] right = new int[W];
    for (int i = W - 1; i >= 0; i--) {
      int next = lowerBound(workdays, workdays.get(i) + C);
      if (next == W) right[i] = 1;
      else right[i] = right[next] + 1;
    }
    int[] left = new int[W];
    for (int i = 0; i < W; i++) {
      int prev = upperBound(workdays, workdays.get(i) - C);
      if (prev < 0) left[i] = 1;
      else left[i] = left[prev] + 1;
    }
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < W; i++) {
      int r = i < W - 1 ? right[i + 1] : 0;
      int l = i > 0 ? left[i - 1] : 0;
      if (r + l < K) sb.append(workdays.get(i) + 1).append('\n');
    }
    System.out.print(sb.toString());
  }

  public static int upperBound(List<Integer> a, int k) {
    int left = -1;
    int right = a.size();
    while (right - left > 1) {
      int mid = (left + right) / 2;
      if (a.get(mid) < k) {
        left = mid;
      } else {
        right = mid;
      }
    }
    return left;
  }

  public static int lowerBound(List<Integer> a, int k) {
    int left = -1;
    int right = a.size();
    while (right - left > 1) {
      int mid = (left + right) / 2;
      if (k < a.get(mid)) {
        right = mid;
      } else {
        left = mid;
      }
    }
    return right;
  }
}


Measured memory_bytes: 48500
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    int c[3][3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> c[i][j];
        }
    }
    if(c[1][1]==c[0][1]+c[1][0]-c[0][0] && c[1][2]==c[0][2]+c[1][0]-c[0][0] && c[2][1]==c[0][1]+c[2][0]-c[0][0] && c[2][2]==c[0][2]+c[2][0]-c[0][0]) cout << "Yes";
    else cout << "No";
    

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <stack>
#include <cstdio>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <iterator>
#include <sstream>
#define popcount(x) __builtin_popcount(x)
#define oddparity(x) __builtin_parity(x)
#define clz(x) __builtin_clz(x)
#define ctz(x) __builtin_ctz(x)
#define sf scanf
#define pf printf
#define ll long long int
using namespace std;

int i, ans, n;
string s;

int main()
{
    cin >> s;
    ans = s.size();
    for (i = 0; i < s.size(); i++) {
        if (s[i] == 'A') break;
    }
    ans -= i;
    for (i = s.size() - 1; i >= 0; i--) {
        if (s[i] == 'Z') break;
        ++n;
    }
    ans -= n;
    pf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;
using std::pow;

int cnt = 0;

int main()
{
  int n, k;
  long long ans;

  cin >> n >> k;
  ans = pow((k - 1), n - 1) * k;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int prime(int n) {
	int a;

	for (a = 2; a <= n / a; a++)
		if (n % a == 0)
			return 0;
	return 1;
}

int main() {
	static int aa[100000];
	int q, a;

	scanf("%d", &q);
	aa[1] = 0;
	for (a = 3; a < 100000; a += 2) {
		aa[a] = aa[a - 2];
		if (prime(a) && prime((a + 1) / 2))
			aa[a]++;
	}
	while (q--) {
		int l, r;

		scanf("%d%d", &l, &r);
		printf("%d\n", aa[r] - aa[l - 2]);
	}
	return 0;
}


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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

template<typename F> long long discrete_binary_search(long long ok, long long ng, F is_ok) {
    while (abs(ok - ng) > 1) {
        long long mid = (ok + ng) / 2;
        (is_ok(mid) ? ok : ng) = mid;
    }
    return ok;
}

int N, K;
int A[220000], F[220000];
signed main() {
    cin >> N >> K;
    rep(i, N) { cin >> A[i]; }
    sort(A, A + N);
    rep(i, N) { cin >> F[i]; }
    sort(F, F + N), reverse(F, F + N);
    cout << discrete_binary_search(1e13, -1, [&](int x) {
        int sum = 0;
        rep(i, N) {
            sum += max(0LL, A[i] - x / F[i]);
        }
        return sum <= K;
    }) << endl;
}


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

#define pb push_back

using ll=long long;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vpii=vector<pii>;
using vvpii=vector<vpii>;


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

    string s;
    cin >> s;
    int n = s.size();

    vi res(n, 0);
    pii state{0,0};
    for (int i=0; i<n; ++i) {
        swap(state.first, state.second);
        if (s[i] == 'R')
            ++state.first;
        else {
            assert(i > 0);
            assert(s[i] == 'L');
            res[i-1] += state.second;
            res[i] += state.first;
            state = {0,0};
        }
    }
    for (int i=n-1; i>=0; --i) {
        swap(state.first, state.second);
        if (s[i] == 'L')
            ++state.first;
        else {
            assert(i+1 < n);
            assert(s[i] == 'R');
            res[i+1] += state.second;
            res[i] += state.first;
            state = {0,0};
        }
    }
    for (int i=0; i<n-1; ++i)
        cout << res[i] << " ";
    cout << res.back() << "\n";
}


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

int main() {
  int a, b;
  cin >> a >> b;
  int c = a+b;
  if (a % 3 == 0 || b % 3 == 0 || c % 3 == 0) {
    cout << "Possible" << endl;
  }
  else {
    cout << "Impossible" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	double a, b;
	int i;
	
	while(scanf("%lf", &a) != EOF){
		for(b = a, i = 2; i <= 10; i++)
			if(i % 2)
				a += (b /= 3);
			else
				a += (b *= 2);
		
		printf("%lf\n", a);
	}
	
	return 0;
}

Measured memory_bytes: 648
class Node:
  key = None
  left = None
  right = None
  def __init__(self, k):
    self.key = k

class BST:
  root = None
  def insert(self, k):
    x = self.root
    y = None
    z = Node(k)
    while x is not None:
      y = x
      if z.key < y.key:
        x = x.left
      elif y.key < z.key:
        x = x.right
    
    if y is None:
      # 初回値
      self.root = z
    else:
      if z.key < y.key:
        y.left = z
      elif y.key < z.key:
        y.right = z

  def inorder(self, r, lis):
    # 中間巡回順で出力
    if r != None:
      self.inorder(r.left, lis)
      lis.append(r.key)
      self.inorder(r.right, lis)


  def preorder(self, r, lis):
    # 先行巡回順で出力
    if r != None:
      lis.append(r.key)
      self.preorder(r.left, lis)
      self.preorder(r.right, lis)

    
n = int(input())
bst = BST()
for _ in range(n):
  # query = [int(x) if re.match('[+|-]?\d', x) else x for x in input().split()]
  query = input().split()
  if query[0] == 'insert':
    bst.insert(int(query[1]))
  elif query[0] == 'print':
    root = bst.root
    in_lis = []
    pre_lis = []
    bst.preorder(root, pre_lis)
    bst.inorder(root, in_lis)
    print(" " + " ".join(list(map(str, in_lis))))
    print(" " + " ".join(list(map(str, pre_lis))))


Measured memory_bytes: 211292
#include<bits/stdc++.h>
using namespace std;
 
 
int main(){
  string a,b;
  cin>>a;
  cin>>b;
  
  int c = 0;
  for(int i=0;i<3;i++){
   	if(a[i]==b[i]){
     	c = c+1;
    }
  }
  cout<<c<<"\n";
  
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{


	static char[][] map;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int[] p = new int[n];
		for(int i = 0;i < n;i++){
			p[i] = sc.nextInt();
		}
		
		int ans = 0;
		for(int i = 0;i < n-2;i++){
			if((p[i] < p[i+1] && p[i+1] < p[i+2] )||( p[i] > p[i+1] && p[i+1] > p[i+2])){
				ans++;
			}
		}

		System.out.println(ans);


	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}



class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   end- otherpair.end;
	}







	static int find(int index,int current,int[] students,int ans,int[][] memo){
		if(current == index){
			return 1;
		}

		if(memo[current][index] != 0){
			return memo[current][index];
		}

		memo[current][index] = find(index, students[current]-1, students, ans+1, memo)+1;

		return memo[current][index];
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}






Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin>>s;
	int ans=0,cnt=0;
	for(int i=0; i<s.size(); i++) {
		if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T') {
			cnt++;
		} else {
			cnt=0;
		}
		if(ans<cnt)ans=cnt;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <list>
//#include <bits/stdc++.h>


using namespace std;

#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
typedef long long ll;

int main(){
    int n,d;
    cin >> n >> d;
    int sho = n/(d*2+1);
    int amari = n%(2*d+1);
    if(n<=d){cout << 1 << endl;}
    else if(amari>=1){cout << sho+1 << endl;}
    else{cout << sho << endl;}
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
        int a,b,c;
        char d;
        while(1){
         scanf("%d %c %d",&a,&d,&b);
         if(d=='?'){
          break;
         }
         else if(d=='+'){
          c=a+b;
         }
         else if(d=='-'){
          c=a-b;
         }
         else if(d=='*'){
          c=a*b;
         }
         else if(d=='/'){
          c=a/b;
         }
         printf("%d\n",c);
        }
    return 0;
}

Measured memory_bytes: 1808
#include <stdio.h>
int main(void){
    //    
    char s[19];
    //
    for(int i=0;i<=18;i++){
        scanf("%c",&s[i]);
        
        if(s[i] == ','){
            s[i] = ' ';
        }
    
    printf("%c",s[i]);
    }

    return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python
# coding: utf-8

# In[8]:


N = int(input())
mylist = []
for _ in range(N):
    x,l = map(int, input().split())
    a = x-l
    b = x+l
    mylist.append([a,b])


# In[12]:


mylist = sorted(mylist,key=lambda x:x[1])
cnt = 1
p = mylist[0][1]
for i in range(1,N):
    if mylist[i][0] < p:
        continue
    else:
        cnt += 1
        p = mylist[i][1]
print(cnt)


# In[ ]:






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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define FORR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 );
#define ALL( a )        (a).begin(), (a).end()             
#define MP( a, b )		make_pair( (a), (b) )
#define fi				first
#define se				second

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; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main() {
	int r, D, x; cin >> r >> D >> x;

	REP( i, 10) {
		x = r * x - D;
		cout << x << endl;
	}
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int a;
    cin >> a;
    int b;
    cin >> b;
    int res = (x - a) % b;
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int a[200010],n;
int bs(int k){
	if(a[0]>k)return 0;
	int l=0,r=n;
	while(r-l>1){
		int m=(l+r)/2;
		if(a[m]<=k)l=m;
		else r=m;
	}
	return a[l]==k;
}

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	int q;
	scanf("%d",&q);
	int flag=1;
	while(q--){
		int k;
		scanf("%d",&k);
		flag&=bs(k);
	}
	printf("%d\n",flag);
}



Measured memory_bytes: 2564
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define pi acos(-1)
#define int long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<int> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const int ths = 1LL << 40;
const int NN = 5e3 + 6;

const int maxN = 1000007;

///abc 160_e
///easy probably

void solve()
{

    int x, y, a, b, c;
    cin>>x>>y>>a>>b>>c;
    int p[a], q[b], r[c];
    for(int i = 0; i < a; i ++) {
        cin>>p[i];
    }
    for(int i = 0; i < b; i ++) {
        cin>>q[i];
    }
    for(int i = 0; i < c; i ++) {
        cin>>r[i];
    }
    sort(p, p + a);
    reverse(p, p + a);
    sort(q, q + b);
    reverse(q, q + b);
    sort(r, r + c);
    reverse(r, r + c);
    vector<int> XX;

    int ans = 0;
    for(int i = 0; i < x; i ++) {
        XX.push_back(p[i]);
        ans += p[i];
    }

    for(int i = 0; i < y; i ++) {
        XX.push_back(q[i]);
        ans += q[i];
    }

    sort(XX.begin(), XX.end());
    for(int i = 0; i < min(c, (int)XX.size()); i ++) {
        if(r[i] > XX[i] ) {
            ans += r[i] - XX[i];
        }
    }

    cout<<ans;

    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 4852
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

struct Stuple {
    int s; int t; int c;
    using type = tuple<int, int, int>;
    Stuple(int s, int t, int c): s(s), t(t), c(c){ }
    operator tuple<int, int, int> () const { return make_tuple(s, t, c); }
    // bool operator < (const Stuple& e) const { return tie(s, t, c) < tie(e.s, e.t, e.c); }
    bool operator < (const Stuple& e) const { return s != e.s ? s < e.s : t != e.t ? t < e.t : c < e.c; }
    ostream& operator >> (ostream& out) const { prints(tie(s, t, c)); return out; }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, c;
    cin >> n >> c;
    // set<tuple<int, int, int>> stcs;
    set<Stuple> stcs;
    for(int i = 0; i < n; i++){
        int s, t, c;
        cin >> s >> t >> c;
        stcs.emplace(s, t, c);
    }
    int ans = 0;
    prints(stcs);
    while(stcs.size()){
        ans++;
        auto next = stcs;
        int time = -1, channel = -1;
        for(auto& stc : stcs){
            // if(time + (channel != get<2>(stc)) <= get<0>(stc)){
            //     time = get<1>(stc);
            //     channel = get<2>(stc);
            //     next.erase(stc);
            // }
            // get<0>(stc.data) = 1;
            // decltype(auto) a = get<0>(stc.data);
            // a = 1;
            // stc.t = 1;
            if(time + (channel != stc.c) <= stc.s){
                time = stc.t;
                channel = stc.c;
                next.erase(stc);
            }
        }
        next.swap(stcs);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 12800
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int main(void)
{
	int n,t,e,i,j,flg,suu,x[100],xx;
	scanf("%d %d %d",&n,&t,&e);

	for(i=0;i<n;i++)	{
		scanf("%d",&x[i]);
	}
	suu=-1;
	for(i=0;i<n;i++)	{
		flg=0;
		xx=x[i];
		while(xx<=t+e)	{
			if(xx>=t-e && xx<=t+e)	{
				suu=i+1;
				flg=1;
				break;
			}
			xx+=x[i];
		}
		if(flg==1)	break;
	}
	printf("%d\n",suu);
	return 0;
}


Measured memory_bytes: 1024
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner sc = null;
		try {
			sc = new Scanner(System.in);
			Map<Character, Integer> map = new HashMap<Character, Integer>();
			map.put('I', 1);
			map.put('V', 5);
			map.put('X', 10);
			map.put('L', 50);
			map.put('C', 100);
			map.put('D', 500);
			map.put('M', 1000);

			while (sc.hasNextLine()) {
				char[] roman = sc.nextLine().toCharArray();
				int[] arabia = new int[roman.length];
				for (int i = 0; i < roman.length; i++) {
					arabia[i] = map.get(roman[i]);
				}

				int sum = 0;
				for (int i = 1; i < arabia.length; i++) {
					if (arabia[i] > arabia[i - 1]) {
						sum -= arabia[i-1];
					} else {
						sum += arabia[i-1];
					}
				}
				sum += arabia[arabia.length-1];
				System.out.println(sum);
			}

		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 17196
def submit():
    n = int(input())
    alist = [-1] + list(map(int, input().split()))

    i = n // 2
    while i > 0:
        j = i + i
        while j <= n:
            alist[i] += alist[j]
            j += i

        alist[i] %= 2
        i -= 1

    ans = alist[1:]

    print(sum(ans))
    for i, a in enumerate(ans):
        if a == 1:
            print(i + 1)

    return


if __name__ == '__main__':
    submit()


Measured memory_bytes: 63580
#include <string>
#include <algorithm>
#include <stdio.h>
using namespace std;

int main(void) {
	int ans;
	int n, a, b;//n人　電車1人　a円　たくしNでB
	scanf("%d%d%d", &n, &a, &b);
	a *= n;
	if (a < b) {
		ans = a;
	}
	else {
		ans = b;
	}

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

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

double ans = 0;
int n, m;

void func(int s[], double d[20][20], int beforenum, int cnt)
{
	if(cnt == m){
		double sum = 0;
		for(int i = 0; i < cnt - 1; i++){
			for(int j = i + 1; j < cnt; j++){
				sum += d[s[i]][s[j]];
			}
		}
		ans = max(ans, sum);
		return;
	} else {
		for(int i = beforenum + 1; i < n; i++){
			s[cnt] = i;
			func(s, d, i, cnt + 1);
		}
	}
}

int main()
{
	double l[20], a[20], b[20];
	double distance[20][20];
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> l[i] >> a[i] >> b[i];
	}
	for(int i = 0; i < n - 1; i++){
		for(int j = i + 1; j < n; j++){
			distance[i][j] =  pow((l[i] - l[j]), 2) + pow((a[i] - a[j]), 2) + pow((b[i] - b[j]), 2);
			distance[j][i] = distance[i][j];
		}
	}
	int select[20];
	func(select, distance, -1, 0);
	cout.setf(std::ios_base::fixed,std::ios_base::floatfield);
	cout << setprecision( 6 ) <<  ans << endl;
	return 0;
}

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

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

  double m = 0;
  for (int i = 0; i < (int)N; ++i) m += a[i];
  m /= N;

  auto cost = [&](int k) {
    ll res = 0;
    for (int i = 0; i < (int)N; ++i) res += (k - a[i]) * (k - a[i]);
    return res;
  };

  int f = floor(m), c = ceil(m);
  cout << min(cost(f), cost(c)) << endl;

  return 0;
}


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

int main(){
  int a,b,k;
  cin >> a >> b >> k;
  for(int i = 1;i <= k;i++){
    if(i % 2 != 0){
      if(a % 2 != 0){
        a--;
      }
      b += a/2;
      a /= 2;
    }else{
      if(b % 2 != 0){
        b--;
      }
      a +=  b/2;
      b /= 2;
    }
  }
  cout << a << ' ' <<  b << endl;
}

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

typedef long long ll;
 
int main(){
  int a[] = {1, 3, 5, 7, 8, 10, 12};
  int b[] = {4, 6, 9, 11};
  int c[] = {2};
  int x, y;
  cin >> x >> y;
  char xg, yg;
  for(int i=0; i<7; i++){
    if(x==a[i]) xg='a';
    if(y==a[i]) yg='a';
  }
  for(int i=0; i<4; i++){
    if(x==b[i]) xg='b';
    if(y==b[i]) yg='b';
  }
  for(int i=0; i<1; i++){
    if(x==c[i]) xg='c';
    if(y==c[i]) yg='c';
  }
  if(xg==yg) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n,k;
    cin >>n>>k;
    vector<ll> h(n);
    
    for(ll i = 0; i<n;i++){
        cin>>h[i];
    }
    
    ll ans = 0;
    
    for (ll i = 0; i < n; i++){
        if (h[i] >= k)ans++;
    }
    cout << ans << endl;
    return 0;
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n); i >= 0; i--)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define RREP(i, a, n) for(int i = (int)(n); i >= a; i--)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

ll gcd(ll x, ll y)
{
	return y==0 ? x:gcd(y,x % y);
}


int main()
{
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];
    sort(all(a));

    ll key = a[0];
    REP(i, 1, N)
    {
        key = gcd(key, a[i]);
    }
    cout << key << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <map>

using namespace std;

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

	map<string, int> ret;
	string s;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		ret[s]++;
	}


	vector<string> v = {
		"AC", "WA", "TLE", "RE"
	};

	for (int i = 0; i < v.size(); ++i) {
		cout << v[i] << " x " << ret[v[i]] << endl;
	}
	return 0;
}


Measured memory_bytes: 3236
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    
    int ans = 8910016;
    for(int i = 0; i < n; i++) {
        int c, t;
        cin >> c >> t;
        if(m >= t) {
            ans = min(ans, c);
        }
    }

    cout << (ans <= 1000 ? to_string(ans) : "TLE") << endl;
    return 0;
}


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

using namespace std;

int main() {
  vector<int> vs;
  vs.push_back( 6 );
  for ( int i = 1; i <= 300000 / 7; i++ ) {
	vs.push_back( 7 * i + 1 );
	vs.push_back( 7 * i + 6 );
  }
  
  array<bool, 300001> isPrime;
  fill( isPrime.begin(), isPrime.end(), false );
  for ( int val : vs ) {
	isPrime[ val ] = true;
  }
  
  const int limit = sqrt( 300000 );
  for ( int i = 6; i <= limit; i++ ) {
	if ( isPrime[ i ] ) {
	  for ( int j = i * i; j <= 300000; j += i ) {
		isPrime[ j ] = false;
	  }
	}
  }
  vector<int> prime;
  for ( int i = 0; i <= 300000; i++ ) {
	if ( isPrime[ i ] ) {
	  prime.push_back( i );
	}
  }
  
  while( true ) {
	int n;
	cin >> n;
	if ( n == 1 ) break;

	cout << n << ":";
	for ( int i = 0; i < prime.size() and prime[ i ] <= n; i++ ) {
	  if ( n % prime[ i ] == 0 ) {
		cout << " " << prime[ i ];
	  }
	}
	cout << endl;
  }
}

Measured memory_bytes: 1988
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int A;
  int B;
  int C[100000];
  int i;
  int tmp;

  
  cin >> A;
  cin >> B;
  for(i=0;i<B;i++){
    cin >> C[i];
    tmp += C[i];
  }
  if(tmp<A){
    cout << "No";
  }else{
    cout << "Yes";
  }
}



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

using namespace std;

int main(){

	while(true){
		string str,box;
		cin >> str;
		if(str == "-")
			break;

		int len ,count;
		box = str;
		len = box.length();
		cin >> count;

		for(int t=0;t<count;t++){

			int i;
			cin >> i;
			str = "";
			for(int k = i;k <len+i;k++){
				str += box[k%len];
				//cout << str << endl;
			}
			box = str;
		}
		cout << box << endl;
	}

	return 0;
}



Measured memory_bytes: 3172
#include <stdio.h>

int table[100000];

int main(void)
{
	int n;
	int i, j;
	int cnt;
	int stone;
	int sum;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		cnt = 0;
		table[0] = 0;	// 偶数が黒、奇数が白
		
		for (i = 1; i <= n; i++){
			scanf("%d", &stone);
			if (i % 2 == 1){	//テーブルに置いてあった碁石は置き換えず,新しい碁石を左 から i 番目に置く
				if (cnt % 2 == 0){	//右端が黒
					if (stone == 0){	//石は白
						table[++cnt] = 1;
					}
					else {				//石は黒
						table[cnt]++;
					}
				}
				else {				//右端が白
					if (stone == 0){	//石は白
						table[cnt]++;
					}
					else {				//石は黒
						table[++cnt] = 1;
					}
				}
			}					//新しく左から i 番目に置く碁石の色とテーブル上の右端の碁 石の色が同じ場合は・・・
			else {
				if (cnt % 2 == 0){	//右端が黒
					if (stone == 0){	//石は白
						if (cnt == 0){
							cnt = 1;
							table[1] = table[0] + 1;
							table[0] = 0;
						}
						else {
							cnt--;
							table[cnt] += (table[cnt + 1] + 1);
						}
					}
					else {				//石は黒
						table[cnt]++;
					}
				}
				else {				//右端が白
					if (stone == 0){	//石は白
						table[cnt]++;
					}
					else {				//石は黒
						cnt--;
						table[cnt] += (table[cnt + 1] + 1);
					}
				}
			}
#if 0
printf("<%d>", cnt);
for (j = 0; j <= cnt; j++){
	printf("%d ", table[j]);
}
printf("\n");
#endif			
		}
		sum = 0;
		for (i = 1; i <= cnt; i += 2){
			sum += table[i];
		}
		
		printf("%d\n", sum);
	}
	
	return (0);
}

Measured memory_bytes: 600
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args)  {

		Scanner scanner = new Scanner( System.in );

		ArrayList<Integer> nums1 = new ArrayList<Integer>();
		ArrayList<Integer> nums2 = new ArrayList<Integer>();

		while ( true ) {
			String inputText1 = scanner.next();
			String inputText2 = scanner.next();

			int x1 = Integer.parseInt(inputText1);
			int x2 = Integer.parseInt(inputText2);

			if ( x1 == 0 && x2 == 0 ) {
				break;
			}

			if ( x1 <= x2 ) {
				nums1.add(x1);
				nums2.add(x2);
			}
			else {
				nums1.add(x2);
				nums2.add(x1);
			}
		}

		for ( int i = 0; i < nums1.size(); i++ ) {
			System.out.println(nums1.get(i) + " " + nums2.get(i));
		}

		scanner.close();
	}
}

Measured memory_bytes: 38768
#include<bits/stdc++.h>
#define mo 998244353
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,i,j,k,x[205],y[205],sum,ans;
long long ksm(long long u,long long v){
	long long o=1;
	while(v){
		if(v&1)
			o=o*u%mo;
		u=u*u%mo;
		v>>=1;
	}
	return o;
}
int main(){
    //freopen("teleports.in","r",stdin);
    //freopen("teleports.out","w",stdout);
    n=read();
    for(i=1;i<=n;i++){
    	x[i]=read();
    	y[i]=read();
    }
    for(i=1;i<=n;i++)
    	for(j=i+1;j<=n;j++){
    		sum=0;
    		for(k=1;k<=n;k++)
				if(x[i]==x[j]&&x[i]==x[k]||x[i]==x[k]&&y[i]==y[k]||x[j]==x[k]&&y[j]==y[k]){
					sum++;
				}
				else if(x[i]!=x[j]&&x[i]!=x[k]&&x[j]!=x[k]){
					if((y[j]-y[i])*(x[k]-x[i])==(y[k]-y[i])*(x[j]-x[i]))
						sum++;
				}
			ans=(ans+(ksm(2,sum)-sum-1+mo)%mo*ksm(sum*(sum-1)/2,mo-2))%mo;
		}
	ans=((ksm(2,n)-ans-n-1)%mo+mo)%mo;
	pus(ans,2);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main()
{
  long a, result = 1, sum = 0, l = 1, b[100002];
  cin >> a;
  
  if (a == 0)
  {
    cin >> a;
    cout << (a == 1 ? 1 : -1);
    return 0;
  }
  else
  {
    for (long i=0; i<=a; i++)
    {
      cin >> b[i];
      sum += b[i];
    }
    
    if (b[0] != 0)
    {
      cout << -1;
      return 0;
    }
    
    for (int i=1; i<=a; i++)
    {
      if (l*2 < b[i])
      {
        cout << -1;
        return 0;
      }
      
      if (l*2 < sum)
        l *= 2;
      else
        l = sum;
      
      result += l;
      sum -= b[i];
      l -= b[i];
    }
 
    cout << result;
    return 0;
  }
}

Measured memory_bytes: 3936
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int total = 0;
    ArrayList<Integer> list1 = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list1.add(sc.nextInt());
    }
    for (int i = 0; i < N; i++) {
      int A = sc.nextInt();
      if (list1.get(i) > A) {
        total += list1.get(i) - A;
      }
    }
    System.out.println(total);

  }
}


Measured memory_bytes: 21844
/*
	0184:Turuga Castle
*/
#include	<iostream>

using namespace std;

int main(void) {
	const int cls_step[7] = {10, 20, 30, 40, 50, 60, -1};
	
	while(1) {
		int cls[7] = { 0 }, d;
		
		cin >> d;
		if(d == 0) { break; }
		for(int i = 0; i < d; i++) {
			int inp ;
			
			cin >> inp;
			for(int i = 0; i < 7; i++) {
				if(i == 6) { cls[i]++; }
				else {
					if(inp < cls_step[i]) {
						cls[i]++;
						break;
					}
				}
			}
		}
		for(int i = 0; i < 7; i++) {
			cout << cls[i] << endl;
		}
	}
}

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

int main(){
	int x;
	cin >> x;
	if(x==1000) {
		cout << 1000;
		return 0;
	}
	
	for (double i = x; i > 0; i--)
	{
		for (double j = 2; j <= 12; ++j)
		{
			if(pow(i, 1/j)==floor(pow(i, 1/j))){
				cout << i;
				return 0;
			}
		}
	}

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const ll INF=1e9;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}
vector<ll> divisor(ll n) {
    vector<ll> ret;
    for(ll i=1; i*i<=n; i++) {
        if(n%i==0) {
            ret.pb(i);
            if(i*i!=n) {
                ret.pb(n/i);
            }
        }
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> div = divisor(n);
    sort(ALL(div));
    ll a,b;
    Each(kv,div){
        if(kv<sqrt(n)){
            a = kv;
        }else{
            if(kv==sqrt(n)){
                a = kv;
                b = kv;
                break;
            }
            b = kv;
            break;
        }
    }
//    dbg(a);
//    dbg(b);
    ll ans= a+b-2;
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define N 500005
using namespace std;

string t, p;
int memo[N],memo2[N];
vector<int> v[300];


int main(){

  
  cin>>t>>p;

  int cnt=0;
  
  for(int i=0;i<t.size();i++){

    if(p[cnt]==t[i]){

      memo[cnt]=v[t[i]].size();

      memo2[cnt]=i;
      
      cnt++;
      
    }
    
    v[t[i]].push_back(i);
    
  }
  
  if(cnt!=p.size()){
    cout<<"no"<<endl;
    return 0;
  }

  memo2[cnt]=N;
  
  bool ans=true;
  
  for(int i=0;i<p.size();i++){
    
    if(memo[i]+1==v[p[i]].size()) continue;
    
    if(memo2[i+1]>v[p[i]][memo[i]+1]) ans=false;
    
  }

  if(ans) cout<<"yes"<<endl;
  else cout<<"no"<<endl;
  
  return 0;
}

Measured memory_bytes: 11076
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

bool check(string S) {
    FOR(i, 0, S.size()) {
        if (i % 2 == 0) {
            if (S[i] == 'L') return false;
        } else {
            if (S[i] == 'R') return false;
        }
    }
    return true;
}

signed main() {
    string S;
    cin >> S;
    Yes(check(S));
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int q;
    cin >> q;
    int c,a,n,ans;
    REP(i,q){
        cin >> c >> a >> n;
        ans=0;
        if(c>0&&a>0&&n>0){
            int mi=min(c,min(a,n));
            ans+=mi;
            a-=mi;
            c-=mi;
        }
        if(a>0&&c>1){
            if(c/2>=a){
                ans+=a;
                c-=a*2;
            }else{
                ans+=c/2;
                c%=2;
            }
        }
        if(c>0)ans+=c/3;
        cout << ans << endl;
    }
}



Measured memory_bytes: 3108
#include <stdio.h>
main()
{int hh=0,mm=0,ss=0;
 scanf("%d",&ss);
 while(ss > 3599 )
 {
	  ss = ss - 3600;
	  hh++;
 }
 while(ss > 59 )
 {
	 ss = ss - 60;
	 mm++;
 }
printf("%d:%d:%d\n",hh,mm,ss);
return 0;
}

Measured memory_bytes: 2716