akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.text.DecimalFormat;

/**
 * Created by Reopard on 2014/05/06.
 */
public class Main {
    public static void main(String args[]){
        double x, y;
        double a, b, c, d, e, f;
        String line;
        String tmp[];
        DecimalFormat df = new DecimalFormat("0.000");
        BufferedReader reader  = new BufferedReader(new InputStreamReader(System.in));
        try{
            while((line = reader.readLine()) != null){
                tmp = line.split(" ");
                a = Double.parseDouble(tmp[0]);
                b = Double.parseDouble(tmp[1]);
                c = Double.parseDouble(tmp[2]);
                d = Double.parseDouble(tmp[3]);
                e = Double.parseDouble(tmp[4]);
                f = Double.parseDouble(tmp[5]);
                x = (c*e-b*f)/(a*e-b*d);
                y = (-c*d+a*f)/(a*e-b*d);
                BigDecimal bi_x = new BigDecimal(x);
                BigDecimal bi_y = new BigDecimal(y);
                x = bi_x.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
                y = bi_y.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
                System.out.println(df.format(x) + " " + df.format(y));
            }
        }catch(IOException error){
            System.exit(0);
        }
    }
}

Measured memory_bytes: 17224
// /*
// power code taken from geeks for geeks
// */
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e6 + 5;
const ll MODD = 1e9 + 7;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
double modd(double a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return a % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;
 
    ll P = power(k, p/2LL);
    P = (P * P) % MODD;
 
    if (p % 2 == 1)
        P = (P * k) % MODD;
 
    return P;
}


struct p_str {
    ll a, b, c;
};



void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll ans = 0;
    for(ll i = 0; i < n; i += 2) {
        if(a[i] % 2 == 1) {
            ans++;
        }
    }
    cout << ans << endl;
}



int main(){




    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    



    ll t=1;


    // cin>>t;
    


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

Measured memory_bytes: 3648
#!/usr/bin/env python3

def main():
    syutudai,teisyutsu_count = map(int, input().split())
    result_list = [input().split() for i in range(teisyutsu_count)]
    penalty_count = [0] * syutudai

    penalty_sum = 0
    ac_count = 0
    for result in result_list:
        problem = int(result[0])
        result = result[1]
        if penalty_count[problem-1] == -1:
            continue
        if result == 'AC':
            penalty_sum += penalty_count[problem-1]
            penalty_count[problem-1] = -1
            ac_count += 1
        else:
            penalty_count[problem-1] = penalty_count[problem-1] + 1

    print('{} {}'.format(ac_count,penalty_sum))




if __name__ == "__main__":
    main()


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


int main() {
    ll n; cin >> n;
    n--;
    ll ans = n * (n + 1) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <list>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    int p1=0,p2=0,p3=0;
    int p;
    for(int i=0;i<N;i++){
        cin >> p;
        if(p<=A) p1++;
        else if(p>=B+1) p3++;
        else p2++;
    }
    cout << (min(min(p1,p2),p3)) << endl;

}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    vector<Int> res;
    Int a, d, n;
    while (cin >> a >> d >> n and a) {
        while (n > 0) {
            bool check = true;
            for (Int i = 2; i * i <= a; i++) {
                if (a % i == 0) {
                    check = false;
                }
            }
            if (check and a > 1) {
                n--;
            }
            a += d;
        }
        res.push_back(a - d);
    }
    for (Int i = 0; i < (Int)res.size(); i++) {
        dump(res[i]);
    }
    return 0;
}



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

int main()
{ int n;
  string str;
  cin>>n;
  cin>>str;
  if(str.length()>n)
     {cout<<str.substr(0,n)<<"...";
     }
  else
     {cout<<str;
     }


    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#define MAXN 105
using namespace std;

const long long INF = 1e10;

long long N, W, w[MAXN], v[MAXN], dp[MAXN][100005];

int main() {
	cin >> N >> W;
	for (int i=0; i<N; i++) {
		cin >> w[i] >> v[i];
	}
	for (int i=0; i<N; i++) {
		for (int j=0; j<100005; j++) {
			dp[i][j] = INF;
		}
	}
	dp[0][v[0]] = w[0];
	for (int i=1; i<N; i++) {
		dp[i][v[i]] = min(dp[i - 1][v[i]], w[i]);
		for (int j=0; j<100001; j++) {
			dp[i][j] = min(dp[i][j], dp[i - 1][j]);
			if (j - v[i] < 0) continue;
			dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i]] + w[i]);
		}
	}
	long long ans = 0;
	for (int i=0; i<100005; i++) {
		if (dp[N - 1][i] <= W)
			ans = i;
	}
	cout << ans;
}

