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

int main(){
    int n;
    cin >> n;
    ll k;
    cin >> k;

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

    ll cou = 0;
    ll q = 10e8 + 7;

    for(int i = 0; i < n - 1; i++){
        for(int j = i + 1; j < n; j++){
            if(a[i] > a[j]){
                cou++;
            }
        }
    }

    ll ans = 0;
    ans = cou * k;
    ans %= q;
    ll t = k * (k - 1);
    t /= 2;
    t %= q;
    for(int i = 0; i < n; i++){
        cou = 0;
        for(int j = 0; j < n; j++){
            if(i != j){
                if(a[i] > a[j]){
                    cou++;
                }
            }
        }
        ans += cou * t;
        ans %= q;
    }

    cout << ans << endl;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ttd, atd;
  ttd = (a+d-1) / d;
  atd = (c+b-1) / b;
  
  if (ttd < atd) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n+2, 0), df(n+1);
	rep(i, n) cin >>a[i+1];
	
	rep(i, n+1) df[i] = abs(a[i+1] - a[i]);
	vector<ll> smf(n+2);
	rep(i, n+1) smf[i+1] = smf[i]  +df[i];
	
	rep(i, n){
		ll ans = smf[i];
		ans += smf[n+1] - smf[i+2];
		ans += abs(a[i+2] - a[i]);
		cout << ans <<"\n";
	}
	return 0;
}


Measured memory_bytes: 2816
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

static size_t A[100000];

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	size_t a, b;

	scanf("%zu %zu", &a, &b);

	puts(((a*b) % 2 == 0 ? "Even" : "Odd"));

	return 0;
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << c << " " << a << " " << b << endl;
  return 0;
}


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

using namespace std;

