akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n;
llong a[100005];
pair<llong, llong> p[100005];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p[i] = make_pair(a[i], i + 1);
    }

    sort(p, p + n);
    for (int i = 0; i < n; i++) {
        cout << p[i].second << ' ';
    }
    cout << endl;

    return 0;
}


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

int main(){
  //宣言と入力
  int H,W,N,SX,SY;
  string S,T;
  cin>>H>>W>>N;
  cin>>SX>>SY;
  cin>>S>>T;
  
  int OX=SX;
  int OY=SY;
  
  //U
  for(int i=0;i<N;i++){
    if(S.at(i)=='U'){
      SX--;
    }
    if(SX<1){
      cout<<"NO"<<endl;
      return 0;
    }
    if(T.at(i)=='D' && SX<H){
      SX++;
    } 
  }
  
  SX=OX;
  
  //D
  for(int i=0;i<N;i++){
    if(S.at(i)=='D'){
      SX++;
    }
    if(SX>H){
      cout<<"NO"<<endl;
      return 0;
    }
    if(T.at(i)=='U' && SX>1){
      SX--;
    } 
  }  
  
  //L
  for(int i=0;i<N;i++){
    if(S.at(i)=='L'){
      SY--;
    }
    if(SY<1){
      cout<<"NO"<<endl;
      return 0;
    }
    if(T.at(i)=='R' && SY<H){
      SY++;
    } 
  }  
  
  SY=OY;

  //R
  for(int i=0;i<N;i++){
    if(S.at(i)=='R'){
      SY++;
    }
    if(SY>W){
      cout<<"NO"<<endl;
      return 0;
    }
    if(T.at(i)=='L' && SY>1){
      SY--;
    } 
  } 
  
  cout<<"YES"<<endl;
  return 0;
}



Measured memory_bytes: 3908
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long sum = 0;
        for(int i = 0; i < Math.pow(2, s.length()-1); i++) {
            StringBuilder sb = new StringBuilder();
            for(int j = 0; j < s.length(); j++) {
                sb.append(s.charAt(j));
                if((1 & i >> j) == 1) {
                    sb.append("+");
                }
            }
            String[] nums = sb.toString().split("\\+");
            for(int l = 0; l < nums.length; l++) {
                sum += Long.parseLong(nums[l]);
            }
        }
        System.out.println(sum);
    }
}


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

string st;
vector<string> ans2;
set<string> ans;
int k;

int main() {
  int i, j, now = 0;
  cin >> st >> k;
  while(ans.size() < k) {
    for(i = 0; i < st.size(); ++i) {
      if(st[i] == now + 'a') {
        string x;
        for(j = 0; j < k; ++j) {
          x += st[i + j];
          ans.insert(x);
          if(i + j == st.size() - 1) break;
        }
      }
    }
    ++now;
  }
  now = 1;
  set<string>::iterator it = ans.begin();
  for(i = 1; i < k; ++i) it++;
  cout << *it << endl;
  return 0;
}

Measured memory_bytes: 256
/*
 * Since g++10 is released, some characters is not valid inside #if 0 :(
 * So, why not using clang++? :D

 * Date:
  echo -n '  ' && date +%Y.%m.%d # Just Run this (Type !!sh in Vim).

 * Solution:
  To be updated after "Accept".

 * Digression:

 * CopyRight:
          ▁▃▄▄▄▃▃▃▃▄▶
        ▗▇▀▔    ▔▔▔▔
       ▄▛   ▃▅━━■▄▂
      ▟▊   ▐▘     ▀▙
     ▟▜▌   ▐▖   ▋  ▐▍
    ▟▘ ▜   ▝▀▇▆●▘  ▐▌
  ▗▟▘   ▜▃       ▁▅▛
  ▔▀▼▅▄▃▃██▅▄▄▄▅■▀▔
        ▔▔▔▔▔▔
 */

#include <cstdio>
#include <vector>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	/* inline operator ll () { ll x; return scanf("%lld", &x), x; } */
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator () (a...); }
} read;

const int maxn = 270000, maxw = 100005;
int val[maxn], wei[maxn], dep[maxn];
ll f[515][maxw];
int tv[20], tw[20];

int main () {
	int n = read;
	for (int i = 1; i <= n; i ++)
		read(val[i], wei[i]);

	for (int i = 1; i <= n; i ++)
		dep[i] = dep[i >> 1] + 1;

	int K = dep[n] >> 1, Lim = 100000;
	for (int i = 1; i <= n and dep[i] <= K; i ++) {
		std::copy(f[i >> 1], f[i >> 1] + wei[i], f[i]);
		for (int w = wei[i]; w <= Lim; w ++)
			f[i][w] = std::max(f[i >> 1][w], f[i >> 1][w - wei[i]] + val[i]);
	}

	int q = read;
	while (q --) {
		int u = read, lim = read;
		if (dep[u] <= K) {
			printf("%lld\n", f[u][lim]);
			continue;
		}
		int p = dep[u] - K, x = u >> p;
		for (int i = 0; i < p; i ++)
			tv[i] = val[u >> i], tw[i] = wei[u >> i];
		ll ans = 0;
		for (int S = 0; S < (1 << p); S ++) {
			ll v = 0, w = 0;
			for (int i = 0; i < p; i ++)
				if (S >> i & 1)
					v += tv[i], w += tw[i];
			if (w <= lim)
				ans = std::max(ans, f[x][lim - w] + v);
		}
		printf("%lld\n", ans);
	}
}


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

