akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>
#include <cmath>
#include <stdio.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    int N;
    cin >> N;

    vector<int> v(N);
    int cnt = 0;
    for(int i = 0; i < N; i++){
        cin >> v[i];
        if(v[i] == i + 1) cnt ++;
    }

    if(cnt >= N - 2) cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 256
#include<cstdio>
const int MOD = int(1E9) + 7;
const int MAXN = 2000;
int A[MAXN + 5], N, K;
int main() {
	scanf("%d%d", &N, &K);
	for(int i=0;i<N;i++) scanf("%d", &A[i]);
	int ans = 0;
	for(int i=0;i<N;i++)
		for(int j=i+1;j<N;j++)
			if( A[i] > A[j] ) ans++;
	ans = 1LL*ans*K%MOD;
	int tmp = 0;
	for(int i=0;i<N;i++)
		for(int j=0;j<N;j++)
			if( A[i] > A[j] ) tmp++;
	ans = (ans + 1LL*K*(K-1)/2%MOD*tmp%MOD)%MOD;
	printf("%d\n", ans);
}

Measured memory_bytes: 128
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

int main() {
    int N, count = 0;
    string able = "Yes";
    cin >> N;
    vector<pair<int, int>> pairs(N);
    for(int i = 0; i < N; i++) {
        cin >> pairs.at(i).first >> pairs.at(i).second;
    }
    sort(pairs.begin(), pairs.end(), compare_by_b);
    for(int i = 0; i < N; i++) {
        count += pairs.at(i).first;
        if(count > pairs.at(i).second)
            able = "No";
    }
    cout << able << endl;
}

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

bool check(int a, int b, int c){
  if(a==b && b!=c) return true;
  if(a==c && a!=b) return true;
  if(b==c && b!=a) return true;
  return false;
}

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  
  bool flag = check(a, b, c);
  if(flag) cout << "Yes";
  else cout << "No";
  
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    char c[N];
    REP(i, N){
        cin >> c[i];
    }

    int wp, rp = 0, ans = 0;
    bool flag = false;
    REPD(i, N){
        if(c[i] == 'R'){
            while (rp < i){
                if (c[rp] == 'W'){
                    c[i] = 'W';
                    c[rp] = 'R';
                    ans++;
                    break;
                }
                ++rp;
            }
        }
    }

    cout << ans << endl;
}


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

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 2e2 )+10;
const int MOD  = int( 360 );
const int oo   = INT_MAX;

int c[10][10];
int n,m;

