akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    int N;
    std::cin >> N;

    std::string S;
    S.reserve(N);
    std::cin >> S;

    auto result = std::count(S.cbegin(), S.cend(), 'R')
                  * std::count(S.cbegin(), S.cend(), 'G')
                  * std::count(S.cbegin(), S.cend(), 'B');

    for (auto first_idx = 0; first_idx < N - 2; first_idx++) {
        auto first = S.at(first_idx);

        for (auto step = 1; step <= (N - first_idx - 1) / 2; step++) {
            auto second = S.at(first_idx + step), third = S.at(first_idx + step * 2);
            if (first != second
                && first != third
                && second != third) {

                result--;
            }
        }
    }

    std::cout << result << std::endl;

    return 0;
}

Measured memory_bytes: 3628
/* template.cpp(shinobu_menkoi) {{{ */
#include <bits/stdc++.h>
using namespace std;

// clang-format off
#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) rep4(i, a, n, 1)
#define rep4(i, a, n, s) for (lint i = (a); i < (lint)(n); i += (s))
#define rrep(...) GET_MACRO(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rrep1(a) rrep2(_, a)
#define rrep2(i, a) rrep3(i, a, 0)
#define rrep3(i, a, n) rrep4(i, a, n, 1)
#define rrep4(i, a, n, s) for (lint i = (a); i >= (lint)(n); i -= (s))
#define each(i, ctn) for (auto &&i : (ctn))

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(v) begin(v), end(v)
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'
#define TEMP_T template <class T>
#define TEMP_TU template <class T, class U>

TEMP_T using vec = vector<T>;
TEMP_T using heap = priority_queue<T>;
TEMP_T using minheap = priority_queue<T, vec<T>, greater<T>>;
using lint = long long;
using ulint = unsigned long long;
using ld = long double;
using vi = vec<int>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<int, int>;
using vs = vec<string>;

TEMP_TU ostream &operator<<(ostream &os, const pair<T, U> &p) { return os << p.fi << " " << p.se; }
TEMP_TU istream &operator>>(istream &is, pair<T, U> &p) { return is >> p.fi >> p.se; }

const int INF{1001001001};
const lint LINF{1001001001001001001ll};
const int MOD{(int)1e9 + 7};
const double EPS{1e-9};
const double PI{acos(-1)};
const int dx[]{0, 1, 0, -1, 1, -1, 1, -1}, dy[]{1, 0, -1, 0, 1, -1, -1, 1};

inline bool inside(int y, int x, int h, int w) { return y >= 0 && x >= 0 && y < h && x < w; }
TEMP_T inline bool chmin(T &a, const T &b) { if (a > b) a = b; return a > b; }
TEMP_T inline bool chmax(T &a, const T &b) { if (a < b) a = b; return a < b; }
TEMP_T inline void print(const T &x) { cout << x << '\n'; }
TEMP_T inline void print(const vec<T> &v, string d = "\n") { rep(i, v.size()) cout << v[i] << (i == (lint)v.size() - 1 ? "\n" : d); }
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = string> vec<T> split(const string &s, char d = ',') {
  vec<T> v; stringstream ss(s); for (string b; getline(ss, b, d); ) {
    stringstream conv(b); T t; conv >> t; v.eb(t); } return v;
}
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } pre__;
// clang-format on
/* }}} */

signed main() {
  int n;
  cin >> n;
  vec<string> s(n);
  rep(i, n) cin >> s[i];
  string res;
  int f[256][60] = {};

  rep(i, n) {
    each(c, s[i]) f[c][i]++;
  }
  for (char i = 'a'; i <= 'z'; ++i) {
    int mi = INF;
    rep(j, n) {
      mi = min(mi, f[i][j]);
    }
    if (mi == 0) continue;
    rep(j, mi) {
      res += i;
    }
  }

  sort(all(res));
  print(res);
}


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