#define MAX 100000

struct node{
  int p, r, l;
};

node d[MAX+1];
int depth[MAX+1];
int height[MAX+1];

void dep(int key, int num){
  depth[key] = num;
  if(d[key].l != -1) dep(d[key].l, num+1);
  if(d[key].r != -1) dep(d[key].r, num+1);
}

int hei(int key){
  int h1 = 0, h2 = 0;
  if(d[key].l != -1) h1 = hei(d[key].l)+1;
  if(d[key].r != -1) h2 = hei(d[key].r)+1;
  return height[key] = max(h1,h2);
}


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

  for(int i = 0; i < n; i++){
    d[i].l = -1;
    d[i].r = -1;
    d[i].p = -1;
  }

  for(int i = 0; i < n; i++){
    int id, c1, c2;
    cin >> id >> c1 >> c2;
    d[id].l = c1;
    d[id].r = c2;
    if(c1 != -1) d[c1].p = id;
    if(c2 != -1) d[c2].p = id;
  }

  int x;

  for(int i = 0; i < n; i++){
    if(d[i].p == -1) x = i;
  }

    hei(x);

  dep(x,0);
  for(int i = 0; i < n; i++){
    printf("node %d: parent = %d, sibling = ",i, d[i].p);
    if(d[i].p == -1) cout << -1;
    else if(d[d[i].p].l != i && d[d[i].p].l != -1){
      cout << d[d[i].p].l;
    }else if(d[d[i].p].r != i && d[d[i].p].r != -1){
      cout << d[d[i].p].r;
    }
    else cout << -1;
    cout << "," << " degree = ";
    if(d[i].l != -1 && d[i].r != -1) cout << 2 << ", ";
    else if(d[i].r == -1 && d[i].l != -1) cout << 1 << ", ";
    else if(d[i].l == -1 && d[i].r != -1) cout << 1 << ", ";
    else cout << 0 << ", ";

    printf("depth = %d, height = %d, ",depth[i], height[i]);
    if(d[i].p == -1) cout << "root";
    else if(d[i].l != -1 || d[i].r != -1) cout << "internal node";
    else if(d[i].l == -1) cout << "leaf";
    cout << endl;

  }

}

Measured memory_bytes: 1200
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif

int dp[N], vis[N];
vector<int> adj[N]; 

int dfs(int u){
	if(vis[u]) return dp[u];
	vis[u] = 1; 
	for(auto it : adj[u])
		dp[u] = max(1 + dfs(it), dp[u]) ;
	return dp[u];
}

