akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <cstdio>
#include <string>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const long long mod = 1e9+7;
long long ten[12345], last[12345];
long long solve( const char a[] , const int &n , const char b[] , const int &m ){
    long long ans = 0;
    if( m == 1 && b[0] == '0' )
        ans = 1;
    last[n] = 0;
    for( int i = n - 1 ; i >= 0 ; i -- )
        last[i] = ( last[i+1] + ten[n-i-1] * ( a[i] - '0' ) ) % mod;

    long long pre = 0;
    for( int i = 0, flag ; i < n ; i ++ ){
        if( i == 0 && b[0] == '0' && m == 1 ){
            pre = ( pre * 10LL + a[i] - '0' ) % mod;
            continue;
        }
        if( i + m > n )
            break;
        flag = 0;
        for( int j = 0 ; j < m ; j ++ ){
            if( a[i+j] < b[j] ){
                flag = -1;
                break;
            }else if( a[i+j] > b[j] ){
                flag = 1;
                break;
            }
        }
        if( flag > 0 )
            ans = ( ans + ( i == 0 ? 1LL : ( pre + mod - ( b[0] == '0' && m == 1 ) ) + 1 ) * ten[n-i-m] % mod ) % mod;
        else if( flag < 0 )
            ans = ( ans + ( i == 0 ? 0LL : ( pre + mod - ( b[0] == '0' && m == 1 ) ) ) % mod * ten[n-i-m] % mod ) % mod;
        else{
            ans = ( ans + ( i == 0 ? 0LL : ( pre + mod - ( b[0] == '0' && m == 1 ) ) ) % mod * ten[n-i-m] % mod ) % mod;
            ans = ( ans + last[i+m] + 1 ) % mod;
        }
        pre = ( pre * 10LL + a[i] - '0' ) % mod;
    }
    return ans;
}
char a[12345], b[12345], c[512];
int main(){

    ten[0] = 1;
    for( int i = 1 ; i <= 10000 ; i ++ )
        ten[i] = ten[i-1] * 10LL % mod;
    scanf( "%s %s %s" , a , b , c );
    int n = strlen( a ),
        m = strlen( b ),
        l = strlen( c );
    long long add = 0;

    for( int i = 0, flag ; i < n ; i ++ ){
        flag = 1;
        for( int j = 0 ; j < l ; j ++ ){
            if( a[i+j] != c[j] ){
                flag = 0;
                break;
            }
        }
        add += flag;
    }

    printf( "%lld\n" , ( solve( b , m , c , l ) - solve( a , n , c , l ) + mod + add ) % mod );
    return 0;
}

Measured memory_bytes: 1316
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			double sa = slove(n, scanner);
			int m = scanner.nextInt();
			double sb = slove(m, scanner);
			if (Math.abs(sa-sb)<1e-7) {
				System.out.println(0);
			} else if (sa > sb) {
				System.out.println(1);
			} else {
				System.out.println(2);
			}
		}
	}

	public static double slove(int n, Scanner scanner) {
		double sa = 0;
		int s = 360;
		while (n-- > 1) {
			int t = scanner.nextInt();
			s -= t;
			sa += Math.sin(Math.toRadians(t));
		}
		sa += Math.sin(Math.toRadians(s));
		return sa;
	}
}

Measured memory_bytes: 19140
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    int n,k,ans=0;
	string s;
	cin >> n;

	

	cout << 3*n*n << endl;
}

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

#define ll long long
#define eb emplace_back
#define nl '\n'
#define deb(x) cerr << #x" = " << x << nl
#define in() ( { int a ; scanf("%d", &a); a; } )

const int N = 3e5 + 9;
const int mod = 1e9 + 7;

vector<pair<int, int>> g[N];
int vis[N], a[N], b[N];
vector<int> ans;
int dfs(int u)
{
    vis[u] = 1;
    int ret = b[u];
    for(auto x: g[u]){
        int v = x.first;
        if(!vis[v]){
            int k = dfs(v);
            //cout << u << v << k << nl;
            if(k) ans.eb(x.second);
            ret ^= k;
        }
    }
    return ret;
}
pair<int, int> c[N];
int32_t main()
{
    int n = in();
    int q = in();
    for(int i = 1; i <= n; i++) c[i].first = in(), c[i].second = in();
    sort(c + 1, c + n + 1);
    for(int i = 1; i <= n; i++) a[i] = c[i].first, b[i] = c[i].second;
    for(int i = n + 1; i >= 1; i--) b[i] =b[i - 1] ^ b[i];
    for(int i = 1; i <= q; i++){
        int l = in(), r = in();
        int u = lower_bound(a + 1, a + n + 1, l) - a;
        if(u == n + 1 || a[u] > r) continue;
        int v = upper_bound(a + 1, a + n + 1, r) - a;
        //deb(u); deb(v);
        g[u].eb(v, i);
        g[v].eb(u, i);
    }
    for(int i = 1; i <= n + 1; i++){
        if(!vis[i]){
            if(dfs(i)) return cout << - 1 << nl, 0;
        }
    }
    sort(ans.begin(), ans.end());
    cout << ans.size() << nl;
    for(auto x: ans) printf("%d ", x);
    cout << nl;
    return 0;
}


