akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv,  digitDP//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal ,RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 998244353; ll INF = 1LL << 60; ll ans = 0; ll z = 0, o = 1;
vl flag; vll path; vl D;
//***********//
ll Npow(ll x, ll n) {
	if (n == 0) return 1;
	if (n % 2 == 0) return Npow(x * x % MOD, n / 2);
	else return x * Npow(x, n - 1) % MOD;
}

int main() {
	ll S;
	cin >> N >> S;
	vl A(N);
	for (i = 0; i < N; i++) cin >> A[i];
	vll dp(N+1, vl(S+1, 0));
	dp[0][0] = 1;
	ll base = Npow(2, N - 1);
	// i個選択してちょうど和がjであるものがいくつあるか
	for (i = 0; i < N; i++) {
		for (j = 0; j <= S; j++) {
			if(j!=S) (dp[i + 1][j] += dp[i][j]*2) %= MOD;
			if (j + A[i] <= S) {
				(dp[i+1][j + A[i]] += dp[i][j]) %= MOD;
			}
		}
	}
	ans = 0;
	for (i = 1; i <= N; i++) {
		//debug(N - i);
		(ans += dp[i][S]*Npow(2,N-i))%=MOD;
	}
	cout << ans;
}

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

int main() {
	
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(a+b > c+d) cout << "Left" << endl;
	else if(a+b == c+d) cout << "Balanced" << endl;
	else cout << "Right" << endl;
	
	return 0;
}

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

const int N = (2e3) + 5;
int n, a[N];

int main() { // claudio van
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  ll cnt = 0;
  for (int i = 0; i + 1 < n; ++i) {
    for (int j = i + 1; j + 1 < n; ++j) {
      int sum = a[i] + a[j];
      int dif = abs(a[i] - a[j]);
      int l = upper_bound(a + j + 1, a + n, dif) - a;
      int r = upper_bound(a + j + 1, a + n, sum - 1) - a;
      if (l > r) continue;
      cnt += r - l;
    }
  }
  printf("%lld\n", cnt);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
            using namespace std;
            int main()
            {
                int n;
                cin>>n;
                int a[n];
                for(int i=0;i<n;i++)
                {
                    cin>>a[i];
                }
                int ans[n]={0};
                ans[0]=0,ans[1]=abs(a[1]-a[0]);
                for(int i=2;i<n;i++)
                {
                    ans[i]=min(ans[i-1]+abs(a[i]-a[i-1]),ans[i-2]+abs(a[i]-a[i-2]));
                }
                cout<<ans[n-1];
                return 0;
            }


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

class Main {

	static final int M = 1000000007;


	private static long pow(long x, long n) {
		if (x == 0) return 0;
		long a = 1;
		while (n > 0) {
			if (n % 2 == 1) {
				a = a * x % M;
			}
			x = x * x % M;
			n >>= 1;
		}
		return a;
	}

	private static long inv(long x, long M) {
		return pow(x, M - 2);
	}

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] x = new long[N];
		for (int i = 0; i < N; i++) {
			x[i] = sc.nextLong();
		}

		long[] fact = new long[N];
		fact[0] = 1;
		for (int i = 1; i < N; i++) {
			fact[i] = fact[i - 1] * i % M;
		}

		long a = 0;
		long c = 0;
		for (int i = 0; i < N - 1; i++) {
			c = (c + fact[N - 1] * inv(i + 1, M) % M) % M;
			long d = x[i + 1] - x[i];
			a = (a + c * d % M) % M;
		}

		System.out.println(a);
	}
}


Measured memory_bytes: 52000
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
  unsigned long K, N, A[200001];
  unsigned long i, max, tmp;
  
  scanf("%lu %lu", &K, &N);
  
  for (i = 0; i < N; i++) {
    scanf("%lu", &(A[i]));
  }
  A[N] = A[0] + K;
  
  max = 0;
  for (i = 0; i < N; i++) {
    if ((tmp = abs(A[i+1] - A[i])) > max) {
      max = tmp;
    }
  }
  
  printf("%lu", K-max);  

  return 0;
}

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