int main()
{
    int a, b, k, ans;
    cin >> a >> b >> k;

    int h = min(a, b);
    int cnt = 1;
    for (int i = h; i > 0; --i) {
        if (a % i == 0 && b % i == 0) {
            if (cnt == k) {
                ans = i;
                break;
            } else {
                ++cnt;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
let id = fun x -> x;;
let n = read_int ();;
let arr = Array.init n (fun _ -> Scanf.scanf "%d\n" id);;
let _ = Array.fast_sort compare arr;;

let sum = Array.fold_right (fun acc x -> x + acc) arr 0;;
let rec solve i =
  if i >= n then
    0
  else
    let sum' = sum - arr.(i) in
    if sum' mod 10 = 0 then solve (succ i) else sum';;

let () =
  (if sum mod 10 = 0 then solve 0 else sum)
|> Printf.printf "%d\n";;


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

int main() {
    string b;
    cin >> b;
    if (b == "A") cout << "T" << endl;
    else if(b == "T") cout << "A" << endl;
  	else if(b == "C") cout << "G" << endl;
  	else if(b == "G") cout << "C" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    int[][] dp = new int[N+1][N+1];
    for(int i = N-1; i >= 0; i--){
      for(int j = N-1; j >= 0; j--){
        if(S.charAt(i)==S.charAt(j)){
          dp[i][j]=dp[i+1][j+1]+1;
        }
      }
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        if(i > j){
          continue;
        }
        ans = Math.max(ans, Math.min(dp[i][j], j-i));
      }
    }
    System.out.println(ans);
  }
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    const string u = "ABCU";
    array<int, 3> v;
    cin >> v[0] >> v[1] >> v[2];
    vector<int> q(n), ans(n, -1);
    stack<int> s[3];
    map<string, int> m = {{"AB", 2}, {"BC", 0}, {"AC", 1}};
    bool ok = true;
    for (int i = 0; i < n; i++) {
        string t; cin >> t; q[i] = m[t];
        for (int j = 0; j < 3; j++) {
            v[j] = v[j] - (q[i] != j);
            if (v[j] < 0) {
                for (int k = 0; k < 3; k++) {
                    if (j == k) continue;
                    if (!s[k].empty()) {
                        ans[s[k].top()] = j;
                        v[j] = 1;
                        s[k].pop(); break;
                    }
                }
            }
        }
        int cnt = 0;
        for (int j = 0; j < 3; j++) {
            if (v[j] < 0) {
                cnt++;
                v[j] = 1; ans[i] = j;
            }
        }
        if (cnt == 2) ok = false;
        if (cnt == 0) s[q[i]].emplace(i);
    }
    if (!ok) { cout << "No\n"; }
    else {
        cout << "Yes\n";
        for (int i = 0; i < n; i++) {
            if (ans[i] == -1) ans[i] = (q[i] + 1) % 3;
            cout << u[ans[i]] << "\n";
        }
    }
    return 0;
}

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

int main(){
     int a, b, c, k;
     cin >> a >> b >> c >> k;
     for(int i = 0; i < 4; i++){
          if(a<b){
               break;
          }
          b = b*2;
          k = k - 1;
     }
     for(int i = 0; i < 5; i++){
          if(b<c){
               break;
          }
          c = c*2;
          k = k - 1;
     }
     if(k<0){
          cout << "No";
     }
     else{
          cout << "Yes";
     }
     return 0;
}


Measured memory_bytes: 3592
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

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

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

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func count(dist [][][]int, d []int) int {
	res := 0
	for i := range dist {
		for j := range dist[i] {
			if dist[i][j][0] == d[0] && dist[i][j][1] == d[1] {
				res++
			}
		}
	}
	return res
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	x, y := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		x[i], y[i] = nextInt(), nextInt()
	}

	dist := make([][][]int, n)
	for i := range dist {
		dist[i] = make([][]int, n)
		for j := range dist[i] {
			dist[i][j] = []int{x[j] - x[i], y[j] - y[i]}
		}
	}

	ans := n
	for i := range dist {
		for j := range dist[i] {
			if i == j {
				continue
			}
			d := []int{x[j] - x[i], y[j] - y[i]}
			ans = min(ans, n-count(dist, d))
		}
	}

	puts(ans)
}


Measured memory_bytes: 768
Module Program
  Sub Main
    Dim s = Gets()
    Dim a=s(0)
    Dim ans=If(a.Contains("a"c)And a.Contains("b"c) And a.Contains("c"c),"Yes","No")
    Console.WriteLine(ans)
  End Sub
  
  '/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  Function Gets() As String()
    Gets = Console.ReadLine().Split(" "c)
  End Function
  Function GetInts() As Integer()
    Dim s = Gets(), r(UBound(s)) As Integer
    For i As Integer=0 To UBound(s): r(i)=s(i): Next i
    GetInts = r
  End Function
End Module

Measured memory_bytes: 22352
//CREATED BY HARSH THAKUR
//ALL RIGHTS RESERVED

#include<bits/stdc++.h>
#define ll long long
#define tc ll T;cin>>T;while(T--)
#define fn for(int i=0;i<=n;i++)
using namespace std;

int main(){
	
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	//--------------------CODE BEGINS------------------//
	ll d,t,s; cin>>d>>t>>s;
	float k=(float)d/s;
	if(k<=t){
		cout<<"Yes";
	}else{
		cout<<"No";
	}


	//---------------------CODE ENDS------------------//
	
	return 0;

}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

i64 s;

i64 here(i64 from ,i64 to,i64 MOD){

	if(from % MOD != 0){
		from += MOD - (from % MOD);
	}
	{
		to -= to % MOD;
	}
	i64 cou = (to - from) / MOD + 1;
	return cou;
}

i64 c(i64 k){
	int digit = 1;
	i64 res = 0;
	{
		i64 i;
		for(i = 10;i <= k;i *= 10){
			res += (i - 1 - (i / 10) + 1) * digit;
			i64 from = i / 10;
			i64 to = i - 1;
			i64 three = here(from,to,3);
			i64 five = here(from,to,5);
			i64 both = here(from,to,15);
			res += -three * digit + three * 4 - five * digit + five * 4 + both * digit;
			digit++;
		}
		i /= 10;
		{
			res += (k - i + 1) * digit;
			i64 from = i;
			i64 to = k;
			i64 three = here(from,to,3);
			i64 five = here(from,to,5);
			i64 both = here(from,to,15);
			res += -three * digit + three * 4 - five * digit + five * 4 + both * digit;
		}
	}
	return res;
}

i64 binary(){
	i64 ok = 1;
	i64 ng = 1e18;
	while(ng - ok > 1){
		i64 mid = (ng + ok) / 2;
		if(c(mid) <= s){
			ok = mid;
		}
		else
		{
			ng = mid;
		}
	}
	return ok;
}

int main(){
	cin >> s;
	i64 num = binary();
	i64 start = c(num - 1);
	string ans = "";
	s--;
	i64 sz = s - start + 20;
	for(i64 i = num;ans.size() < sz;i++){
		if(i % 3 == 0) ans += "Fizz";
		if(i % 5 == 0) ans += "Buzz";
		if(i % 3 != 0 && i % 5 != 0) ans += to_string(i);
	}

	cout << ans.substr(s-start, 20) << endl;;
}



Measured memory_bytes: 3280
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]

s = str(input())
c = 0
for i in s:
    c += int(i)
if (c % 9) == 0: print("Yes")
else: print("No")


