akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;
int n;
int ar[N + 5];
ll dp[N][2];
bool vis[N][2];
ll F(int pos, int prev){
  if (pos >= n - 1){
    if (prev == 0){
      return ar[n - 1];
    }
    return -ar[n - 1];
  }
  if (vis[pos][prev] == true){
    return dp[pos][prev];    
  }
  ll x = F(pos + 1, 0) + ((prev == 0) ? ar[pos] : -ar[pos]);
  ll y = F(pos + 1, 1) + ((prev == 0) ? -ar[pos] : ar[pos]);
  vis[pos][prev] = true;
  return dp[pos][prev] = max(x, y);
}

int main(){
  FASTER;
  cin >> n;
  for (int i = 0; i < n; i++){
    cin >> ar[i];
  }
  cout << F(0, 0) << '\n';
  return 0;
}

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

struct Problem {
public:

	bool ok[21][21];
	ULL dp[1 << 21] = {};

	void Solve() {
		UL N; scanf("%u", &N);
		rep(i, N) rep(j, N) {
			UL a; scanf("%u", &a);
			ok[i][j] = a;
		}
		dp[0] = 1;
		for (UL i = 1; i < (1 << N); i++) {
			UL p = i;
			p = (p & 0x55555555) + (p >> 1 & 0x55555555);
			p = (p & 0x33333333) + (p >> 2 & 0x33333333);
			p = (p & 0x0f0f0f0f) + (p >> 4 & 0x0f0f0f0f);
			p = (p & 0x00ff00ff) + (p >> 8 & 0x00ff00ff);
			p = (p & 0x0000ffff) + (p >> 16 & 0x0000ffff);
			rep(j, N) {
				if (i & (1u << j)) if (ok[p - 1][j])
					dp[i] += dp[i - (1u << j)];
			}
			dp[i] %= 1000000007;
		}
		printf("%llu", dp[(1 << N) - 1]);
	}
};

int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int main(){
	int n, m; cin >> n >> m;
	vi v;
	if(n <= 2 || n % 2){
		rep(i, n / 2 + 1) v.pb(0);
		rep(i, n / 2) v.pb(m);
	}
	else{
		rep(i, n / 2 + 1) v.pb(0);
		rep(i, n / 2 - 1) v.pb(m);
	}
	rep(i, v.size()) cout << v[i] << (i+1 == v.size() ? "\n":" ");
	return 0;
}

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

public class Main
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok;

    public void go() throws IOException
    {
        ntok();
        int n = ipar();
        out.println(n*n*n);

        out.flush();
        in.close();
    }

    public void ntok() throws IOException
    {
        tok = new StringTokenizer(in.readLine());
    }

    public int ipar()
    {
        return Integer.parseInt(tok.nextToken());
    }

    public int[] iapar(int n)
    {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++)
        {
            arr[i] = ipar();
        }
        return arr;
    }

    public long lpar()
    {
        return Long.parseLong(tok.nextToken());
    }

    public long[] lapar(int n)
    {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++)
        {
            arr[i] = lpar();
        }
        return arr;
    }

    public double dpar()
    {
        return Double.parseDouble(tok.nextToken());
    }

    public String spar()
    {
        return tok.nextToken();
    }

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


Measured memory_bytes: 23124
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

    int n,k;

    cin >> n >> k;
    if(k == 1){
        cout << 0 << endl;
    }
    if(k != 1){

        cout << n-k << endl;
    }

    return 0;
}

Measured memory_bytes: 888
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 2010

int dp[SIZE][SIZE];
int sum[SIZE];