int main() {
  int N,sum;
  sum = 0;
  cin >> N;
  
  rep(i,N){
  	string S;
    cin >> S;
    
    if(S == "Y"){
    cout << "Four" << endl;
      sum++;
      break;
    }
      
  }
	if(sum != 1){
    cout << "Three" << endl;      
    }
   
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    
    int N,T,c[10000],t[10000],ans,min;
    min=10000;
    
    scanf("%d %d",&N,&T);
    
    for(int i=0; i<N; i++){
        scanf("%d %d",&c[i],&t[i]);
        
        if(T>=t[i]){
            if(c[i] < min){
                min=c[i];
                ans=i; 
            }
        }
    }
    if(min==10000)
        printf("TLE");
    else
        printf("%d",c[ans]);
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int n;
  int u,k,v;
  int A[101][101]={};
  int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      A[u][v]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",A[i+1][j+1]);
      if(j!=n-1) printf(" ");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2052
/*************************************
 * @contest:      dwacon6th-prelims.
 * @user_name:    hkxadpall.
 * @time:         2020-01-11.
 * @language:     C++.
 * @upload_place: AtCoder.
*************************************/ 

#include <bits/stdc++.h>
using namespace std;

typedef signed char          int8;
typedef unsigned char       uint8;
typedef short                int16;
typedef unsigned short      uint16;
typedef int                  int32;
typedef unsigned            uint32;
typedef long long            int64;
typedef unsigned long long  uint64;

template <typename Int>
inline Int read()       
{
    Int flag = 1;
    char c = getchar();
    while ((!isdigit(c)) && c != '-') c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
	return init * flag;
}

template <typename Int>
inline Int read(char &c)       
{
    Int flag = 1;
    c = getchar();
    while ((!isdigit(c)) && c != '-') c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
	return init * flag;
}

template <typename Int>
inline void write(Int x)
{
    if (x < 0) putchar('-'), x = ~x + 1;
    if (x > 9) write(x / 10);
    putchar((x % 10) | 48);
}  

template <typename Int>
inline void write(Int x, char nextch)
{
    write(x);
    putchar(nextch);
}

int n;
string s[50 + 3], end_str; 
int t[50 + 3], ans = 0;
bool start_record = false;

int main()
{
    n = read<int>();
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
        t[i] = read<int>();
    }
    cin >> end_str;
    for (int i = 1; i <= n; i++) {
        if (start_record) ans += t[i];
        if (s[i] == end_str) start_record = true;
    }
    write(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);

using UINT64 = unsigned long long;

#define NMAX 1010


int main(void){
    int n,k;
    cin >> n >> k;
    vector<UINT64> a;

    for(int i = 0; i < n; i++) {
        int j;
        cin >> j;
        a.emplace_back(j);
    }

    vector<UINT64> v;
    for(int i = 1;i <= n;i++){
        for(int j = 0;j <= n-i;j++){
            UINT64 sum = accumulate(a.begin()+j, a.begin()+j+i,0ULL);
            v.emplace_back(sum);
        }

    }
    //for(auto itr = v.begin();itr != v.end(); itr++) cerr << *itr << endl;
    //sort(v.rbegin(),v.rend());

    UINT64 ans = 0;

    for(int m = 40; m >= 0; m--){
        UINT64 t2 = 1ULL << m;
        int cnt = 0;
        int vs = v.size();
        for(int s = 0; s < vs ; s++){
            if (((ans + t2) & v[s]) == (ans + t2)) {
                cnt++;
                if (cnt == k){
                    ans += t2;
                    break;
                }
            }
        }
    }

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



Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;
const int INF = 1001001001;


int main() {
  int x, n;
  cin >> x >> n;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  int a = 0;
  while(1){
    bool ok = true;
    rep(i,n){
      if(a+x==p[i]){
        ok = false;
        break;
      }
    }
    bool okl = true;
    rep(i,n){
      if(x-a==p[i]){
        okl = false;
        break;
      }
    }
    if(ok==true&&okl==true){
      cout << min(a+x,x-a) << endl;
      return 0;
    }
    else if(ok==true&&okl==false){
      cout << a+x << endl;
      return 0;
    }
    else if(ok==false&&okl==true){
      cout << x-a << endl;
      return 0;
    }
    ++a;

  }
  return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

#include <bits/stdc++.h>
#define rep(i,a,n) for(ll i = a;i < n;i++)
typedef long long ll;
using namespace std;

int main(){ 
    string s;
    cin >> s;

    ll cnt = 0,s_cnt = 0;
    rep(i,0,(ll)s.size()){
        if(s[i] == 'S') s_cnt++;
        else if(s[i] == 'T' && s_cnt > 0){
            s_cnt--;
            cnt += 2;
        }
    }

    cout << (ll)s.size() - cnt << endl;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  s += "AA";
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#include <tuple>
#include <string>

using namespace std;

const vector<int> dx = {0, 1, 0, -1};
const vector<int> dy = {1, 0, -1, 0};

int main() {
    int N;

    for (;;) {
        cin >> N;
        if (N == 0) break;

        set<tuple<int, int>> stii;
        for (int i = 0; i < N; i++) {
            int x, y;
            cin >> x >> y;

            stii.insert(make_tuple(x, y));
        }

        int M, cx = 10, cy = 10;
        cin >> M;
        for (int i = 0; i < M; i++) {
            string d;
            int l, di = 0;
            cin >> d >> l;

            if (d == "N") di = 0;
            else if (d == "E") di = 1;
            else if (d == "S") di = 2;
            else if (d == "W") di = 3;

            for (int j = 0; j < l; j++) {
                cx += dx[di];
                cy += dy[di];

                auto pos = make_tuple(cx, cy);
                auto res = stii.find(pos);
                if (res != stii.end()) {
                    stii.erase(res);
                }
            }
        }

        if (stii.empty()) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1212
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        String s3 = sc.next();
        if (s1.charAt(s1.length() - 1) == s2.charAt(0) && s2.charAt(s2.length() - 1) == s3.charAt(0)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23764
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;



int main(){
	int N;
	cin >> N;
	int AC, WA, TLE, RE;
	AC = WA = TLE = RE = 0;
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		if (S == "AC") AC++;
		if (S == "WA") WA++;
		if (S == "TLE") TLE++;
		if (S == "RE") RE++;
	}
	cout << "AC x " << AC << endl;
	cout << "WA x " << WA << endl;
	cout << "TLE x " << TLE << endl;
	cout << "RE x " << RE << endl;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N, M; cin >> N >> M;
    vector<i64> A(N);
    REP(i, N) cin >> A[i];
    sort(A.rbegin(), A.rend());
    vector<i64> C(N + 1, 0);
    REP(i, N) C[i + 1] = C[i] + A[i];

    auto count = [&](i64 x) {
        i64 cnt = 0;
        i64 r = N - 1;
        REP(l, N) {
            while (l <= r && (A[l] + A[r]) < x) r--;
            if (r < l) break;
            cnt += (r - l + 1) * 2 - 1;
        }
        return cnt;
    };
    auto sum = [&](i64 x) {
        i64 s = 0;
        i64 r = N - 1;
        REP(l, N) {
            while (l <= r && (A[l] + A[r]) < x) r--;
            if (r < l) break;
            s += (C[r + 1] - C[l] + (r - l + 1) * A[l]) * 2 - (A[l] + A[l]);
        }
        return s;
    };

    i64 ok = 0;
    i64 ng = 2 * 1e15 + 1;
    while (ng - ok > 1) {
        i64 mid = (ok + ng) / 2;
        if (count(mid) >= M) ok = mid;
        else ng = mid;
    }

    i64 ans = sum(ok + 1) + (M - count(ok + 1)) * ok;
    cout << ans << endl;

    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a >= 13)
    {
        cout << b << endl;
    }
    else if (a >= 6)
    {
        cout << b / 2 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); 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 all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int dp[101010];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, num; cin >> N;
    REPS(i, 1, N) {
        dp[i] = dp[i-1] + 1;
        num = 1;
        while (num <= i) {
            chmin(dp[i], dp[i-num] + 1);
            num *= 6;
        }
        num = 1;
        while (num <= i) {
            chmin(dp[i], dp[i-num] + 1);
            num *= 9;
        }
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int h[1000000];
int main() {
	int n;
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	int dp[100000];
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	
	for (int i = 1; i < n; i++) {
		dp[i + 1] =   min(dp[i-1]+abs(h[i+1] - h[i - 1]), dp[i]+abs(h[i+1] - h[i]));
	}
	cout << dp[n-1] << endl;
	return 0;

}

Measured memory_bytes: 1024
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
//#define mod 998244353
#define inf 1000000000
#define pr1(a) cout << a << "\n"
#define pr2(a,b)cout << a <<  " " <<b<< "\n"
#define pr3(a,b,c) cout << a <<" " << b << " " << c << "\n"

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

int gcd(int a, int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
const int maxn = 2*1e5 + 10;


void solve(){

    int n;
    cin >> n;
    // n/=100.0;
    int tmp = 100;
    double x = 1.01;

    for(int i = 1;i<=3761; i++){

        if(tmp*x>=n){
            cout << i << endl;
            return;
        }
        
        int t = tmp*x;
        tmp = t;
        
    }
    

} 

signed main() 
{   
    IOS;
    int t = 1;
    // cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 

Measured memory_bytes: 3668
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>

#define MAXN 105
#define MAXK 100005

using namespace std;

typedef long long ll;

int mod = 1e9 + 7;
int dp[MAXN][MAXK];
int prefix[MAXK], candies[MAXN];

int range(int i, int j) {
    if(i == 0) return prefix[j];
    return (prefix[j] - prefix[i - 1] + mod) % mod;
}

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

    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++) {
        cin >> candies[i];
    }
    dp[0][0] = 1;
    for(int i = 1; i <= k; i++) {
        dp[0][i] = 0;
    }
    for(int i = 1; i <= n; i++) {
        prefix[0] = dp[i - 1][0];
        for(int j = 1; j <= k; j++) {
            prefix[j] = (prefix[j - 1] + dp[i - 1][j]) % mod;
        }
        for(int j = 0; j <= k; j++) {
            dp[i][j] = range(max(j - candies[i - 1], 0), j);
        }
    }
    cout << dp[n][k] << '\n';

    return 0;
}

Measured memory_bytes: 43428
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
// http://drken1215.hatenablog.com/entry/2019/04/01/165200
// 左側の落ちる区間と、落ちない区間の境目
// 右側の落ちる区間と、落ちない区間の境目
// をにぶたんで求めることができる

using pchar = pair<char, char>;

//にぶたん判定パート
// sはマスに書かれてる文字列
// posは位置
// tdはいままでのすべての呪文
int simulate(const string &s, const vector<pchar> &td, int pos) {
    for(auto c : td) {
        if(s[pos] != c.first) {
            continue;
        }
        if(c.second == 'L') {
            pos--;
        } else {
            pos++;
        }
        if(pos < 0) {
            return -1;
        } else if(pos >= (int)s.size()) {
            return 1;
        }
    }
    return 0;
}
//にぶたん
int solve(int N, const string &s, const vector<pchar> &td) {
    int low = -1;
    int high = N;
    while(high - low > 1) {
        int mid = (low + high) / 2;
        if(simulate(s, td, mid) == -1) {
            low = mid;
        } else {
            high = mid;
        }
    }
    int left_fall = high;
    low = -1;
    high = N;
    while(high - low > 1) {
        int mid = (low + high) / 2;
        if(simulate(s, td, mid) == 1) {
            high = mid;
        } else {
            low = mid;
        }
    }
    int right_fall = N - 1 - low;
    return N - (left_fall + right_fall);
}
int main() {
    int N, Q;
    string s;
    cin >> N >> Q >> s;
    vector<pchar> td(Q);
    REP(i, Q) { cin >> td[i].first >> td[i].second; }
    cout << solve(N, s, td) << endl;
}

Measured memory_bytes: 900
/*
Hanit Banga
*/

#include <iostream>
#include <vector>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 5;

int a[N], up[N] = {0};
bool seen[N] = {0};
vector <int> g[N];

bool solve(int cur);

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];	

	for (int i = 1; i < n; ++i)
	{
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		g[v].pb(u);
	}

	bool ans;
	if (n == 2)
		ans = (a[1] == a[2]);
	else
	{
		int root = 1;
		while (g[root].size() == 1)
			++root;

		ans = (solve(root) and up[root] == 0);
	}
		
	if (ans)	
		cout << "YES\n";
	else
		cout << "NO\n";
}

bool solve(int cur)
{
	seen[cur] = true;
	if (g[cur].size() == 1)
	{
		up[cur] = a[cur];
		return true;
	}

	ll sum = 0;
	bool ans = true;
	for (auto &i : g[cur])
	{
		if (!seen[i])
		{
			ans &= (solve(i) and (up[i] <= a[cur]));
			sum += up[i];
		}
	}

	up[cur] = 2*a[cur] - sum;
	return (ans and (up[cur] <= a[cur]) and (up[cur] >= 0));
}

Measured memory_bytes: 10624
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf
import Debug.Trace

readInt = ( readLn :: IO Int )
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = readInts >>= print . uncurry (-) . ( id *** pred ) . mp

Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    ll N;
    cin >> N;
    ll even = 0;
    for(int i=0;i<N;i++){
        int tmp;
        cin >> tmp;
        if(tmp%2 == 0)
            even++;
    }

    cout << pow(3, N) - pow(2, even) << endl;

}

Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"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()
}

// Node :
type Node struct {
	to []int
}

func main() {
	sc.Split(bufio.ScanWords)

	N, M := getInt(), getInt()
	n := make([]Node, N)
	for i := 0; i < M; i++ {
		from, to := getInt()-1, getInt()-1
		n[from].to = append(n[from].to, to)
		n[to].to = append(n[to].to, from)
	}

	for i := 0; i < N; i++ {
		out(len(n[i].to))
	}

}


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

int P;
int A[12];
int D[]={1,5,10,50,100,500};
const int INF = (1<<28);
int turi(int a){
  if( a < 0 ) return INF;
  int ret = 0;
  for(int i=5;i>-1;i--){
    if( a >= D[i] ) {      
      ret += a/D[i]; a=a%D[i];
    }
  }
  return ret;
}

int check(int id,int p){
  if( p == 0 ) return 0;
  if( id < 0 ) return INF;
  if( A[id] * D[id] <= p ) return check( id - 1, p - A[id] * D[id] ) + A[id];
  else return check( id - 1, p % D[id] ) + p/D[id];
}

int solve(){
  int sum =0;
  for(int i=0;i<6;i++) sum += A[i] * D[i];
  int ret = INF;
  for(int i=P;i<=sum;i++) {
    int st = check( 5, i );
    if( st < INF ) 
      ret = min( ret, st + turi( i - P ) );
  }
  return ret;
}

int main(){
  while( cin >> P ){
    for(int i=0;i<6;i++) cin >> A[i];
    if( !P ) break;
    cout << solve() << endl;
  }
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

vi v;
int p(){
    vi vv;
    for(int i=2; i < 300000; i++) if(i%7 == 1 || i%7 == 6)vv.pb(i);
    rep(i, vv.size()){
        bool isP = false;
        rep(j, i){
            if(vv[i] < vv[j]*vv[j]) break;
            if(vv[i]%vv[j] == 0) isP = true;
        }
        if(!isP) v.pb(vv[i]);
    }
}



int main(){
    int n;
    p();
    while(cin >> n, n != 1){
        vi ans;
        rep(i, v.size()) if(n%v[i] == 0) ans.pb(v[i]);
        cout << n << ":";
        rep(i, ans.size()) cout << " " << ans[i];
        cout << endl;
    }
}

Measured memory_bytes: 1720
using static System.Math;
using System.Collections.Generic;
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var c = new double[n, 3];
        for (int i = 0; i < n; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < 3; j++)
                c[i, j] = double.Parse(line[j]);
        }
        getAns(n, m, c);
    }
    static void getAns(int n, int m, double[,] c)
    {
        var res = 0d;
        var imax = 1 << n;
        for (int i = 0; i < imax; i++)
        {
            if (countbit(i) == m)
            {
                var b = new List<int>();
                for (int j = 0; j < n; j++)
                    if (((i >> j) & 1) == 1) b.Add(j);
                res = Max(res, calc(b, c, m));
            }
        }
        Console.WriteLine(res);
    }
    static double calc(List<int> b, double[,] c, int m)
    {
        var res = 0d;
        for (int i = 0; i < m - 1; i++)
            for (int j = i + 1; j < m; j++)
                for (int k = 0; k < 3; k++)
                    res += (c[b[i], k] - c[b[j], k]) * (c[b[i], k] - c[b[j], k]);
        return res;
    }
    static int countbit(int bits)
    {
        bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
        bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
        bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
        bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
        return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff);
    }
}