Measured memory_bytes: 9164
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int a,b,c,d;
cin >> a >> b >> c >> d;
cout << max(a*b, c*d) << endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
ll factorial_count(ll N)
{
    vector<int> count(1003, 0); // 約数の候補

    for (int i = 2; i <= N; i++) { // すべての候補を探す
        int t = i;
        for (int p = 2; p <= t; p++) { // ここでは約数を求めている
            while (t % p == 0) {
                count[p]++;
                t /= p;
            }
        }
    }

    ll ans = 1;
    for (auto x : count) {
        ans = ans * (x + 1) % MOD;
    }
    return ans;
}
int main()
{
    ll n;
    cin >> n;
    ll ans = factorial_count(n);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 3e18 + 8;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 1e9 + 7;

const int maxn = 1e5 + 7;

int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n, k;
    cin >> n >> k;
    int ans = 0;
    for(int i = k; i <= n+1; i++)
    {
        int mn = i * (i - 1) / 2;
        int mx = i * (2 * n - i + 1) / 2;
        // cout << mn << " " << mx << endl;
        ans += (mx - mn + 1) % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;

int main() {
    int n; cin >> n;
    int ans = 1; int now; cin >> now;
    for(int i = 1;i < n;i++){
        int x; cin >> x;
        if(now <= x){
            now = x;
            ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 3600
sx,sy,tx,ty = gets.split.map(&:to_i)
xx, yy = tx-sx, ty - sy
puts 'R'*xx + 'U'*yy + 'L'*xx + 'D'*yy + 'D' + 'R'*(xx+1) + 'U'*(yy+1) + 'L' + 'U' + 'L'*(xx+1) + 'D'*(yy+1) + 'R'


Measured memory_bytes: 1916
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<string>
#include<set>
#include<map>
#define ll long long
#define INF 0x3f3f3f3f
#define N 100005
using namespace std;

int a[3][N];

int main()
{
	int n;
	scanf("%d",&n);
	int x;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[0][i]);
	}
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[1][i]);
	}
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[2][i]);
	}
	sort(a[0],a[0]+n);
	sort(a[1],a[1]+n);
	sort(a[2],a[2]+n);
	ll ans=0;
	ll i=0,k=0;
	for(int j=0;j<n;j++)
	{
		while(a[0][i]<a[1][j]&&i<n) i++;
		while(a[2][k]<=a[1][j]&&k<n) k++;
		if(a[1][j]>a[2][n-1]) break;
	//	cout<<i<<' '<<k<<endl;
		ans+=i*(n-k);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define INFF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define t int t;scanf("%d",&t);for(int v=1;v<=t;v++)
#define loop_arr(i,a,b) for(int i=a;i<b;i++)
#define loop_norm(i,a,b) for(int i=a;i<=b;i++)
#define minheap priority_queue<int,vector<int>,greater<int> >
#define maaheap priority_queue<int>
#define pb push_back
#define newl "\n"
ll BIGMOD ( ll a, ll p, ll m )
{
    ll result = 1;
    ll x = a;

    while ( p )
    {
        if ( p & 1 ) //p is odd
        {
            result = ( result * x ) % m;
        }
        x = ( x * x ) % m;
        p = p >> 1;
    }

    return result;
}

bool isPrime(int n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {

        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}
const int MAX=1e5+5;
const int INF=100000;
int arr[MAX];
ll mem[MAX];

ll Frog(int i,int n)
{
    if(i==n-1) return 0;
    if(mem[i]!=INF) return mem[i];
     ll res1,res2;
    if(i+1<n) res1=abs(arr[i+1]-arr[i])+Frog(i+1,n);
    if(i+2<n) res2=abs(arr[i+2]-arr[i])+Frog(i+2,n);
    return mem[i]=min(res1,res2);
}
int main()
{
 //  fastread;
  int n;
  cin>>n;
  loop_arr(i,0,n) cin>>arr[i];
  loop_arr(i,0,n+4) mem[i]=INF;
  ll res=Frog(0,n);
  cout<<res<<newl;

  return 0;
}


Measured memory_bytes: 6144
#include <iostream>

using namespace std;

void hello() {
	cout << "Hello World" << endl;
}

void sum() {
	int a, b;
	cin >> a >> b;
	cout << (a + b) << endl;
}

int main(){
	int n;
	cin >> n;
	if (n == 1) hello();
	else sum();
    return 0;
}

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())


dx = x2 - x1
dy = y2 - y1

if(dx == 0):
    distance = y2 - y1
    x3 = x2 - distance
    y3 = y2
    x4 = x2 - distance
    y4 = y1
elif(dy == 0):
    distance = x1 -x2
    x3 = x2
    y3 = y2 - distance
    x4 = x1
    y4 = y1 - distance
else:
    x3 = x2 - dy
    y3 = y2 + dx
    x4 = x3 - dx
    y4 = y3 - dy

print("{} {} {} {}".format(x3, y3, x4, y4))


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <set>

#include <regex>
#include <locale>
#include <iomanip>

using namespace std;
using ll = long long;

#define OVERLOAD3(_1,_2,_3,name,...) name
#define REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a),i##_Len=int(b);i<i##_Len;++i)
#define rep(...) OVERLOAD3(__VA_ARGS__,REPI,REP,)(__VA_ARGS__)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())

int main () {
  int n, t;
  cin >> n >> t;
  cout << t*2 - n << endl;
}

Measured memory_bytes: 3136
n,k=map(int,input().split())
a=list(map(int, input().split()))
b=[1]
ba={1}
c=0
m=0
# while flag==1:
for i in range(n):
    if a[m] not in ba:
        b.append(a[m])
        ba.add(a[m])
        c+=1
        m=a[m]-1
    else:
        e=a[m]
        break
# print(b,e,c+1)
e=b.index(e)
# print(b,e)
bc=b
b=b[e:c+1]
f=c+1-e
if c>k:
    if c-1>=k:

        print(bc[k])
        exit()
if 1 not in b:
    # print(b,f)
    ans=(k-e)%f
    print(b[ans])
else:

    ans=k%f
    print(b[ans])

Measured memory_bytes: 32304
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
ans=1

dp=[0]*(n+1)
dp[0]=1
dp[1]=1
for i in range(2,n+1):
    dp[i]=dp[i-1]+dp[i-2]
    dp[i]%=mod
if m==0:
    ans=dp[n]
else:
    begin=0
    end=a[0]-1
    for i in range(m):
        end=a[i]-1
        ans*=dp[end-begin]
        
        if(i+1<m and a[i+1]==a[i]+1):
            ans=0
            break
            
        else:
            begin=end+2

    ans*=dp[n-a[m-1]-1]

print(ans%mod)

Measured memory_bytes: 16880
N,K = map(int,input().split())

MOD = 10**9 +7

fact = [1]
for i in range(1,N):
    fact.append(fact[-1]*i)


def cmb(n,k):
    return (fact[n]//(fact[k]*fact[n-k]))%MOD

def f(x,y):
    if(x<0):return 0
    if(y<0):return 0
    if(x<y):return 0
    return cmb(x-1,y-1)


for i in range(1,K+1):

    print ((f(K,i))*(f(N-K,i-1)+2*f(N-K,i)+f(N-K,i+1))%MOD)

Measured memory_bytes: 46056
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define Mp make_pair
#define pb push_back

using ll = long long;
using db = double;
using pii = pair<int, int>;
using vi = vector<ll>;
mt19937 mrand(time(0));
ll get(ll r) { return ((ll)mrand() * mrand() % r + r) % r; }
ll get(ll l, ll r) { return get(r - l + 1) + l; }

// #define int ll
int n, K, p[5100], c[5100], inCir[5100], CirSz[5100], v[5100]; ll CirVal[5100];
signed main() {
    scanf("%d %d", &n, &K);
    for(int i = 1; i <= n; i++) scanf("%d", &p[i]);
    for(int i = 1; i <= n; i++) scanf("%d", &c[i]);
    for(int i = 1; i <= n; i++) if(!v[i]) {
        stack<int> st; int nw = i;
        while(!v[nw]) v[nw] = 1, st.push(nw), nw = p[nw];
        ll val = c[nw]; vi ns = {nw};
        while(st.top() != nw) val += c[st.top()], ns.pb(st.top()), st.pop();
        for(int j : ns) inCir[j] = 1, CirVal[j] = val, CirSz[j] = ns.size();
    }
    ll ans = -1e18;
    for(int i = 1; i <= n; i++) {
        ll sum = 0; int nw = i, lst = K;
        for(int j = 1; j <= 2 * n && lst; j++, lst--)
            nw = p[nw], ans = max(ans, sum += c[nw]);
        int dhj = max((lst - CirSz[nw]) / CirSz[nw], 0);
        sum += CirVal[nw] * dhj;
        ans = max(ans, sum), lst -= dhj * CirSz[nw];
        while(lst > 0) nw = p[nw], ans = max(ans, sum += c[nw]), lst--;
    }
    printf("%lld\n", ans);
    fprintf(stderr, "time=%.4f\n", (db)clock()/CLOCKS_PER_SEC);
    return 0;
    /* 取模直接除，爆零两行泪
     * 不开ll见祖宗
     */
}

Measured memory_bytes: 4136
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

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

	const int size = S.size();
	int ret = size;
	for(int i=0; i<S.size()-1; i++){
		if(S[i] != S[i+1]){
			ret = min(ret, max(i+1, size-i-1));
		}
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 512
from heapq import heappush, heappop

INF = 10**15

def dijkstra(s, edges):
    n = len(edges)
    que = []
    d = [INF] * n
    prev = [-1] * n
    d[s] = 0
    heappush(que, (0, s))

    while len(que) > 0:
        (c, v) = heappop(que)
        if d[v] < c:
            continue
        for (cc, w) in edges[v]:
            if d[w] > d[v] + cc:
                d[w] = d[v] + cc
                prev[w] = v
                heappush(que, (d[w], w))

    return d, prev

n, m = map(int, input().split())
edges = [[] for i in range(n)]
for i in range(m):
    ui, vi = map(int, input().split())
    ui, vi = vi-1, ui-1
    edges[ui].append((1, vi))
    edges[vi].append((1, ui))

d, prev = dijkstra(0, edges)
print('Yes')
for i in range(1, n):
    print(prev[i]+1)

Measured memory_bytes: 64200
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int H[1000];
int main(){
  int N, T, A;
  cin >> N >> T >> A;
  int ans = 0;
  int minDiff;
  int diff;

  rep(i, N){
    int h;
    cin >> h;
    diff = abs(T * 1000 - h * 6 - A * 1000);
    if(ans == 0 || minDiff > diff){
      minDiff = diff;
      ans = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#import <stdio.h>
typedef long long INT;
INT f(INT n){
	for(INT k=1;;k++){
		if(k*(k+1)/2>=n) {
			return k;
		}
	}
}
int main() {
	INT N;
	scanf("%lld",&N);
	while(N>0){
		INT m=f(N);
		printf("%lld\n",m);
		N-=m;
	}
}

Measured memory_bytes: 7116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    int a,b;
    cin >> a >> b;
    if(a<=b){
        cout << a << endl;
    }else {
        cout << a-1 << endl;
    }
}

Measured memory_bytes: 3560
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	int n;
	cin >> n;
	vector<array<int, 3>> vv;
	for (int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		vv.push_back({x, y, 0});
	}
	for (int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		vv.push_back({x, y, 1});
	}
	set<int> ss;
	sort(vv.begin(), vv.end());
	int ans = 0;
	for (int i = 0; i < vv.size(); ++i) {
		if (vv[i][2] == 1) {
			auto it = ss.lower_bound(vv[i][1]);
			if (it != ss.begin()) {
				--it;
				++ans;
				ss.erase(it);
			}
		}
		else {
			ss.insert(vv[i][1]);
		}
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> N >> X;
  ll c[N], t[N];
  ll count=1e+6;
  rep(i, N){
    cin >> c[i] >> t[i];
    if (t[i] <= X){
      count =min(count, c[i]);
    }
  }
  if (count!=1e+6) cout << count <<endl;
  else cout <<"TLE" << endl;
  
}


Measured memory_bytes: 256
import re,sys
for e in sys.stdin:
 s=any([len(x)>1 and x[0]=='X' for x in re.split('[+=]',e.strip())])
 for i in '0123456789'[s:]:
  if eval(e.replace('X',i).replace('=','==')):print(i);break
 else:print('NA')


Measured memory_bytes: 6572
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

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


long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int a[MAXN];
int tmp[MAXN];
vector <int> g[MAXN];

bool dfs(int v, int par) {
	if (g[v].size() == 1) {
		return 1;		
	}	
	int sum = 0;
	int mx = 0;
	for (int i : g[v]) {
		if (par == i) continue;
		if (!dfs(i, v)) return 0;
		sum += a[i];
		mx = max(mx, a[i]);
	}
	if (a[v] > sum || sum > 2 * a[v]) {
		return 0;
	}
	int k = sum - a[v];
	if (k > sum - mx) {
		return 0;
	}
	a[v] -= k;
	return (par == 0 && a[v] != 0 ? 0 : 1);
}


int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    for (int i = 1; i <= n; i++) {
    	a[i] = readInt();
    }
    for (int i = 1; i < n; i++) {
    	int v = readInt(), u = readInt();
    	g[u].pb(v);
    	g[v].pb(u);
    }
    if (n == 2) {
    	cout << (a[1] == a[2] ? "YES" : "NO");
    	return 0;
    }
	int r = 1;
	while(g[r].size() == 1) r++;
	cout << (dfs(r, 0) ? "YES" : "NO");
    return 0;
}

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

using namespace std;

int main()
{
  int card[4][13] = {};
  
  int n,num;
  char m;

  cin >> n ;
  
  for(int k = 0;k < n;k++)
    {
      cin >> m >> num;

      if(m == 'S')
	{
	  card[0][num-1] = num;
	}
      if(m == 'H')
	{
	  card[1][num-1] = num;
	}
      if(m == 'C')
	{
	  card[2][num-1] = num;
	}
      if(m == 'D')
	{
	  card[3][num-1] = num;
	}
	
    }
  for(int i = 0;i < 4;i++)
    {
      for(int j = 0;j < 13;j++)
	{
	  if(card[i][j] == 0)
	    {
	      if(i == 0)
		{
		  cout << 'S' << " " << j+1 << endl;
		}
	      if(i == 1)
		{
		  cout << 'H' << " " << j+1 << endl;
		}
	      if(i == 2)
		{
		  cout << 'C' << " " << j+1 << endl;
		}
	      if(i == 3)
		{
		  cout << 'D' << " " << j+1 << endl;
		}
	    }
	}
    }
}



Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<queue<int>> Q(n);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++){
    int s;
    cin >> s;
    if (s == 0){
      int t, x;
      cin >> t >> x;
      Q[t].push(x);
    }
    if (s == 1){
      int t;
      cin >> t;
      if (!Q[t].empty()){
        cout << Q[t].front() << endl;
      }
    }
    if (s == 2){
      int t;
      cin >> t;
      if (!Q[t].empty()){
        Q[t].pop();
      }
    }
  }
}


Measured memory_bytes: 4348
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {

	int n;
	cin >> n;

	if (n == 25)
		cout << "Christmas" << endl;
	else if (n == 24)
		cout << "Christmas Eve" << endl;
	else if (n == 23)
		cout << "Christmas Eve Eve" << endl;
	else if (n == 22)
		cout << "Christmas Eve Eve Eve" << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
	static void Main(string[] args)
	{
      List<string> youso = new List<string>();
      string line = "";
      while((line=Console.ReadLine()) != null)
      {
        youso.Add(line.ToString());
      }
      /////////////////////////////////////////
      
      string answer;

      List<string> Kisu = new List<string>() { "R", "U", "D" };
      List<string> Gusu = new List<string>() { "L", "U", "D" };

      answer = "Yes";
      for (int i = 0; i < youso[0].Length; i++)
      {
        string s = youso[0].Substring(i, 1).ToString();
        if ((i+1)%2 == 0)
        {
          if (!Gusu.Contains(s)) answer = "No";
        }
        else
        {
          if (!Kisu.Contains(s)) answer = "No";
        }
      }

      Console.WriteLine(answer);        
	}
  
  
  
}


Measured memory_bytes: 13148
package main

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

const (
	maxBufferSize     = 2000000 // check
	initialBufferSize = 20000
)

func Reverse(a []int) {
	n := len(a)
	for i := 0; i < n/2; i++ {
		a[i], a[n-i-1] = a[n-i-1], a[i]
	}
}

func BinarySearch(a []int, begin, end, target int) (int, int) {
	lb, ub := begin-1, end-1
	for ub-lb > 1 {
		mid := (lb + ub) / 2
		if a[mid] <= target {
			lb = mid
		} else {
			ub = mid
		}
	}
	return lb, ub
}

func Fill(a []int, value int) {
	for i := 0; i < len(a); i++ {
		a[i] = value
	}
}

func solve() {
	sc := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, initialBufferSize)
	sc.Buffer(buffer, maxBufferSize)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	a := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}

	Reverse(a)

	b := make([]int, n)
	Fill(b, 1010101010)
	b[0] = a[0]
	for i := 1; i < n; i++ {
		_, ub := BinarySearch(b, 0, n, a[i])
		b[ub] = a[i]
	}

	var ans int
	for i := 0; i < n; i++ {
		if b[i] != 1010101010 {
			ans = i + 1
		}
	}

	fmt.Println(ans)
}