Measured memory_bytes: 80128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int A, B;
        A = cin.nextInt();
        B = cin.nextInt();
        Console.WriteLine((A+B)%24);
    }
    

    

}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

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

public class Main {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer stok;

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null) {
                return null;
            }
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) (br.read());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }
    boolean inField(int x, int y, int n, int m) {
        return (x >= 0 && y >= 0 && x < n && y < m);
    }
    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        char[][] c = new char[n][m];
        for (int i = 0; i < n; i++) {
            c[i] = nextToken().toCharArray();
        }
        int[] dx = {-1,0,1,1,1,0,-1,-1};
        int[] dy = {1,1,1,0,-1,-1,-1,0};
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (c[i][j] == '#') continue;
                int ans = 0;
                for (int k = 0; k < 8; k++) {
                    int ni = i + dx[k];
                    int nj = j + dy[k];
                    if (inField(ni,nj,n,m) && c[ni][nj] =='#'){
                        ans++;
                    }
                }
                c[i][j] = (char)('0' + ans);
            }
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                out.print(c[i][j]);
            }
            out.println();
        }
    }

    void run() throws IOException {
        // br = new BufferedReader(new FileReader("dragons.in"));
        //out = new PrintWriter("dragons.out");
        // br = new BufferedReader(new FileReader("input.txt"));
        // out = new PrintWriter("output.txt");
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        br.close();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        // Locale.setDefault(Locale.US);
        new Main().run();
    }
}

Measured memory_bytes: 21332
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        Array.Sort(a);
        var sum = a[0]; var si = 0;
        for (int i = 1; i < n; i++)
        {
            if (sum * 2 < a[i]) si = i;
            sum += a[i];
        }
        Console.WriteLine(n - si);
    }
}

Measured memory_bytes: 29788
#include <stdio.h>
#include <cstring>
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
typedef long long LL;
const int maxn = 5e4+10;
double esp = 1e-8;
int flag, le;
double r,PI = acos(-1);

int main()
{
    int a, b;
    while(~scanf("%d %d",&a, &b))
    {
        int x = b-a;
        printf("%d\n", x*(x+1)/2-b);
    }
    return 0;
}
/***************

****************/


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>*/
 