Measured memory_bytes: 21972
import fractions
n = int(input())
l = list(map(int,input().split()))
if n == 1:
    print(1)
    exit()

def lcm(a,b):
    return a*b//fractions.gcd(a,b)
ans = l[0]
for i in range(1,n):
    ans = lcm(ans,l[i])
    

mod = 10**9+7
a = 0
for i in range(n):
    a += ans//l[i]
    
print(a%mod)


Measured memory_bytes: 6200
#include<stdio.h>

int binarySearch(int n, int key, int *S){

  int left=0,right=n,mid;

  while(left<right){
    mid=(left + right)/2;
    if(S[mid]==key){
      return mid;
    }
    else if(key<S[mid]){
      right=mid;
    }
    else{
      left=mid+1;
    }
}
    return 0;
}

    
int main(){

  int i,n,q,key,count=0;
  int S[100001];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(binarySearch(n,key,S)){
      count++;
    }
  }

  printf("%d\n",count);

  return 0;
}
 

Measured memory_bytes: 988
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    
    int N,Q; cin >> N >> Q;
    vector<int> c(N); for(auto& in:c) cin >> in;
    sort(c.begin(),c.end());
    
    while(Q--){
        int q; cin >> q;
        
        int base = q;
        int ans = -1;
        while(q < 300000){
            
            auto it = lower_bound(c.begin(), c.end(),q) - c.begin();
            if(it != 0){
                ans = max(ans,c[it-1]%base);
            }
            
            q += base;
        }
        
        cout << ans << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}