func main() {
	solve()
}


Measured memory_bytes: 3840
import sys
input = sys.stdin.readline

class BIT:
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)
 
    def sum(self, i):
        # [0, i) の要素の総和を返す
        s = 0
        while i>0:
            s += self.tree[i]
            i -= i & -i
        return s
    # 0 index を 1 index に変更  転倒数を求めるなら1を足していく
    def add(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


n,q = map(int,input().split())
c = list(map(int,input().split()))
Q = []
for i in range(q):
    l,r = map(int,input().split())
    Q.append([l,r,i])

Q.sort(key=lambda x: x[1])

bit = BIT(n)
ind = [-1]*(n+1)

ans = [0]*q
now = 0
for l,r,num in Q:
    while now < r:
        x = c[now]
        if ind[x] == -1:
            ind[x] = now
            bit.add(now,1)
        else:
            bit.add(ind[x],-1)
            ind[x] = now
            bit.add(now,1)
        now += 1
    ans[num] = bit.sum(r)-bit.sum(l-1)
for i in ans:
    print(i)



Measured memory_bytes: 226576
N, X, Y = list(map(int, input().split()))

if X > Y:
    tmp = Y
    Y = X
    X = tmp

ans = [ 0 for i in range(N-1)]
for i in range(N):
    for j in range(i+2, N):
        #print(i,j)
        dis = j-i
        dis_xy = 1 + abs(X-i-1) + abs(Y-j-1)
        #print(min(dis, dis_xy))
        #print(dis_xy)
        ans[min(dis, dis_xy)-1] += 1
ans[0] = N

for i in range(N-1):
    print(ans[i])

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    LL N, X;
    cin >> N >> X;
    cout << (N - __gcd(N, X)) * 3;
    return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long 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; }
  
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll inf = (1LL<<60);

