akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

int main() {
    string S;
    cin >> S;
    
    string divide[4] = {"dream", "dreamer", "erase", "eraser"};
    
    // 後ろから解くかわりにすべての文字列を「左右反転」する
    reverse(S.begin(), S.end());
    for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
    
    // 端から切っていく
    bool can = true;
    for (int i = 0; i < S.size();) {
        bool can2 = false; // 4 個の文字列たちどれかで divide できるか
        for (int j = 0; j < 4; ++j) {
            string d = divide[j];
            if (S.substr(i, d.size()) == d) { // d で divide できるか
                can2 = true;
                i += d.size(); // divide できたら i を進める
            }
        }
        if (!can2) { // divide できなかったら
            can = false;
            break;
        }
    }
    
    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(){
	int M,N,T[11234],p,x;
	int total =0;
	scanf("%d", &N);

	for (int i = 0;i < N;i++) {
		scanf("%d", T + i);
		total += T[i];
	}

	scanf("%d", &M);

	for (int i = 0;i < M;i++) {
		scanf("%d %d", &p, &x);
		printf("%d\n", total - T[p-1] + x);
	}
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
int main()
{
	LL a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(a==0)
	{
		cout<<1<<"\n";
	}
	else if(b==0)
	{
		cout<<2<<"\n";
	}
	else if(c==0)
	{
		cout<<3<<endl;
	}
	else if(d==0)
	{
		cout<<4<<"\n";
	}
	else
	cout<<5<<endl;

}


Measured memory_bytes: 3624
//

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

int main() {
	double A, B, H, M;
	cin >> A >> B >> H >> M;

	double theta = 2 * M_PI * M / 60 - (2 * M_PI * H / 12 + 2 * M_PI / 12 * M / 60);

	double ans = sqrt(pow(A * sin(theta), 2) + pow(A * cos(theta) - B, 2));

	cout << fixed << setprecision(10);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4164
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
int n,dp[100100][3];

signed main() {
    cin >> n;
    vvi v(n,vi(3));
    rep(i, n)cin >> v[i][0] >> v[i][1] >> v[i][2];
    rep(i, n) {
        rep(j, 3) {
            rep(k, 3) {
                if(j==k)continue;
                chmax(dp[i+1][k],dp[i][j]+v[i][k]);
            }
        }
    }
    int ma = -1;
    rep(i, 3) chmax(ma,dp[n][i]);
    /*rep(i, n+1) {
        cout << i << ':';
        rep(j, 3) {
            cout << dp[i][j];
            if(j==2)cout << endl;
            else {
                cout << ' ';
                if(i<=1)cout << ' ';
            }
        }
    }*/
    cout << ma << endl;
    return 0;
}

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

struct V {
    ll d, par, v;
    bool operator<(const V &rhs) const {
        return this->d < rhs.d;
    }
};

vector<int> TopologicalSort(vector<vector<int>> &G) {
    int N = G.size();
    vector<int> cnt(N);
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < G[i].size(); j++) {
            cnt[G[i][j]]++;
        }
    }
    vector<int> S;
    for (int i = 0; i < N; i++) {
        if (!cnt[i]) S.push_back(i);
    }
    if (!S.size()) return vector<int>();

    vector<int> L;
    while(!S.empty()) {
        int n = S.back(); S.pop_back();
        L.push_back(n);
        for(int i = 0; i < G[n].size(); i++) {
            cnt[G[n][i]]--;
            if (!cnt[G[n][i]]) {
                S.push_back(G[n][i]);
            }
        }
    }
    if (L.size() == N) return L;
    return vector<int>();
}


void solve() {
    int N, M;
    cin >> N >> M;
    vector<int> D(N);
    vector<vector<int>> G(N);
    for (int i = 0; i < N - 1 + M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        D[b]++;
        G[a].push_back(b);
    }

    vector<int> T = TopologicalSort(G);

    vector<int> P(N);

    for(int i = 0; i < N; i++) {
        if (D[i] == 0) {
            P[i] = -1;
            break;
        }
    }

    for (int i = 0; i < N; i++) {
        int v = T[i];
        for(int j = 0; j < G[v].size(); j++) {
            P[G[v][j]] = v;
        }
    }

    for (int i = 0; i < N; i++) {
        cout << P[i] + 1 << endl;
    }
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();

    #ifdef LOCAL_ENV
    assert(cin.rdstate() & ios_base::eofbit);
    #endif
}

Measured memory_bytes: 7536
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>

typedef int LL;
using namespace std;

int main() {
    LL A, B, K, cnt = 0;
    scanf("%d%d%d", &A, &B, &K);
    for (LL i = A; i >= 1; i--) {
        if (A % i == 0 && B % i == 0)
            cnt += 1;
        if (cnt == K) {
            printf("%d\n", i);
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    string a;   bool v[2]={0};
    cin>>a;
    for(int i=0;i<a.length();i++){
        if(a[i]=='C') v[0]=1;
        if(a[i]=='F'&&v[0])  v[1]=1;
    }
    if(v[1]) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b=MI()
def accumbi(x):
    ans=((x+1)//2)%2
    i=1
    while 2**(i-1)<x:
        ans+=(2**i)*((max(0,x%(2**(i+1))-2**i+1))%2)
        i+=1
    return ans
print(accumbi(b)^accumbi(a-1))

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

int main()
{
  ll n;
  cin>>n;
  vector<ll> a(n),b(n),c(n);
  for(int i=0;i<n;i++)
    cin>>a[i]>>b[i]>>c[i];

  if(n==1)
  {
    cout<<max(a[0],max(b[0],c[0]))<<endl;
    return 0;
  }
  vector<vector<ll>> dp(n,vector<ll>(3,-1));

  dp[0][0]=a[0];
  dp[0][1]=b[0];
  dp[0][2]=c[0];
  for(int i=1;i<n;i++)
  {
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
    dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
  }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;

}


Measured memory_bytes: 11124
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
S = input()
lnS = len(S)
for i in range(lnS-1,-1,-1):
    #print(S)
    S = S[:i]
    flag = True
    if S[:len(S)//2] == S[len(S)//2:]:
        print(len(S))
        exit()


Measured memory_bytes: 10300
#include <iostream>
#include <stdio.h>
#include <math.h>

#define MAX 26
#define NIL -1

struct Node {
    int parent;
    int left;
    int right;
};

Node T[MAX];
int n, H[MAX];
int ch_num[MAX];

int setDepth(int id) {
    int d = 0;
    Node tmp = T[id];
    while (tmp.parent != NIL) {
        tmp = T[tmp.parent];
        d++;
    }
    return d;
}

int setHeight(int H[], int id) {
    int h1 = 0, h2 = 0;
    if (T[id].right != NIL) {
        h1 = setHeight(H, T[id].right) + 1;
    }
    if (T[id].left != NIL) {
        h2 = setHeight(H, T[id].left) + 1;
    }
    return H[id] = std::max(h1, h2);
}

int getsibling(int id) {
    if (T[id].parent == NIL) return -1;
    
    if (T[T[id].parent].left == id) {
        return T[T[id].parent].right;
    } else {
        return T[T[id].parent].left;
    }
}


void print(int ch_num[]) {
    for (int i = 0; i < n; i++) {
        printf("node %d: ", i);
        printf("parent = %d, ", T[i].parent);
        int sibling = getsibling(i);
        printf("sibling = %d, ", sibling);
        printf("degree = %d, ", ch_num[i]);
        printf("depth = %d, ", setDepth(i));
        printf("height = %d, ", setHeight(H, i));
        if (setDepth(i) == 0) printf("root\n");
        else if (setHeight(H, i) != 0) printf("internal node\n");
        else printf("leaf\n");
    }
}

int main() {
    int id;
//    int *ch_num = new int();
    scanf("%d", &n);
    
    for (int i = 0; i < n; i++) {
        T[i].left = T[i].right = T[i].parent = NIL;
    }
    
    for (int i = 0; i < n; i++) {
        scanf("%d", &id);
        scanf("%d %d", &T[id].left, &T[id].right);
        ch_num[id] = 0;
        // set the parent id
        if (T[id].left != NIL) {
            T[T[id].left].parent = id;
            ch_num[id] ++;
        }
        if (T[id].right != NIL) {
            T[T[id].right].parent = id;
            ch_num[id] ++;
        }
    }
    
    print(ch_num);
    
    return 0;
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

string N;

int main(){
    cin >> N;
    if(N[0] == '9' or N[1] == '9'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 768
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		List<String> grade=new ArrayList<>();
		int a,b,c;
		while(true) {
			a=s.nextInt();
			b=s.nextInt();
			c=s.nextInt();
			if(a==-1 && b==-1 && c==-1) {
				break;
			}
			if(a==-1 || b==-1) {
				grade.add("F");
			}else if(a+b>=80) {
				grade.add("A");
			}else if(a+b<80 && a+b>=65) {
				grade.add("B");
			}else if(a+b<65 && a+b>=50) {
				grade.add("C");
			}else if(a+b<=50 && a+b>=30) {
				if(c>=50) {
					grade.add("C");
				}else {
					grade.add("D");
				}
			}else if(a+b < 30){ 
				grade.add("F");
			}
		}
		
		for(int i=0;i<grade.size();i++) {
			System.out.println(grade.get(i));
		}

	}

}

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

int main(){
    int H, W;
    while(1){
        cin >> H >> W;
        if (H==0 && W==0) return 0;
        rep(i,H){
            rep(j,W) cout << ((i+j)%2==0 ? "#" : ".");
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
using System;
using System.Linq;

class AtCoder {
  public static void Main() {
    var N = int.Parse(Console.ReadLine().Trim());
    var X = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToList();
    var ans = 1000000000;
    for(var i = 0; i <= 100; i++) {
      var tmp = 0;
      for(var j = 0; j < N; j++) {
        tmp += (X[j] - i) * (X[j] - i);
      }
      if (tmp < ans) {
        ans = tmp;
      }
    }
    Console.WriteLine(ans);
  }
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) cin >> P[i];

  int answer = 0;
  for (int i = 1; i + 1 < N; i++) {
    if (((P[i] < P[i - 1]) && (P[i] > P[i + 1])) ||
        ((P[i] > P[i - 1]) && (P[i] < P[i + 1]))) {
      answer++;
    }
  }
  cout << answer;

  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		int N = sc.nextInt();
		
		long sum = 0;
		long[] a = new long[N];
		for(int i=0; i<N; i++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}
		
		for(int i=1; i<N; i++) {
			a[i] = a[i] + a[i-1];
		}
		
		long min = Long.MAX_VALUE;
		for(int i=0; i<N-1; i++) {
			if(Math.abs(sum - 2 * a[i]) < min) {
				min = Math.abs(sum - 2 * a[i]);
			}
		}
		
		System.out.println(min);
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 41468
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int main(){
    int n;cin>>n;
    vector<long long> d(n);
    int maxi = 0;
    
    for(int i=0;i<n;i++){
        int x;cin>>x;//辺の長さ
        if(i!=0&&x==0){
            cout<<"0"<<endl;
            return 0;
        }
        maxi = max(maxi,x);
        d[x]++;
    }
    long long res = 1;
    
    for(int i=1;i<=maxi;i++){
        for(int j=0;j<d[i];j++){
            res *= d[i-1];
            res %= MOD;
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1024
S = input()

s1 = int(S[:2])
s2 = int(S[2:])

f1 = 0
f2 = 0
if s1 in range(1, 13):
    f1 = 1

if s2 in range(1, 13):
    f2 = 1

if f1 == 1 and f2 == 1:
    print("AMBIGUOUS")
elif f1 == 1 and f2 == 0:
    print("MMYY")
elif f1 == 0 and f2 == 1:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 3060
program atcoder0404_D
  integer(8),dimension(1000000)::A
  read(5,*)K
  do I=1,9
     A(I)=I
  end do
  M=10
  do I=1,K
     if(mod(A(I),10)/=0) then
        A(M)=10*A(I)+mod(A(I),10)-1
        M=M+1
     end if
     A(M)=10*A(I)+mod(A(I),10)
     M=M+1
     if(mod(A(I),10)/=9) then
        A(M)=10*A(I)+mod(A(I),10)+1
        M=M+1
     end if
     if (M>=K+1) exit
  end do
  write(6,*)A(K)
end program atcoder0404_D

Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
typedef long long ll;

int main(void) {
  ll i, n;
  scanf("%lld", &n);
  ll v[n];
  double ans;
  for(i = 0; i < n; ++i) scanf("%lld", &v[i]);
  std::sort(v, v + n);
  ans = (double)v[0];
  for(i = 1; i < n; ++i) ans += v[i], ans /= 2;
  printf("%lf", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const char newl = 10;
const string sep = "\n_____\n";
const ll MOD = 1000000007; // 998244353
const int maxN = 300005;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void run(){
   string s;
   cin >> s;
   for (int i = 0; i < sz(s); i++) if (s[i] == '7') {
      cout << "Yes";
      return;
   }
   cout << "No";
}
int main(){
   ios_base::sync_with_stdio(0);cin.tie(0);
   cout.tie(0);
   // stress(); return 0;
   int t = 1;
   // cin >> t;
   for (int tc = 1; tc <= t; tc++) {
      // cout << "Case #" << tc << ": ";
      run();
      cout << newl;
   }
   return 0;
}


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

using i64 = int64_t;

int main(){
    i64 n, k;
    cin >> n >> k;
    vector<i64> v, nxt(n, -1), num2idx(200001, -1);
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
        if(num2idx[a] != -1)nxt[num2idx[a]] = i;
        num2idx[a] = i;
    }
    if(n == 1){
        if(k%2)cout << v[0];
        cout << endl;
        return 0;
    }
    for(int i=0;i<n;++i){
        if(nxt[num2idx[v[i]]] != -1)continue;
        nxt[num2idx[v[i]]] = i;
    }

    i64 a = 0, period = 0;
    do{
        i64 b = nxt[a];
        if(b <= a)period++;
        b = (b+1) % n;
        if(b == 0)period++;
        a = b;
    }while(a != 0);

    i64 m = k % period - 1;
    if(m < 0)m += period;
    //cerr << period << " " << m << endl;
    a = 0;
    while(m > 0){
        i64 b = nxt[a];
        if(b <= a)m--;
        b = (b+1) % n;
        if(b == 0)m--;
        a = b;
        //cerr << a << " " << m << endl;
    }

    vector<i64> ans;
    for(;a<n;++a){
        if(nxt[a] > a){
            a = nxt[a];
            continue;
        }
        ans.push_back(v[a]);
    }
    for(int i=0;i<(int)ans.size();++i){
        if(i)cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 8048
#include <stdio.h>

int main(void)
{
    int p[3], j[2];
    int i;
    int maxP, maxJ;

    scanf("%d", &p[0]);

    maxP = p[0];
    for (i = 0; i < 2; i++){
        scanf("%d", &p[i]);
        if (maxP > p[i]){
            maxP = p[i];
        }
    }

    scanf("%d", &j[0]);
    scanf("%d", &j[1]);
    if (j[0] > j[1]){
        maxJ = j[1];
    }
    else {
        maxJ = j[0];
    }

    printf("%d\n", maxP + maxJ - 50);

    return (0);
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#define maxn 300005
using namespace std;
struct node{int l,r;}d[maxn];
int cmp(node a,node b){return a.l==b.l?a.r<b.r:a.l<b.l;}
int st[maxn],n,m;
priority_queue<int,vector<int>,greater<int> > q;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d%d",&d[i].l,&d[i].r);
	sort(d+1,d+n+1,cmp);
	int nl=1,nr=m;
	for(int i=1;i<=n;i++)
	{
		q.push(d[i].r);
		if(nl<=nr&&nl<=d[i].l) nl++;
		else
		{
			st[++st[0]]=q.top();
			q.pop();
		}
	}
	sort(st+1,st+st[0]+1);
	int ans=0;
	for(int i=st[0];i>=1;i--)
	{
		if(nl<=nr&&st[i]<=nr) nr--;
		else ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);


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

  int n;
  cin >> n;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }

  string ans;
  while (n != 0) {
    if (n % 2 == 0) ans.append("0");  // 後で reverse するので末尾に足す
    else {
      ans.append("1");
      n -= 1;   // 余りを取り除く
    }
    n /= -2;
  }

  reverse(ALL(ans));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace PaizaTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
            //var AB = Console.ReadLine().Split(' ').Select(long.Parse).ToList();

            //// 最小公約数
            //// 4(2*2) 6(2*3) => 12
            //// 7 11 => 77
            //// 12(=2*2*3) 8(2*2*2) => 24

            //var A = AB[0];
            //var B = AB[1];
            //var aList = new List<long>();
            //int num = 2;
            //while (A > 1 && A >= num)
            //{
            //    if (num > 1 && A % num == 0)
            //    {
            //        aList.Add(num);
            //        A = A / num;
            //    }

            //    num++;
            //}
            //if (A > 1)
            //{
            //    aList.Add(A);
            //}

            //var bList = new List<long>();
            //num = 2;
            //while (B > 1 && B >= num)
            //{
            //    if (num > 1 && B % num == 0)
            //    {
            //        bList.Add(num);
            //        B = B / num;
            //    }

            //    num++;
            //}
            //if (B > 1)
            //{
            //    bList.Add(B);
            //}

            //var sum = 1L;
            //for (int i = aList.Count - 1; i >= 0; i--)
            //{
            //    var targetNum = aList[i];
            //    var bListIndex = bList.IndexOf(targetNum);
            //    if (bListIndex > 0)
            //    {
            //        bList.RemoveAt(bListIndex);
            //    }
            //    sum *= targetNum;
            //}

            //for (int i = 0; i < bList.Count; i++)
            //{
            //    sum *= bList[i];
            //}

            //Console.WriteLine(sum);

        }

        static void Solve()
        {
            var AB = Console.ReadLine().Split(' ').Select(long.Parse).ToList();

            long x = AB[0] * AB[1];
            long a = AB[0];
            long b = AB[1];
            if (a < b)
            {
                long tmp = a;
                a = b;
                b = tmp;
            }

            long r = a % b;
            while (r != 0)
            {
                a = b;
                b = r;
                r = a % b;
            }
            Console.WriteLine(x / b);
        }
    }
}



Measured memory_bytes: 11348
#include <iostream>
#include <cmath>
#include <vector>
#include <string>

typedef long long ll;

void solve(const ll n, const ll k, const ll s, std::vector<ll> &ans)
{
    if (n == k) {
        std::vector<ll>(n, s).swap(ans);
        return;
    }

    // n != k
    if (s < 100000) {
        std::vector<ll>(n, 100000).swap(ans);
        for (int i = 0; i < k; i++) {
            ans[i] = s;
        }
        return;
    }

    std::vector<ll>(n, 1).swap(ans);
    for (int i = 0; i < k; i++) {
        ans[i] = s;
    }
    return;
}

int main(int argc, char *argv[])
{
    ll n, k, s;
    std::vector<ll> ans;

    std::cin >> n >> k >> s;

    solve(n, k, s, ans);

    const int len = ans.size();
    for (int i = 0; i < len; i++) {
        std::cout << ans[i] << " ";
    }

    std::cout << std::endl;

    return 0;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    int p[n];
    rep(i,n){
        int temp;
        cin >> temp;
        p[i] = temp;
    }
    double sum = 0;
    double largest = 0;
    for(int i = 0; i < n; i++){
        if(i < k){
            sum += (p[i]+1)/2.0;
            largest = sum;
        }
        else{
            sum = sum- (p[i-k]+1)/2.0 + (p[i]+1)/2.0;
        }
        if(largest < sum){
            largest = sum;
        }

    }
    cout << fixed << setprecision(12) << largest << endl;
}

Measured memory_bytes: 4556
#include<bits/stdc++.h>
#include <cstdlib>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long long int a[n+1],b[n],t=0;
    int i;
    for(i=0; i<=n; i++)
    {
     cin>>a[i];
    }
    for(i=0; i<n; i++)
    {
     cin>>b[i];
    }
    for(i=0; i<n; i++)
    {
        if(b[i]<=a[i])
        {
            t+=b[i];

        }
        else if(a[i+1]<=(b[i]-a[i]))
        {

            t+=a[i]+a[i+1];
            a[i+1]=0;

        }
        else if(a[i+1]>(b[i]-a[i]))
        {
            t+=b[i];
            a[i+1]=a[i+1]-(b[i]-a[i]);

        }
    }
    cout<<t<<endl;
    return 0;
}


Measured memory_bytes: 1792
// ABC106_A
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値

int main() {
    // input
    ll N, M;
    cin >> N >> M;
    
    
    
    // calculation
    cout << (N-1)*(M-1) << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
    using namespace std;
 
    int main(){
      int n,a;
      cin >> n >> a;
      if(n%500<=a) cout << "Yes" << endl;
      else cout << "No" << endl;
      return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k,i;
	string s;
	cin>>n>>s>>k;
	k--;
	for(i=0;i<n;i++)
	{
		if(s[i]!=s[k])
			cout<<"*";
		else
			cout<<s[i];
	}
	cout<<endl;
	return 0;
}

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

long long GCD(long long a, long long b) 
{ 
    if(b==0) 
        return a; 
    return GCD(b, a%b);  
      
}

long long LCM(long long a, long long b)
{
    long long gcd=GCD(a,b);
     return (a*b)/gcd;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    long long i, j, k, n, m, t, x, y, z, s=0, c=0, l;
    cin >> x;
    if(x==25)
        cout << "Christmas\n";
    else if(x==24)
        cout << "Christmas Eve\n";
    else if(x==23)
        cout << "Christmas Eve Eve\n";
    else if(x==22)
        cout << "Christmas Eve Eve Eve\n";
}


Measured memory_bytes: 3588
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

ll N;
string pref, suff;

void solve(){
    if(pref == suff) pref = "";
    else{
        rep(i,N){
            // cout << pref.substr(i, N-i) << " & " << suff.substr(0, N-i) << endl;
            if(pref.substr(i, N-i) == suff.substr(0, N-i)){
                suff.erase(i,N-i);
                break;
            }
        }
    }
    cout << (pref + suff).size() << endl;
}

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

    solve();
}


Measured memory_bytes: 256
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())
# N = int(input())
L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

ans = 0
before = 1
for i in range(N):
    if L[i] != before:
        ans += 1
    else:
        before += 1

if N == ans:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 25244
#include<stdio.h>
#include<stdlib.h>
int asc(const void* a, const void* b)
{
	if (*(int*)a < *(int*)b)return -1;
	return 1;
}
int main()
{
	int n;
	scanf("%d", &n);
	int i, j, k;
	int a[200005];
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	qsort(a, n, sizeof(int), asc);
	int c[1000006];
	for (i = 0; i < 1000006; i++)
		c[i] = 0;
	int ans = 0;
	for (i = 0; i < n; i++)
	{
		k = 0;
		for (j = 1; j * j <= a[i]; j++)
			if (a[i] % j == 0)
				if (c[j] + c[a[i] / j] > 0)
					k++;
		if (k == 0)
		{
			if (a[i] != a[i + 1])
				ans++;
		}
		c[a[i]]++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 6420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, d;
    cin >> h >> w >> d;
    P a[h*w+5];
    rep(i,h)rep(j,w){
        int p;
        cin >> p;
        a[p] = make_pair(i,j);
    }
    int u[h*w+5];
    for(int i = 0; i < d; i++){
        for(int j = i; j <= h*w; j+=d){
            if(j==i){u[j] = 0;continue;}
            u[j] = u[j-d] + abs(a[j].first-a[j-d].first)+abs(a[j].second-a[j-d].second); 
        }
    }
    int q;
    cin >> q;
    while(q--){
        int l, r;
        cin >> l >> r;
        printf("%d\n", u[r]-u[l]);
    }
}

Measured memory_bytes: 2176
package main

import (
	"fmt"
)

func main() {
	for {
		var h, w int
		if _, err := fmt.Scan(&h, &w); err != nil {
			panic(err)
		}
		if h == 0 && w == 0 {
			break
		}

		for y := 0; y < h; y++ {
			for x := 0; x < w; x++ {
				if (x+y) % 2 == 0 {
					fmt.Print("#")
				} else {
					fmt.Print(".")
				}
			}
			fmt.Println()
		}
		fmt.Println()
	}
}



Measured memory_bytes: 1128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(), (v).end()
#define fastIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


signed main(){
    fastIO
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if(u == s){
        a--;
    }else{
        b--;
    }
    cout << a << " " << b;
}

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

#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
int main()
{
    int n;
    cin >> n;
    auto v = genprimevec(2 * n);
    for (auto i : v)
    {
        if (n <= i)
        {
            cout << i << endl;
            break;
        }
    }

    return 0;
}

/*author  https://qiita.com/drken/items/0c88a37eec520f82b788*/
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}

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

using namespace std;

int main() {
  int N;
  cin>>N;
  map<int,int> map;
  for(int i=0;i<N;i++){//0desyokika
    map[i]=0;
  }
  for(int i=1;i<N;i++){//kazuwokazoeru
    int A;
    cin>>A;
    map[A-1]+=1;
  }
  for(int i=0;i<N;i++){
    cout<<map[i]<<endl;
  }
  
  
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    int a,b;
    cin >> a >> b;

    if (a>0 && b>0) {
        cout << "Positive" << endl;
    }else if (a <= 0 && 0 <= b) {
        cout << "Zero" << endl;
    }else if (abs(b-a) & 1) {
        cout << "Positive" << endl;
    }else{
        cout << "Negative" << endl;
    }

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int ASC(const void *a,const void *b){
	return strcmp(a,b);
}

int DESC(const void *a,const void *b){
	return strcmp(b,a);
}

int main(int argc, char const *argv[])
{
	char s[103],t[103];
	scanf("%s",s);	scanf("%s",t);
	qsort(s,strlen(s),sizeof(char),ASC);
	qsort(t,strlen(t),sizeof(char),DESC);
	if(strcmp(s,t) < 0)	puts("Yes");
	else puts("No");
	return 0;
}


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

#define int long long

const int INF = 1e9;

int N, M;
vector<int> A, B;
int dp[51][51][51][51][2][3];

int dfs(int n, int m, int a, int b, int t, int con) {
	if ( con == 2 ) return 0;	
	if ( n == N && m == M ) {
		int nn = n-1;
		int mm = m-1;
		bool fa = true, fb = true;
		int sumA = 0, sumB = 0;
		if ( !t ) {
			while ( 1 ) {
				if ( mm < b ) break;
				if ( B[mm] < 0 ) fa = false;
				if ( fb && B[mm] >= 0 ) sumB += B[mm];
				if ( nn < a ) break;
				if ( A[nn] < 0 ) fb = false;
				if ( fa && A[nn] >= 0 ) sumA += A[nn];
				nn--; mm--;			
			}
		} else {
			while ( 1 ) {		
				if ( nn < a ) break;
				if ( A[nn] < 0 ) fb = false;
				if ( fa && A[nn] >= 0 ) sumA += A[nn];
				if ( mm < b ) break;
				if ( B[mm] < 0 ) fa = false;
				if ( fb && B[mm] >= 0 ) sumB += B[mm];
				nn--; mm--;			
			}
		}
		return sumA-sumB;		
	}	
	if ( dp[n][m][a][b][t][con] != -INF ) return dp[n][m][a][b][t][con];	
	
	int ret;
	if ( !t ) { // player1
		ret = -INF;		
		if ( n < N ) ret = max(ret, dfs(n+1, m, a, b, !t, 0));
		int nn = n-1;
		int mm = m-1;
		bool fa = true, fb = true;
		int sumA = 0, sumB = 0;
		while ( 1 ) {
			if ( mm < b ) break;
			if ( B[mm] < 0 ) fa = false;
			if ( fb && B[mm] >= 0 ) sumB += B[mm];
			if ( nn < a ) break;
			if ( A[nn] < 0 ) fb = false;
			if ( fa && A[nn] >= 0 ) sumA += A[nn];
			nn--; mm--;			
		}
		if ( sumA || sumB )
			ret = max(ret, dfs(n, m, n, m, !t, 0)+sumA-sumB);
		else {		 
			ret = max(ret, dfs(n, m, n, m, !t, con+1)+sumA-sumB);
		}
	} else { // player2
		ret = INF;
		if ( m < M ) ret = min(ret, dfs(n, m+1, a, b, !t, 0));
		int nn = n-1;
		int mm = m-1;
		bool fa = true, fb = true;
		int sumA = 0, sumB = 0;
		while ( 1 ) {		
			if ( nn < a ) break;
			if ( A[nn] < 0 ) fb = false;
			if ( fa && A[nn] >= 0 ) sumA += A[nn];
			if ( mm < b ) break;
			if ( B[mm] < 0 ) fa = false;
			if ( fb && B[mm] >= 0 ) sumB += B[mm];
			nn--; mm--;			
		}
		if ( sumA || sumB )
			ret = min(ret, dfs(n, m, n, m, !t, 0)+sumA-sumB);
		else {		 
			ret = min(ret, dfs(n, m, n, m, !t, con+1)+sumA-sumB);
		}
	}

	return dp[n][m][a][b][t][con] = ret;	
}

signed main() {
	cin >> N >> M;	
	
	A = vector<int>(N);
	B = vector<int>(M);
	for ( int i = 0; i < N; i++ )
		cin >> A[i];
	for ( int i = 0; i < M; i++ )
		cin >> B[i];

	fill_n(*****dp, 51*51*51*51*2*3, -INF);
	cout << dfs(0, 0, 0, 0, 0, 0) << endl;	
	
	return 0;
}



Measured memory_bytes: 320224
#include <iostream>
#include <cstring>

using namespace std;

#define REP(i, s, n) for (int i = (int)(s); i < (int)(n); ++i)

typedef long long ll;

ll mod;

void add(ll &x, ll y) {
  x = (x + y) % mod;
}

const int N = 310;

ll dp[N][N], dp2[N][N];

// This solution is implemented after the author read the editorial.
int main(void) {
  int n, k;
  cin >> n >> k >> mod;
  dp[0][0] = 1;
  REP(i, 0, k) {
    memset(dp2, 0, sizeof(dp2));
    REP(j, 0, N) dp2[j][j] = dp[i][j];
    REP(j, 0, N) {
      for (int l = N - 1; l >= 0; --l) {
	if (j < N - 1) {
	  add(dp2[j + 1][l], dp2[j][l] * (l + 1));
	}
	if (l > 0) {
	  add(dp2[j][l - 1], dp2[j][l]);
	}
      }
    }
    REP(j, 0, N) {
      dp[i + 1][j] = dp2[j][0];
    }
  }
  cout << dp[k][n] << endl;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(){
 	int A, B, C;
 	scanf("%d %d %d", &A, &B, &C);
	if(A == B){
		if(A != C){
			printf("Yes");
		}
		else{
			printf("No");
		}
	}
	else if(A == C){
		if(A != B){
			printf("Yes");
		}
		else{
			printf("No");
		}
	}
	else if (B == C){
		if(B != A){
			printf("Yes");
		}
		else{
			printf("No");
		}
	}
	else{
		printf("No");
	}
	return 0;
 }

Measured memory_bytes: 3140
#include "bits/stdc++.h"
using namespace std;

/*
vector.push_back()
vector<int> hoge(3,-1); {-1,-1,-1}
vector<vector<int>> hogehoge(2,vector<int>(2,-1)); {{-1,-1},{-1,-1}} 
cin >>temp;
scanf("%d %d %d",&A,&B,&Q);
sort(a.begin(),a.end());
a.push_back(4000000000000);
a.insert(a.begin(),-1000000000000);
upper_bound(a.begin(),a.end(),x); // list[i] > x のイテレータ取得. *itrで数値化 
    std::priority_queue<
      int,
      std::vector<int>,
      decltype(compare) // 比較関数オブジェクトを指定
    > que(comp);
*/
template <typename T> void debug(T arr);
template <typename T> void debug (T arr, int dim);


int main(void){
  int n,a,b,c;
  cin >> a;
  cin >> b;

  cout << max(0,a-2*b) << endl;;
};


template <typename T> void debug(T arr){
    for (auto col:arr){
        cout << col << " ";
    }
    cout <<endl;
};

template <typename T> void debug (T arr, int dim){
    for (auto raw:arr){
        for(auto col:raw){
            cout << col << " ";
        }
        cout << endl;
    }
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	ll n, a, b;
	cin >> n >> a >> b;
	if(a > b || (n == 1 && a != b)) {
		cout << 0 << endl;
		return 0;
	}
	// if(b - a + 1 > n) {
		
	// }
	cout << (b*(n-1)+a) - (b+a*(n-1)) + 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

main(){
  string s;
  cin>>s;
  int k=s.size();
  int a=0;
  rep(i,s.size()){
    if(s[i]=='o') a++;
  }

  if(a+15-k>=8){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }

}


Measured memory_bytes: 256
N=int(input())
x_a=[0]*N
y_a=[0]*N
r_a=[0]*N
x_b=[0]*N
y_b=[0]*N
r_b=[0]*N
for i in range(N):
    x_a[i],y_a[i],r_a[i],x_b[i],y_b[i],r_b[i]=map(float,input().split())
for i in range(N):
    AB=((x_a[i]-x_b[i])**2+(y_a[i]-y_b[i])**2)**(1/2)
    r_diff=abs(r_a[i]-r_b[i])
    if AB > r_a[i]+r_b[i]:
        print(0)
    elif r_a[i]+r_b[i] >= AB and AB >= r_diff:
        print(1)
    else:
        if r_a[i] > r_b[i]:
            print(2)
        else:
            print(-2)

Measured memory_bytes: 7660
#include<stdio.h>
#include<math.h>
#include<algorithm>

int main() {
	int m, f, r;
	char S;
	while (1) {
		scanf("%d %d %d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1) {
			break;
		}

		if (m == -1 || f == -1) {
			S = 'F';
		}
		else if (m + f >= 80) {
			S = 'A';
		}
		else if (m + f >= 65) {
			S = 'B';
		}
		else if (m + f >= 50) {
			S = 'C';
		}
		else if (m + f >= 30) {
			S = 'D';
			if (r >= 50) {
				S = 'C';
			}
		}
		else {
			S = 'F';
		}

		printf("%c\n", S);
	}

		return 0;
	}

Measured memory_bytes: 2752
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;

void koch(double x0, double y0, double x1, double y1, int n){
  assert(n >= 0);
  if(n == 0){
    cout << x0 << " " << y0 << endl;
  } else {
    koch(x0, y0, x0 + (x1-x0)/3, y0 + (y1-y0)/3, n-1);
    koch(x0 + (x1-x0)/3, y0 + (y1-y0)/3, x0 + (x1-x0)/2 - (y1-y0)*sqrt(3)/6, y0 + (y1-y0)/2 + (x1-x0)*sqrt(3)/6, n-1);
    koch(x0 + (x1-x0)/2 - (y1-y0)*sqrt(3)/6, y0 + (y1-y0)/2 + (x1-x0)*sqrt(3)/6, x0 + (x1-x0)*2/3, y0 + (y1-y0)*2/3, n-1);
    koch(x0 + (x1-x0)*2/3, y0 + (y1-y0)*2/3, x1, y1, n-1);
  }
}

int main(){
    int n;
    cin >> n;
    koch(0,0,100,0,n);
    cout << 100 << " " << 0 << endl;
}

Measured memory_bytes: 3240
#include<stdio.h>
#include<string.h>
char comm[100][2000],temp;
int main()
{
int q,i,j,jin,jen,start,p=0,v,w;
char str[1005];
scanf("%s",str);
scanf("%d",&q);
getchar();
for(i=0;i<q;i++)
{
p=0;
scanf("%[^\n]s",comm[i]);
getchar();
if(comm[i][2]=='i')
{
jin=0;
jen=0;
for(v=6;comm[i][v]!=' ';v++)
{
jin=(comm[i][v]-'0')+jin*10;
}
for(v=v+1;comm[i][v]!='\0';v++)
{
jen=(comm[i][v]-'0')+jen*10;
}
for(j=jin;j<=jen;j++)
{
printf("%c",str[j]);
}
printf("\n");
}
else if(comm[i][2]=='v')
{
jin=0;
jen=0;
for(v=8;comm[i][v]!=' ';v++)
{
jin=(comm[i][v]-'0')+jin*10;
}
for(v=v+1;comm[i][v]!='\0';v++)
{
jen=(comm[i][v]-'0')+jen*10;
}
for(j=jin;j<=(jin+jen)/2;j++)
{
temp=str[j];
str[j]=str[jen-p];
str[jen-p]=temp;
p++;
}
}
else
{
jin=0;
jen=0;
for(v=8;comm[i][v]!=' ';v++)
{
jin=(comm[i][v]-'0')+jin*10;
}
for(v=v+1;comm[i][v]!=' ';v++)
{
jen=(comm[i][v]-'0')+jen*10;
}
start=v+1;
for(j=jin;j<=jen;j++)
{
str[j]=comm[i][start];
start++;
}
}
}
return 0;
}



Measured memory_bytes: 2148