Measured memory_bytes: 4052
#include<bits/stdc++.h>
#define fr(i,x,y) for(int i=x;i<=y;++i)
#define rf(i,x,y) for(int i=x;i>=y;--i)
#define LL long long
using namespace std;
const int N=30;
struct data{
	int nt,to,w;
}a[N*N];
int b[N],head[N];
int n,m,cnt=0;

void add(int x,int y,int w){
	a[++cnt].to=y,a[cnt].w=w,a[cnt].nt=head[x],head[x]=cnt;
}

int main(){
	int L;scanf("%d",&L);
	int n=0;
	for(;(1<<n)-1<L;++n) ;
	fr(i,1,n-1) add(i,i+1,1<<(i-1)),add(i,i+1,0);
	fr(i,1,n-1) if((L>>(i-1))&1) add(i,n,(L>>i)<<i);
	printf("%d %d\n",n,cnt);
	fr(u,1,n) for(int i=head[u];i;i=a[i].nt){
		printf("%d %d %d\n",u,a[i].to,a[i].w);
	}
	return 0;
}

Measured memory_bytes: 256
import itertools

n, m, x = map(int, input().split())
c = []
a = []
for i in range(n):
  t = list(map(int, input().split()))
  c.append(t[0])
  a.append(t[1:])
ans = 10**10
for s in itertools.product(range(2), repeat=n):
  cost = 0
  skill = [0] * m
  for i in range(n):
    if s[i] == 0:
      continue
    cost += c[i]
    for j in range(m):
      skill[j] += a[i][j]
  if min(skill) >= x:
    ans = min(ans, cost)