int main(){
  
  int n, sum = 0;
  cin >> n;
  
  for(int m = n; m >= 1; m /=10){
    sum += m % 10;
  }
  if(n % sum) cout << "No" << endl;
  else cout << "Yes" << endl;
  
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.Random;

public class Main {
    private static FastScanner sc = new FastScanner();
    private static boolean DEBUG_FLG = false;

    public static void main(String[] args) {
    	long W = sc.nextLong();
    	long H = sc.nextLong();
    	long x = sc.nextLong();
    	long y = sc.nextLong();
    	double ans = (double)W * H / 2;
    	if(W%2 == 0 && W/2 == x && H%2 == 0 && H/2 == y) {
    		System.out.println(ans + " " + 1);
    	} else {
    		System.out.println(ans + " " + 0);
    	}
    }

    static void debug(long... args) {
    	if(!DEBUG_FLG) return;
    	boolean flg = false;
    	for(long s : args) {
    		if(flg) System.out.print(" ");
    		flg = true;
    		System.out.print(s);
    	}
    	System.out.println();
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }

    static void shuffleArray(long[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            long tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }
    }
}


Measured memory_bytes: 22356
open Printf
open Scanf

type card = {suit : string; value : int}
              
let id x = x

let partition cmp a p r =
  let swap i j =
    let t = a.(i) in
    a.(i) <- a.(j);
    a.(j) <- t in
  let x = a.(r) in
  let rec iter i j =
    if j = r then begin swap (i+1) r; i+1 end
    else if cmp a.(j) x <= 0 then
      let ii = i+1 in
      swap ii j;
      iter ii (j+1)
    else iter i (j+1) in
  iter (p-1) p

let rec quick_sort cmp a p r =
  if p >= r then ()
  else let q = partition cmp a p r in
       quick_sort cmp a p (q-1);
       quick_sort cmp a (q+1) r
                  
let () =
  let n = scanf "%d\n" id in
  let ar = Array.init n (fun _ -> scanf "%s %d\n" (fun x y -> {suit = x; value = y})) in
  let ar2 = Array.copy ar in
  quick_sort (fun x y -> compare x.value y.value) ar 0 (n-1);
  Array.stable_sort (fun x y -> compare x.value y.value) ar2;
  printf "%s\n" (if ar = ar2 then "Stable" else "Not stable");
  Array.iter (fun x -> printf "%s %d\n" x.suit x.value) ar

Measured memory_bytes: 11084
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int a,p;cin>>a>>p;
  cout<<(a*3+p)/2<<endl;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

cnt = [[0] * 26 for i in range(26)]

for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')][ord(T[i]) - ord('a')] += 1

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

for i in range(26):
    n = 0
    for j in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

print("Yes")



Measured memory_bytes: 44912
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s;
    int counter = 0;
    if (s[0] == '1') ++counter;
    if (s[1] == '1') ++counter;
    if (s[2] == '1') ++counter;
    std::cout << counter << std::endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
	int h, w;
	cin >> h >> w;
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<vector<int>> ans(h, vector<int>(w));
    int num = 0;
    rep(x, n) rep(y, a[x]) {
        int i = num/w;
        int j = num%w;
        if (i%2) j = w-1-j;
        ans[i][j] = x+1;
        num++;
    }
	rep(i,h) {
        rep(j,w) {
            cout << ans[i][j];
            if(j!=w-1) cout << ' ';
        }
        cout << endl;
    } 
	return 0;
}


Measured memory_bytes: 384
a,b,c,d=map(int,input().split())
i="true"
while(i=="true"):
  c=c-b
  if(c<=0):
    print("Yes",end="")
    i="False"
  else:
    a=a-d
    if(a<=0):
      print("No",end="")
      i="False"

Measured memory_bytes: 9192
fn input_one<T: std::str::FromStr> () -> Result<T, T::Err> {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).unwrap();
    n.trim().parse()
}

fn main() {
    let s = input_one::<String>().unwrap();
    println!("{}", ['x'].repeat(s.len()).into_iter().collect::<String>());
}


Measured memory_bytes: 2112
#include <cstdio>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
using namespace std;
char a[111111],b[111111],*p;
char buf[222222];
map<string,bool> used;
set<string> res;
void solve(string s,map<string,vector<string> >& g)
{
  if(used[s])return;
  used[s]=true;
  vector<string>& w=g[s];
  for(int i=0;i<int(w.size());i++){
    if(g[w[i]].size()!=0)solve(w[i],g);
    else res.insert(w[i]);
  }
}
int main(void)
{
  int n;
  for(;;){
    scanf("%d",&n); if(!n)break;
    res.clear();
    used.clear();
    vector<string> v;
    map<string,vector<string> > g;
    for(int i=0;i<n;i++){
      scanf("%s",buf);
      sscanf(buf,"%[^:]:%[^.]",a,b);
      v.push_back(a);
      //printf("a:%s %d\n",a,strlen(a));
      p=strtok(b,",");
      vector<string>& r=g[a];
      while(p){
        r.push_back(p);
        //printf("%s %d\n",p,strlen(p));
        p=strtok(NULL,",");
      }
    }
    solve(v[0],g);
    printf("%d\n",res.size());
  }
  return 0;
}

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

#define ll long long
#define rep(i,n) for(int i=0;(i)<n;i++)

using namespace std;