int main(){
  int n, m;
  int a[SIZE], b[SIZE];

  scanf("%d%d", &n, &m);

  for(int i=0; i<n; i++) scanf("%d", a+i);
  for(int i=0; i<m; i++) scanf("%d", b+i);

  ll ans = 0;

  for(int i=0; i<n; i++){
    ll row = 0;
    for(int j=0; j<m; j++) {
      if (a[i] == b[j]) {
        dp[i][j] = row + 1;
        ans = (ans + dp[i][j]) % mod;
      }
      row = (row + sum[j]) % mod;
      sum[j] = (sum[j] + dp[i][j]) % mod;
      debug(dp[i][j]);
    }
  }


  cout << (ans + 1) % mod << endl;

  return 0;
}


Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string S;
    cin >> S;
    
    int ans = 0;
    rep(i, S.size()) rep(j, S.size()) {
        bool judge = true;
        for (int k = i; k <= j; ++k) {
            if (S[k] != 'A' && S[k] != 'C' && S[k] != 'G' && S[k] != 'T') judge = false;
        }
        if (judge) ans = max(ans, j - i + 1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from operator import itemgetter


def main():
    N = int(input())
    ab = [tuple(int(j) for j in input().split()) for i in range(N)]
    cd = [tuple(int(j) for j in input().split()) for i in range(N)]
    # y 降順
    ab.sort(key=itemgetter(1), reverse=True)
    # x 昇順
    cd.sort(key=itemgetter(0))
    # ペアになった赤
    done = [False] * N
    for bx, by in cd:
        i = 0
        for rx, ry in ab:
            if not done[i] and rx < bx and ry < by:
                done[i] = True
                break
            i += 1
    print(sum(done))
    return


main()


Measured memory_bytes: 3064
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto n = readln.chomp.to!int;
  writeln((n-2) * 180);
};


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    N = NI()
    TA = [NLI() for _ in range(N)]
    nt, na = 0, 0
    for t, a in TA:
        if t >= nt and a >= na:
            nt = t
            na = a
        elif t >= nt and a < na:
            k = na // a if na % a == 0 else na // a + 1
            nt = k*t
            na = k*a
        elif t < nt and a >= na:
            k = nt // t if nt % t == 0 else nt // t + 1
            nt = k*t
            na = k*a
        else:
            kt = nt // t if nt % t == 0 else nt // t + 1
            ka = na // a if na % a == 0 else na // a + 1
            k = max(kt, ka)
            nt = k * t
            na = k * a
    print(nt+na)



if __name__ == "__main__":
    main()

Measured memory_bytes: 9652
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        l: f64,
    }
    println!("{:.10}", l.powf(3.0) / 27.0);
}


Measured memory_bytes: 4352
mod = 998244353
n = int(input())
d = list(map(int, input().split()))
ans = 1
l = [[i, 0] for i in range(n)]
for i in range(n): l[d[i]][1] += 1
while l[-1][1] == 0: l.pop(-1)
if d[0] != 0 or l[0][1] > 1: ans = 0
else:
    for i in range(len(l)-1):
        if l[i][1] > 0: 
            ans = (ans*(l[i][1]**l[i+1][1]))%mod
        else:
            ans = 0
            break
print(ans)