if ans == 10**10:
  print(-1)
else:
  print(ans)


Measured memory_bytes: 9232
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

x, y = map(int, readline().split())

A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]


print('Yes' if (x in A and y in A) or (x in B and y in B) else 'No')


Measured memory_bytes: 3064
S = input()
N = len(S)

maxLength = 0

count = 0
for i in range(N):
    c = S[i]
    if c == 'A' or c == 'C' or c == 'G' or c == 'T':
        count += 1
    else:
        if maxLength < count:
            maxLength = count
        count = 0

if maxLength < count:
    maxLength = count

print(maxLength)

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

using namespace std;
const int N = 2e5 + 5;
int a[N], p[N], ans[N];
bool cmp(int i, int j) {return a[i] < a[j];}
int main()
{
    int n; cin >> n;
    int k = n/2;
    for (int i = 0; i < n; i++) cin >> a[i], p[i] = i;
    sort(p, p + n, cmp);
    for (int i = 0; i < k; i++) ans[p[i]] = a[p[k]];
    for (int i = k; i < n; i++) ans[p[i]] = a[p[k - 1]];
    for (int i = 0; i < n; i++) cout << ans[i] << "\n";

    return 0;
}


Measured memory_bytes: 4480
import           Data.Maybe
import           Data.List
import           Control.Monad