int main()
{
	ll n, c; cin>>n>>c;
	vector<ll> a(n), ra(n);
	vector<ll> asum(n+1), rasum(n+1);
	vector<ll> amax(n+1, 0), ramax(n+1, 0);
	rep(i, n){
		cin>>a[i]>>asum[i+1];
		ra[n-i-1] = c-a[i];
		rasum[n-i] = asum[i+1];
	}
	asum[0] = 0; rasum[0] = 0;
	rep(i, n){
		asum[i+1] += asum[i];
		rasum[i+1] += rasum[i];
	}
	rep(i, n){
		asum[i+1] -= a[i];
		rasum[i+1] -= ra[i];
		amax[i+1] = max(amax[i], asum[i+1]);
		ramax[i+1] = max(ramax[i], rasum[i+1]);
	}
	ll ans = 0;
	//L->R
	rep(i, n){
		ll sum = 0;
		sum += rasum[i];
		if (i>0){
			sum += max(0ll, amax[n-i]-ra[i-1]);
		}else{
			sum += max(0ll, amax[n-i]);
		}
		ans = max(ans, sum);
	}
	//R->L
	rep(i, n){
		ll sum = 0;
		sum += asum[i];
		if (i>0){
			sum += max(0ll, ramax[n-i]-a[i-1]);
		}else{
			sum += max(0ll, ramax[n-i]);
		}
		ans = max(ans, sum);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>

using namespace std;

int main()
{
	// 入力
	int hp, dam;
	cin >> hp >> dam;

	int cnt = 0;

	while( hp > 0 )
	{
		hp -= dam;
		cnt ++;
	}

	// 出力
	cout << cnt << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll a, b;
    cin >> a >> b;
    auto f = [](ll x) {
        ll ans = 0;
        for(int i = 0; i <= 40; i++) {
            if(i) {
                ll m = x % (1ll << (i + 1));
                ans |= ll(m >= (1ll << i) and m % 2 == 0) << i;
            } else {
                ans |= x % 4 == 1 or x % 4 == 2;
            }
        }
        return ans;
    };
    cout << (f(b) ^ f(a - 1)) << endl;
    return 0;
}


Measured memory_bytes: 764
N,M=map(int,input().split())
d=[-1 for _ in range(N)]
for m in range(M):
  s,c=map(int,input().split())
  if d[s-1]==-1:
    d[s-1]=c
  elif d[s-1]!=c:
    print(-1)
    exit()

if N>1:
  if d[0]==0:
    print(-1)
    exit()
  elif d[0]==-1:
  	d[0]=1

A=0
for i in range(N):
  A=A*10+(d[i] if d[i]!=-1 else 0)

print(A)


Measured memory_bytes: 3064
N, M =map(int, input().split())
S = []
for i in range(M):
    S.append(list(map(int, input().split())))
P = list(map(int, input().split()))
ans = 0
for i in range(2):
    for j in range(2):
        for k in range(2):
            for l in range(2):
                for m in range(2):
                    for n in range(2):
                        for o in range(2):
                            for p in range(2):
                                for q in range(2):
                                    for r in range(2):
                                        SWL = [0,i, j, k, l, m, n, o, p, q, r]
                                        cnt = 0
                                        for f in range(M):
                                            SW = 0
                                            for g in S[f][1:]:
                                                SW += SWL[g]
                                            if SW % 2 == P[f]:
                                                cnt += 1
                                        if cnt == M:
                                            ans += 1
print(ans//(2 ** (10 - N)))


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;

int main(){
    string S;
    cin >> S;
    int N = S.size();
    int MOD = 1000000007;

    long long dp[100010][4] = {};
    for (int i = N; i >= 0; --i) {
        for (int j = 3; j >= 0; --j) {
            if (i == N) {
                dp[i][j] = (j == 3 ? 1 : 0);
            } else {
                dp[i][j] = dp[i+1][j] * (S[i] == '?' ? 3LL : 1LL);
                if (j < 3 && (S[i] == '?' || S[i] == "ABC"[j])) {
                    dp[i][j] += dp[i+1][j+1];
                }
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[0][0] << endl;
}

Measured memory_bytes: 3584
#include <stdio.h>


int main()
{
	int A[100], N, sw=0;
	scanf("%d", &N);
	for (int i = 0; i < N; i++)scanf("%d", &A[i]);
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = N - 1; j >= i + 1; j--) {
			if (A[j] < A[j - 1]) {
				int k = A[j];
				A[j] = A[j - 1];
				A[j- 1] = k;
				flag = 1;
				sw++;
			}
		}
	}
	
	for (int i = 0; i < N; i++) {
		if (i)printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
	printf("%d\n",sw);
		return 0;
}



Measured memory_bytes: 2740
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define debug(x) cerr << #x << " " << x << endl;
#define debug_p(x) cerr << #x << " [" << x.fi << " " << x.se << "]"<<endl;
#define debug_v(x) {cerr << #x << " "; for (auto ioi : x) cerr << ioi << " "; cerr << endl;}
#define debug_vp(x) {cerr << #x << " "; for (auto ioi : x) cerr << '[' << ioi.fi << " " << ioi.se << ']'; cerr << endl;}
#define debug_v_v(x) {cerr << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cerr << ioi2 << " "; cerr << '\n';} cerr << "*/" << #x << endl;}
#define gen_clock(x) ll x = clock(); cerr << "Clock " << #x << " created" << endl;
#define check_clock(x) cerr << "Time spent in " << #x << ": " << (double)(clock() - x)/CLOCKS_PER_SEC << endl; x = clock();
#define reset_clock(x) x = clock()

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

vi adj[200009];
bool vis[200009];
int par[200009];

void bfs(int s)
{
	queue<int> q;
	q.push(1);
	par[1]=vis[1]=1;
	while(!q.empty())
	{
		int temp=q.front();
		q.pop();
		for(auto u:adj[temp])
		{
			if(vis[u]) continue;
			vis[u]=1;
			par[u]=temp;
			q.push(u);
		}
	}
}

void solve()
{
	int n,m,i,x,y;
	cin>>n>>m;
	for(i=0;i<m;i++)
	{
		cin>>x>>y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	bfs(1);
	for(i=1;i<=n;i++)
	if(!vis[i])
	{
		cout<<"No";
		return;
	}
	//memset(dist,-1,sizeof dist);
	cout<<"Yes\n";
	for(i=2;i<=n;i++)
	cout<<par[i]<<'\n';
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


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

Measured memory_bytes: 256
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if (i+j) % 2 == 0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()


Measured memory_bytes: 7000
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

using namespace std;

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<vector<int>> A(N, vector<int>(3));
    for (int i=0; i<N; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        A[i][0] = a;
        A[i][1] = b;
        A[i][2] = c;
    }

    vector<vector<int>> dp(N, vector<int>(3, 0));
    dp[0] = {A[0][0], A[0][1], A[0][2]};
    for (int i=1; i<N; i++) {
        dp[i][0] = max(dp[i-1][1]+A[i][0], dp[i-1][2]+A[i][0]);
        dp[i][1] = max(dp[i-1][0]+A[i][1], dp[i-1][2]+A[i][1]);
        dp[i][2] = max(dp[i-1][0]+A[i][2], dp[i-1][1]+A[i][2]);
    }

    cout << *max_element(dp[N-1].begin(), dp[N-1].end()) << endl;

    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main(){
    
    // 1. 入力情報.
    LL N, A, B;
    scanf("%lld %lld %lld", &N, &A, &B);
    
    // 2. 最小のラウンド数は？
    LL ans = 0;
    if((B - A) & 1){
        // 卓 1, N のうち, 近い方は？
        LL near = min(A - 1, N - B);
        
        // A, B の いずれかが, 卓 1, N に 到達し, 1回停止できるように勝敗をコントロール.
        ans = near + 1;
        
        // A, B が お互いに近づくように勝敗をコントロール.
        if(near == A - 1) ans += (B - near - 1) / 2;
        else              ans += (N - near - 1 - A) / 2;
    }else{
        ans = (B - A) / 2;
    }
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

//関数
//最大公約数
long long gcd(long long m,long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m,long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x,long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//nCr
long long C(long long n, long long r);
//nCr (mod)
long long modC(long long n, long long r) {
    vector<long long> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (long long i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%mod;
        inv[i]=mod-((mod/i)*inv[mod%i])%mod;
        invf[i]=(inv[i]*invf[i-1])%mod;
    }
    long long cmb=f[n]*(invf[r]*invf[n-r]%mod)%mod;
    if (n>=r) return cmb;
    else return 0;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  lin(a);lin(b);lin(N);
  if(a>N)
    cout<<a-N<<" "<<b;
  else{
    b-=N-a;
    if(b>0)
      cout<<0<<" "<<b;
    else
      cout<<0<<" "<<0;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b;
int n;
int sum;
int s[100005];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s[i];
		sum+=abs(s[i]-s[i-1]);
		if(i==n) sum+=abs(s[i]);
	}
	for(int i=1;i<=n;i++){
		int ans=sum+abs(s[i-1]-s[i+1]);
		ans-=abs(s[i-1]-s[i])+abs(s[i]-s[i+1]);
		cout<<ans<<endl;
	}	
	return 0;
}
/*

2 2
*/

Measured memory_bytes: 1664
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), sum = 0, not10 = 101;
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
			sum += s[i];
			if (s[i]%10 != 0 && not10 > s[i]) {
				not10 = s[i];
			}
		}
		if (sum % 10 == 0) {
			if (not10 != 101) {
				sum -= not10;
			} else {
				sum = 0;
			}
		}
		System.out.println(sum);
	}

}


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

int prime_factors(long long x){
    set<int>s;
    if(x%2 == 0){
        s.insert(2);
        while(x%2 == 0){
            x /= 2;
        }
    }
    for(int i = 3; i <= sqrt(x); i++){
        if(x%i == 0){
            s.insert(i);
            while(x%i == 0){
                x/= i;
            }
        }
    }
    if(x > 1){
        s.insert(x);
    }
    
    return s.size();
    
}


int main(){
    
    long long a, b;
    cin >> a >> b;
    long long g = __gcd(a, b);
    
    long long factors = prime_factors(g);
    
    cout << factors + 1 << endl;
}


Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <algorithm>

template <class T>
struct Edge {
    int from, to;
    T cost;
    Edge(int from = -1, int to = -1, T cost = 1) : from(from), to(to), cost(cost) {}

    bool operator<(const Edge<T>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<T>& e) const { return this->cost > e.cost; }
};

template <class T = int>
class Graph {
public:
    explicit Graph(int N = 0) : size(N) { path.resize(size); }
    void span(int u, int v, T cost = 1) { path[u].push_back(Edge<T>(u, v, cost)); }
    std::vector<Edge<T>> operator[](int v) const { return path[v]; }

    int size;
    std::vector<std::vector<Edge<T>>> path;
};

template <class T = int>
class Lowlink {
public:
    Graph<T> graph;
    int cur;
    std::vector<int> order, low;
    std::vector<int> artics;
    std::vector<Edge<T>> bridges;

    void dfs(int v, int r) {
        order[v] = low[v] = cur++;
        int deg = 0;
        bool is_artic = false;

        for (auto e : graph[v]) {
            if (order[e.to] < 0) {
                ++deg;
                dfs(e.to, e.from);
                low[e.from] = std::min(low[e.from], low[e.to]);

                if (order[e.from] <= low[e.to]) is_artic = true;
                if (order[e.from] < low[e.to]) bridges.push_back(e);
            } else if (e.to != r) {
                // eは後退辺 1回だけ遡る
                low[e.from] = std::min(low[e.from], order[e.to]);
            }
        }

        if (r < 0) is_artic = (deg > 1);
        if (is_artic) artics.push_back(v);
    }

    explicit Lowlink(const Graph<T> graph)
        : graph(graph), order(graph.size, -1), low(graph.size, graph.size) {
        cur = 0;
        for (int v = 0; v < graph.size; ++v) {
            if (order[v] < 0) dfs(v, -1);
        }
    }
};

int main() {
    int N, M;
    std::cin >> N >> M;
    Graph<> graph(N);
    for (int i = 0; i < M; ++i) {
        int u, v;
        std::cin >> u >> v;
        graph.span(u, v);
        graph.span(v, u);
    }

    Lowlink<> lowlink(graph);
    std::sort(lowlink.artics.begin(), lowlink.artics.end());
    for (auto v : lowlink.artics) {
        std::cout << v << std::endl;
    }
    return 0;
}



Measured memory_bytes: 9448
#include "bits/stdc++.h"
using namespace std;
 
int N;
int A[20];
int x[20][20];
int y[20][20];
 
int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}
 
void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        for(int j = 1; j <= A[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans = 0;
    for(int bits = 1; bits < (1 << N); bits++) {
        bool ok = true;
        for(int i = 1; i <= N; i++) {
            if(!(bits & (1 << (i-1)))) continue;
            for(int j = 1; j <= A[i]; j++) {
                if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if(ok) ans = max(ans, counter(bits));
    }
    cout << ans << endl;
    return;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce
import sys
sys.setrecursionlimit(4100000)
from functools import lru_cache

#ここから書き始める
s = input()

def dfs(index, ret, op1, op2, op3):
    if index == 4:
        if ret == 7:
            print(s[0] + op1 + s[1] + op2 + s[2] + op3 + s[3] + "=7")
            sys.exit()
    if index == 1:
        dfs(index + 1, ret + int(s[index]), "+", op2, op3) or dfs(index + 1, ret - int(s[index]), "-", op2, op3)
    if index == 2:
        dfs(index + 1, ret + int(s[index]), op1, "+", op3) or dfs(index + 1, ret - int(s[index]), op1, "-", op3)
    if index == 3:
        dfs(index + 1, ret + int(s[index]), op1, op2, "+") or dfs(index + 1, ret - int(s[index]), op1, op2, "-")

dfs(1, int(s[0]), "", "", "")


Measured memory_bytes: 63980
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int N,count=0;
	long long int A[100000],hen1,hen2;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lld", &A[i]);
	}
	sort(A, A + N, greater<int>());
	for (int i = 0; i < N; i++) {
		if (count == 1) {
			if (A[i] == A[i + 1]) {
				hen2 = A[i];
				i++;
				count++;
			}
		}
		if (count == 0) {
			if (A[i] == A[i + 1]) {
				hen1 = A[i];
				i++;
				count++;
			}
		}
		
		if (count == 2) {
			printf("%lld", hen1 * hen2);
			return 0;
		}
	}
	printf("0");
	return 0;
}

Measured memory_bytes: 896
import sys
input = sys.stdin.readline
class UnionFind:
    def __init__(self,n):
        self.par = [i for i in range(n)] #親
        self.rank = [1]*n #深さ
        self.size = [1]*n #size[i]:=iを根とするグループのサイズ
    
    def find(self,x):
        if self.par[x] == x:
            return x
        else:
            return self.find(self.par[x])
            
    def unite(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                self.par[x] = y
                self.size[y] += self.size[x]
            else:
                self.par[y] = x
                self.size[x] += self.size[y]
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1
                    
    def same(self,x,y):
        return self.find(x) == self.find(y)
        
    def group_size(self,x):
        return self.size[self.find(x)]
n, m = map(int,input().split())
bridge = [list(map(lambda x:x-1,list(map(int,input().split())))) for i in range(m)]
uf = UnionFind(n)
res = []
inc = n*(n-1)//2
res.append(inc)
for x,y in list(reversed(bridge)):
    if uf.same(x,y):
        res.append(inc)
        uf.unite(x,y)
    else:
        inc -= (uf.group_size(x)*uf.group_size(y))
        res.append(inc)
        uf.unite(x,y)
res.reverse()
for ans in res[1:]:
    print(ans)

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

using namespace std;

#define inf 1ll<<60
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> P;


int main(){
	int N;
	llong h[100000];
	llong dp[100000];
	fn(dp, 100000, inf);
	cin >> N;
	for(int i = 0; i < N; i++)
		cin >> h[i];
	dp[0] = 0, dp[1] = abs(h[1] - h[0]);
	for(int i = 1; i < N; i++){
		dp[i] = min({dp[i], dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2])});
	}

	cout << dp[N-1] << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

int N;
int d[100];
int n[100];

int main(){
    cin >> N;
    for (size_t i = 0; i < N; i++) {
      cin >> d[i];
    }
    
    set<int> values;
    for (size_t i = 0; i < N; i++) {
      values.insert(d[i]);
    }
    
    cout << values.size(); 
    return 0;
}


Measured memory_bytes: 256
def q2():
    N = int(input())
    W = [int(i) for i in input().split()]
    min_abs = 100*100
    for i in range(N-1):
        new_abs = abs(sum(W[0:i+1]) - sum(W[i+1:]))
        min_abs = min(min_abs, new_abs)
    print(min_abs)

    
if __name__ == '__main__':
    q2()


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define MAXN 50000

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

	int n, i, j, k, ans;
	cin >> n;
	vector<int> a(n), b(n), c(n, 0);
	for (i = 0; i < n; i++) cin >> a[i];
	for (i = 0; i < n; i++) cin >> b[i];
	for (i = 1; i < n; i++) cin >> c[i];

	ans = 0;
	for (i = 0; i < n; i++) {
		a[i]--;
		ans += b[i];
		if ((i > 0) && (a[i] == a[i - 1] + 1)) ans += c[a[i]];
	}
	
	cout << ans << "\n";

	return 0;
}


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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) for(int i = 0; i < n; ++i)
#define _ << " " <<

typedef long long ll;
typedef pair<int, int> point;

int readint() {
   int ret = 0, d;
    d = getchar();
    while (d < 48 || d > 57)
       	d = getchar();
    do {
        ret = ret * 10 + d - 48;
        d = getchar();
    } while (d > 47 && d < 58);
    return ret;
}

const int MAXN = 2e4 + 5;

int a[MAXN], b[MAXN], p[MAXN];

int main() {

   int n = readint();

   REP(i, n) p[i] = readint();

   a[0] = MAXN;
   b[0] = MAXN * n;

   FOR(i, 1, n) {
      a[i] = a[i - 1] + MAXN;
      b[i] = b[i - 1] - MAXN;
   }

   REP(i, n) {
      a[p[i] - 1] += i;
   }

   REP(i, n) cout << a[i] << " ";
   cout << endl;
   REP(i, n) cout << b[i] << " ";
}


Measured memory_bytes: 896
n = int(input())
a = list(map(int,input().split()))
s = []
tmp = 0
for i in range(n-1):
    tmp += a[i]
    s.append(tmp)

ans = 10**9
total = sum(a)
for i in s:
    ans = min(ans, abs(total-2*i))
print(ans)

Measured memory_bytes: 9128
class UnionFind:
    def __init__(self, size):
        self.data = [-1] * size
    def find(self, x):
        if self.data[x] < 0:
            return x
        else:
            self.data[x] = self.find(self.data[x])
            return self.data[x]
    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x != y:
            if self.data[y] < self.data[x]:
                x, y = y, x
            self.data[x] += self.data[y]
            self.data[y] = x
        return (x != y)
    def same(self, x, y):
        return (self.find(x) == self.find(y))
    def size(self, x):
        return -self.data[self.find(x)]

N, M, *AB = map(int, open(0).read().split())

uf = UnionFind(N + 1)
for a, b in zip(*[iter(AB)] * 2):
    uf.union(a, b)

print(max(uf.size(i) for i in range(1, N + 1)))

Measured memory_bytes: 57144
#include <stdio.h>

int main(void){
    int n,i;
    int a[100];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++){
        printf("%d",a[n-i-1]);
        if(i<n-1) printf(" ");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 1816
n = int(input())
A = [list(map(int,input().split())) for i in range(n)]

# B = [[[0, 0] for i in range(n)] for j in range(n)]
if n == 1:
    print(1)
else:

    D = {}
    for i in range(n):
        for j in range(n):
            if i != j:
                dy = A[i][1] - A[j][1]
                dx = A[i][0] - A[j][0]
                try:
                    D[(dx, dy)] += 1
                except:
                    D[(dx, dy)] = 1
    # print(D)
    ans = n - max(list(D.values()))
    print(ans)

Measured memory_bytes: 39536
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

vector<int> edge[110000];
int memo[110000];

int dp(int v) {
  if(memo[v]!=-1) return memo[v];
  int ans = 0;
  for(int to : edge[v]) {
    ans = max(ans,dp(to)+1);
  }
  memo[v] = ans;
  return ans;
}

int main() {
  int n, m;
  cin >> n >> m;
  rep(i,m) {
    int x, y;
    cin >> x >> y;
    edge[x].push_back(y);
  }
  rep(i,110000) memo[i] = -1;
  int ans = 0;
  for(int v = 1; v<=n; v++) {
    ans = max(ans,dp(v));
  }
  cout << ans << endl;
  return 0;
}

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

#pragma GCC optimize("O3")
#pragma GCC target("sse4")
// io
#define get(i) scanf("%d", &i)
#define flush fflush(stdin)

// manipulations
#define f(i, n) for (int i = 0; i < n; i++)
#define fr(i, n) for (int i = n - 1; i >= 0; i--)
#define ff(i, a, b) for (int i = a; i <= b; i++)
#define sz(x) int((x).size())
#define fi first
#define se second

// built-in
#define bitcount __builtin_popcount
#define gcd __gcd

// short
#define pb push_back
#define fill(arr, a) memset(arr, a, sizeof(arr))
#define mp(a,b) make_pair(a,b)

// useful bits
#define IN(i,l,r) (i >= l && i <= r);
#define relax(a,b) a = max(a,b);
#define relaxi(a,b) a = min(a,b);

typedef vector<int> VI;
typedef pair<int, int> PII;
typedef long long ll;
typedef long double ld;

ll modpow(ll a, ll b, ll mod = (ll) (1e9 + 7)) 
{if (!b) return 1; a %= mod; return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod;}

// for rand
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// use uniform_int_distribution<int>(0, i)(rng)



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	#ifndef ONLINE_JUDGE
//	freopen("output.txt", "w" , stdout);
	/* freopen("in.txt" , "r" , stdin); */
	/* clock_t start = clock(); */
	#endif

	int a;
	string s;
	cin >> a >> s;
	s = a < 3200? "red" : s;
	cout << s << endl;

	#ifndef ONLINE_JUDGE
	/* cout << setprecision(12) << ld(clock()-start) / CLOCKS_PER_SEC << endl; */
	#endif
	return 0;
}



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

int main() {
    double a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    double wat,sug,con,watmax;
    double sugmax = 0;
    double conmax = 0;
    for (int x=0; x<=30; x++){
        for (int y=0; y<=30; y++){
            wat = 100*(a*x+b*y);
            if (wat <= f){
                for (int z=0; z<=3000; z++) {
                    for (int w=0; w<=3000; w++){
                        sug = c*z+d*w;
                        if (sug == 0) {
                            con = 0;
                            if (con <= 100*e/(100+e) && con >= conmax){
                                conmax = con;
                                sugmax = sug;
                                watmax = wat;
                            }
                        }
                        else if (wat+sug>0 && wat+sug<=f){ 
                            con = 100*sug / (wat+sug);
                            if (con <= 100*e/(100+e) && con > conmax){
                                conmax = con;
                                sugmax = sug;
                                watmax = wat;
                            }
                            else continue;
                        }
                        else continue;
                    }
                }
            }
            else continue;
        }
    }
    cout << watmax+sugmax << " " << sugmax << endl;
    return 0;
}

Measured memory_bytes: 256
A,B,H,M = map(int,input().split())

import math

minute = math.pi*2*M/60
hour = math.pi*2*H/12 + math.pi*(1/6)*M/60

cos = math.cos(abs(hour-minute))

ans = math.sqrt(A**2+B**2-2*A*B*cos)

print(ans)

Measured memory_bytes: 62544
N,K = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))

A.sort()
F.sort(reverse=True)

sumA = sum(A)
if  K >= sumA:
    print(0)
    exit()

def isok(x):
    k = 0
    for a, f in zip(A, F):
        if a > x//f:
            k += a - (x//f)
            if k > K:
                return False
    return True

ng = -1
ok = 10**12+1

while ok - ng > 1:
    mid = (ok + ng)//2
    if isok(mid):
        ok = mid
    else:
        ng = mid
print(ok)

Measured memory_bytes: 119500
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  vector<char>c(6);
  for(int i=0;i<6;i++)cin>>c[i];
  if(c[0]==c[5] && c[1] ==c[4] && c[2]==c[3])cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}
  

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }
    var sum = 0.0
    if (n >= k) {
        sum += (n - k + 1) / n.toDouble()
    }
    val min = Math.min(n, k - 1)
    var sub = 0.0
    for (i in 1..min) {
        var cnt = 0
        var now = i
        while (now < k) {
            now *= 2
            cnt++
        }
        sub += 1 / Math.pow(2.0, cnt.toDouble())
    }
    sum += sub * (1 / n.toDouble())
    println(sum)
}