int main( ) {

  #ifdef LOCAL
    freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif
  while( cin >> n >> m ) {
    for( int i = 0; i < 10; ++i ) {
      for( int j = 0; j < 10; ++j ) {
        cin >> c[i][j];
      }
    }

    for( int k = 0; k < 10; ++k ) {
      for( int i = 0; i < 10; ++i ) {
        for( int j = 0; j < 10; ++j ) {
          c[i][j] = min( c[i][j], c[i][k] + c[k][j] );
        }
      }
    }
    ll sum = 0;
    int cur;
    for( int i = 0; i < n; ++i ) {
      for( int j = 0; j < m; ++j ) {
        cin >> cur;
        if( cur != -1 ) sum += c[cur][1];
      }
    }
    cout << sum << '\n';

  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define STRING_LENGTH 100000
#define ARRAY_SIZE (STRING_LENGTH + 1)

void printOdds(char s[ARRAY_SIZE]);


int main()
{
  char s[ARRAY_SIZE];

  scanf("%s", &s);

  printOdds(s);

  return 0;
}

void printOdds(char s[ARRAY_SIZE])
{
  int i;

  i = 0;
  while (s[i] != '\0')
    {
      printf("%c", s[i]);
      i++;
      if(s[i] == '\0')
	{
	  break;
	}
      i++;
    }
  printf("\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

signed main() {
	int a;
	double b;
	
	cin >> a >> b;
	int B = b * 100 + (1e-9);
	
	cout << a * B / 100 << endl;
	return 0;
}

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

string calc(int total, int idx, string formula, string s) {
    if (s.size() <= idx) return total == 7 ? formula+"=7" : "";
    char n_c = s.at(idx);
    int n = n_c - '0';
    string n_s = to_string(n);
    if (idx == 0) return calc(n, idx + 1, n_s, s);
    string plus = calc(total + n, idx + 1, formula + "+" + n_s, s);
    string minus = calc(total - n, idx + 1, formula + "-" + n_s, s);
    return plus == "" ? minus : plus;
}

void solve() {
    string S;
    cin >> S;
    string x = calc(0, 0, "", S);
    cout << x << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#define ll long long
using namespace std;

int main(){
	ll n, cnt=0, x, y;
	cin >> n;
	for (ll i=2; i*i<=n; i++){
		if (n%i!=0) continue;

		x = n;
		while(x%i==0) x/=i;
		x%=i;
		if (x==1) cnt++;
		
		y = n, x=n/i;
		while(y%x==0) y/=x;
		y%=x;
		if (y==1) cnt++;

		if (i==n/i && y==1) cnt--;
	}
	n--;
	for(ll i=1; i*i<=n; i++){
		if (n%i==0) {
			cnt++;
			if (i!=n/i) cnt++;
		}
	}
	cout << cnt;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }

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

  auto i = std::stoi(s.substr(0, 4)) * 10000;
  i += std::stoi(s.substr(5, 2)) * 100;
  i += std::stoi(s.substr(8, 2));

  if (i <= 20190430) {
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"I=lambda:list(map(int,input().split()))\n"
"n,k=I()\n"
"z=[I()for _ in[0]*n]\n"
"z.sort()\n"
"a=10**20\n"
"for i in range(n):\n"
" for j in range(i+k-1,n):l=sorted(t[1]for t in z[i:j+1]);a=min(a,*[(z[j][0]-z[i][0])*(v-u)for u,v in zip(l,l[k-1:])])\n"
"print(a)\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 3280
if __name__ == '__main__':

	n = int(input())
	S = set()

	for _ in range(n):
		x,y = map(int,input().split())
		if x == 0:
			S.add(y)
			print(len(S))
		elif x == 1:
			if y in S:
				print("1")
			else:
				print("0")
		else:
			S.discard(y)



Measured memory_bytes: 23360
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    ll n,ans=0;
    cin>>n;
    vector<int>L(n);
    rep(i,n) cin>>L[i];
    sort(L.begin(),L.end());
    rep(i,n)for(int j=i+1;j<n;j++){
        if(L[i]+L[j]<=L[n-1]) ans+=lower_bound(L.begin(),L.end(),L[i]+L[j])-L.begin()-(j+1);
        else ans+=n-(j+1);
    }
    cout<<ans;
}

Measured memory_bytes: 256
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) 
{
	cout << *it << " = " << a;
	nl;
	err(++it, args...);
}
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
void solveforthiscase(const int & test)
{//deb(test);

cin>>n;
vll v(n);
ll ans[n+1];
read(v);
ll sum=0;
for(int i=0;i<n;i++)
{
    sum+=(pow(-1,i)*v[i]);
}
ans[0]=sum;
for(int i=1;i<n;i++)
{
    ans[i]=2*v[i-1]-ans[i-1];
}
for(int i=0;i<n;i++)
{
    cout<<ans[i]<<' ';
}






return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  char b;
  cin >> b;
  if (b == 'A') {
    cout << 'T' << endl;
  }
  if (b == 'T') {
    cout << 'A' << endl;
  }
  if (b == 'C') {
    cout << 'G' << endl;
  }
  if (b == 'G') {
    cout << 'C' << endl;
  }
}

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

#define endl "\n"
#define ll long long
#define F first
#define S second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define mll unordered_map<ll,ll>
#define dec(v) sort(v.rbegin(),v.rend());
#define REP(i, n) for (int i = 0; i < (n); i++)
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<ll> vll;

#define deb(x) cout << ">" << #x << '=' << x << endl;
#define setbits(n) __builtin_popcountll(n)
#define done {cout<<"-1"<<endl; return;}

#define inf INT_MAX
#define ninf INT_MIN
const ll N = 2e5 + 5;
#define MOD 1000000007

vector<int> f;
void div(int n)
{
   bool flag = false;
   while (n % 2 == 0)
   {
      flag = true;
      n = n / 2;
   }
   if (flag) f[2]++;

   for (int i = 3; i <= sqrt(n); i = i + 2)
   {
      flag = false;
      while (n % i == 0)
      {
         flag = true;
         n = n / i;
      }
      if (flag) f[i]++;
   }
   flag = false;
   if (n > 2)
      f[n]++;
}
void solve()
{
   int n;
   cin >> n;
   vector<int> v(n);
   for (int i = 0; i < n; i++) cin >> v[i];
   int z = *max_element(all(v));
   f.resize(z + 1);
   for (auto &it : f) it = 0;
   for (auto it : v) {
      div(it);
   }
   bool flag = false;

   int zx = *max_element(all(f));
   if (zx == n) {
      cout << "not coprime";
   }
   else {
      for (auto it : f)
         if (it > 1) flag = true;
      if (flag) cout << "setwise coprime";
      else cout << "pairwise coprime";
   }


}
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
   freopen("inputc.txt", "r", stdin);
   freopen("outputc.txt", "w", stdout);
#endif
   int t = 1;
   //cin >> t;
   while (t--)  solve();
   cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
   return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];

  ll total = 0;
  rep(i, k) { total += p[i] + 1; }

  ll tmp = total;
  for (int i = 0; i + k < n; i++) {
    tmp = tmp - (p[i] + 1) + (p[i + k] + 1);
    total = max(total, tmp);
  }

  printf("%.10f\n", (double)total / 2);
  return 0;
}

Measured memory_bytes: 1024
import math
from itertools import product
class Eratos:
    def __init__(self, num):
        assert(num >= 1)
        self.table_max = num
        # self.table[i] は i が素数かどうかを示す (bool)
        self.table = [False if i == 0 or i == 1 else True for i in range(num+1)]
        for i in range(2, int(math.sqrt(num)) + 1):
            if self.table[i]:
                for j in range(i ** 2, num + 1, i):    # i**2 からスタートすることで定数倍高速化できる
                    self.table[j] = False
        # self.table_max 以下の素数を列挙したリスト
        self.prime_numbers = [2] if self.table_max >= 2 else []
        for i in range(3, self.table_max + 1, 2):
            if self.table[i]:
                self.prime_numbers.append(i)
    
    def is_prime(self, num):
        """
        >>> e = Eratos(100)
        >>> [i for i in range(1, 101) if e.is_prime(i)]
        [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
        """
        assert(num >= 1)
        if num > self.table_max:
            raise ValueError('Eratos.is_prime(): exceed table_max({}). got {}'.format(self.table_max, num))
        return self.table[num]
    
    def prime_factorize(self, num):
        """
        >>> e = Eratos(10000)
        >>> e.prime_factorize(6552)
        {2: 3, 3: 2, 7: 1, 13: 1}
        """
        assert(num >= 1)
        if int(math.sqrt(num)) > self.table_max:
            raise ValueError('Eratos.prime_factorize(): exceed prime table size. got {}'.format(num))
        factorized_dict = dict()    # 素因数分解の結果を記録する辞書
        candidate_prime_numbers = [i for i in range(2, int(math.sqrt(num)) + 1) if self.is_prime(i)]
        # n について、√n 以下の素数で割り続けると最後には 1 or 素数となる
        # 背理法を考えれば自明 (残された数が √n より上の素数の積であると仮定。これは自明に n を超えるため矛盾)
        for p in candidate_prime_numbers:
            # これ以上調査は無意味
            if num == 1:
                break
            if num % p == 0:
                cnt = 0
                while num % p == 0:
                    num //= p
                    cnt += 1
                factorized_dict[p] = cnt
        if num != 1:
            factorized_dict[num] = 1
        return factorized_dict
    
    def enum_divisor(self, num):
        """
        >>> e = Eratos(10000)
        >>> e.enum_divisor(4)
        [1, 2, 4]
        >>> e.enum_divisor(19)
        [1, 19]
        >>> e.enum_divisor(100)
        [1, 5, 25, 2, 10, 50, 4, 20, 100]
        """
        factorized_dict = self.prime_factorize(num)
        primes = list(factorized_dict.keys())
        all_pattern_powers = product(*[range(i + 1) for i in factorized_dict.values()])    # 各素数を 0 to value 個まで任意回かけるとする。その全パターンを列挙
        divisor = []
        for power_pattern in all_pattern_powers:
            tmp = 1
            for i in range(len(power_pattern)):
                tmp *= pow(primes[i], power_pattern[i])
            divisor.append(tmp)
        return divisor

N, M = map(int, input().split())
eratos = Eratos(int(math.sqrt(M)) + 1)
L = eratos.enum_divisor(M)
L.sort(reverse=True)
for div in L:
    if div * N <= M:
        print(div)
        exit()

Measured memory_bytes: 40816
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> graph(N, vector<int>(N, 1));
    int a, b;
    rep(0, i, M)
    {
        cin >> a >> b;
        a--;
        b--;
        graph.at(a).at(b) = 0;
        graph.at(b).at(a) = 0;
    }
    vector<int> v(N);
    rep(0, i, N)
    {
        v.at(i) = i;
    }

    int ans = 0;
    do
    {
        if (v.at(0))
        {
            break;
        }
        bool flag = true;
        rep(0, i, N - 1)
        {
            if (graph.at(v.at(i)).at(v.at(i + 1)))
            {
                flag = false;
            }
        }
        if (flag)
        {
            ans++;
        }
    } while (next_permutation(all(v)));
    cout << ans << endl;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli a,b,c;
	cin>>a>>b>>c;

	if(a==b && a!=c){
		cout<<"Yes"<<endl;
	}
	else if(a==c && a!=b){
		cout<<"Yes"<<endl;
	}
	else if(b==c && a!=b){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b;
    int c;
    scanf("%d %d",&a,&b);
    
    if(a>=13){
        c=b;
    }else if(a>5 && a<13){
        c=b/2;
    }else{
        c=0;
    }
    
    printf("%d",c);
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

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

        char one = line.charAt(0);
        char two = line.charAt(1);
        char three = line.charAt(2);
        char four = line.charAt(3);

        Set<Character> set = new HashSet<>();
        set.add(one);
        set.add(two);
        set.add(three);
        set.add(four);
        if(set.size() != 2){
            System.out.println("No");
            System.exit(0);
        }

        int c = one == two ? 1 : 0;
        c += one == three ? 1 : 0;
        c += one == four ? 1 : 0;
        if(c != 1){
            System.out.println("No");
            System.exit(0);
        }

        System.out.println("Yes");
    }

}



Measured memory_bytes: 23892
M,D=map(int,input().split())
# M,D=15,40
# M,D = 100,99
ls = []
for i in range(2,10):
    for j in range(2,10):
        if i*10+j <= D:
            ls.append((i*j,i,j))
ls = list(sorted(ls))
r = []
for lls in ls:
    if lls[0] > M:
        break
    r.append(lls)
# print(r)
print(len(r))



Measured memory_bytes: 38512
#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;


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

	long long w, h, x, y, p;
	long double s;

	cin >> w >> h >> x >> y;

	s = w * h * 0.5;
	if ((x * 2 == w) && (y * 2 == h)) p = 1;
	else p = 0;
	
	cout << setprecision(12) << fixed << s << " " << p << "\n";

	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val list = sc.next().toCharArray().map(Char::toString).map(String::toInt).toMutableList()
    val f = list.removeAt(0)
    op(list, f, "$f")
}