main = do
  [n,m,x] <- map read . words <$> getLine :: IO [Int]
  cas <- replicateM n $ map read . words <$> getLine :: IO [[Int]]
  let ans = solve cas x
  print $ if 1200001 == ans then -1 else ans


powerSetC cas = tail $ do
  chosen <- catMaybes <$> mapM (\n -> [Nothing, Just n]) cas
  return chosen

solve cas x = loop powerSetCAS
  where
    powerSetCAS = powerSetC cas
    loop [] = 1200001
    loop (y:ys) = if boolA then min sumC (loop ys) else loop ys
      where
        sumCA = check y
        sumC = head sumCA
        boolA = foldl (\n m-> (x <= m) && n) True $ tail sumCA

check ca = map sum $ transpose ca


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

int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    map<int,int>mp;
    long long ans =0;
    for(int i=0;i<n;i++){
        int sa = i- a[i];
        int wa = a[i] + i;
        ans += mp[sa];
        
        mp[wa] ++ ;
    }
    cout  << ans<< endl;
}

Measured memory_bytes: 21132
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+7;
const int mod =2019;
char a[maxn];
int b[maxn],c[2020];
int  Pow(int a,int b)
{
	 int res=1;
	 while(b){
	  if(b&1)  res=res*a%mod;
	  a=a*a%mod;
	  b>>=1;
	 }
	 return res%mod;
}
int main()
{
	scanf("%s",a+1);
	int n=strlen(a+1);
	for(int i=1;i<=n;i++)
	{
	b[i]=(mod+b[i-1]+(a[i]-'0')*Pow(10,(n-i))%mod)%mod;
	c[b[i]]++;
	} 
   long long sum=0;
   for(int i=0;i<2019;i++)
   	sum+=1ll*c[i]*(c[i]-1)/2;
   if(c[0]) cout<<sum+c[0]<<endl;
   else cout<<sum<<endl;	
	
}