Measured memory_bytes: 36128
n = int(input())
s = input()

w = [0] * (n + 1)
e = [0] * (n + 1)
a = [0] * n
for i, x in enumerate(s):
    if x == 'W':
        w[i+1] = w[i] + 1
        e[i+1] = e[i]
    else:
        w[i+1] = w[i]
        e[i+1] = e[i] - 1
    a[i] = w[i] + e[i+1]

print(n - w[-1] + min(a))


Measured memory_bytes: 29520
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> C(4, 0);
    for (int i = 0; i < N; i++)
    {
        string S;
        cin >> S;
        if (S == "AC")
        {
            C[0]++;
        }
        else if (S == "WA")
        {
            C[1]++;
        }
        else if (S == "TLE")
        {
            C[2]++;
        }
        else
        {
            C[3]++;
        }
    }
    cout << "AC x " << C[0] << endl;
    cout << "WA x " << C[1] << endl;
    cout << "TLE x " << C[2] << endl;
    cout << "RE x " << C[3] << endl;

    return 0;
    
}

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

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

const int Maxn = 105;

int n;
int L[Maxn];
int res;

bool Trian(int a, int b, int c)
{
    if (a > b) swap(a, b);
    if (b > c) swap(b, c);
    if (a > b) swap(a, b);
    return a + b > c;
}