int N;
vector<pair<int, ll>> adj[100005];
vector<ll> d(100005, inf);

void bfs(){
    d[0] = 0;
    queue<int> q;
    q.push(0);

    while(!q.empty()){
        int now = q.front(); q.pop();
        for(auto edge:adj[now]){
            if(d[edge.first] > d[now]+edge.second){
                d[edge.first] = d[now]+edge.second;
                q.push(edge.first);
            }
        }
    }
}

int main(){
    cin >> N;
    for(int i=0; i<N-1; i++){
        int u,v; cin >> u >> v;
        ll w; cin >> w;
        u--; v--;
        adj[u].push_back({v, w});
        adj[v].push_back({u, w});
    }

    bfs();
    for(int i=0; i<N; i++){
        if(d[i]%2 == 0) cout << 0 << endl;
        else cout << 1 << endl;
    }

}

Measured memory_bytes: 8704
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	if(a+b==15){
		cout << "+" << endl;
	}else if(a*b==15){
		cout << "*" << endl;
	}else{
		cout << "x" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val x = readLine()!!
    val y = readLine()!!
    val r = when{
        x.count() > y.count() -> "GREATER"
        x.count() < y.count() -> "LESS"
        else -> when{
            x > y -> "GREATER"
            x < y -> "LESS"
            else -> "EQUAL"
        }
    }
    println(r)
}

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