Measured memory_bytes: 23292
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, a[101], b[101], flag = 0, cnt = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 0; i < n; i++) {
    if (a[i] == b[i]) {
      cnt++;
      if (cnt == 3) {
        flag = 1;
        break;
      }
    }
    else {
      cnt = 0;
    }
  }
  if (flag) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a<=c&&c<=b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define lb(v, z) lower_bound(all(v), z)
#define ub(v, z) upper_bound(all(v), z)
#define fill(a, z) memset(a, z, sizeof(a))
#define rep(i, a, b) for (i = (a); i <= (b); i++)
#define rdp(i, a, b) for (i = (a); i >= (b); i--)
#define cns(z) cout << z << ' '
#define cnl(z) cout << z << '\n'
#define M 1000000007
#define M2 998244353
#define endl "\n"
#define iip(t) \
	int t;     \
	cin >> t;
#define iip2(a, b) \
	int a, b;      \
	cin >> a >> b;
#define dip(a) \
	double a;  \
	cin >> a;
#define dip2(a, b) \
	double a, b;   \
	cin >> a >> b;
#define garr(ip)       \
	for (auto &x : ip) \
		cin >> x;
#define parr(ip)          \
	for (auto &x : ip)    \
		cout << x << " "; \
	cout << endl;
#define test   \
	int _t;    \
	cin >> _t; \
	while (_t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vp;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int x, y, z;
	cin >> x >> y >> z;
	cns(z); cns(x); cnl(y);
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, m;
    cin >> n >> m;
    long long sum = 0;
    int cnt = 0;
    vector<long long> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }

    for (int i = 0; i < n; ++i) {
        cnt += (a[i] * m * 4 >= sum);
    }
    cout << (cnt >= m ? "Yes" : "No") << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if(w==0 && h==0) break;
			
			BigInteger[][] bi = new BigInteger[h+1][w+1];
			for(int i=0;i<=h;i++){
				for(int j=0;j<=w;j++){
					bi[i][j] = BigInteger.ZERO;
				}
			}
			
			BigInteger zero = BigInteger.ZERO;
			BigInteger max = BigInteger.ZERO;
			String s, t;
			for(int i=1;i<=h;i++){
				s = sc.next();
				for(int j=1;j<=w;j++){
					t = s.substring(j-1,j);
					if(t.codePointAt(0)<58){
						if(bi[i][j-1].compareTo(zero)==0 && bi[i-1][j].compareTo(zero)==0 && t.compareTo("0")==0) continue;
						BigInteger x = bi[i][j-1].multiply(BigInteger.TEN).add(new BigInteger(t));
						BigInteger y = bi[i-1][j].multiply(BigInteger.TEN).add(new BigInteger(t));
						if(x.compareTo(y)>0) bi[i][j] = x;
						else bi[i][j] = y;
						if(max.compareTo(bi[i][j])<0) max = bi[i][j];
					}
				}
			}
			System.out.println(max);
		}
	}	
}

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

int h,w;
char temp;
int int_temp;