#define pb push_back
#define mp make_pair
#define sz(s) ((int)(s.size()))
#define all(s) s.begin(), s.end()
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define per(i, n, a) for (int i = n; i >= a; --i)
#define onlycin ios_base::sync_with_stdio(false); cin.tie(0) 
#define F first
#define S second
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
/*typedef tree<
pair < int, int >,
null_type,
less< pair < int, int > >,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
// find_by_order() order_of_key()
const int MAXN = (int)5e5+228;
const char nxtl = '\n';
const int mod = (int)1e9+7;
const double eps = (double)1e-7;
template<typename T> inline bool updmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<typename T> inline bool updmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

string s;

int main() {
	#ifdef accepted
		freopen(".in", "r", stdin);
		freopen(".out", "w", stdout);
	#endif
	onlycin;
	cin >> s;
	int sum = -1;
	int i = 0;
	cerr << sz(s) << nxtl;
	if(sz(s) == 1) {
		cout << s << nxtl;
		return 0;
	}
	int cur = 0;
	// for(auto &to : s) cur += to-'0';
	int cnt = 0;
	for(auto &to : s) {
		cnt++;
		if(to > '0')
			updmax(sum, cur+to-'1'+(sz(s)-cnt)*9);
		cur += to-'0';
	}
	updmax(sum, cur);
	cout << sum << nxtl;
	
	return 0;
}

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

int main(int argc, char *argv[]) {
        int a, b, c;

        scanf("%d", &a);
        scanf("%d", &b);
        scanf("%d", &c);

        if (a < b && b < c)
                printf("Yes\n");
        else
                printf("No\n");

        return 0;
}

Measured memory_bytes: 580
# -*- coding: utf-8 -*-

# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = input_int()


    cnt = [[0] * 10 for i in range(10)]
    for n in range(1, n + 1):
        cnt[int(str(n)[0])][int(str(n)[-1])] += 1

    ret = 0
    for i in range(10):
        for j in range(10):
            ret += cnt[i][j] * cnt[j][i]

    return ret


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 3064
#include <algorithm>
#include <chrono>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <tuple>
#include <utility>
#include <vector>

#define llong long long

using namespace std;
const int IINF = 2147483647;
const llong LLINF = 9223372036854775807;

// UnionFind
class UNF {
 private:
  int s;
  vector<int> tree, rank;
  int getP(int i) {
    if (tree[i] == -1)
      return i;
    else
      return tree[i] = getP(tree[i]);
  }

 public:
  UNF(int n) {
    s = n;
    tree.resize(s, -1);
    rank.resize(s, 1);
  }
  int size() { return s; }
  void connect(int a, int b) {
    a = getP(a);
    b = getP(b);
    if (a == b) return;
    if (rank[a] >= rank[b]) {
      tree[b] = a;
      rank[a] += rank[b];
    } else {
      tree[a] = b;
      rank[b] += rank[a];
    }
  }
  bool check(int a, int b) { return getP(a) == getP(b); }
};

int main(){
  UNF uf(13);
  uf.connect(1, 3);
  uf.connect(3, 5);
  uf.connect(5, 7);
  uf.connect(7, 8);
  uf.connect(8, 10);
  uf.connect(10, 12);
  uf.connect(4, 6);
  uf.connect(6, 9);
  uf.connect(9, 11);
  int x, y;
  cin >> x >> y;
  cout << (uf.check(x, y) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 100005
#define oo 1000000000000000007LL
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int k, a[maxN];

int main () {
    scanf("%d", &k);
    fto(i, 1, k) scanf("%d", &a[i]);

    ll l = 2, r = 2;
    fdto(i, k, 1) {
        ll x = (l+a[i]-1)/a[i] * a[i], y = r/a[i] * a[i];
        if (y < x) {
            puts("-1");
            return 0;
        }
        l = x; r = y+a[i]-1;
    }

    cout << l << " " << r;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pll pair<ll,ll>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vbl vector<bool>
#define vvll vector<vll>
#define vld vector<ld>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()

template<class T> ostream& operator<<(ostream &os, vector<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T> ostream& operator<<(ostream &os, set<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, map<T , R> V){
	os << "[ ";
	for(auto v  : V) os << "(" << v.first << ":" << v.second << ")";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, pair<T , R> V){
	return os << "(" << V.first << "," << V.second << ")";
}

#define cerr cout
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
    clock_t clk=clock();
    #define checktime() cout<<"\nTime Elapsed : "<<float(clock()-clk)/CLOCKS_PER_SEC<<endl
#else
    #define trace(...);
    #define checktime();
#endif

const ll Mod = 1e9 + 7;
// const ll Mod = 998244353;
const ll MAXN = 1e5;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<fixed<<setprecision(25);

    ll n,m;cin>>n>>m;
    ll sum=0;
    for(ll i=0;i<m;i++){
        ll x;cin>>x;
        sum+=x;
    }
    if(sum<=n) cout<<n-sum<<"\n";
    else cout<<"-1\n";
    
    return 0;
}

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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

int n;
Vec<Vec<int> > a(2);

int dfs(int y, int x)
{
  if (y) {
    return accumulate(a[y].begin() + x, a[y].end(), 0);
  }
  if (x + 1 == n) {
    return a[y][x] + a[y + 1][x];
  }
  return a[y][x] + max(dfs(y + 1, x), dfs(y, x + 1));
}

void hawawa()
{
  cin >> n;
  for (auto&& i : a) {
    i.resize(n);
    for (auto&& j : i) {
      cin >> j;
    }
  }
  cout << dfs(0, 0) << "\n";
}

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

struct RMQ {

};

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

using namespace std;

int main(){
  string c;
  cin >> c;
  string B = "aiueo";
  if(B.find(c) != string::npos) {
   cout << "vowel" << endl;
  } else {
   cout << "consonant" << endl;
  }
 return 0;
} 


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

int main() {
    int r, s, p; cin >> r >> s >> p;
    vector<int> nums;
    for (int _ = 0; _ < p; ++_) {
        int i, j; cin >> i >> j; --i, --j;
        if (j >= s) ++j;
        nums.push_back(abs(i - r) + abs(j - s));
    }
    sort(nums.begin(), nums.end(), greater<int>());
    int res = 0;
    for (int i = 0; i < p; ++i) res = max(res, nums[i] + i);
    cout << res << endl;
}



Measured memory_bytes: 4976
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> m[i];
        sum += m[i];

    }

    x -= sum;
    int mm = *min_element(m.begin(), m.end());
    cout << n + x / mm << endl;




    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) {

		Scanner inScanner = new Scanner(System.in);

	 
		String worString = inScanner.next();
		char d = worString.charAt(0);
		if (Character.isUpperCase(d)) {
			System.out.println("A");
		}else {
			System.out.println("a");
		}
		
	}
}

Measured memory_bytes: 35912
K,N=map(int,input().split())
mod=998244353

INV=[None]*(N+K+2)
for i in range(1,N+K+2):
    INV[i]=pow(i,mod-2,mod)
 
Combi=[None]*(N+K+1)#Combi[i]=i C (K-1) を表す
Combi[K-1]=1
for i in range(K,N+K+1):
    Combi[i]=Combi[i-1]*i *INV[i-K+1] %mod





all=Combi[N+K-1]
ANSLIST=[]
for i in range(2,2+K):
    ANS=all
    x=i//2-max(0,(i-K-1))
    CB_x=1

    j=1
    while N+K-1-j*2>=K-1 and j<=x:
        CB_x=CB_x*(x-j+1)//j
        #print(CB_x)
        ANS+=((-1)**j)*CB_x*Combi[N+K-1-j*2]
        #print(((-1)**j)*CB_x*Combi[N+K-1-j],ANS)
        ANS=ANS%mod

        j+=1
        #print(i,j,ANS)
    
    #ANS-=x*Combi[N+K-3]
    ANSLIST.append(ANS%mod)


for i in ANSLIST:
    print(i)
ANSLIST=ANSLIST[::-1]
for j in ANSLIST[1:]:
    print(j)

    
        



Measured memory_bytes: 50396
#include <bits/stdc++.h>
using namespace std;
int flag = 0;
int main() {
	char s[100000];
	cin >> s + 1;
	int n = strlen(s + 1);
	for (int i = 1; i <= n / 2; i++) {
		if (s[i] != s[n - i+1]) flag = 1;
	}
	for (int i = 1; i <= (n - 1) / 4; i++) {
		if (s[i] != s[(n - 1) / 2 - i+1]) flag = 1;
	}
	for (int i = (n + 3) / 2, j = 1; i <= (n + (n + 3) / 2) / 2; i++, j++) {
		if (s[i] != s[n - j+1]) flag = 1;
	}
	if (!flag) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
n = int(input())
d = dict()
for i in range(n):
    a = int(input())
    for j in range(a):
        l = d.get(i, [])
        p, t = list(map(int, input().split(' ')))
        l.append((p-1, t))
        d[i] = l
# d[i] に i番の人の証言のlistがあるので 全パターン(=2^15)で矛盾しないか試す？
def get_bit_array(num):
    res = []
    while num > 0:
        res.append(num%2)
        num //= 2
    while len(res) < n:
        res = res + [0]
    return res[::-1]

def valid(tfs):
    for i in range(len(tfs)):
        honest = tfs[i]
        if not honest:  # 嘘つきは無視する
            continue
        for (person, tf) in d.get(i, []):  # 合ってる？
            if tfs[person] != tf:
                return False
    return True

ans = 0
def f(num):
    global ans
    if num >= 2**n:
        return
    tfs = get_bit_array(num)  # tfs = [1,0,1,0,...0] true or flase 
    total = sum(tfs)
    if valid(tfs):
        ans = max(ans, total)

for i in range(int(2**n)):
    f(i)

print(ans)


Measured memory_bytes: 74708
using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            
            string[] str = Console.ReadLine().Split(' ');

            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);

            int answer = 0;
            switch (a)
            {
                case 3:
                    answer += 100000;
                    break;
                case 2:
                    answer += 200000;
                    break;
                case 1:
                    answer += 300000;
                    break;
                default:
                    answer += 0;
                    break;
            }

            switch (b)
            {
                case 3:
                    answer += 100000;
                    break;
                case 2:
                    answer += 200000;
                    break;
                case 1:
                    answer += 300000;
                    break;
                default:
                    answer += 0;
                    break;
            }

            if(a == 1 && b == 1)
            {
                answer += 400000;
            }

            Console.WriteLine(answer);
        }
    }
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

typedef string::const_iterator S;
string s;

//(t.size()>=3 && t.substr(0,3)=="the") || (t.size()>=4 && (t.substr(0,4)=="that" || t.substr(0,4)=="this"))

bool ok(S &i, S &e) {
	if (i==e) return 0;
	string t;
	while (*i!=' ') t.pb(*i), i++;
	if (t=="the" || t=="this" || t=="that") return 1;
	return ok(++i,e);
}

signed main() {
	while (getline(cin,s)) {
		if (s.empty()) break;
		s.pb(' ');
		rep(i,26) {
			S b = s.begin(), c = s.end();
			if (ok(b,c)) {
				cout << s.substr(0,s.size()-1) << ln << flush;
				break;
			}
			rep(j,s.size()) if ('a'<=s[j] && s[j]<='z') {
				s[j]++;
				if (s[j]>'z') s[j] = 'a';
			}
		}
	}
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int main(int argc, char **argv) {
	string s;
	ll k;
	cin >> s >> k;
	k = min(k, (ll)s.length());
	REP(i, k) if (s[i] != '1') {
		cout << s[i] << endl;
		return 0;
	}
	cout << '1' << endl;
	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(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;
const int INF = 1001001001;

bool equal(char a, char b) {
    return (a==b || a=='?' || b=='?');
}

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    int ans = INF;
    int sa = a.size();
    int sb = b.size();
    int sc = c.size();
    vector<bool> ab(sa+sb+1);
    vector<bool> ac(sa+sc+1);
    vector<bool> bc(sb+sc+1);
    
    rep(i, sa) rep(j, sb) {
        if (!equal(a[i], b[j])) ab[i-j+sb] = true;
    }
    rep(i, sb) rep(j, sc) {
        if (!equal(b[i], c[j])) bc[i-j+sc] = true;
    }
    rep(i, sa) rep(j, sc) {
        if (!equal(a[i], c[j])) ac[i-j+sc] = true;
    }
    
    for (int i=-sb-sc; i<=sa+sc; i++) {
        for (int j=-sb-sc; j<=sa+sb; j++) {
            int vab = i+sb;
            int vac = j+sc;
            int vbc = j-i+sc;
            if (vab>=0 && vab<sa+sb+1 && ab[vab]) {
                continue;
            }
            if (vac>=0 && vac<sa+sc+1 && ac[vac]) {
                continue;
            }
            if (vbc>=0 && vbc<sb+sc+1 && bc[vbc]) {
                continue;
            }
            int l = min(0, min(i, j));
            int r = max(sa, max(i+sb, j+sc));
            ans = min(ans, r-l);
        }
    }
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define cpresent(c,x) ((c).find(x) != (c).end()) 
#define vpresent(c,x) (find(all(c),x) != (c).end())
#define endl '\n'
#ifdef LOCAL
#include "/home/iggaboi/Desktop/CP/debug.h"
#else
#define debug(Args...)
#endif
using ll = long long;
using namespace __gnu_pbds;
using namespace std;
template<class T>
using indexed_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;

ll n;

void shit() {
    cin >> n;
    ll ans = 0;
    // a(n) = Sum_{m=1..floor(sqrt(n))} m*(m+floor(n/m))*(floor(n/m)+1-m)
    for(ll i = 1; i <= sqrt(n); ++i) {
        ans += i*(i + (n/i))*(n/i + 1 - i);
    }
    n = sqrt(n);
    ll extra = n;
    extra *= (n + 1);
    extra *= (2*n + 1);
    extra /= 6;//n*(n+1)*(2*n+1)/6
    ans -= extra;
    cout << ans << endl;
}

int32_t main() {
	ios_base::sync_with_stdio(false),cin.tie(nullptr);
	// int t; cin >> t;
	// while(t--)
		shit();
	return 0;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch StillTBD | diff StillTBD.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address StillTBD.cpp && ./a.out

/*
 
 3/11/2019
 
 14:28-
 
 */