int main()
{
    scanf("%d", &n);
    int res = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &L[i]);
        for (int j = i - 1; j >= 0; j--) if (L[j] != L[i])
            for (int k = j - 1; k >= 0; k--) if (L[k] != L[j] && L[k] != L[i])
                res += Trian(L[i], L[j], L[k]);
    }
    printf("%d\n", res);
    return 0;
}


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

int main() {
  long long int x;
  cin >>x;
  long long int count=0,a=100;
  while(a>0){
    a *= 1.01;
    count++;
    if(x <=a) break;
  }
  cout << count << endl;
}


Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
from math import sqrt
# import numpy as np


n = int(input())

for i in range(n):
    tmp = input().split(' ')
    
    a, b, c = [(float(tmp[i]), float(tmp[i+1])) for i in range(0, len(tmp), 2)]
    
    #A = np.array(((a[0], a[1], 1),
    #              (b[0], b[1], 1),
    #              (c[0], c[1], 1)))
    A_tmp1 = 1/(a[0]*b[1] + a[1]*c[0] + b[0]*c[1] - b[1]*c[0] - a[1]*b[0] - a[0]*c[1])
    A_tmp2 = [[b[1]-c[1], -(a[1]-c[1]), a[1]-b[1]],
              [-(b[0]-c[0]),  (a[0]-c[0]), -(a[0]-b[0])],
              [b[0]*c[1] - b[1]*c[0], -(a[0]*c[1] - a[1]*c[0]), a[0]*b[1] - a[1]*b[0]]]
    A = [list(map(lambda x: A_tmp1*x, A_tmp2[i])) for i in range(3)]
    
    #B = np.array((((-(a[0]**2 + a[1]**2))),
    #              ((-(b[0]**2 + b[1]**2))),
    #              ((-(c[0]**2 + c[1]**2)))))
    B = [[-(a[0]**2 + a[1]**2)],
         [-(b[0]**2 + b[1]**2)],
         [-(c[0]**2 + c[1]**2)]]
    
    
    tmp = [sum([A[i][j]*B[j][0] for j in range(3)]) for i in range(3)]
    # tmp = np.dot(np.linalg.inv(A), B)
    
    x = -tmp[0]/2
    y = -tmp[1]/2
    r = sqrt((tmp[0]**2 + tmp[1]**2 - 4*tmp[2])/4)
    
    print('{:.3f} {:.3f} {:.3f}'.format(x, y, r))


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