int main() {
  cin >> h >> w;
  std::vector<vector<int>> state(h, vector<int>(w,1));
  std::vector<vector<int>> dp(h,std::vector<int>(w,10000));
  for (size_t i = 0; i < h; i++) {
    for (size_t j = 0; j < w; j++) {
      cin >> temp;
      if (temp == '.') {
        state.at(i).at(j) = 0;
      }
    }
  }
  dp.at(0).at(0) = state.at(0).at(0);
  for (size_t j = 0; j < h - 1; j++) {
    for (size_t i = 0; i < w - 1; i++) {
      int_temp = dp.at(j).at(i);
      if (state.at(j).at(i + 1) == 1 and state.at(j).at(i) == 0) {
        int_temp++;
      }
      dp.at(j).at(i + 1) = min(dp.at(j).at(i + 1), int_temp);
    }
    for (size_t i = 0; i < w; i++) {
      int_temp = dp.at(j).at(i);
      if (state.at(j + 1).at(i) == 1 and state.at(j).at(i) == 0) {
        int_temp++;
      }
      dp.at(j + 1).at(i) = min(dp.at(j + 1).at(i), int_temp);
    }
  }
  for (size_t i = 0; i < w - 1; i++) {
    int_temp = dp.at(h - 1).at(i);
    if (state.at(h - 1).at(i + 1) == 1 and state.at(h - 1).at(i) == 0) {
      int_temp++;
    }
    dp.at(h - 1).at(i + 1) = min(dp.at(h - 1).at(i + 1), int_temp);
  }
  cout << dp.at(h - 1).at(w - 1) << endl;
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

int main(void){
  int n, a[21], b[21], c[20], sum=0;
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  for(int i = 0; i < n; i++){
    scanf("%d", &b[i]);
  }
  for(int i = 0; i < n-1; i++){
    scanf("%d", &c[i]);
  }
  // for(int i = 0; i < n; i++)
  //   printf("DEB a[%d]:%d b[%d]:%d c[%d]:%d \n", i, a[i], i, b[i], i, c[i]);
  // printf("DEB sum:%d\n", sum);
  sum += b[a[0]-1];
  // printf("DEB sum: %d b[%d]:%d\n", sum, a[0]-1, b[a[0]-1]);
  for(int i = 1; i < n; i++){
    sum += b[a[i]-1];
    // printf("DEB sum: %d b[%d]:%d\n", sum, a[i], b[a[i]-1]);
    if(a[i-1]+1 == a[i]){
      sum += c[a[i-1]-1];
      // printf("DEB sum: %d c[%d]:%d\n", sum, a[i-1]-1, c[a[i-1]-1]);
    }
  }
  printf("%d", sum);
  return 0;
}

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

#define TABLE_SIZE 16777216
#define ORDER_LENGTH 7
#define STR_LENGTH 13

using namespace std;

int array[128];

int translateStr(char buf[]){
    int sum = -1,mult = 1;
    for(int i = 0; buf[i] != '\0'; i++){
        sum += array[buf[i]]*mult;
        mult *= 4;
    }
    return sum;
}

int main(){

    array['A']=1,array['C']=2,array['G']=3,array['T']=4;

    int n;
    scanf("%d",&n);
    char order[ORDER_LENGTH],str[STR_LENGTH];

    char* check_table = new char[TABLE_SIZE];

    for(int i = 0; i < n; i++){
        scanf("%s %s",order,str);
        if(order[0] == 'i'){
            check_table[translateStr(str)] = 'Y';
        }else{
            if(check_table[translateStr(str)] == 'Y'){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
}

Measured memory_bytes: 4500
/*input
6 6 8
..##..
.#..#.
#....#
######
#....#
#....#
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std; 

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
#define rept(v) for(auto it=v.begin();it<v.end();it++)
#define all(v) v.begin(),v.end()
const int INF = 1<<30;
typedef long long ll;
typedef pair<int,int> pii;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int h,w,k;
	cin >> h >> w >> k;
	char a[h][w];
	rep(i,h)rep(j,w) cin >> a[i][j];
	int ans=0;
	rep(i, 1<<(h+w)) {
		bool r[h], c[w];
		int bk=0;
		memset(r, 0, sizeof(r));
		memset(c, 0, sizeof(c));
		rep(j, h) {
			if(i>>j&1) r[j]=1;
		}
		rep(j, w) {
			if(i>>(j+h)&1) c[j]=1;
		}
		rep(x, h)rep(y, w) {
			if(r[x]||c[y]) continue;
			if(a[x][y]=='#') bk++;
		}
		if(bk==k) ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3604
inf=float("inf")
n=int(input())
DP=[inf]*(n+1)
DP[0]=0

for i in range(1,n+1):
    DP[i]=DP[i-1]+1
    for num in (6,9):
        cnt=1
        while num**cnt<=i:
            DP[i]=min(DP[i],DP[i-num**cnt]+1)
            cnt +=1

print(DP[n])

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
 
  if (n / 10 % 111 == 0 || n % 1000 % 111 == 0 ) {
  	cout << "Yes" << endl;
  } else {
  	cout << "No" << endl;
  }
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    
    for(int i = 0;i < s.size();i++){
        char x = (s.at(i) + n - 'A')%26 + 'A';
        //char x =  + 'A';
        cout << x;
    }
    cout << endl;

    return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	string A, B, s = "";
	cin >> n >> A >> B;
	for (int i = 0; i < n; i++) {
		s += A[i];
		s += B[i];
	}
	cout << s;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb(x) push_back((x))
#define line() cerr << "DEBUG @" << __LINE__ << endl;
#define debug(x) \
    cerr << "DEBUG @" << __LINE__ << " -> " << #x << " = " << x << endl;
using namespace std;

vector<int> m[(int) 1e6 + 1];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> v(n);
    for (int &x : v) cin >> x;
    const int mx = 1e6;
    vector<int> divisors(mx + 1);
    for (int i = 2; i <= 1000000; i++) {
        if (!divisors[i]) {
            for (int j = i; j <= 1000000; j += i) {
                divisors[j] = i;
            }
        }
    }
    bool pair_wise_coprime = true;
    bool gcd_is_one = true;

    for (int x : v) {
        int cur = x;
        unordered_set<int> q;
        while (cur != 1) {
            q.insert(divisors[cur]);
            cur /= divisors[cur];
        }
        for (int div : q) {
            auto &curr_map = m[div];
            curr_map.push_back(x);
            if (curr_map.size() > 1) pair_wise_coprime = false;
            if (curr_map.size() == n) gcd_is_one = false;
        }
    }
    if (pair_wise_coprime) {
        cout << "pairwise coprime\n";
        return 0;
    }
    if (gcd_is_one) {
        cout << "setwise coprime\n";
        return 0;
    }
    cout << "not coprime\n";
}


Measured memory_bytes: 55408
#include<stdio.h>

int main()
{
    int n,i;
    double t=0;
    scanf("%d",&n);
    double a[n];
    for(i=0;i<n;i++){
        scanf("%lf",&a[i]);
        t=t+(1/a[i]);
    }
    printf("%g",1/t);

}


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

const int INF = 1e9;

int main() {
  int n;
  cin>>n;
  int len = 1e9 + 1;
  map<int, int> a;
  for (int i=0; i<n; i++) {
    int ai;
    cin>>ai;
    ++a[ai];
  }

  int cnt = 0;
  for (auto e: a) {
    if (e.second % 2 == 1) {
      ++cnt;
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 4992
import sys

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

def main():
    s=SI()
    s.replace(" ","")
    print(eval(s))

main()

Measured memory_bytes: 3064
//
// Created by PIIMUU on 8/29/2020.
//
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;
int fgcd(int x, int y) {
    if (y > x) {
        swap(x, y);
    }
    while (y != 0) {
        int temp = y;
        y = x % y;
        x = temp;
    }
    return x;
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<bool> prime(1e6 + 10, true);
    prime[1] = false;
    for (int i = 2; i * i <= 1e6; i++) {
        if (prime[i] == true) {
            for (int j = i + i; j <= 1e6; j += i) {
                prime[j] = false;
            }
        }
    }
    set<int> s;
    for (int i = 2; i <= 1e6; i++) {
        if (prime[i] == true) {
            s.insert(i);
        }
    }
    int gcd = 0;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        gcd = fgcd(gcd, a[i]);
    }
    if (gcd == 1) {
        sort(a.begin() + 1, a.end());
        bool yes = true;
        for (int i = 1; i <= n; i++) {
            if (a[i] == 1) {
                continue;
            }
            if (s.size() == 0) {
                yes = false;
            }
            auto p = s.begin();
            set<int> t;
            while (a[i] > 1) {
                if (p == s.end()) {
                    break;
                }
                if (a[i] % *p == 0) {
                    a[i] /= *p;
                    t.insert(*p);
                } else {
                    p++;
                }
            }
            if (a[i] > 1) {
                yes = false;
                break;
            }
            for (auto x : t) {
                s.erase(x);
            }
        }
        if (yes == true) {
            cout << "pairwise coprime";
        } else {
            cout << "setwise coprime";
        }
    } else{
        cout << "not coprime";
    }
}

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

#define N_MAX 100+10


struct ST
{
	int weight;
	long long int t;
	int SorE;
};

int main(void)
{

	ST mt[(N_MAX)*2],tmp;

	//vector<int> tm;

	int n;
	int m;
	long long a, b;

	int i,j;

	while ((cin >> n), n != 0)
	{

		for (i = 0; i < n * 2; i += 2)
		{
			cin >> m >> a >> b;

			mt[i].weight = m;
			mt[i].t = a;
			mt[i].SorE = 1;
			//cout << "GDG=" << mt[i].SorE << endl;

			mt[i + 1].weight = m;
			mt[i + 1].t = b;
			mt[i + 1].SorE = 2;

		}

		for (i = 0; i < n * 2 - 1; i++)
		{
			for (j = i + 1; j < n * 2; j++)
			{
				if (mt[i].t > mt[j].t)
				{
					tmp = mt[i];
					mt[i] = mt[j];
					mt[j] = tmp;
				}
			}
		}
		mt[n * 2].t = -1;

		//cout << "BFB=" << mt[0].SorE << endl;

		int sum_W = 0;
		int ch = 1;
		for (i = 0; i < n * 2; i++)
		{
			//printf("i=%d\n", i);

			if (mt[i].SorE == 1)
			{
				//printf("B mt[i].weight=%d   %d\n", mt[i].weight, mt[i].SorE);
				sum_W += mt[i].weight;
			}
			else
			{
				//printf("C mt[i].weight=%d   %d\n", mt[i].weight, mt[i].SorE);
				sum_W -= mt[i].weight;
			}

			if (sum_W > 150 && mt[i].t!=mt[i+1].t)
			{
				ch = 0;
				break;
			}
		}

		if (ch == 1)
		{
			cout << "OK\n";
		}
		else
		{
			cout << "NG\n";
		}

	}

	return 0;
}



Measured memory_bytes: 2992
#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <random>
#include <bitset>
#include <cassert>
#include <tuple>
#include <list>
#include <iterator>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;
typedef long double ld;

template<class htpe, class cmp>
using heap = priority_queue<htpe, vector<htpe>, cmp>;

template<class htpe>
using min_heap = heap<htpe, greater<htpe> >;

template<class htpe>
using max_heap = heap<htpe, less<htpe> >;

#define mp make_pair
#define pb push_back
#define mt make_tuple
#define ff first
#define ss second

#define forn(i, n) for (int i = 0; i < ((int)(n)); ++i)
#define forrn(i, s, n) for (int i = (int)(s); i < ((int)(n)); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define PYMOD(a, m) ((((a) % (m)) + (m)) % (m))

const int INF = 1791791791;
const ll INFLL = 1791791791791791791ll;

struct point {
    ll x, y;
};

struct vect {
    ll x, y;
    vect(ll x_, ll y_) : x(x_), y(y_) {}
    vect(point a, point b) {
        x = b.x - a.x;
        y = b.y - a.y;
    }
    ll sqlen() {
        return x * x + y * y;
    }
};

vect perpendicular(point a, point b) {
    return vect(b.x - a.x, a.y - b.y);
}

ll cp(vect u, vect v) {
    return u.x * v.y - v.x * u.y;
}

ll dp(vect u, vect v) {
    return u.x * v.x + u.y * v.y;
}

ld angle(vect u, vect v) {
    return atan2(cp(u, v), dp(u, v));
}

vector<int> convex_hull(vector<point> p) {
    int n = p.size();
    int first = 0;
    forn(i, n) {
        if (mp(p[i].x, p[i].y) < mp(p[first].x, p[first].y))
            first = i;
    }
    vector<int> ind(n);
    iota(all(ind), 0);
    sort(all(ind), [&](int i, int j) -> bool {
        if (cp(vect(p[first], p[i]), vect(p[first], p[j])) == 0)
            return vect(p[first], p[i]).sqlen() < vect(p[first], p[j]).sqlen();
        else
            return cp(vect(p[first], p[i]), vect(p[first], p[j])) > 0;
    });
    vector<int> ans = {ind[0], ind[1]};
    forrn(i, 2, n) {
        point c = p[ind[i]];
        while (ans.size() > 1 && cp(vect(p[ans[ans.size() - 2]], p[ans.back()]), vect(p[ans.back()], c)) <= 0)
            ans.pop_back();
        ans.push_back(ind[i]);
    }
    return ans;
}

int main() {
    // Code here:

    int n;
    cin >> n;

    vector<point> p(n);
    forn(i, n)
        cin >> p[i].x >> p[i].y;

    vector<int> ch = convex_hull(p);
    vector<ld> ans(n, 0);
    int last = ch.size() - 1;
    int next = 1;
    forn(i, ch.size()) {
        vect u = perpendicular(p[ch[i]], p[ch[last]]);
        vect v = perpendicular(p[ch[next]], p[ch[i]]);
        assert(angle(v, u) > 0);
        ans[ch[i]] = abs(angle(v, u) / (2 * M_PI));
        last++; last %= ch.size();
        next++; next %= ch.size();
    }

    cout.precision(16);
    forn(i, n) {
        cout << fixed << ans[i] << endl;
    }

    return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  int a = 0, b = 0, ab = 0, ba = 0;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < s.size() - 1; j++) {
      if (s[j] == 'A' && s[j + 1] == 'B') ab++;
    }
    if (s[0] == 'B' && s[s.size() - 1] != 'A') b++;
    if (s[0] != 'B' && s[s.size() - 1] == 'A') a++;
    if (s[0] == 'B' && s[s.size() - 1] == 'A') ba++;
  }
  while (ba > 1) {
    ab++;  // くっつける
    ba--;
  }
  if (ba == 1) {
    if (a > 0 && b > 0) {
      a--;
      b--;
      ab += 2;
    } else if (a > 0 && b <= 0) {
      a--;
      ab++;
    } else if (a <= 0 && b > 0) {
      b--;
      ab++;
    }
    ba--;
  }
  cout << ab + min(a, b) << endl;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

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

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    int ans = 10000000;
    inc(i, 1, n){
        ans = min(ans, sum(i)+sum(n-i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 896
#include<iostream>
    #include<cstdlib>
    #include<math.h>
    #include<set>
    #include<string>
    #include<stdlib.h>
    using namespace std ;
    int main(){
      int A,B;
      cin>>A>>B;
      if(A+B<10)cout<<A+B<<endl;
      else cout<<"error"<<endl;
      return 0;
    }

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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

const int MAX = 1e5+10;

bool vis[MAX];
ll down[MAX], up[MAX];
int par[MAX];

int main(){ _

	int n, m; cin >> n >> m;
	vector<vector<int>> g(n);
	for(int i=0; i<n-1; i++) {
		int a, b; cin >> a >> b; a--, b--;
		g[a].push_back(b), g[b].push_back(a);
	}

	function<ll(int)> solve = [&] (int v) {
		vis[v] = 1;
		ll ret = 1;
		for(auto u : g[v]) if(!vis[u])
			ret = (ret * solve(u)) % m, par[u] = v;

		down[v] = (ret + 1) % m;
		return down[v];
	};

	par[0] = -1;
	solve(0);
	vector<vector<ll>> pref(n), rpref(n);
	for(int i=0; i<n; i++) if(g[i].size()) {
		pref[i].resize(g[i].size());
		rpref[i].resize(g[i].size());

		pref[i][0] = (g[i][0] == par[i] ? 1 : down[g[i][0]]);
		for(int j=1; j<g[i].size(); j++) {
			int u = g[i][j];
			if(u != par[i]) pref[i][j] = (pref[i][j-1] * down[u]) % m;
			else pref[i][j] = pref[i][j-1];
		}

		rpref[i][g[i].size()-1] = (g[i].back() == par[i] ? 1 : down[g[i].back()]);
		for(int j=g[i].size()-2; j>=0; j--) {
			int u = g[i][j];
			if(u != par[i]) rpref[i][j] = (rpref[i][j+1] * down[u]) % m;
			else rpref[i][j] = rpref[i][j+1];
		}
	}

	function<ll(int,int)> calc = [&] (int v, int excl) {
		ll ret = 1;
		if(excl - 1 >= 0) ret = pref[v][excl-1];
		if(excl + 1 < g[v].size()) ret = (ret * rpref[v][excl+1]) % m;
		return ret;
	};

	function<void(int,int)> solve2 = [&] (int v, int adjpos) {
		vis[v] = 1;
		
		ll upv = 1;
		if(par[v] != -1)
			upv = ((calc(par[v], adjpos) * (up[par[v]]-1)) + 1) % m;
		
		up[v] = (upv+1) % m;

		for(int i=0; i<g[v].size(); i++) if(!vis[g[v][i]]) solve2(g[v][i], i);
	};

	memset(vis, 0, sizeof vis);
	solve2(0,-1);

	for(int i=0; i<n; i++) {
		ll ans = 1;
		if(par[i] != -1) ans = up[i]-1;
		for(auto u : g[i]) if(u != par[i]) {
			ans = (ans * down[u]) % m;
		}
		cout << (ans+m) % m << endl;
	}

	return 0;
}

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

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        
        String S = next();
        String T = next();
 

        if(S.equals(T.substring(0, T.length()-1))){
            System.out.println("Yes");
        } 
        else{
            System.out.println("No");
        }


    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

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

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 25;
bool flag;

int main(){
    CIN(n,x,y);
    vi ans(n);
    RepS(i,1,n){
        RepS(j,i+1,n){
            ans[min(j-i,abs(i-x)+1+abs(j-y))]++;
        }
    }
    Rep(i,1,n)printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $h, $n);
$inputs = explode(' ', trim(fgets(STDIN)));

$total = array_sum($inputs);
#var_dump([$h, $n, $inputs, $total]);

if ($h <= $total) {
    echo "Yes";
} else {
    echo "No";
}


Measured memory_bytes: 12792
#include <iostream>
#include <cmath>
#define int long long

using namespace std;

const int MOD = 1000000007;

int qmi(int m, int k, int p)
{
    int res = 1 % p, t = m;
    while (k)
    {
        if (k&1) res = res * t % p;
        t = t * t % p;
        k >>= 1;
    }
    return res;
}

signed main() {
	int n;
	cin >> n;
	
	int ans = (qmi(10, n, MOD) - qmi(9, n, MOD) - qmi(9, n, MOD) + qmi(8, n, MOD)) % MOD;
	ans = (ans + MOD) % MOD;
	
	cout << ans << '\n';
	
	return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>

int main(){
	int n,m,d,x,y,i;
	for(;scanf("%d",&n),n;puts(n?"No":"Yes")){
		int f[21][21] = {0};
		for(i=n;i--;f[y][x] = 1)
			scanf("%d %d",&x,&y);
		scanf("%d",&m);
		x=y=10;
		for(i=m;i--;)
			for(scanf(" %c %d",&m,&d);d--; ){
				x += m=='E'? 1 : m=='W'? -1 : 0;
				y += m=='N'? 1 : m=='S'? -1 : 0;
				if(f[y][x]){
					n--;
					f[y][x] = 0;
				}
			}
	}
}

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

///////////////////////////////////////////
const long long int INF = INT64_MAX;
//const long long int INF = 1000000;
const long long int Mod = 1000000007;
using ll = long long int;
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////
ll n,m;
struct mati{
    ll y,n;
    mati(ll a,ll b){y=a;n=b;}
};
bool operator<(mati e,mati e2){return e.y<e2.y;}
bool operator>(mati e,mati e2){return e.y>e2.y;}
ll p[100001]={0};
ll y[100001]={0};
ll bb[100001]={0};
vector<vector<mati> > mx(100001);
vector<string> ss(100001);
bool flg[100001]={false};
int main(){
    cin>>n>>m;
    rep(i,m){
        cin>>p[i]>>y[i];
        mx[p[i]].pb(mati(y[i],i+1));
    }//input
    string f,b;
    rep(i,n)sort(all(mx[i+1]));
    rep(i,n){
        rep(j,mx[i+1].size()){
            bb[mx[i+1][j].n]=j+1;
        }
    }
    rep(i,m){
        if(!flg[p[i]]){
            f=to_string(p[i]);
            while(f.size()<6){f="0"+f;}
            ss[p[i]]=f;
            flg[p[i]]=true;
        }else{
            f = ss[p[i]];
        }
        b=to_string(bb[i+1]);
        while(b.size()<6){b="0"+b;}
        cout<<f+b<<endl;
        f.clear();b.clear();
    }
    return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int W, H;
char B[30][30];

int dfs(int y, int x) {
   int ret = 1;
   B[y][x] = '#';
   rep (i, 4) {
      int nx = x + dx[i], ny = y + dy[i];
      if (nx < 0 || nx >= W || ny < 0 || ny >= H || B[ny][nx] == '#') continue;
      ret += dfs(ny, nx);
   }
   return ret;
}

void solve() {
   rep (i, H) {
      cin >> B[i];
   }
   rep (i, H) {
      rep (j, W) {
         if (B[i][j] == '@') {
            cout << dfs(i, j) << endl;
            return;
         }
      }
   }
}

int main() {
   while (1) {
      cin >> W >> H;
      if (H*W == 0) break;
      solve();
   }

   return 0;
}


Measured memory_bytes: 3080
#include <cstdio>

int main(void)
{
    double g, h;
    while (scanf("%lf %lf", &g, &h) != EOF){
        if ((g < 35.5) && (h < (60 * 1) + 11)){
            printf("AAA\n");
        }
        else if ((g < 37.5) && (h < (60 * 1) + 17)){
            printf("AA\n");
        }
        else if ((g < 40) && (h < (60 * 1) + 23)){
            printf("A\n");
        }
        else if ((g < 43) && (h < (60 * 1) + 29)){
            printf("B\n");
        }
        else if ((g < 50) && (h < (60 * 1) + 45)){
            printf("C\n");
        }
        else if ((g < 55) && (h < (60 * 1) + 56)){
            printf("D\n");
        }
        else if ((g < 70) && (h < (60 * 2) + 28)){
            printf("E\n");
        }
        else {
            printf("NA\n");
        }
    }
    
    return (0);
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
static const int MAX = 100;
int pre[MAX], in[MAX];
int preidx = 0;


void reconstruction(int l, int r, int n) {
    if (l >= r) return;
    int c = pre[preidx++];
    int m;
    for (int i = 0; i < n; i++) {
        if (in[i] == c) {
            m = i;
            break;
        }
    }
    reconstruction(l, m, n); // 左部分木を復元
    reconstruction(m + 1, r, n); // 右部分木を復元
    if (c == pre[0]) cout << c << endl;
    else cout << c << " ";
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> pre[i];
    for (int i = 0; i < n; i++) cin >> in[i];
    reconstruction(0, n, n);

    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(s) cout << s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int a,b,c; cin>>a>>b>>c;
    set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    cout<<s.size()<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long double ans,a,b,h,m;
int main()
{
	cin>>a>>b>>h>>m;
	ans=sqrt(a*a+b*b-2.0*a*b*cos((30.0*h-5.5*m)/180.0*M_PI));
	printf("%.10Lf",ans);
	return 0;
}

Measured memory_bytes: 4140
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  
  if((a>b || (a==1 && b==13)) && !(a==13 && b==1)) cout<<"Alice";
  else if(a==b) cout<<"Draw";
  else cout<<"Bob";
}

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

int main(void)
{
	int l, n;
	vector<string> s;
	cin >> n >> l;
	s.resize(n);
	for (int i = 0; i < n; i++) cin >> s[i];
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++) cout << s[i];
	cout << endl;
	return 0;
}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ELeague {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        map<P, vector<P>> G;
        map<P, int> in;
        REP(i, N) {
            P prev = {-1, -1};
            REP(j, N - 1) {
                int to;
                cin >> to;
                to--;
                int from = i;
                if (from > to) swap(from, to);
                P p = {from, to};
                if (prev.first >= 0) {
                    G[prev].push_back(p);
                    in[p]++;
                }
                if (in.count(p) == 0) {
                    in[p] = 0;
                }
                prev = p;
            }
        }

        queue<P> q;
        for (auto kv: in) {
            if (kv.second == 0) {
                q.push(kv.first);
            }
        }

        int res = 0;
        int cur = 0;
        while (!q.empty()) {
            map<int, bool> used;

            while (!q.empty()) {
                int a, b;
                tie(a, b) = q.front();
                if (used[a] || used[b]) break;
                q.pop();
                used[a] = true;
                used[b] = true;
                cur++;
                for (auto next : G[{a, b}]) {
                    in[next]--;
                    if (in[next] == 0) {
                        q.push(next);
                    }
                }
            }
            res++;
        }
        if (cur != N * (N - 1) / 2) {
            cout << -1 << endl;
            return;
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ELeague solver;
    solver.solve(in, out);
    return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j,o;
  ll result=0,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  double m=0;
  ll a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
  vector<ll> t(31),k(3001);
  t[0]=1;k[0]=1;
  for(i=0;i+a<=f/100;i++){
    if(t[i]==1)t[i+a]=1;
  }
  for(i=0;i+b<=f/100;i++){
    if(t[i]==1)t[i+b]=1;
  }
  for(i=0;i+c<=f;i++){
    if(k[i]==1)k[i+c]=1;
    //cout<<i spa k[i]<<endl;
  }
  for(i=0;i+d<=f;i++){
    if(k[i]==1)k[i+d]=1;
  }

  for(i=0;i<=30;i++){
    for(j=0;j<=3000;j++){
      if(t[i]==1&&k[j]==1&&100*i+j<=f&&i*e>=j){
        //cout<<i spa j<<endl;
        if(m<=(100*j)/double(i*100+j)){
          m=(100*j)/double(i*100+j);
          buf1=100*i+j;
          buf2=j;
        }
      }
    }
  }
  cout<<buf1 spa buf2<<endl;



  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }

        int[] b = new int[n];
        for (int i = n - 1 ; i >= 0 ; i--) {
            int m = i + 1;
            int count = 0;
            for (int j = m - 1 ; j < n ; j += m) {
                if (b[j] == 1) {
                    count++;
                }
            }
            if (count % 2 != a[i]) {
                b[i] = 1;
            }
        }

        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (b[i] == 1) c++;
        }

        System.out.println(c);

        for (int i = 0 ; i < n ; i++) {
            if (b[i] == 1) {
                System.out.print(i + 1);
                System.out.print(" ");
            }
        }

        System.out.print("\n");

    }

}


Measured memory_bytes: 94176
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> p(N);
    for(int i=0; i<N; i++){
        cin >> p.at(i);
    }
    sort(p.begin(),p.end());
    ll sum=0;
    for(int i=0; i<K; i++){
        sum += p.at(i);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3628
N, M = map(int, input().split())
ls = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(M)]

# Union Find Tree
def find(par, x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par, par[x])
        return par[x]

def unite(par, rank, x, y):
    rx = find(par, x)
    ry = find(par, y)

    if rx == ry:
        return False
    else:
        if rank[rx] < rank[ry]:
            par[rx] = ry
        else:
            par[ry] = rx
            if rank[rx] == rank[ry]: rank[rx] += 1
        return True

def same(par, x, y):
    return find(par, x) == find(par, y)

c = 0
for i in range(M):
    par = [-1] * N
    rank = [0] * N
    for idx, (a, b) in enumerate(ls):
        if idx == i:
            continue
        unite(par, rank, a, b)
    
    # グループが2つ以上ならばカウント
    if len([i for i, x in enumerate(par) if x < 0]) >= 2:
        c += 1
print(c)


Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var r int
	fmt.Scan(&r)

	if r < 1200 {
		fmt.Println("ABC")
	} else if r < 2800 {
		fmt.Println("ARC")
	} else {
		fmt.Println("AGC")
	}
}


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

using namespace std;
using ll = long long;
using vs = vector<string>;
using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;

#define R(a,i) for(ll a=0; a < (i); (a)++)
#define FOR(a,i,j) for(ll a=(i); a < (j); (a)++)
#define RD(a,i) for(ll a=(i)-1; (a) >= 0; (a)--)
#define FORD(a,i,j) for(ll a=(j)-1; (a) >= (i); (a)--)

#define xx first
#define yy second
#define pb push_back

#define all(X) begin(X),end(X)
#define rall(X) rbegin(X),rend(X)
#define sz(X) (X).size()

#define DBG 0
#define TR(X) {if(DBG) cerr << (#X) << " = " << (X) << "\n";}
#define hline {if(DBG) cerr << "----------------------------------------------------------------------" << "\n";}
#define PK(X) {if(DBG) cerr << (X) << "\n";}

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

	ll N;
	cin >> N;

	ll search = 0;
	ll combi = 0;
	vl ai(N);
	FOR(i,0,N) {
		cin >> ai[i];
		combi ^= ai[i];
	}

	FOR(i,0,N){
		ai[i] &= ~ combi;
	}

	ll taken = 0;
	FORD(i,0,61){
		ll idx = -1;
		FOR(j,taken,N){
			if( ai[j] & (1LL << i) ) {
				if(idx == -1){
					idx = j;
					swap(ai[j], ai[taken]);
					taken++;
					break;
				}
			}
		}
		if(idx != -1)
			TR(bitset<64>(ai[taken-1]));
		FOR(j,0,N){
			if( ai[j] & (1LL << i) ) {
				if(idx != -1 && j != taken - 1){
					ai[j] ^= ai[taken-1];
				}
			}
		}
	}

	FOR(i,0,N){
		TR(bitset<64>(ai[i]));
		search ^= ai[i];
	}

	TR(bitset<64>(combi));

	cout << search * 2 + combi << endl;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 


void solve(){
    int n;
    cin >> n;
    cout << n << ":";
    for(int i = 2; i*i<=n;i++){
        while(n%i==0){
            n /= i;
            cout << " " << i;
        }
    }
    if(n != 1) cout << " " << n;
    cout << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3168