fun op(list: List<Int>, v: Int, s: String): Boolean {
    if (list.isEmpty()) {
        return if (v == 7) {
            println("$s=7")
            true
        } else {
            false
        }
    }
    val n = list[0]
    val nextList = list.slice(1 until list.count()).toList()
    if (op(nextList, v + n, "$s+$n")) {
        return true
    }
    if (op(nextList, v - n, "$s-$n")) {
        return true
    }
    return false
}

Measured memory_bytes: 29476
#include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

VI memo;
int fib(int i){
	if (memo[i]) return memo[i];
	
	return memo[i] = fib(i - 1) + fib(i - 2);
	
}


void solve(){
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif
	int n;
	cin >> n;
	memo.resize(n + 2);
	memo[0] = memo[1] = 1;
	
	cout << fib(n) << endl;
}


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


	solve();
	return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
// #define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    ll N, X, T;
    cin >> N >> X >> T;
    cout << ((N + X - 1) / X * T) << endl;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
#define INF 1000000000
#define M_INF -1000000000
typedef long long int ll;

int main(){
    int D,G;
    cin>>D>>G;
    vector<int> p(D),c(D);
    for(int i=0;i<D;i++){
        cin>>p[i]>>c[i];
    }
    int ans=INF;
    for(int bit=0;bit<(1<<D);bit++){//bit全探索
        int s=0,num=0,rest_max=-1;
        for(int i=0;i<D;i++){
            if(bit & (1<<i)){//i番目の問題を全て解く
                s+=100*(i+1)*p[i]+c[i];
                num+=p[i];//解いた問題数を格納
            }else{
                rest_max=i;//全て解いていない問題の中で最も配点が高い問題
            }
        }
        if(s<G){//もしまだ問題を解く必要がある場合
            int s1=100*(rest_max+1);//rest_maxの問題の配点
            int need=(G-s+s1-1)/s1;//rest_maxの問題を全て解いては意味ない(rest_maxは全て解く問題として選択されていないから)
            //+s1は，必ずs1をrest_maxの問題を１個は解く必要があるため
            //-1は，G-s=s1だった場合，need=2となってしまうのを防ぐため
             if(need>=p[rest_max]){//もし問題数以上だった場合は無視(以上⇒全て解いてもダメ)
                continue;
            }
            num+=need;
        }
        ans=min(ans,num);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int n;
  cin >> n;
  ll k[n+1];
  k[1]=1;
  ll ans=0;
  rep(i,n){
    ll y=i+1;
    ll o=y*(ll)(n/(i+1)+1)*(ll)(n/(i+1))/2;
    ans+=o;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3616
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=1001000;
struct node{
	int id,x;
}a[maxn];
int val[maxn];
bool cmp(const node &A,const node &B){
	return A.x<B.x;
}
int beg[maxn],nex[maxn<<1],tto[maxn<<1],e;
void putin(int s,int t){
	tto[++e]=t;
	nex[e]=beg[s];
	beg[s]=e;
}
bool vis[maxn];
int dp[maxn];
int main(){
//	freopen("C.in","r",stdin);
//	freopen("C.out","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i].x);
		a[i].id=i;
		val[i]=a[i].x;
	}
	sort(a+1,a+n+1,cmp);
	int s,t;
	for(int i=1;i<n;i++){
		scanf("%d%d",&s,&t);
		putin(s,t);
		putin(t,s);
	}
	bool bo;
	for(int i=1;i<=n;i++){
		if(a[i].x==0) dp[a[i].id]=0;
		else{
			bo=0;
			for(int j=beg[a[i].id];j;j=nex[j]){
				if(val[tto[j]]<a[i].x&&dp[tto[j]]==0){
					bo=1;
					break;
				}
			}
			dp[a[i].id]=bo;
		}
	}
	for(int i=1;i<=n;i++){
		if(dp[i]==1)
			printf("%d ",i);
	}
	return 0;
}

Measured memory_bytes: 10496
#include<bits/stdc++.h>
using namespace std;
#define con continue
#define bk break
#define LL long long
#define db double
#define pt cout<<'\n'
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
LL inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =1000000000000000000;
#define sz size()
#define len(X) strlen(X)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ULL unsigned long long
#define de cout<<"test"<<endl;
#define st system("pause");
#define F first
#define S second
class MinimizeAbsoluteDifferenceDiv1
{
    public:
vector <int> findTuple(vector <int> x)
{


}
};
string A[1024]={};
int n;
int check(int x){

for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(A[ (i+x)%n ][j]!=A[ (j+x)%n ][i])
            return 0;
        
    }
}

return 1;

}
int main()
{
while(cin>>n){
    for(int i=0;i<n;i++)
        cin>>A[i];
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=check(i)*n;
    }
    cout<<ans<<endl;
    
    
}
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const string ok = "Yes", ng = "No";