int main()
{
    int n;
    cin >> n;
    int a[100002];
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) if(a[i] % 2){
        cout << "first" << endl;
        return 0;
    }
    cout << "second" << endl;
}

Measured memory_bytes: 640
h = {}

while line = gets
  key, value = line.chomp.split
  h[key] ? h[key] << value.to_i : h[key] = [value.to_i]
end

h.each do |k, v|
  h[k].sort!
end

h.sort.each do |str, arr|
  puts str, arr.join(" ")
end

Measured memory_bytes: 6092
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    
        var sc = new Scanner(System.in);
        
        int h1 = Integer.parseInt(sc.next());
        int m1 = Integer.parseInt(sc.next());
        int h2 = Integer.parseInt(sc.next());
        int m2 = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
    
        System.out.println(h2*60 + m2 - (h1*60 + m1) - k);
    }
}

Measured memory_bytes: 35628
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb push_back;
#define sp " ";
#define INF 10000000000
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    vector<lli> mi,ma;
    int n;
    int ans;
    cin>>n;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        mi.push_back(a);
        ma.push_back(b);
    }
    sort(mi.begin(),mi.end());
    sort(ma.begin(),ma.end());
    if(n%2==0){
        int x=mi.at(n/2-1)+mi.at(n/2);
        int y=ma.at(n/2-1)+ma.at(n/2);
        ans=y-x+1;
    }
    else{
        int x=mi.at((n+1)/2-1);
        int y=ma.at((n+1)/2-1);
        ans=y-x+1;
    }
    out(ans);
}