vector<string> m;


void draw(int a,int b){
  if(m[a][b]=='1'){
    m[a][b]='0';
    draw(a-1,b);
    draw(a+1,b);
    draw(a,b-1);
    draw(a,b+1);
  }
}

int solve(){
  int ans= 0;
  for(int i=0;i<m.size();i++){
    for(int j=0;j<m[i].size();j++){
      if(m[i][j]=='1'){
        draw(i,j);
        ans++;
      }
    }
  }
  return ans;
}

int main(){
  while(!cin.eof()){
    string s;
    m.clear();
    m.push_back("00000000000000");
    for(int i=0;i<12;i++){
      cin>>s;
      s = "0"+s+"0";
      m.push_back(s);
    }
    m.push_back("00000000000000");
    cin.ignore(100,'\n');
    cin.ignore();
    cout<<solve()<<endl;
  }
}

Measured memory_bytes: 1200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace AtCoder.ARC083
{
    class RestoringRoadNetwork
    {
        public static void Main()
        {
            var n = int.Parse(ReadLine().Trim());
            var graph = new Graph(n);
            for (var i = 0; i < n; ++i) { 
                var a = ReadLine().Trim().Split(' ').Select(_ => int.Parse(_)).ToArray();
                for (var j = i; j < n; ++j)
                    graph[i, j] = a[j];
            }
            WriteLine(CalMap(graph));
        }
        static long CalMap(Graph graph)
        {
            long res = 0;
            for (var from = 0; from < graph.Size; ++from) {
                for (var to = from + 1; to < graph.Size; ++to) {
                    bool hasEdge = true;
                    for (var mid = 0; mid < graph.Size; ++mid) {
                        if (from != mid && mid != to) {
                            if (graph[from, to] > graph[from, mid] + graph[mid, to]) return -1;
                            else if (graph[from, to] == graph[from, mid] + graph[mid, to]) {
                                mid = graph.Size;
                                hasEdge = false;
                            }
                        }
                    }
                    if (hasEdge) res += graph[from, to];
                }
            }
            return res;
        }
        class Graph
        {
            int[,] map;
            public Graph(int n)
            {
                map = new int[n, n];
            }
            public int Size { get { return map.GetLength(0); } }
            public int this[int from, int to]
            {
                get { return map[from, to]; }
                set { map[from, to] = map[to, from] = value; }
            }
        }
    }
}