string solve(int h, int w, int k)
{
    rep(i,h+1)rep(j,w+1)
    {
        int a = (h-i)*j + i*(w-j);
        if(a==k) return ok;
    }

    return ng;
}

int main()
{
    int n,m,k;
    cin >>n >>m >>k;
    cout << solve(n,m,k) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>  
#include<iostream>  
#include<algorithm>  
#include<cstdlib>  
#include<cstring>
#include<string>
#include<climits>
#include<vector>
#include<cmath>
#define LL long long

using namespace std;

int wt,ss[19];
inline void print(int x){
	if (x<0) x=-x,putchar('-'); 
	if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}
}
inline void print(LL x){
	if (x<0) x=-x,putchar('-');
	if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}
}

 int n,a[100010];

int main()
{
	cin>>n;
    int x=0,y=0,ans=0;
    memset(a,0,sizeof(a));
    while(n--)
    {
        cin>>y;
        if(a[y]) x++;else a[y]++,ans++;
    }
    if(x%2) ans--;
    cout<<ans<<endl;
}

Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
	8
	ABABBABA
										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	x := nextInt()
	t := nextInt()

	ans := divCeil(n, x) * t

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)

}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}

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

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func sign(x int) int {
	if x == 0 {
		return 0
	}
	if x > 0 {
		return 1
	}
	return -1
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}
func divCeil(shi, bo int) int {
	ans := shi / bo
	if shi%bo != 0 {
		ans++
	}
	return ans
}