string S;

bool solve() {
  int y=stoi(S.substr(0,4)),m=stoi(S.substr(5,2)),d=stoi(S.substr(8,2));
  if(y<2019) return true;
  if(y>2019) return false;
  if(m<4) return true;
  if(m>4) return false;
  return d<=30;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>S;
  cout<<(solve()?"Heisei":"TBD")<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
 
#define ll long long int
using namespace std;

int main(){
int N,M; cin>>N>>M;
ll ans = 0;

vector <priority_queue <int> > date(M);
priority_queue <int> pq;
int cnt = 0;
for(int i=0;i<N;i++){
  int a,b; cin>>a>>b;
  if(M - a < 0) {date[0].push(0);cnt++;continue;}
  date[M-a].push(b);
}
//N = N - cnt;
/* 
for(int i=M-1;i>=0;i--){
  if(date[i].empty()) continue;
  ans += date[i].top();
  date[i].pop();

  if(i==0) break;

for(int j=1;date[i-1].size() <= i;j++){
  if(date[i].empty()) break;
 date[i-1].push(date[i].top());
  date[i].pop();
}


}
*/

for(int i=M-1;i>=0;i--){

  while(/* pq.size() <= i + 2 and */ (not date[i].empty() ) ){
    pq.push(date[i].top());
    date[i].pop();
  } 

  if(pq.empty()) continue;

  ans += pq.top();

  //cout<<i<<' '<<ans<<endl;
  pq.pop();

}

cout<<ans<<endl;
return 0;

}

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

int main() {
  string a;
  cin >> a;
  int num = 0;
  for (int i = 0; i < a.size(); i++)
  {
    num += a.at(i) - '0';
  }
  if (num%9 == 0)
  {
    cout << "Yes" << endl;
  }else
  {
    cout << "No" << endl;
  }
  
  

  return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;   cin >> s;
    if (s[0] == s[1] && s[1] == s[2])
        cout << "Yes" << endl;
    else if (s[1] == s[2] && s[2] == s[3])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

const double eps = 1e-9;
bool equal(double a, double b) { return abs(a - b) < eps; }

struct V {
	double x, y;
	V(double x = 0, double y = 0) : x(x), y(y) {}
	V operator+(const V& p) const { return V(x + p.x, y + p.y); }
	V operator-(const V& p) const { return V(x - p.x, y - p.y); }
	V operator*(double a) const { return V(x*a, y*a); }
	double sqrNorm() const { return x * x + y * y; }
	double norm() const { return sqrt(sqrNorm()); }
	V rotate90() const { return V(y, -x); }
};

struct Circle {
	V o; double r;
	Circle(V o = V(), double r = 0) : o(o), r(r) {}
	vector<V> xp(const Circle& c) {
		V v = c.o - o;
		double l = v.norm();
		if (equal(l, 0)) return {};
		if (equal(l + r + c.r, max({ l,r,c.r }) * 2)) {
			return { o + v * (r / l) };
		}
		if (l + r + c.r < max({ l,r,c.r }) * 2) return {};
		double x = -(c.r*c.r - l * l - r * r) / (2 * l);
		double y = sqrt(r*r - x * x);
		V mid = o + v * (x / l);
		v = v.rotate90();
		return { mid + v * (y / l), mid - v * (y / l) };
	}
	bool isInside(const V& p) {
		return (p - o).norm() < r + eps;
	}
};

int main() {
	int N,K;
	cin >> N>> K;
	if (K == 1) {
		cout << 0 << endl;
		return 0;
	}
	vector<Circle> c(N);
	for (int i = 0; i < N;++i) {
		cin >> c[i].o.x >> c[i].o.y >> c[i].r;
	}
	double l = 0, r = 400000;
	for (int ti = 0;ti<100;++ti) {
		double x = (l + r) / 2;
		vector<V>ps;
		//候補点を入れる
		for (int i = 0;i < N;++i) {
			ps.push_back(c[i].o);
		}
		for (int i = 0;i<N;++i) {
			for (int j = 0;j<i;++j) {
				Circle a = c[i], b = c[j];
				a.r = x / a.r;
				b.r = x / b.r;
				auto tmp = a.xp(b); 
				ps.insert(ps.end(), tmp.begin(), tmp.end());
			}
		}
		bool ok = false;
		for (V p : ps) {
			int cnt = 0;
			for (int ci = 0; ci < N;++ci) {
				Circle nc = c[ci];
				nc.r = x / nc.r;
				if (nc.isInside(p)) cnt++;
			}
			if (cnt >= K) ok = true;
		}
		if (ok) r = x; else l = x;
	}
	printf("%.10f\n", r);
	return 0;
}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
 
// #define int long long
#define pb push_back
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;

template <class X> void print(X Target){ cout << Target << '\n'; }

const int MAXN = 100, MAXW = 10000;
int N, W;
int v[MAXN], w[MAXN];
int dp[MAXN + 1][MAXW + 1];

int recdp(int now, int remW)
{
  if (dp[now][remW] != -1){
    return (dp[now][remW]);
  }
  
  int res;
  if (now == N){
    res = 0;
  }
  else if (remW < w[now]){
    res = recdp(now + 1, remW);
  }
  else {
    res = max(recdp(now + 1, remW), recdp(now + 1, remW - w[now]) + v[now]);
  }
  
  dp[now][remW] = res;

  return (res);
}

signed main()
{
  ios::sync_with_stdio(false);
  memset(dp, -1, sizeof(dp));

  cin >> N >> W;
  for (int i = 0; i < N; i++){
    cin >> v[i] >> w[i];
  }

  print(recdp(0, W));

  return (0);
}

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

const char NL = '\n';
const int MOD = 1e9 + 7;

void solve()
{
    int a, b, c, k; cin >> a >> b >> c >> k;
    while (b <= a) {
        b *= 2;
        --k;
    }
    while (c <= b) {
        c *= 2;
        --k;
    }
    cout << (k >= 0 ? "Yes" : "No") << NL;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

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

using namespace std;
using Integer = long long;

Integer min_i (Integer W, Integer H) {
  return min(W, H);
}

Integer min_t (Integer W, Integer H) {
  Integer res = 1e10;

  for (Integer l = H / 2; l < H; l++) {
    Integer S_head = W * (H - l);
    Integer S_larger  = (Integer) (l *  ceil((double)W / 2));
    Integer S_smaller = (Integer) (l * floor((double)W / 2));
    Integer S_max = max(S_head, S_larger);
    Integer S_min = min(S_head, S_smaller);
    Integer dS = S_max - S_min;

    if (dS < res) res = dS;
    if (S_head < S_smaller) break;
  }

  return res;
}

int main () {
  Integer H, W;
  cin >> H >> W;

  int ans = (H % 3 == 0 || W % 3 == 0)
    ? 0
    : min(min_i(W, H), min(min_t(W, H), min_t(H, W)));

  cout << ans << "\n";
}


Measured memory_bytes: 256
while True:
    a, op, b = raw_input().split()
    a, b = map(int,[a,b])
    if op == "?":
        break
    if op=="+":
        print (a+b)
    elif op=="-":
        print (a-b)
    elif op=="*":
        print (a*b)
    elif op=="/":
        print (a/b)

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    bool isa = false, isb = false, isc = false;
    REP(i, s.length())
    {
        if (s[i] == 'a')
            isa = true;
        else if (s[i] == 'b')
            isb = true;
        else if (s[i] == 'c')
            isc = true;
    }
    if (isa == true && isb == true && isc == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


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

int main()
{
        int a , b , c , d;

        cin >> a >> b >> c >> d;

        if(a<=b && c<=b && b<=d && c>=a)
        {
            cout << b - c;
        }
        else if(a<=b && c<=b && d<=b && c>=a)
        {
            cout << d - c;
        }
        else if(c<=d && a<=d && d<=b && a>=c)
        {
            cout << d - a;
        }
        else if(c<=d && a<=d && b<=d && a>=c)
        {
            cout << b - a;
        }
        else
            cout << "0";
    return 0;
}


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

/*ll gcd(ll a, ll b){
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll LCM(ll a,ll b)
{
    return (a*b)/gcd(a, b);
}*/

int main()
{
   int n;
   cin>>n;
   int c0=0,c1=0,c2=0,c3=0;
   while(n--)
   {
       string s;
       cin>>s;
       if(s=="AC")
        c0++;
       else if(s=="WA")
         c1++;
       else if(s=="TLE")
         c2++;
        else
         c3++;
   }
   cout<<"AC x "<<c0<<endl;
   cout<<"WA x "<<c1<<endl;
   cout<<"TLE x "<<c2<<endl;
   cout<<"RE x "<<c3<<endl;
  return 0;
}


Measured memory_bytes: 3560
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

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

    for (int i = 0; i < 3; i++) {
        if (n[i] == '1') {
            cout << '9';
        } else {
            cout << '1';
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int n,k,d[1001];
int a[1001][1001]; 
vector<int> v[1001];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		cin>>d[i];
		for(int j=1;j<=d[i];j++)
		cin>>a[i][j],v[a[i][j]].push_back(i);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	if(v[i].empty()) 
	ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=2005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,W,H;cin>>N>>W>>H;
    
    int D=2*(H+W);
    
    vector<pair<int,int>> S(N);
    
    map<int,int> MA;
    
    for(int i=0;i<N;i++){
        int x,y;char c;cin>>x>>y>>c;
        int l,r;
        if(c=='N'){
            l=x+y;
            r=H+x+(H-y);
        }else if(c=='E'){
            l=H+x+(H-y);
            r=H+W+(H-y)+(W-x);
        }else if(c=='S'){
            l=H+W+(H-y)+(W-x);
            r=H+W+H+(W-x)+y;
        }else{
            l=H+W+H+(W-x)+y;
            r=x+y;
        }
        l%=D;
        r%=D;
        S[i]=mp(l,r);
        
        MA[l]=1;
        MA[r]=1;
    }
    
    int id=0;
    
    for(auto &a:MA){
        a.se=id;
        id++;
    }
    
    for(int i=0;i<N;i++){
        S[i].fi=MA[S[i].fi];
        S[i].se=MA[S[i].se];
    }
    
    int ans=INF;
    
    for(int t=0;t<id;t++){
        vector<pair<int,int>> A;
        for(int i=0;i<N;i++){
            int l=S[i].fi,r=S[i].se;
            if(l<=r){
                if(l<=t&&t<=r) {}
                else{
                    if(t<l) A.push_back(mp(l-t,r-t));
                    else A.push_back(mp(l+id-t,r+id-t));
                }
            }else{
                if(l<=t||t<=r) {}
                else A.push_back(mp(l-t,r+id-t));
            }
        }
        
        sort(all(A),[](auto a,auto b){
            return a.se<b.se;
        });
        
        int sum=1,last=0;
        
        int i=0;
        
        while(i<si(A)){
            while(i<si(A)&&A[i].fi<=last) i++;
            if(i==si(A)) break;
            int j=i;
            while(j<si(A)&&A[i].se==A[j].se) j++;
            
            sum++;
            if(i<si(A)) last=A[i].se;
            i=j;
        }
        
        chmin(ans,sum);
    }
    
    cout<<ans<<endl;
    
}




Measured memory_bytes: 3304
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    bool b = true;
    int a[n];
    for(int i = 0; i<n;i++){
        cin>>a[i];
        if(a[i]%2 == 0){
            if(a[i]%3 != 0 && a[i]%5 != 0){
                b = false;
            }
        }
    }
    if(b){
        cout<<"APPROVED"<<endl;
    }else{
        cout<<"DENIED"<<endl;
    }
    
    
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>
#include<cassert>
#include<climits>
using namespace std;

int main() {
	long long N, K;
	cin >> N >> K;
	cout << static_cast<long long>(K * pow(K - 1, N - 1)) << endl;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
#define llINF 1000000000000000007
#define v(i) vector<i>
#define vv(i) vector<vector<i>>
// cin.eof() 入力個数の問題
// int num = atoi(string.c_str()); 文字列の整数変換

int main() {
ll a[3],D;
ll n;
cin>>a[0]; a[0] *= 4;
cin>>a[1]; a[1] *= 2;
cin>>a[2];
cin>>D;
cin>>n;
sort(a,a+3);
if(a[0] <= D/2){
cout<<n*a[0];
}else{
    if(n%2 == 0){
        cout<<n*D/2<<endl;
    }else
    {
        cout<<(n/2)*D + a[0]<<endl;
    }
    
}


   return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <vector>


using namespace std;

//変数デバッグ
#define DEB(variable) cout <<#variable <<"="<<variable<<endl
//for簡易表記(引数ミス防止) a<bにすること！
#define FOR(inc,a,b) for(int inc =(a);(inc)<(b);(inc)++) //incをaにし、b-a回(iがb未満 の間)処理を行う
#define DEFOR(de,a,b) for(int de =(a);(de)>(b);(de)--)

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

	vector<int> v(n, 0);

	FOR(i, 0, n) {
		cin >> v[i];
	}

	FOR(i, 1, n) {
FOR(k, 0, n - 1) {
					cout << v[k] << " ";
				}
				cout << v[n-1] << endl;
		FOR(j, 0, i) {
			if (v[i] < v[j]) {
				space = v[i];
				DEFOR(k, i, j) {
					v[k] = v[k - 1];
				}v[j] = space;
				
			}
		}
		
	}
	FOR(k, 0, n - 1) {
		cout << v[k] << " ";
	}
	cout << v[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 3120
x,y = gets.split.map(&:to_i)

a = Array.new
b = Array.new

a[0] = 1
a[1] = 3
a[2] = 5
a[3] = 7
a[4] = 8
a[5] = 10
a[6] = 12

b[0] = 4
b[1] = 6
b[2] = 9
b[3] = 11

switch = 0

if x == 2 && y == 2
 switch = switch + 1
end

for i in 0..6
 for j in 0..6
  if x == a[i] && y == a[j]
   switch = switch + 1
  end
 end
end

for i in 0..3
 for j in 0..3
  if x == b[i] && y == b[j]
   switch = switch + 1
  end
 end
end

if switch == 1
 puts("Yes")
 else puts("No")
end

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

int toMin(string s){
  int h = (s[0] - '0') * 10 + (s[1] - '0');
  int m = (s[3] - '0') * 10 + (s[4] - '0');
  return h * 60 + m;
}

int n, m;
int f_tm[12], t_tm[12];
string f_nm[12], t_nm[12];

int main(){
  while(cin >> n >> m){
    string s;

    for(int i = 0; i < n; i++){
      cin >> s >> f_nm[i];
      f_tm[i] = toMin(s);
      cin >> s >> t_nm[i];
      t_tm[i] = toMin(s);
    }

    vector<string> nm;
    vector<int> tm;

    for(int i = 1; i < n; i++){
      if(f_tm[i] - t_tm[i - 1] >= m){
        nm.push_back(f_nm[i]);
        tm.push_back(f_tm[i] - t_tm[i - 1]);
      }
    }

    cout << nm.size() << endl;

    for(int i = 0; i < nm.size(); i++){
      cout << nm[i] << " " << tm[i] << endl;
    }
  }
}

Measured memory_bytes: 1236