Measured memory_bytes: 19160
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
    #include <iostream>
    #include <cstdlib>
    #include <cmath>
    #include <string>
    #include <vector>
    #include <algorithm>
#include <iomanip>
     
    using namespace std;
     
    int main()
    {
        vector<long> a;
        int n, k;
        
        cin >> n >> k;
        
        for(int i = 0; i < n; i++) {
            int v;
            cin >> v;
            a.push_back((v + 1));
        }
     
        long m = 0;
        for (int i = 0; i <  k; i++) {
            m += a[i];
        }
        
        long s = m;
        for (int i = k; i < (int)a.size(); i++) {
            s += a[i] - a[i - k];
            if (s > m) {
                m = s;
            }
        }
        cout << setprecision(30) << m / 2.0 << endl;
        return 0;
    }
     
    // GCC reference:
    //   https://gcc.gnu.org/
     
    // C++ language references:
    //   https://cppreference.com/
    //   https://isocpp.org/
    //   http://www.open-std.org/jtc1/sc22/wg21/
     
    // Boost libraries references:
    //   https://www.boost.org/doc/

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 5) {
    cout << 0 << endl;
  } else if (a <= 12) {
    cout << b / 2 << endl;
  } else {
    cout << b << endl;
  }
}

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

int main() {
  int n,x;
  cin>>n>>x;
  vector<int>vec(n);
  for(int i=0;i<n;i++){
    cin>>vec[i];
  }
  int cnt=1;
  int a=0;
  for(int i=0;i<n;i++){
    a+=vec[i];
    if(a<=x)cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
typedef long long ll;
ll solve(ll x,ll n)
{
    ll ans;
    if(n%x==0)
        return n*2-x;
    ans=n/x*x*2+solve(n%x,x);
    return ans;
}
int main()
{
    ll n,x;
    ll ans;
    scanf("%lld%lld",&n,&x);
    ans=solve(x,n-x)+n;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public void printAdjMatrix() {
		Integer[][] adjMatrix = new Integer[totalVertex][totalVertex];
		for(int i = 0; i < totalVertex; i++) {
		for(int x = 0; x < totalVertex; x++) {
		adjMatrix[i][x] = 0;
		}
		}
		for(int i = 0; i < adjList.size(); i++) {
		LinkedList<Integer> curr = adjList.get(i);
		for(int x = 0; x < curr.size(); x++) {
		adjMatrix[i][curr.get(x)] = 1;
		}
		}
		for(int i = 0; i < totalVertex; i++) {
		for(int x = 0; x < totalVertex; x++) {
		if(x != totalVertex - 1) System.out.print(adjMatrix[i][x] + " ");
		else System.out.print(adjMatrix[i][x]);
		}
		System.out.println();
		}
		
	}
}

public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.printAdjMatrix();
	}
}