Measured memory_bytes: 6556
#include<iostream>
#include<string>
#include<algorithm>

typedef long long ll;
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (c >= a && c <= b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


int main(int argc, char const *argv[]) {
    string s;
    cin >> s;
    int n = s.length();
    long long num_w=0,res=0;
    for(int i = n-1;i>-1;i--){
        if(s[i]=='W')num_w++;
        else res+=num_w;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 640
#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;
using ll = long long;

int main()
{
  int N, A, B; cin >> N >> A >> B;

  printf("%d %d\n", min(A, B), max(0, A+B-N));
}

Measured memory_bytes: 256
/**
 * author: moririn_cocoa       
**/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

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

return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <cmath>
#include <cstdint>
using namespace std;

int main() {
    uint32_t x; cin >> x;
    if (x == 2) { cout << 2 << endl; return 0; }
    if (!(x & 1))++x;

    uint32_t ret;

    for (uint32_t i = x; ; i += 2) {
        bool found = true;
        for (uint32_t j = 3; j <= sqrt(i); j += 2)
            if (!(i % j)) { found = false; break; }
        if (found) { ret = i; break; }
    }

    cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define Endl '\n'

template <class T>
void updatemax(T& a, T b) { if (b > a) a = b; }

const int MaxN = 2e5;
int a[MaxN+1];
int main() {
    fastio;
    ll ans=0, N;
    cin >> N;
    map<int,int> s;
    rep1(i,N) {
        int t;
        cin >> t;
        a[i] = t;
        s[t + i]++;
    }
    rep1(j,N) {
        int d = j - a[j];
        if (s.count(d))
            ans += s[d];
    }
    cout << ans << Endl;
}


Measured memory_bytes: 13752