Measured memory_bytes: 1812
from fractions import gcd

def lcm(x, y):
    ret = (x*y)//gcd(x,y)
    return ret

def f(n, c, d):
    x = n
    x -= n//c
    x -= n//d
    x += n//lcm(c,d)
    return x

a, b, c, d = map(int, input().split())
r = f(b, c, d) - f(a-1, c, d)
print(r)


Measured memory_bytes: 5076
N, M = map(int, input().split())
Hs = list(map(int, input().split()))
Bs = [False]*N
for i in range(M):
  A, B = map(int, input().split())
  A, B = A-1, B-1
  if Hs[A] <= Hs[B]:
    Bs[A] = True
  if Hs[B] <= Hs[A]:
    Bs[B] = True
r = Bs.count(False)
print(r)


Measured memory_bytes: 19908
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string b;
    cin >> b;
    if(b =="A") cout << 'T' << endl;
     if(b =="C") cout << 'G' <<endl;
         if(b=="G") cout << 'C' <<endl;
    if (b=="T")cout << 'A' << endl;
        return 0;
        
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
   public static void main(String[] args) {
	  Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
   int money =100000;
   for(int i=0; i<n; i++){
	   money*=1.05;
   if(money%1000!=0){money+=1000-money%1000;
   }
   }
   System.out.println(money);
   }
   }