Measured memory_bytes: 32856
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		//A_i:出席番号iの生徒がきたときの教室の生徒の人数＝到着番号
		int[] A = new int[N];
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
		}
		sc.close();
		
		//B[]:到着した順番に出席番号が並んでる配列
		int[] B = new int[N];
		
		//出席番号順にfor文を回す。
		//つまり、Aを先頭から見る。
		for(int i=0;i<N;i++) {
			B[A[i]-1]=i+1;//到着番号、出席番号は1からなので配列の要素番号と１ずれてくる。
		}
		//B[]を先頭から出力すれば良い。
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<N;i++) {
			sb.append(B[i]);
			sb.append(" ");
		}
		String ans = sb.toString();
		
		System.out.println(ans);
		
	}
}


Measured memory_bytes: 50016
/*
g++ -std=c++14 -o2 -Wall diverta2019A.cpp -o .\out\diverta2019A.out
.\out\diverta2019A.out
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int mass[1005][1005];

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int k, n;
  cin >> n >> k;
  cout << n - k + 1 << "\n";
  return 0;
}


Measured memory_bytes: 256
import java.util.*;


public class Main {
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		double sum = 0;
		for(int i = 0; i < N; i++){
			X[i] = sc.nextInt();
			sum += X[i];
		}
		double avr = sum/N;
		avr = Math.round(avr);
		int r = 0;
		for(int i = 0; i < N; i++) {
			r += (X[i] - avr) * (X[i] - avr);
		}
		System.out.println(r);
	}
}

Measured memory_bytes: 21588
def main():
    import sys
    input = sys.stdin.buffer.readline
    from collections import Counter as cc
    from fractions import gcd
    n = int(input())
    mod = 10**9 + 7
    C_p,C_n = cc(),cc()
    count= 0
    count_zero_a = count_zero_b = 0
    ans = 1
    for i in range(n):
        a,b = map(int, input().split())
        if a == 0 and b== 0:
            count += 1
        else:
            gcd_ab = gcd(a,b)
            a //= gcd_ab
            b //= gcd_ab
            if b == 0:
                count_zero_b += 1
            elif a == 0: 
                count_zero_a += 1
            else:
                if a/b>0:
                    C_p[a,b] += 1
                else:
                    C_n[a,b] += 1
    count_zero = count
    ans *= (2**count_zero_a + 2**count_zero_b -1)%mod
    count += count_zero_a + count_zero_b    
    for a,b in C_p:
        if (-b,a) in C_n:
            count += C_n[-b,a] + C_p[a,b]
            ans *= (2**C_n[-b,a] + 2**C_p[a,b] -1)%mod
    ans *= pow(2,n-count,mod)%mod
    ans = (ans +count_zero -1) % mod
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 45868
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

int main()
{
	int n; cin >> n;
	double ans = 100;
	for(int i=0; i<n; i++){
		ans = ceil(ans * 1.05);
	}
	cout << (int)(1000*ans) << endl;

	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define inf (int)1e9+7
#define eb emplace_back

int main() {
    int a, b, c; cin >> a >> b >> c;
    cout << min({a + b, b + c, c + a}) << endl;
}


Measured memory_bytes: 256