Measured memory_bytes: 20396
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int a[1100];
pair<int,int> F(int left,int right){
    int p=-1,q=mod;
    for(int i=left;i<right;i++){
        p=max(p,a[i]);
        q=min(q,a[i]);
    }
    return make_pair(p,q);
}
int main(){
    int n,m;
    cin>>n>>m;
    lol(i,n)cin>>a[i];
    int left=0,right=m;
    int ans=0;
    while(true){
        int p,q;
        if(left<right){
            pair<int,int> tmp=F(left,right);
            p=tmp.first,q=tmp.second;
        }
        else{
            pair<int,int> tmp=F(0,right);
            p=tmp.first,q=tmp.second;
            tmp=F(left,n);
            p=max(p,tmp.first);
            q=min(q,tmp.second);
        }
        ans+=p-q;
        left=right;
        right=(right+m)%n;
        if(left==0)break;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3072
#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
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n, l;
    scanf("%ld%ld", &n, &l);
    
    vector<string> ss(n);
    long i;
    for(i=0; i<n; i++) {
        char str[105]={0};
        scanf("%s", str);
        ss[i] = string(str);
    }
    sort(ss.begin(), ss.end());

    string ans;
    for(i=0; i<n; i++) {
        ans = ans + ss[i];
    }
    printf("%s\n", ans.c_str());
 
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main(){
  char s[101];
  int data[27]={0};
  int flag=0;
  cin >> s;
  int len=strlen(s);
  for(int i=0;i<len;i++){
    data[s[i]-'a']++;
  }
  for(int i=0;i<27;i++){
    if(data[i]!=0){
      if(data[i]%2 != 0){
	flag++;
      }
    }
  }
  if(flag != 0){
    cout << "No" << endl;
  } else{
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s,t;
    cin >> s >> t;
    int slen = s.size(), tlen = t.size();
    VVI dp(slen+1, VI(tlen+1));
    REP(i,0,slen) REP(j,0,tlen) {
        if (s[i] == t[j]) dp[i+1][j+1] = dp[i][j] + 1;
        else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
    }
    int lcs = dp[slen][tlen];
    string ans = "";
    int i = slen, j = tlen;
    while (i > 0 && j > 0 && lcs > 0) {
        if (dp[i-1][j] == dp[i][j]) --i;
        else if (dp[i][j-1] == dp[i][j]) --j;
        else {
            ans = s[i-1] + ans;
            --i; --j;
        }
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 35584
#include <stdio.h>

struct DICE{      // struct
    int ue;
    int temae;
    int migi;
    int hidari;
    int oku;
    int shita;
};

void fancDice(char *direct, struct DICE *diceStr) {     // original_function
    int temp;
    switch (*direct) {
        case 'E':
            temp = diceStr->ue;
            diceStr->ue = diceStr->hidari;
            diceStr->hidari = diceStr->shita;
            diceStr->shita = diceStr->migi;
            diceStr->migi = temp;
            return;
        case 'S':
            temp = diceStr->ue;
            diceStr->ue = diceStr->oku;
            diceStr->oku = diceStr->shita;
            diceStr->shita = diceStr->temae;
            diceStr->temae = temp;
            return;
        case 'W':
            temp = diceStr->ue;
            diceStr->ue = diceStr->migi;
            diceStr->migi = diceStr->shita;
            diceStr->shita = diceStr->hidari;
            diceStr->hidari = temp;
            return;
        case 'N':
            temp = diceStr->ue;
            diceStr->ue = diceStr->temae;
            diceStr->temae = diceStr->shita;
            diceStr->shita = diceStr->oku;
            diceStr->oku = temp;
            return;
    }
    return;
}

int main() {        // main
    int n, jud = 1;
    char *directStr;
    scanf("%d", &n);
    struct DICE diceArr[n];
    
    for (int i=0; i<n; i++) {
        scanf("%d", &diceArr[i].ue);
        scanf("%d", &diceArr[i].temae);
        scanf("%d", &diceArr[i].migi);
        scanf("%d", &diceArr[i].hidari);
        scanf("%d", &diceArr[i].oku);
        scanf("%d", &diceArr[i].shita);
    }
    
    for (int j=0; j<n; j++) {
        for (int k=0; k<n; k++) {
            if (j == k) {continue;}
            struct DICE temp1 = diceArr[j], temp2 = diceArr[k];
            
            for (int p=0; p<6; p++) {
                if (p % 2 == 0) {
                    directStr = "W";
                } else {
                    directStr = "S";
                }
                fancDice(directStr, &temp2);
                
                for (int q=0; q<4; q++) {
                    if (temp1.ue == temp2.ue) {
                        if (temp1.temae == temp2.temae) {
                            if (temp1.migi == temp2.migi) {
                                if (temp1.hidari == temp2.hidari) {
                                    if (temp1.oku == temp2.oku) {
                                        if (temp1.shita == temp2.shita) {
                                            printf("No\n");
                                            return 0;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (temp1.ue == temp2.ue) {
                        directStr = "WSE";
                        for (int k=0; directStr[k]!='\0'; k++) {
                            fancDice(&directStr[k], &temp2);
                        }
                    }
                }
            }
        }
    }
    
    printf("Yes\n");
    return 0;
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll)1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll v[3010][3010];
ll dp[3010][3010][4];

void solve() {
    ll r, c, k;
    cin >> r >> c >> k;
    REP(i, k) {
        ll rr, cc, vv;
        cin >> rr >> cc >> vv;
        rr--;
        cc--;
        v[rr][cc] = vv;
    }

    REP(i, r + 1) {
        REP(j, c + 1) {
            REP(k, 4) {
                chmax(dp[i + 1][j][0], dp[i][j][k]);
                chmax(dp[i][j + 1][k], dp[i][j][k]);
                if(k < 3) {
                    chmax(dp[i + 1][j][0], dp[i][j][k] + v[i][j]);
                    chmax(dp[i][j + 1][k + 1], dp[i][j][k] + v[i][j]);
                }
            }
        }
    }
    ll ans = 0;
    REP(i, 4) {
        chmax(ans, dp[r][c][i]);
    }
    cout << ans << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 356404
def f():
    import sys
    import numpy as np
    input=sys.stdin.readline
    n=int(input())
    a=np.array([0]+[int(j) for j in input().split()])
    np.cumsum(a,out=a)
    dp=np.zeros((n,n+1),np.int64)

    for i in range(1,n):
        l=np.arange(n-i)
        r=np.arange(i+1,n+1)
        m=(np.arange(1,i+1)+l[:,np.newaxis]).T
        dp[l,r]=np.amin(dp[l,m]+dp[m,r],0)+a[r]-a[l]
    print(dp[0][n])
f()

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

int n, i, len[300], ans;

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

	cin >> n;
	for (i=1; i<=2*n; i++) {
		cin >> len[i];
	}
	sort (len+1, len+2*n+1);

	for (i=1; i<=2*n; i+=2) {
		ans+=len[i];
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n, t;
    cin >> n >> t;
    vector<P> p(n);
    ll a, b;
    REP(i, n) {
        cin >> a >> b;
        p[i] = {a, b};
    }
    VSORT(p);
    // 最後に i 番目の料理を食べる.
    // 食べる料理の集合を決めたとき, 一番時間がかかるものを最後に食べるのが最適
    vvll dp(n + 1, vll(t + 1, 0)); // dp[i][j] : i - 1 までを使って時間 j までに食べられる価値の最大値
    REP(j, t + 1) dp[0][j] = 0;
    REP(i, n) {
        a = p[i].first, b = p[i].second;
        REP(j, t) {
            dp[i + 1][j] = dp[i][j];
            if (j - a < 0) continue;
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - a] + b);
        }
    }
    ll res = 0;
    REP(i, n) {
        res = max(res, dp[i][t - 1] + p[i].second);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 70784
#include <stdio.h>

int 
main(){
	int P,Q,N;
	int num[3];	
	scanf("%d%d%d",&num[0],&num[1],&num[2]);
	int i,j;
	int tmp;
	for(i=0;i<3;i++){
		for(j=i+1;j<3;j++){
			if(num[i]>num[j]){
				tmp=num[i];
				num[i]=num[j];
				num[j]=tmp;
			}
		}
	}
	

	
	
	printf("%d\n",num[0]+num[1]);
 return 0;
}

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

using namespace std;
typedef long long ll;
int _w;

void check( ll n, ll a, ll b ) {
	ll down = n*a*b;
	ll up = 4*a*b - n*b - n*a;
	if( up > 0 && down % up == 0 )
		printf( "%lld %lld %lld\n", a, b, down/up ), exit(0);
}

int main() {
	ll n;
	_w = scanf( "%lld", &n );
	for( ll a = 1; a <= 3500; ++a )
		for( ll b = 1; b <= 3500; ++b )
			check(n, a, b);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int A[100001],i,j,a,p;
int partition(int A[],int p,int r){
  int temp,x=A[r];
  i=p-1;
  for(j=p;j<=r-1;j++){
    if(A[j]<=x){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  return i+1;  
}
  
int main(){
  int n;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  a= partition(A,1,n);
  for(i=1;i<n;i++){
    if(i==a){
      printf("[%d] ",A[i]);
    }else{
      printf("%d ",A[i]); 
    }
  }
  printf("%d\n",A[n]);
  return 0;
}



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

int main() {
  ll n,k;
  cin >> n >> k;
  ll ans=0;
  ll zero=0;
  if(k>0) {
    for(ll i=k+1;i<=n;i++) {
      ll temp=i-k;
      ans+=n/i*temp+max(n%i-k+1,zero);
    }
  }
  else {
    ans=n*n;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回
// double pi = M_PI or acos(-1)

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A) {
    if(A.size() == n + 1) {
        int now = 0;
        rep(i, q) {
            if (A.at(b.at(i)) - A.at(a.at(i)) == c.at(i)) now += d.at(i);
        }
        ans = max(ans, now);
        return;
    }

    A.push_back(A.back());
    while(A.back() <= m) {
        dfs(A);
        A.back()++;
    }
}

int main() {
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i, q) {
        cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
    }
    dfs(vector<int>(1, 1));
    cout << ans << endl;

    return 0;
}


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

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

    int n, r;

    cin >> n >> r;
    if (n < 10)
        r += 100*(10-n);
    cout << r << '\n';        
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n,a,b;
int main(){
	cin>>n>>a>>b;
	if((n>1&&b>=a)||(n==1&&a==b))cout<<(n-2)*(b-a)+1<<endl;
	else cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
gets.split(" ").map(&:to_i)
a = gets.split(" ").map(&:to_i).sort.reverse
while a.length > 1
  a[0] -= 1
  a[a.length - 1] -= 1
  if a[a.length - 1] == 0
    a.pop()
  end
  if a.length > 0 && a[0] == 0
    a.shift()
  end
end
if a.length == 0
  puts 0
else
  puts a[0] - 1
end


Measured memory_bytes: 1788
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1100000000;
constexpr long long LLINF = 1100000000000000000LL;
constexpr long long MOD = 1000000007;

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N; cin >> N;
  vector<int> a(N);
  REP(i, N) cin >> a[i];
  vector<bool> ans(N, false);
  int M = 0;
  for (int i = N-1; i >= 0; i--) {
    int cnt = 0;
    for (int j = i; j < N; j += (i+1)) {
      cnt += ans[j];
    }
    if ((a[i] + cnt) % 2) {
      ans[i] = true;
      M++;
    }
  }
  cout << M << endl;
  REP(i, N) {
    if (ans[i]) cout << (i + 1) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1792
/*s1190073  Rina Sato
  File name: prog10a.c
  This is a program which outputs the n-th iterm of the fibonacci series.
*/

#include <stdio.h>
#include <stdlib.h>

int main(void){
  int n,fib,f[44],i,f1=1,f2=1;

  scanf("%d",&n);

  if(n == 0 || n == 1){
    fib = 1;
  }
  else {
    for(i = 1 ; i < n ; i++){
      fib = f1 + f2;
      f1 = f2;
      f2 = fib;
    }
  }
  printf("%d\n",fib);

  return 0;
}

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

int main() {
  int n,k,q;
  cin>>n>>k>>q;
  vector<bool> ans(n,1);
  map<int,int> maru;
  rep(i,n){
    maru[i+1]=0;
  }
  rep(i,q){
    int a;
    cin>>a;
    maru[a]++;
  }
  rep(i,n){
    if(k<=q-maru[i+1]){
      ans[i]=0;
    }
  }
  rep(i,n){
    if(ans[i]){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 5376
def main():
    S = input()
    upper = int(S[:2])
    lower = int(S[2:4])
    s = ''
    if upper <= 12 and upper > 0:
        s += 'MM'

    else:
        s += 'YY'

    if lower <= 12 and lower > 0:
        s += 'MM'

    else:
        s += 'YY'

    if s == 'MMMM':
        print('AMBIGUOUS')

    elif s == 'YYYY':
        print('NA')

    else:
        print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=550;
//ここまでテンプレ
ll grundy(ll A,ll K){
	//cout<<A<<" "<<K<<endl;
	if(A%K==0)
		return A/K;
	else if(A<K)
		return 0LL;
	else
		return grundy(A-(1+A/K)*max(((A%K)/(A/K+1)),1LL),K);
}
int main(){
	ll N;
	cin>>N;
	vll A,K;
	for(int i=0;i<N;i++){
		ll a,k;
		cin>>a>>k;
		A.pb(a);
		K.pb(k);
	}
	ll G=0;
	for(int i=0;i<N;i++){
		G^=grundy(A[i],K[i]);
	}
	//cout<<G<<endl;
	if(G)
		cout<<"Takahashi"<<endl;
	else
		cout<<"Aoki"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
const int maxn=100010;
int N,K,lin[maxn],len,ans[maxn];
struct edge{
	int y,next;
}e[maxn*2];
inline void insert(int xx,int yy){
	e[++len].next=lin[xx];
	lin[xx]=len;
	e[len].y=yy;
}
inline void ins(int xx,int yy){
	insert(xx,yy);
	insert(yy,xx);
}
typedef pair<int,int> pii;
priority_queue<pii,vector<pii>,greater<pii> >pq;
bool check(){
	for(int i=1;i<=N;i++)
		for(int j=lin[i];j;j=e[j].next)
			if(abs(ans[i]-ans[e[j].y])!=1)
				return 0;
	return 1;
}
int main(){
	//freopen("in","r",stdin);
	N=read();
	for(int i=1;i<N;i++)
		ins(read(),read());
	memset(ans,10,sizeof(ans));
	K=read();
	for(int i=1;i<=K;i++){
		int v=read(),k=read();
		ans[v]=k;
		pq.push(make_pair(k,v));
	}
	while(!pq.empty()){
		pii tmp=pq.top();
		pq.pop();
		for(int i=lin[tmp.second];i;i=e[i].next)
			if(ans[e[i].y]==ans[0]){
				ans[e[i].y]=tmp.first+1;
				pq.push(make_pair(ans[e[i].y],e[i].y));
			}
	}
	/*for(int i=1;i<=N;i++)
		printf("%d\n",ans[i]);
	puts("");*/
	if(check()){
		puts("Yes");
		for(int i=1;i<=N;i++)
			printf("%d\n",ans[i]);
	}
	else
		puts("No");
	return 0;
}



Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll mypow(ll a, ll b) {
    ll ret = 1;
    while (b--) {
        ret *= a;
    }
    return ret;
}

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

    sort(a.begin(), a.end());
    ll ans = 0;
    rep(i, a[n - 1] + 1) {
        vector<ll>::iterator pos1, pos2;
        pos1 = upper_bound(a.begin(), a.end(), i - 2);
        pos2 = upper_bound(a.begin(), a.end(), i + 1);
        ll key1 = distance(a.begin(), pos1);
        ll key2 = distance(a.begin(), pos2);
        chmax(ans, key2 - key1);
    }

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

Measured memory_bytes: 4036
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define SUM(n) ((n)+1)*(n)/2
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = (1e9)+7;
#define all(v) v.begin(),v.end()
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

  vector<string> vec;
  string s;
  int n;
  char str[10];
  cin >> n;
  rep(i,n){
    rep(j,10){
      cin >> str[j];
    }
    sort(str, str +10);
    s = str[0];
    reps(j,9){
      s += str[j];
    }
    vec.pu(s);
    //cout << s << '\n';
  }
  sort(all(vec));
  lol ans = 0, sum = 1;
  reps(i, n - 1){
    if(vec[i] != vec[i - 1]){
      ans += sum * (sum - 1);
      sum = 1;
    } else {
      sum ++;
    }
  }
  ans += sum*(sum - 1);
  cout << ans / 2 << '\n';
  return 0;
}


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

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using namespace std;

/* function */
//  - none - 


/* code */
int main (void) 
{

  /* Variable_Proclamation */
  int N;    // input
  int64_t ans;  // output

  int i, j, k;    // subscript
  int count;
  int comp; // comparison

  int64_t power;
  int64_t div;


  /* Input, Array_Proclamation */
  cin >> N;


  /* Initialize */
  ans = 0;
  count = 0;

  power = 1;
  div   = 1;
  for(i=1; i<10; i++)
  {
    div *= 10;
  }
  div += 7;



  /* Calculation */
  for(i=1; i<=N; i++)
  {
    power *= i;
    power %= div;
  }

  ans = power;
  

  /* Output */
  cout << ans << endl;


  return 0;

}


/* entity */
//  - none -




Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String s = sc.next();
        String t = sc.next();
        for(int i = 0; i < s.length(); i++){
            String sf = s.substring(0,i);
            String sb = s.substring(i,s.length());
            if((sb+sf).equals(t)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}

Measured memory_bytes: 21460
long d['~~'];A,x,i,j;main(n){for(scanf("%d%d",&n,&A),d[n*=A]=1;~scanf("%d",&x);i=5e3-i)for(x-=A,j=2*n;j--;)d[5000-i+j]=d[i+j]+(j<x|j-x>2*n?0:d[i+j-x]);printf("%ld",d[i+n]-1);}

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

int main(){
	int n, cnt = 0;
	string s;
	cin >> n >> s;
	for(int i=0; i<n-2; i++){
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

int A, B, C, X;

int main() {
    cin >> A >> B >> C >> X;

    int ans = 0;
    for (int i = 0; i <= A; i++) {
        for (int j = 0; j <= B; j++) {
            for (int l = 0; l <= C; l++) {
                if (X == i*500 + j*100 + l*50) ans++;
            }
        }
    }

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

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

using namespace std; 
 
#define int long long
#define M 1000000007
 
signed main(){
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	
	int n;
	cin >> n;
	int dp[3001]={0};
	dp[3]=1;
	dp[4]=1;
	dp[5]=1;
	for(int i=6;i<=n;i++){
		dp[i]=1;
		for(int j=3;j<=i;j++){
			if(i-j>=3){
				dp[i]=(dp[i]+dp[i-j])%M;
			}
		}
	}
	cout << dp[n] << endl;
}


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

using namespace std;

int main()
{
	string s;
  	cin >> s;
  
  	for (int i = 0; i < s.size(); i++){
    	if (s[i] == '1') s[i] = '9';
      	else  if (s[i] == '9') s[i] = '1';
    }
  
  	cout << s << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int i,N,M,sum,a;
	scanf("%d %d",&N,&M);
	if(M < 5)
		{ a = M;}
    else {a = 5;}
	if(N >= 1 && N <= 100 && M >= 1 && M <= 5)
	
{		sum = 1900*M + (N-M)*100;
     	i = sum*pow(2,M);
     	}
     printf("%d",i);
	
    

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int res = 0;
            if (A <= B) {
                res += B;
                B--;
            } else {
                res += A;
                A--;
            }
            if (A <= B) {
                res += B;
                B--;
            } else {
                res += A;
                A--;
            }
            System.out.println(res);
        }
    }
}


Measured memory_bytes: 22612
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
ll compute(ll n,ll k){
	if(n%k==0)
		return n/k;
	if(n<k)
		return 0;
	ll haha,lol,val=n/k;
	val++;
	if(val*val>n){
		n-=val;
		return compute(n,k);
	}
	else{
		haha=n%k;
		lol=haha/val;
		n-=lol*val;
		if(n%k>0){
			n-=val;
			
		}
		return compute(n,k);

	}
	return 0;
}
int main(){
    std::ios::sync_with_stdio(false);
    ll n,ans=0,a,k,i;
    cin>>n;
    rep(i,n){
    	cin>>a>>k;
    	ans^=compute(a,k);
    }
    if(ans==0){
    	cout<<"Aoki"<<endl;
    }
    else{
    	cout<<"Takahashi"<<endl;
    }

    return 0;  
    
}



Measured memory_bytes: 384
#include <iostream>
using namespace std;
 
int main() {
     int n,m,a;
        int h,p,q;
    while(true){
        int amida[101][1001]={{0}};

        cin >> n >> m >> a;
        if(n==0&&m==0&&a==0){
                break;
        }
         
        for(int i=0;i<m;i++){
            cin >> h >> p >> q;
            amida[p][h]=1;
        }
         
        for(int j=1000;j>0;j--){
            if(amida[a][j]==1) a++; //????????????
            else if(amida[a-1][j]==1) a--; //???
        }
         
        cout << a << endl;
    }
     
    return 0;
}

Measured memory_bytes: 1560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll inf=(1ll<<61);
const int MX=3e5+9;
string a,b;
int pw[10];
int main(){
    cin>>a>>b;
    a+=b;
    pw[0]=1;
    ll k=0;
    for(int i=1;i<=8;i++)pw[i]=pw[i-1]*10;
    for(int i=0;i<a.size();i++){
        k*=10;
        k+=a[i]-'0';
    }
    ll o=sqrt(k);
    if(o*o==k)puts("Yes");
    else puts("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define R register
#define For(i, j, k) for(R int i = (j), ED = (k); i <= ED; ++i)
#define Rep(i, j, k) for(R int i = (j), ED = (k); i >= ED; --i)
#define Cross(i, j, k) for(R int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 200011;
const ll INF = 5e16;

namespace IO {

    inline char gc() {
        static char buf[100000], *p1 = buf, *p2 = buf;
        return (p1 == p2) && (p2 = (p1 = buf) +
            fread(buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
    }

    #define dd ch = getchar()
    inline ll read() {
        R ll x = 0; R int f = 0; R char dd;
        for (; !isdigit(ch); dd) f ^= (ch == '-');
        for (; isdigit(ch); dd)  x = x * 10 + (ch ^ 48);
        return f? -x: x;
    }
    #undef dd

    inline void write ( ll x ) {
        if (x < 0) x = -x, putchar('-');
        if (x > 9) write(x / 10); putchar(x % 10 | 48);
    }

    inline void wrn ( ll x ) { write(x), putchar(' '); }

    inline void wln ( ll x ) { write(x), putchar('\n'); }

    inline void wlnn ( ll x, ll y ) { wrn(x), wln(y); }

}

using IO::wln;
using IO::read;

namespace Cesare {
	
	ll n, a[N];
	double Ans = 0;
	
	int main() {
		n = read();
		For ( i, 1, n ) a[i] = read();
		sort(a + 1, a + n + 1);
		Ans = a[1];
		For ( i, 2, n ) Ans = (Ans + a[i]) / 2.0;
		return printf("%.12lf\n", Ans), 0;
	}
	
}

int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
    return Cesare::main();
}

/*

*/







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


int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int>A(M, 0);
  
  
  for (int i=0; i<N; i++) {
    int K;
    cin >> K;
    for (int j=0; j<K; j++) {
      int num;
      cin >> num;
      A[num-1]++;
    }
  }
  
  int ans = 0;
  
  for (int i=0; i<M; i++) {
    if (A[i] == N) ans++;
  }
  
  cout << ans << endl;
 
}



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

int main(){ 
	int n; std::cin >> n; 
	long long max = pow(10,18);
	long long temp = 1;
	bool mm = false;

	std::vector<long long> vec;
	
	for(int i = 0; i < n; ++i){
		long long a;
		std::cin >> a;

		if(a == 0){
			std::cout << 0 << std::endl;
			return 0;
		}

		vec.push_back(a);
	}

	for(int i = 0; i < n; ++i){
		if(temp > max/vec[i]){
			std::cout << -1 << std::endl;
			return 0;
		}

		temp *= vec[i];
	}

	std::cout << (mm ? (temp == 0 ? 0 : -1) : temp) << std::endl;
}


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

long long int MAXM = 1e9 + 7;

void solve()
{
    long long int ans = 0;
    long long int n;
    cin >> n;
    vector<long long int> a(n);
    vector<long long int> prefix(n);
    for (long long int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    prefix[0] = a[0];
    for (long long int i = 1; i < n; i++)
        prefix[i] = prefix[i - 1] + a[i];
    for (long long int i = 1; i < n; i++)
    {
        long long int val = (a[i] * (prefix[i - 1]%MAXM))%MAXM;
        ans += val;
        ans %= MAXM;
    }

    ans %= MAXM;
    
    cout << ans << "\n";

}

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
    
    solve();


    return 0;
}


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

int N , M , dp[503][253] , arr[503];

int main(){
	cin >> N >> M;
	for(int i = 0 ; i < 2 * N ; ++i)
		if(i < N) arr[i] = sqrt(N * N - i * i - 1);
		else arr[i] = -sqrt(4 * N * N - i * i);
	sort(arr , arr + 2 * N , [](int p , int q){return abs(p) < abs(q);});
	int sum = 0;
	for(int i = 0 ; i <= N ; ++i){
		memset(dp , 0 , sizeof(dp)); dp[0][i] = 1; int cnt = N , cnt1 = 0;
		for(int j = 0 ; j < 2 * N ; ++j)
			if(arr[j] < 0){
				for(int k = 0 ; k <= i ; ++k)
					dp[j + 1][k] = 1ll * dp[j][k] * (-arr[j] - (i - k + cnt1) + 1) % M;
				++cnt1;
			}
			else{
				--cnt;
				for(int k = 0 ; k <= i ; ++k){
					dp[j + 1][k] = 1ll * dp[j][k] * (min(2 * N - 1 , (int)sqrt(4 * N * N - cnt * cnt)) - (N + (N - cnt - 1) + k) + 1) % M;
					if(k) dp[j + 1][k - 1] = (dp[j + 1][k - 1] + 1ll * dp[j][k] * (arr[j] - (cnt1 + i - k) + 1)) % M;
				}
			}
		sum = (sum + (i & 1 ? M - 1ll : 1ll) * dp[2 * N][0]) % M;
	}
	cout << sum; return 0;
}

Measured memory_bytes: 768
H, W, K = map(int, input().split())
l = []
ans = 0
for i in range(H):
    l.append(input())
Hblack = []
Wblack = []
for i in range(W):
    Hblack.append(0)
    for j in range(H):
        if l[j][i] == '#':
            Hblack[-1] += 1
for i in range(H):
    Wblack.append(0)
    for j in range(W):
        if l[i][j] == '#':
            Wblack[-1] += 1
ALL = sum(Hblack)
#print(Hblack)
for i in range(2 ** H):
    t1 = i
    Hl = [False] * H
    for j in range(H):
        if t1 & 1:
            Hl[j] = True
        t1 = t1 >> 1
    #print(Hl)
    T = ALL
    for j in range(H):
        if Hl[j]:
            T -= Wblack[j]
    #print(T)
    for j in range(2 ** W):
        T2 = T
        t2 = j
        for k in range(W):
            if t2 & 1:
                T2 -= Hblack[k]
                for m in range(H):
                    if Hl[m] and l[m][k] == '#':
                        T2 += 1
            t2 = t2 >> 1
        #print(T2)
        if T2 == K:
            ans += 1
print(ans)

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<int> t(n);
  int total=0;
  for(int i=0;i<n;i++){
    cin >> t[i];
    total+=t[i];
  }

  int m;
  cin >> m;
  int p,x;
  int ans=total;
  for(int i=0;i<m;i++){
    cin >> p >> x;
    cout << total-t[p-1]+x << endl;
  }
  return 0;
}


Measured memory_bytes: 256