Measured memory_bytes: 17156
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.Collator;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      Collator collator = Collator.getInstance();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;


      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = collator.compare(wordA,wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  }
}


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

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> score(n, k - q);
  for (int i = 0; i < q; i++) {
    int a;
    cin >> a;
    score.at(a - 1)++;
  }
  for (int i = 0; i < n; i++) {
    if (score.at(i) > 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#include <time.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
 
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    int min=INF;
    int cnt=0;
    int i;
    for(i=0; i<n; i++) {
        int tmp;
        scanf("%d", &tmp);
        if(tmp<min) {
            min=tmp;
            cnt++;
        }
    }
    printf("%d\n", cnt);

    return 0;
}


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

int main(){
	int num, maxPoint, minPoint;
	int input, allPoint[100];

	while(cin >> num, num){
		for(int i=0; i < num; i++){
			allPoint[i] = 0;
			for(int j=0; j < 5; j++){
				cin >> input;
				allPoint[i] += input;
			}
		}
		maxPoint = -1; minPoint = 501;
		for(int i=0; i < num; i++){
			maxPoint = max(maxPoint, allPoint[i]);
			minPoint = min(minPoint, allPoint[i]);
		}
		cout << maxPoint << ' ' << minPoint << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;
typedef long long ll;

const int MOD = 1e9+7;
const int INF = 1e9;
ll dp[1005][10000] = {};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin>>N>>M;
    vector<ll> a(M),b(M);
    vector<vector<ll>> c(M);
    vector<ll> bit(M,0);
    rep(i,M){
        cin>>a[i]>>b[i];
        c[i].resize(b[i]);
        rep(j,b[i]){
            cin>>c[i][j];
            c[i][j]--;
            bit[i] |= (1<<c[i][j]);
        }
    }
    /*
    rep(i,M){
        print(c[i]);
    }
    */
    print(bit);
    rep(i,M+1)rep(j,10000){
        dp[i][j] = INF;
    }
    dp[0][0] = 0;
    rep(i,M)rep(j,10000){
        dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        dp[i+1][j|bit[i]] = min(dp[i+1][j|bit[i]], dp[i][j] + a[i]);
    }
    int all1 = 0;
    rep(i,N){
        all1 |= (1<<i);
    }
    cerr<<all1<<endl;
    ll ans = dp[M][all1];
    /*
    rep(i,M+1){
        rep(j,all1+1){
            cerr<<dp[i][j]<<" ";
        }
        cerr<<endl;
    }
    */
    if(ans == INF)ans = -1;
    cout<<ans<<endl;

}

Measured memory_bytes: 78592
def main():
    N, M = (int(i) for i in input().split())
    A = {str(i+1): ["?", 0] for i in range(N)}
    for m in range(M):
        p, s = (i for i in input().split())
        if A[p][0] == "WA" or A[p][0] == "?":
            A[p][0] = s
            if s == "WA":
                A[p][1] += 1

    ans = [0, 0]
    for a in A.values():
        if a[0] == "AC":
            ans[0] += 1
            ans[1] += a[1]
    print(*ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 76504
n, m,c = map(int, input().split())
B=list(map(int, input().split()))
result=0
for i in range(n):
    A=list(map(int, input().split()))
    count=0
    for n1,n2 in zip(A,B):
        count+=n1*n2
    if c+count>0:
        result+=1
print(result)

Measured memory_bytes: 3060
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        boolean flag = true;
//        long res = 0;

        if (n % 2 == 0) {
            for (int i = 0; i < n; i += 2) {
                if (a[i] != a[i + 1]) {
                    flag = false;
                    break;
                }
            }

        } else {
            for (int i = 1; i < n; i += 2) {
                if (a[i] != a[i + 1]) {
                    flag = false;
                    break;
                }
            }
            if (a[0] != 0) {
                flag = false;
            }

        }

        if (flag) {
            long res = 1;
            for (int x=0; x<n/2; x++) { //なんか怖かったので、Math.powじゃなくてforで計算
                res = 2*res%1000000007; //0の数を間違えた。痛恨。
            }
//            res = (long) Math.pow(2, n / 2);
            System.out.println(res);
        }else{
            System.out.println(0);
        }

//        res %= 1000000007;


    }

}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    ll maxn = sqrt(N) + 1;
    map<ll, ll> res;
    rep2(x, 1, maxn){rep2(y, 1, maxn){rep2(z, 1, maxn){
        ll n = x * x + y * y + z * z + x * y + y * z + z * x;
        if (res.find(n) != res.end()){
            res[n]++;
        } else {
            res[n] = 1;
        }
    }}}
    rep2(i, 1, N + 1){
        if (res.find(i) != res.end()){
            cout << res[i] << endl;
        } else {
            cout << 0 << endl;
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 5972
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    vector<int> a(n);
    ll sum=0;
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
        if(i%2==0) sum += a[i];
        else       sum -= a[i];
    }
    ll ans = sum/2;
    printf("%lld ", ans*2);
    for(i=1; i<n; i++) {
        ans = a[i-1]-ans;
        printf("%lld ", ans*2);
    }
    printf("\n");


    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define f(x,y,z) for(int x=y;x<z;++x)
int x, n, k;
map<int,bool> a;
int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin >> x >> n;
    if(!n) return cout << x << '\n', 0;
    f(i,0,n) {
        cin >> k;
        a[k] = true;
    }
    int i = 0;
    while(true) {
        if(!a[x-i]) return cout << x-i << '\n', 0;
        if(!a[x+i]) return cout << x+i << '\n', 0;
        ++i;
    }
}

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

typedef long long int ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> Pair;
typedef vector<Pair> VP;

#define MOD 1000000007
#define times(n) rep(_idx, n)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mk make_pair
#define out(x) cout << (x) << endl;
#define DU(x) cerr << #x << " = " << (x) << endl;

template <typename _Ty>ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "[]";return ostr;}ostr << "[" << v.front();for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}ostr << "]";return ostr;}