Measured memory_bytes: 4636
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long N;
	cin >> N;
	vector<long long>H(N);
	long long MAX = -1;
	for (long long i = 0; i < N; i++) {
		cin >> H.at(i);
	}
	long long ans = 0;
	for (long long i = 0; i < 200; i++) {
		long long num = 0;
		bool check = false;
		for (long long j = 0; j < N; j++) {
			if (H.at(j) > 0) check = true;
		}
		if (!check) {
			cout << ans << endl;
			return 0;
		}
		if (H.at(0) > 0) {
			num++;
		}
		for (long long j = 1; j < N; j++) {
			if (H.at(j - 1) <= 0 && H.at(j) > 0) {
				num++;
			}
			H.at(j - 1)--;
		}
		H.at(N - 1)--;
		ans += num;
	}
}

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

int main() {
    int N;
    cin >> N;
    if (N == 1) {
        cout << 1 << endl;
    }
    else {
        ll temp0 = 2, temp1 = 1, temp = 0;
        rep(i, N - 1) {
            temp = temp1 + temp0;
            temp0 = temp1;
            temp1 = temp;
        }
        cout << temp << endl;
    }
}


Measured memory_bytes: 3624
n, m = map(int, input().split())
eg = [[] for _ in range(n + 1)]

al = [0] * m
bl = [0] * m

for i in range(m):
    a, b = map(int, input().split())
    eg[a].append(b)
    eg[b].append(a)
    al[i], bl[i] = a, b

ans = 0
for i in range(m):
    x, y = al[i], bl[i]
    q = [1]
    seen = {1}
    while len(q) > 0:
        v = q.pop()
        for t in eg[v]:
            if t in seen:
                continue
            elif (v == x and t == y) or (v == y and t == x):
                continue
            q.append(t)
            seen.add(t)
    if len(seen) != n:
        ans += 1
print(ans)