void solve()
{
	int n,m ;
	cin >> n >> m ;
	rep(i,m){
		int x,y;
		cin >> x >> y ;
		adj[x].pb(y);
	}
	int ans = 0 ;
	repA(i,1,n) if(!vis[i]) ans = max(ans, dfs(i)); 
	cout << ans ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 14976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
/* ちゃんと考えてわかって実装 */

const int MAX_V = 50;
const int MAX_S = 50 * MAX_V + 5;
const ll INF = 1e18;

struct Edge{
    int to, a, b;
    // これを書いたらerrorが取れた。どうして必要なのｫぉ
    Edge(int to, int a, int b):to(to),a(a),b(b) {}
};

struct State{
    int v, s; // state = (頂点, 所持金)
    ll x; // その状態までの経過時間

    // これを書いたらerrorが取れた。どうして必要なのｫぉ
    State(int v, int s, ll x):v(v),s(s),x(x) {}

    bool operator<(const State other) const {
        return other.x < x; // (x < other.x とか other.x > x (意味は一緒)だとちゃんと動かねぇ)
    }
};

vector<Edge> g[MAX_V]; // 各頂点から伸びている辺の集合として保持。
ll min_time[MAX_V][MAX_S+5]; // 状態(v, s)までの最小の時間を記録。


int main(void){
    int n, m, s;
    cin >> n >> m >> s;

    for(int i=0; i<m; i++){
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        g[u].emplace_back(v, a, b);
        g[v].emplace_back(u, a, b);
    }

    for(int i=0; i<n; i++){
        for(int j=0; j<MAX_S+5; j++){
            min_time[i][j] = INF;
            // たどり着けない状態はINFのまま。
            // 以下では、たどり着ける状態についてその時間の最小値を探索する。
        }
    }

    vector<int> c(n), d(n);
    for(int i=0; i<n; i++){
        cin >> c[i] >> d[i];
    }

    s = min(s, MAX_S); // 十分な値で切り捨てる。
    priority_queue<State> pq;

    // pqに状態(v, s, x)を emplace するときに、
    // min_time[v][s]の値を x に更新する。(xが最小じゃないなら更新しない。)
    auto push = [&](int v, int s, ll x){
        if(s < 0) return;
        if(min_time[v][s] <= x) return;
        min_time[v][s] = x;
        pq.emplace(v, s, x);
    };

    // 初期状態は(0, s, 0)
    push(0, s, 0);
    while(!pq.empty()){
        State now = pq.top(); pq.pop();
        int v = now.v, s = now.s;
        ll x = now.x;

        // if(min_time[v][s] != x) continue; // なぜ?????(消しても通る)
        
        // 遷移その1 : 換金
        int next_s = min(s+c[v], MAX_S);
        push(v, next_s, x+d[v]);
        

        // 遷移その2 : 電車に乗る
        // そこから伸びている辺を全てみる
        for(Edge e : g[v]){
            push(e.to, s-e.a, x+e.b);
        }
    }

    // 答えの出力(min_timeのなかにある)
    for(int i=1; i<n; i++){
        ll ans = INF;
        for(int j=0; j<MAX_S+5; j++){
            ans = min(ans, min_time[i][j]);
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main() {
    int H, W;
    cin >> H >> W;
    char field[H+2][W+2]; //1-indexed
    for (int i = 0; i < H + 2; ++i) for(int j = 0; j < W + 2; ++j) field[i][j] = '#';

    for (int i = 1; i <= H; ++i) for(int j = 1; j <= W; ++j) cin >> field[i][j];

    

    bool R_void[H+2][W+2];
    bool L_void[H+2][W+2];
    bool U_void[H+2][W+2];
    bool D_void[H+2][W+2];

    //initialize
    for (int i = 0; i < H + 2; ++i) {
        for(int j = 0; j < W + 2; ++j) {
            R_void[i][j] = false;
            L_void[i][j] = false;
            U_void[i][j] = false;
            D_void[i][j] = false;
        }
    }

    for (int i = 1; i <=H; ++i) {
        for(int j = 1; j <= W; ++j) {
            if (field[i][j-1] == '.') R_void[i][j] = true;
            if (field[i][j+1] == '.') L_void[i][j] = true;
            if (field[i-1][j] == '.') U_void[i][j] = true;
            if (field[i+1][j] == '.') D_void[i][j] = true;
        }
    }
    
    int R_num[H+2][W+2];
    int L_num[H+2][W+2];
    int U_num[H+2][W+2];
    int D_num[H+2][W+2];

    //initialize
    for (int i = 0; i < H + 2; ++i) {
        for(int j = 0; j < W + 2; ++j) {
            R_num[i][j] = 0;
            L_num[i][j] = 0;
            U_num[i][j] = 0;
            D_num[i][j] = 0;
        }
    }

    for (int i = 1; i <=H; ++i) {
        for(int j = 1; j <= W; ++j) {
            if (field[i][W-j] == '.') {
                if (field[i][W-(j-1)] == '.') R_num[i][W-j] = R_num[i][W-(j-1)] + 1;
            }
            if (field[i][j] == '.') {
                if (field[i][j-1] == '.') L_num[i][j] = L_num[i][j-1] + 1;
                if (field[i-1][j] == '.') D_num[i][j] = D_num[i-1][j] + 1;
            }
            if (field[H-i][j] == '.'){
                if (field[H-(i-1)][j] == '.') U_num[H-i][j] = U_num[H-(i-1)][j] + 1;
            }

        }
    }

    int ans = 0;
    for (int i = 1; i <= H; ++i){
        for (int j = 1; j<= W; ++j){
            ans = max(ans, R_num[i][j] + L_num[i][j] + U_num[i][j] + D_num[i][j] + 1);
        }
    }

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

Measured memory_bytes: 82432
import numpy as np
pi=np.pi
A, B, H, M=map(int, input().split())
H%=12
M%=60

x=(H+M/60)*pi/6
y=M*pi/30

if x==y:
    print(abs(A-B))
    exit()
    
C2=A**2+B**2-2*A*B*np.cos(abs(x-y))
print(pow(C2, 1/2))

Measured memory_bytes: 27200
import sys
input = sys.stdin.readline

n = int(input())
w = list(map(int, input().split()))
ruiseki = [0]
for i in range(len(w)):
    ruiseki.append(ruiseki[i] + w[i])
result = []
for i in range(1, len(w)):
    result.append(abs(ruiseki[i]-(ruiseki[-1]-ruiseki[i])))
# print(ruiseki)
print(min(result))

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


int main(){
    ll n, l;
    cin >> n >> l;
    ll a[n];
    rep(i, n) cin >> a[i];
    ll key = 0;
    bool flag = false;
    rep(i, n - 1){
        if (a[i] + a[i + 1] >= l){
            key = i;
            flag = true;
            break;
        }
    }
    if (flag){
        cout << "Possible" << endl;
        rep(i, key){
            cout << i + 1 << endl;
        }
        for(int j = n - 2; j >= key; j--){
            cout << j + 1 << endl;
        }
    }
    else cout << "Impossible" << endl;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin>>n;
   int num[n+10];
   for(int i=0;i<n;i++)
        cin>>num[i];

    int cnt=0;

    for(int i=1;i<n-1;i++){
        if(num[i]>num[i-1]&&num[i]<num[i+1])
            cnt++;
        else if(num[i]<num[i-1]&&num[i]>num[i+1])
            cnt++;
    }
    return cout<<cnt<<endl,0;


}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
char get(char t){
	string a = "iw(){}[]-";
	string b = "iw)(}{][-";
	return b[a.find(t)];
}

int check(string s){
	if(!~s.find("iwi")) return false;
	s.replace(s.find("iwi"),3,"---");

	if(~s.find("i")) return false;
	if(~s.find("w")) return false;
	
	for(int i = 0 ; i <= (int)(s.size()-1)/2 ; i++){
		if(s[s.size()-i-1] != get(s[i])){
			return false;
		}
	}
	return true;
}

int main(){
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 1 ; i < (1<<s.size()) ; i++){
		string t;
		for(int j = 0 ; j < s.size() ; j++){
			if(i >> j & 1) t += s[j];
		}
		if(check(t)){
			ans = max<int>(ans,t.size());
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <cstdlib>
#include <iomanip>

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

const long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100100];

int main() {
    int N; cin >> N;
    cout << fixed;
    if (N % 2 == 1) {
        cout << setprecision(10) <<(double)(N / 2 + 1) / N << endl;
        exit(0);
    }
    if (N % 2 == 0) {
        cout << "0.5000000000" << endl;
        exit(0);
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll pow(ll x, ll y)
{
	ll res = 1;
	while(y)
	{
		if(y&1)	
			res = res*x%mod;
		x = x*x%mod;
		y=y>>1;
	}
	return res;
}
int main()
{
	ll n;
	cin>>n;
	pow(10ll,n)-2*pow(9ll,n)+pow(8ll,n);
	cout<<((pow(10ll,n)-2*pow(9ll,n)+pow(8ll,n))%mod+mod)%mod<<endl;
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrepa(i,a,n) for(int i=(n)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b);
#define mins(a,b) a=min(a,b);
#define max3(a,b,c) max(a,max(b,c)) 
#define mix3(a,b,c) mix(a,mix(b,c))

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

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

    repa(i,1,10){
        if(n%i==0 && n/i<=9){
            cout<<"Yes"<<endl;
            return 0;
        }
    }


    cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;
PII H[300000],W[300000];
map<PII,int> mp;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int h,w,m;
  cin>>h>>w>>m;
  
  rep(i,h){
    H[i]=make_pair(0,i);
  }
  rep(i,w){
    W[i]=make_pair(0,i);
  }
  int ans=0;
  
  rep(i,m){
    int a,b;
    cin>>a>>b;
    H[a-1].F++;
    W[b-1].F++;
    mp[make_pair(a-1,b-1)]++;
  }
  sort(H,H+h);
  sort(W,W+w);
  //rep(i,h) cout<<H[i].F<<endl;
  int hmx=H[h-1].F,wmx=W[w-1].F;
  int nowh=h-1,noww=w-1;
  while(H[nowh].F==hmx){
    noww=w-1;
    while(W[noww].F==wmx){
      if(mp.find(make_pair(H[nowh].S,W[noww].S))==mp.end() ){
	cout<<hmx+wmx<<endl;
	return 0;
      }
      noww--;
    }
    nowh--;
  }
  cout<<max(hmx+wmx-1,(int)0)<<endl;
    


  return 0;
}


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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define OUT(a) cout << (a) << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

template <class T, class S>
using umap = std::unordered_map<T, S>;
using ll = long long;
using namespace std;

int main() {
    string s;

    ll ct = 0;
    ll ct_max = 0;
  
  	cin >> s;
  
    REP(i, s.length()){
        if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C'){
            ct++;
        } else {
            ct_max = max(ct_max, ct);
            ct = 0;
        }
    }

    ct_max = max(ct_max, ct);
  
  	OUT(ct_max)

    return 0;
}

Measured memory_bytes: 256
import math
a,b,h,m = map(int,input().split())
x1 = a*math.cos(math.pi/2 - (h+m/60)*math.pi/6)
y1 = a*math.sin(math.pi/2 - (h+m/60)*math.pi/6)
x2 = b*math.cos(math.pi/2 - m*math.pi/30)
y2 = b*math.sin(math.pi/2 - m*math.pi/30)
d = math.sqrt((x1-x2)**2+(y1-y2)**2)
print(d)

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

int main(void) {
	int n;
	long long c, k;
	cin >> n >> c >> k;
	vector<long long> t(n);
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	sort(t.begin(), t.end());
	long long ans = 0, cnt = 0, limit = 0;
	for (int i = 0; i < n;) {
		cnt = 0;
		limit = t[i] + k;
		while (cnt < c && t[i] <= limit && i < n) {
			cnt++;
			i++;
		}
		ans++;

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


Measured memory_bytes: 1024
'use strict';
(function(stdin) {
  //declare function

  //declare variable
  var inputs = stdin.toString().trim().split('\n');
  var EOF = '0';
  //main
  (function(array) {
    for (var i = 0, len = array.length; i < len; i++) {
      console.log('Case', (i + 1) + ':', array[i]);
    }
  })(inputs.slice(0, inputs.indexOf(EOF)));

  //display
  //console.log(inputs);
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 20576
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

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

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N, K := getInt(), getInt()
	s := getString()
	ll, rr, lr, rl := 0, 0, 0, 0
	for i := 1; i < N; i++ {
		if s[i] == 'L' && s[i-1] == 'R' {
			rl++
		}
		if s[i] == 'R' && s[i-1] == 'L' {
			lr++
		}
		if s[i] == 'R' && s[i-1] == 'R' {
			rr++
		}
		if s[i] == 'L' && s[i-1] == 'L' {
			ll++
		}
	}
	ans := ll + rr
	ans += min(K*2, lr+rl)
	// ans = min(ans, N-1)
	out(ans)
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
int main()
{
    int x;
    cin >> x;

    const int MAX = 100005;
    bool P[MAX];
    rep(i,MAX) P[i] = true;
    P[0] = false;
    P[1] = false;
    int ans = MAX;
    for (int i=2; i<MAX;i++) {
        if(!P[i]) continue;

        if (i >= x) {
            ans = i;
            break;
        }

        int g = 2 * i;
        while (g < MAX) {
            P[g] = false;
            g += i;
        }
    }

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

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n, x;
  cin >> n >> x;
  vector<int> l(n);
  for(int i = 1; i <= n; i++){
    cin >> l[i];
  }

  l[0] = 0;
  auto ans = 0;
  auto count = 0;
  for(int i = 0; i <= n; i++ ){
    //cout << l[i] << endl;                                                                                                                                                                   
    ans = ans + l[i];
    if(ans <= x){
      count = count + 1;
    }
  }

  cout << count << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> arr(n);
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		if (i > 0) {
			arr[i] += arr[i - 1];
		}
	}
	int min_diff = INT32_MAX;
	for (int i = 0; i < n - 1; i++) {
		int diff = abs(arr[n - 1] - 2 * arr[i]);
		min_diff = min(diff, min_diff);
	}

	cout << min_diff << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    rep(i,30){
        if(i*7>n)
        continue;
        if((n-i*7)%4==0){
            cout << "Yes" <<endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp,-1,sizeof(dp))
const ll mod = 1e9+7;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
#define PI 3.14159265359
int xs,ys;
ll a[2003];
ll b[2003];
bool vis[1009][1009];
int ans[1000004];
// 10 min for problem A : 50
// 15 min for problem B : 55
// 30 min for problem C : 60
int main()
{
   // freopen ("jumping.in","r",stdin);
   _IOS();
    string s[]={"AC","WA","TLE","RE"};
    map<string,int>mp;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string d;
        cin>>d;
        mp[d]++;
    }
    for(auto x:s)
    {
        cout<<x <<" x "<<mp[x]<<endl;
    }
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N , K , L;
  cin >> N >> K;
  L = 0;
  
  for(int i = 0; i < N; i++){
  	int x , b;
    cin >> x;
  	if(K < x){
    	b = x - K;
    }else{
    	b = K - x;
    }
      
    if(b < x){
    	L += 2 * b;
    }else{
    	L += 2 * x;
    }
    
  }
  cout << L << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int X;
  cin >> X;
  bool can;
  if(X == 3 || X == 5 || X ==7) can = true;
  else can = false;
  if(can){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int, int>
#define fir first
#define sec second
using namespace std;
const int MAXN = 3007;
int dp[MAXN << 1];
pii a[MAXN];
int main()
{
    int n, T; scanf("%d%d", &n, &T);
    for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].fir, &a[i].sec);
    int ans = 0;
    sort(a + 1, a + 1 + n);
    for (int i = 1; i <= n; i++)
    {
        for (int j = T + 3000; j >= a[i].fir; --j) if (j - a[i].fir < T)
            ans = max(ans, dp[j] = max(dp[j], dp[j - a[i].fir] + a[i].sec));
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
def main():
    W, H, x, y = map(int, input().split())
    S = W*H/2
    if W%2==0 and H%2==0 and W//2==x and H//2==y:
        P = 1
    else:
        P = 0
    print(S, P)

if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
    
using namespace std;
typedef long long ll;
    
int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }

    sort(a.begin(), a.end(), greater<int>());

    int alice = 0;
    int bob = 0;

    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            alice += a[i];
        } else {
            bob += a[i];
        }
    }

    int result = alice - bob;
    cout << result;

    return 0;
}


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

using namespace std;
#define ll long long int
int const mod=1000000007;

int main()
{
    string s;
    cin>>s;
    ll sum=0;
    for(int i=0;i<s.size();i++)
        sum+=(s[i]-'0');
    if(sum%9==0)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 3720
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod=1e9+7;
ll inf=1e18;

struct Factorial{
	long long N,mod;
	vector<long long> fact,inv;
	long long mod_pow(long long x,long long n){
		long long res=1;
		while(n){
			if(n&1) (res*=x)%=mod;
			(x*=x)%=mod;
			n>>=1;
		}
		return res;
	}
	long long Inverse(long long n){
		return mod_pow(n,mod-2);
	}
	Factorial(){}
	Factorial(long long sn,long long smod){
		N=sn; mod=smod;
		fact.reserve(sn+1); inv.reserve(sn+1);
		//初期化
		fact[0]=1;
		for(int i=1;i<=sn;i++){
			fact[i]=(fact[i-1]*i) % mod;
		}
		inv[sn]=Inverse(fact[sn]);
		for(int i=sn;i>0;i--){
			inv[i-1]=(inv[i]*i) % mod;
		}
	}
	long long Fact(long long n){
		if(n<0)return 0;
		return fact[n];
	}
	long long Inv(long long n){
		if(n<0)return 0;
		return inv[n];
	}
	long long Combination(long long n,long long r){
		if(n<r)return 0;
		if(r<0)return 0;
		if(r==0)return 1;
		long long ans=1;
		ans = (ans*Fact(n)) % mod;
		ans = (ans*Inv(r)) % mod;
		ans = (ans*Inv(n-r)) % mod;
		return ans;
	}
	long long Plus(long long a,long long b){
		a%=mod;
		b%=mod;
		return (a+b)%mod;
	}
	long long Minus(long long a,long long b){
		a%=mod;
		b%=mod;
		return (a+mod-b)%mod;
	}
	long long Multiply(long long a,long long b){
		a%=mod;
		b%=mod;
		return (a*b)%mod;
	}
	long long divide(long long a,long long b){
		a%=mod;
		b%=mod;
		return (a*Inverse(b))%mod;
	}
};

int main(void){
	ll n,m,p[100010]={},ans=1;
    vector<ll> prime;
    Factorial fact(200010,mod);
    reg(i,2,100000){
        if(p[i]==0){
            prime.push_back(i);
            reg(j,2,100000){
                if(i*j>100000)break;
                p[i*j]=i;
            }
        }
    }
    cin>>n>>m;
    rep(i,prime.size()){
        ll f=0;
        if(m==1)break;
        while(m%prime[i]==0){
            m/=prime[i];
            f++;
        }
        ans=(ans*fact.Combination(n-1+f,f))%mod;
    }
    if(m!=1)ans=(ans*n)%mod;
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ff first 
#define ss second
#define mod 1000000007
#define lim 100005
#define nfs_mw ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main()
{
	nfs_mw;
	int i,j,n;
	string s,t,out;
	cin>>n>>s>>t;
	out.resize(2*n);
	for(i=0; i<n; i++){
		out[2*i] = s[i];
		out[2*i+1] = t[i];
	}
	cout<<out;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

struct edge {
	int to;
	ll cost;
};

int N, M, t[1000], d[1000][11][2], r[1000];
bool b[2000], vis[1000];
ll X, s, res[2];
pair<int, pair<int, int>>p[2000];
vector<edge>v[1000];


int par(int x) {
	if (t[x] < 0)return x;
	return t[x] = par(t[x]);
}

bool uni(int x, int y) {
	x = par(x);
	y = par(y);
	if (x == y) {
		return false;
	}
	if (t[x] < t[y]) {
		t[x] += t[y];
		t[y] = x;
	}
	else {
		t[y] += t[x];
		t[x] = y;
	}
	return true;
}

void dfs(int x, int from, int cost) {
	d[x][0][0] = from;
	d[x][0][1] = cost;
	for (edge e : v[x]) {
		if (e.to != from) {
			r[e.to] = r[x] + 1;
			dfs(e.to, x, e.cost);
		}
	}
}

int f(int x, int y) {
	int a = 0;
	if (r[x] > r[y])swap(x, y);
	for (int i = 10; i >= 0; i--) {
		if (r[x] + (1 << i) <= r[y]) {
			a = max(a, d[y][i][1]);
			y = d[y][i][0];
		}
	}
	if (x == y)return a;
	for (int i = 10; i >= 0; i--) {
		if (d[x][i][0] != d[y][i][0]) {
			a = max({ a,d[x][i][1],d[y][i][1] });
			x = d[x][i][0];
			y = d[y][i][0];
		}
	}
	a = max({ a,d[x][0][1],d[y][0][1] });
	return a;
}

int main() {
	cin >> N >> M >> X;
	for (int i = 0; i < M; i++) {
		cin >> p[i].second.first >> p[i].second.second >> p[i].first;
		p[i].second.first--;
		p[i].second.second--;
	}
	sort(p, p + M);
	for (int i = 0; i < N; i++) {
		t[i] = -1;
	}
	for (int i = 0; i < M; i++) {
		if (uni(p[i].second.first, p[i].second.second)) {
			b[i] = true;
			v[p[i].second.first].push_back({ p[i].second.second,p[i].first });
			v[p[i].second.second].push_back({ p[i].second.first,p[i].first });
			s += p[i].first;
		}
	}
	res[0] = 2;
	if (s == X) {
		res[1] = 1;
		for (int i = 0; i < N - 1; i++) {
			res[1] *= 2;
			res[1] %= mod;
		}
		res[1] += mod - 2;
		res[1] %= mod;
	}
	dfs(0, 0, 0);
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < N; j++) {
			d[j][i + 1][0] = d[d[j][i][0]][i][0];
			d[j][i + 1][1] = max(d[j][i][1], d[d[j][i][0]][i][1]);
		}
	}
	for (int i = 0; i < M; i++) {
		if (!b[i]) {
			int x = f(p[i].second.first, p[i].second.second);
			if (X == s + p[i].first - x) {
				res[1] *= 2;
				res[1] += res[0];
				res[1] %= mod;
			}
			if (X < s + p[i].first - x) {
				res[1] *= 2;
				res[0] *= 2;
				res[1] %= mod;
				res[0] %= mod;
			}
		}
	}
	cout << res[1] << endl;
}

Measured memory_bytes: 512
using System;

namespace ConsoleApplication1
{
    class Program
    {
        const long M =10^9 + 7;
        static void Main(string[] args)
        {
            string[] inputNum = Console.ReadLine().Split(' ');
            int X = int.Parse(inputNum[0]);
            int A = int.Parse(inputNum[1]);

            if(X < A) { 
                Console.WriteLine("0");

            }else
            {
                Console.WriteLine("10");
            }
        }
    }
}


Measured memory_bytes: 13140
import java.lang.*;
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s1 = scan.nextLine();
    String s2 = scan.nextLine();
    
   	int count = 0;
    
    if(!s1.equals(s2)){
      for(int i = 0; i < s1.length(); i++){
        if(s1.charAt(i) != s2.charAt(i)) count++;
      }
    }
    
    System.out.println(count);
  }
}


Measured memory_bytes: 42436
#include <stdio.h>
int main(void)
{
    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: 2104
import bisect
S = input()
T = input()
D = dict()
for i in range(len(T)):
    if T[i] in D:
        continue
    else:
        D[T[i]] = []
for i in range(len(S)):
    if S[i] in D:
        D[S[i]].append(i)

if len(set(T)-set(S))>0:
    print(-1)
else:
    r = -1
    cnt = 0
    for i in range(len(T)):
        m = bisect.bisect_right(D[T[i]], r)
        if m < len(D[T[i]]):
            r = D[T[i]][m]
        else:
            r = D[T[i]][0]
            cnt += 1
    print(len(S)*cnt+r+1)

Measured memory_bytes: 13272
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int N,M,L,K,A,H;
int dist[110][110] = {};
struct edge{
    int to,dist;
};

struct state{
    int node,ti,frozen;
    bool operator<(const state& right)const{
        return ti>right.ti;
    }
};

int dp[110][110] = {};
int inf = 1e9;

int main(){
    while(cin >> N >> M >> L >> K >> A >> H && N>0){
        vector<int> a;
        vector<vector<edge>> v(N);
        int l;
        a.push_back(A); a.push_back(H);
        for(int i=0;i<L;i++){
            cin >> l; a.push_back(l);
        }
        int x,y,d;
        for(int i=0;i<N;i++) for(int j=0;j<N;j++) dist[i][j] = inf;
        for(int i=0;i<K;i++){
            cin >> x >> y >> d;
            dist[x][y] = d; dist[y][x] = d;
        }
        for(int k=0;k<N;k++){
            for(int i=0;i<N;i++){
                for(int j=0;j<N;j++){
                    dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
                }
            }
        }
        for(int i=0;i<L+1;i++){
            for(int j=i+1;j<L+2;j++){
                v[a[i]].push_back({a[j],dist[a[i]][a[j]]});
                v[a[j]].push_back({a[i],dist[a[i]][a[j]]});
            }
        }
        for(int i=0;i<N;i++) for(int j=0;j<=M;j++) dp[i][j] = inf;
        dist[A][M] = 0;
        priority_queue<state> Q;
        Q.push({A,0,M});
        while(!Q.empty()){
            state now = Q.top(); Q.pop();
            if(dp[now.node][now.frozen]<now.ti) continue;
            for(auto x:v[now.node]){
                state ne = now;
                ne.node = x.to;
                if(ne.frozen>=x.dist){
                    ne.ti = now.ti+x.dist;
                    ne.frozen -= x.dist;
                }else if(M>=x.dist){
                    ne.ti = now.ti+x.dist+(x.dist-ne.frozen);
                    ne.frozen = 0;
                }else continue;
                if(dp[ne.node][ne.frozen]>ne.ti){
                    dp[ne.node][ne.frozen] = ne.ti;
                    Q.push(ne);
                }
            }
        }
        int ans = inf;
        for(int i=0;i<=M;i++) ans = min(ans,dp[H][i]);
        if(ans==inf) cout << "Help!" << endl;
        else cout << ans << endl;
    }
}




Measured memory_bytes: 3364
'use strict';
(function(stdin) {
  var inputs = stdin.toString().trim().split('\n');
  var params = inputs[0].split(' ').map(Number);

  (function(a, b) {
    // ????????????????????????
    console.log(a*b,(a+b)*2);
  })(params[0], params[1]);

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15356
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            string s = Console.ReadLine();
            string result = "";

            string a = s.Substring(s.Length - 1, 1);
            if (a == "2"
                || a == "4"
                || a == "5"
                || a == "7"
                || a == "9")
            {
                result = "hon";
            }
            else if (a == "0"
                     || a == "1"
                     || a == "6"
                     || a == "8")
            {
                result = "pon";
            }
            else
            {
                result = "bon";
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 25876
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    vi a(N + 1, 0);
    FOR(i, 1, N + 1) cin >> a[i];

    vi b(N+1, 0);
    REVFOR(i, N / 2 + 1, N + 1) {
        b[i] = a[i];
    }

    REVFOR(i, 1, N / 2 + 1) {
        int cnt = 0;
        for(int j = i; j <= N; j += i) {
            cnt += b[j];
        }

        if ((cnt & 1) != a[i]) b[i] = 1;
    }

    int m = accumulate(ALL(b), 0);
    print(m);
    if (m == 0) return 0;

    FOR(i, 1, N+1) if(b[i]) cout << i << " ";
    cout << endl;
    
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int ret = 0;
  char c_last = 'A';
  for (int i = 0; i < N; i++) {
    if (S.at(i) != c_last) {
      ret++;
      c_last = S.at(i);
    }
  }
  cout << ret << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main(){
    ll N;
    cin >> N;
    ll x=1, y;
    for(ll i=1; i*i<=N; i++) {
        if (N % i == 0) {
            x = i;
            y = N / i;
        }
    }
    cout << (x-1) + (y-1) << endl;
}

Measured memory_bytes: 3644
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

v = []
for i in range(6):
    v.append(I())
k = v.pop()

if v[-1] - v[0] <= k:
    print('Yay!')
else:
    print(':(')




Measured memory_bytes: 7748
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	set<string> st;
	for (int i=0; i<n; i++) {	
		string s; cin>>s;
		st.insert(s);
	}
	cout<<st.size()<<endl;
	return 0;
}


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

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>   
#include <stdio.h>    
 
using namespace std;
     
#define F first
#define S second
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)2e5 + 123;
const ll inf = (ll)3e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int x, a;

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> x >> a;
   if (x < a) cout << 0;
   else cout << 10;

}                                     

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
// cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}


Measured memory_bytes: 256
import java.util.*;

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

        int num1 = sc.nextInt();
        int num2 = sc.nextInt();

        int ans;

        if(num1 == num2){
            ans = num1 * 2;
        }else if(num1 > num2){
            ans = num1 + (num1 - 1);
        }else{
            ans = num2 + (num2 - 1);
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.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 (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;

int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	cin >> n;
	vi s(n), t(n);
	REP(i, n) cin >> s[i];
	ll ans = s[0] - 1;
	int ma = 1;
	REPS(i, n-1){
		if(ma + 1 < s[i]){
			ans += (s[i] - 1) / (ma + 1);
		}else if(ma+1 == s[i]){
			ma ++;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  string b;
  cin >> b;
  
  if(b=="A")
    cout << "T" << endl;
  else if(b=="C")
    cout << "G" << endl;
  else if(b=="T")
    cout << "A" << endl;
  else if(b=="G")
    cout << "C" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
	ll n,i,s=0,t;
	cin>>n;
	ll a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	t=a[0];
	for(i=1;i<n;i++)
	{
		if(a[i]<t)
		{
			s+=t-a[i];
		}
		else
		{
			t=a[i];
		}
	}
	cout<<s<<endl;
	return;



}





int main()
{
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif

	int t=1;
	//cin >> t;

	while (t--)
	{	
		solve();
	}


	return 0;
}


Measured memory_bytes: 5136
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int n,k,s;
  cin >> n >> k >> s;
  if(s == 1e9){
    rep(i,k)cout << INF - 7 << endl;
    rep(i,n - k)cout << 1 << endl;
  }
  else{
    rep(i,k)cout << s << endl;
    rep(i,n - k)cout << INF - 7 << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
package main

import "fmt"

func pow100(d int) int {
	if d == 0 {
		return 1
	} else {
		return 100 * pow100(d-1)
	}
}

func main() {
	var d, n int
	fmt.Scan(&d, &n)
	if n != 100 {
		fmt.Println(pow100(d) * n)
	} else {
		fmt.Println(pow100(d) * 101)
	}
}


Measured memory_bytes: 512