int main() {
    int a;
    string s;
    cin >> a >> s;
    out(3200 <= a ? s : "red");
    return 0;
}

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

int main(){
	int e[12];	for(int i=0;i<12;i++)cin>>e[i];
	sort(e,e+12);

	bool flag=true;

	for(int i=0;i<4;i++){
		if(e[0]!=e[i]){
			flag=false;
			break;
		}
	}

	if(flag){
		for(int i=0;i<4;i++){
			if(e[4]!=e[4+i]){
				flag=false;
				break;
			}
		}
	}

	if(flag){
		for(int i=0;i<4;i++){
			if(e[8]!=e[8+i]){
				flag=false;
				break;
			}
		}
	}

	if(flag)cout<<"yes"<<endl;
	else cout<<"no"<<endl;

	return 0;
}



Measured memory_bytes: 3144
import sys
import numpy as np

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

class BitSum:
    def __init__(self, n):
        self.n = n + 3
        self.table = [0] * (self.n + 1)

    def update(self, i, x):
        i += 1
        while i <= self.n:
            self.table[i] += x
            i += i & -i

    def sum(self, i):
        i += 1
        res = 0
        while i > 0:
            res += self.table[i]
            i -= i & -i
        return res

def main():
    n,k=MI()
    aa=np.zeros(n+1,dtype="i8")
    aa[0]=k
    for i in range(1,n+1):
        aa[i]=II()
    aa-=k
    cs=np.cumsum(aa)
    #print(aa)
    #print(cs)
    #座標圧縮
    ss=set()
    for s in cs:
        ss.add(s)
    enc={s:i for i,s in enumerate(sorted(ss))}
    #print(enc)
    #転倒数の要領で、自分より左にある自分以下の数の個数を数える
    bit=BitSum(len(ss))
    ans=0
    for s in cs:
        enc_s=enc[s]
        ans+=bit.sum(enc_s)
        bit.update(enc_s,1)
    print(ans)