Measured memory_bytes: 68312
#include <iostream>
using namespace std;
int main() {
  string s;
  cin >> s;
  for(int i = 1; i < s.size(); ++i) {
    if(s[i] == s[i - 1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  return 0;
}

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

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

Measured memory_bytes: 256
n, k = map(int, input().split())
ans = 0
if k == 0:
    print(n * n)
    exit()
for b in range(k + 1, n + 1):
    p = n // b
    r = n % b
    ans += (b - k) * p
    if r >= k:
        ans += r + 1 - k
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#define PI 3.141592653589
#define N_MAX 100

int main()
{
  int n, i, j, k, ans, sum, count;
  while(1)
    {
      scanf("%d %d",&n,&ans);
      if(n == 0 && ans == 0) break;
      count = 0;
      for(i = 1; i <= n; i++)
	{
	  for(j = i + 1; j <= n; j++)
	    {
	      for(k = j + 1; k <= n; k++)
		{
		  sum = i + j + k;
		  if(sum == ans) count++;
		}
	    }
	}
      printf("%d\n",count);
    }
  return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int main(void){
  int n, m, i, j, sum;
  scanf("%d %d", &n, &m);
  int A[n][m], b[m];

  /* determinant A */
  for(i = 0; i < n; i++){
    for(j = 0; j < m; j++){
      scanf("%d", &A[i][j]);
    }
  }

  /* vector b */
  for(j = 0; j < m; j++)
    scanf("%d", &b[j]);

  /* vector c */
  for(i = 0; i < n; i++){
    sum = 0;
    for(j = 0; j < m; j++){
      sum += A[i][j] * b[j];
    }
    printf("%d\n", sum);
  }
  
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define N 1000005
using namespace std;
int n,m,sum,flag,x,y;
int main()
{
	ios::sync_with_stdio(false);
	cin >> x >> y;
	if (x == y)
		return cout << 0 << endl, 0;
 
	if (fabs(x) <= fabs(y))
	{
		sum=fabs(y)-fabs(x);
		if(x<0)
			sum++;
		if(y<0)
			sum++;
		cout << sum;
	}
	
	else
	{
		sum=fabs(x)-fabs(y);
		if(x>0)
			sum++;
		if(y>0)
			sum++;
		cout << sum;
	}	

}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

void findPrime(int N, vector<bool>& isPrime)
{
    isPrime.assign(N+1, true);
    isPrime[0] = isPrime[1] = false;
    for(int i=2; i*i<=N; i++){
        if(isPrime[i]){
            for(int j=i; i*j<=N; j++){
                isPrime[i*j] = false;
            }
        }
    }
}

int main()
{
    vector<bool> prime;
    findPrime(200000, prime);

    for(;;){
        int n, p;
        cin >> n >> p;
        if(n == -1)
            return 0;

        vector<int> a;
        for(int i=n+1; ; ++i){
            if(prime[i]){
                a.push_back(i);
                if(a.size() == p)
                    break;
            }
        }

        vector<int> b;
        for(int i=0; i<p; ++i){
            for(int j=i; j<p; ++j){
                b.push_back(a[i] + a[j]);
            }
        }
        sort(b.begin(), b.end());

        cout << b[p-1] << endl;
    }
}

Measured memory_bytes: 1304
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;
typedef long long ll ;
vector<int> matches; 

int KMP(string text , string cad){
    vector<int> T(cad.size()+1 , -1);
    int j=-1;
    T[0]=j;
    for(int i=1;i<=cad.size();i++){
      while(j>=0 && cad[j]!=cad[i-1] ) j=T[j];
      j++;
      T[i] = j;
    }
 
    //vector<int> matches; 
    matches.clear();
    j = 0;
     for(int i=0 ; i<text.size() ;i++){
        while(j >=0 && cad[j] != text[i]) j= T[j];
        j++;
        if(j == cad.size()) {
        matches.push_back(i + 1 - cad.size()); j=T[j] ; 
        //cout<<text.substr(matches.back())<<"\n";
        }
    }
    //cout<<text<<" "<<cad<<"\n";  
    return matches.size();
}

string cad1,cad2;
int n,q;
int acum[100005];
set<int> cont ;
int main(){
	fastio;
	cin>>n>>q;
	cin>>cad1;
	cad2 = "AC";
	KMP(cad1,cad2);
	for(int i=0; i<matches.size();i++){
		cont.insert(matches[i]+2);
	}
	
	for(int i=1; i<=n;i++){
		acum[i] = acum[i-1] ;
		if(cont.count(i)) acum[i]++;
	}
	
	for(int i=1; i<=q;i++){
		int x,y; cin>>x>>y;
		cout<<acum[y]-acum[x]<<"\n";
	}
	cout<<"\n";	
	return 0;
}


Measured memory_bytes: 3916
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    r = input()
    if r == 'RRR':
        print(3)
    elif r == 'RRS' or r == 'SRR':
        print(2)
    elif r == 'RSR' or r == 'RSS' or r =='SSR' or r =='SRS':
        print(1)
    elif r == 'SSS':
        print(0)
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 10304
N,X,Y = map(int, input().split())

#N <=2*10**3
#総当たりはN*(N-1) = 4*10**6　間に合う

ans_dict = {i:0 for i in range(1,N+1)}

for i in range(1,N+1):
    for j in range(i+1,N+1):
        #print(i,j)
        #ストレートで行くパターン
        straight = j-i
        #XYを経由するパターン
        throught_XY = min(abs(X-i),abs(Y-i))+min(abs(X-j),abs(Y-j))+1
        
        distance = min(straight,throught_XY)
        
        ans_dict[distance] += 1
        
for i in range(1,N):
    print(ans_dict[i])

Measured memory_bytes: 52188
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		int N = S.length();
		for(int i=0; i<N; i++)
			System.out.print("x");
		System.out.println();

		sc.close();
	}
}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

struct state
{
	int x, y, dir, cost;
};

struct comp : public binary_function<state &, state &, bool>
{
	bool operator() (const state &x, const state &y) const { return x.cost > y.cost; }
};

// dir = 0 を東向きとして dir が増加すると反時計回りに回転
int D[4] = { 1, 0, -1, 0 };

int W, H;
bool det[31][31][4];
int com[31][31];
int C[4];

bool ok(int x, int y) { return 0 <= x && x < W && 0 <= y && y < H; }
int left(int dir) { return (dir + 1) % 4; }
int right(int dir) { return (dir + 3) % 4; }

int main()
{
	while(cin>>W>>H, W|H)
	{
		for (int y = 0; y < H; y++)
		{
			for (int x = 0; x < W; x++)
			{
				cin >> com[y][x];
				for (int i = 0; i < 4; i++)
				{
					det[y][x][i] = false;
				}
			}
		}

		for (int i = 0; i < 4; i++) cin >> C[i];

		state init = { 0, 0, 0, 0 };

		priority_queue<state, vector<state>, comp> Q;
		Q.push(init);

		while (!Q.empty())
		{
			state s = Q.top();
			Q.pop();
			if (det[s.y][s.x][s.dir]) continue;
			det[s.y][s.x][s.dir] = true;

			if (s.x == W - 1 && s.y == H - 1)
			{
				cout << s.cost << endl;
				break;
			}

			int di[4] = { s.dir, s.dir + 3, s.dir + 2, s.dir + 1 };
			for (int i = 0; i < 4; i++)
			{
				int dir = di[i] % 4, x = s.x + D[dir], y = s.y + D[(dir + 1) % 4];
				if (!ok(x, y)) continue;
				state s2 = { x, y, dir, s.cost + (i == com[s.y][s.x] ? 0 : C[i]) };
				if (!det[s2.y][s2.x][s2.dir]) Q.push(s2);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1040