main()

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

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

  if (S=="Sunny") cout << "Cloudy" << endl;
  if (S=="Cloudy") cout << "Rainy" << endl;
  if (S=="Rainy") cout << "Sunny" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    ll X, a[2];
    cin >> X;
    a[0] = X / 500;
    X = X % 500;
    a[1] = X / 5;
    cout << a[0] * 1000 + a[1] * 5 << endl;
    return 0;
}



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

int main(){
    string weather;
    cin >> weather;
    string next;

    if(weather == "Sunny"){
        next = "Cloudy";
    }
    if(weather == "Cloudy"){
        next = "Rainy";
    }
        if(weather == "Rainy"){
        next = "Sunny";
    }
    cout << next;
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt(), g = sc.nextInt();
        int[] ps = new int[d], cs = new int[d];

        for (int i = 0; i < d; i++) {
            ps[i] = sc.nextInt();
            cs[i] = sc.nextInt();
        }

        int L = 100 * 10;
        long[] dp = new long[L + 1];

        Arrays.fill(dp, -1);
        dp[0] = 0;

        for (int i = 0; i < d; i++) {
            for (int j = L; j >= 0; j--) {
                if (dp[j] >= 0) {
                    for (int k = 1; k < ps[i]; k++) {
                        dp[j + k] = Math.max(dp[j + k], dp[j] + k * (i + 1) * 100);
                    }
                    dp[j + ps[i]] = Math.max(dp[j + ps[i]], dp[j] + ps[i] * (i + 1) * 100 + cs[i]);
                }
            }
        }
//        debug(dp);
        for (int i = 1; i <= L; i++) {
            if (dp[i] >= g) {
                System.out.println(i);
                return;
            }
        }
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

}


Measured memory_bytes: 24020
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }

set<string> se;

signed main()
{
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int vx = x2 - x1;
	int vy = y2 - y1;

	int vx3 = -vy;
	int vy3 = vx;

	int x3 = x2 + vx3;
	int y3 = y2 + vy3;

	vx = x3 - x2;
	vy = y3 - y2;

	int vx4 = -vy;
	int vy4 = vx;

	int x4 = x3 + vx4;
	int y4 = y3 + vy4;

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}



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

#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;

int N;
ll t[30][30];
ll dp[20][100000];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    while(1){
        cin>>N;
        if(N==0)break;
        //init
        rep(i,30)rep(j,30)t[i][j] = 0;
        rep(i,N+1)rep(j,bit(N+1)){
            dp[i][j] = INFLL;
        }
        dp[0][0] = 0;
        //input
        rep(i,N)rep(j,N+1){
            cin>>t[i][j];
        }
        for(int i = 0;i < N;i++){
            //i個からなので、i個立ってる状態を探して、
            //その状態から一個増やして遷移できるものを探す
            //増やすステージに関して、コストの最小値をとる
            for(int k = 0;k < bit(N);k++){
                int cnt = 0;
                for(int j = 0;j < N;j++){
                    if(k & bit(j))cnt++;
                }
                if(cnt != i)continue;
                for(int j = 0;j < N;j++){
                    if(k & bit(j))continue;
                    ll cost = t[j][0];
                    for(int l = 0;l < N;l++){
                        if(k & bit(l))chmin(cost,t[j][l+1]);
                    }
                    chmin(dp[i+1][k | bit(j)],dp[i][k] + cost);
                }
            }
        }
        cout<<dp[N][bit(N)-1]<<endl;
    }
}


Measured memory_bytes: 16684