akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main() {
	int n, l;
	cin >> n >> l;
	int a[305];
	int sum = 0;
	int flag = 0;
	int min = 1e5;
	int count = 0;
	for (int i = 0; i < n; i++) {
		a[i] = l + i;
		sum += a[i];
		if (a[i] == 0) {
			flag = 1;
		}
		if (min > a[i]) {
			min = a[i];
		}
		if (a[i] < 0) {
			count++;
		}
	}
	if (flag == 1) {
		cout << sum << endl;
		return 0;
	}
	if (count == n) {
		cout << sum - a[n-1] << endl;
		return 0;
	}
	else {
		cout << sum - min << endl;
		return 0;
	}
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX 37

typedef struct TT{
    char s;
    int v;
}T;

int N;

T card_s[MAX],card_b[MAX];

void Bubble(void){
    int i,j,a;
    char b;

    for(i=0;i<N;i++){
        for(int j=N-1;j>i;j--){

            if(card_b[j].v < card_b[j-1].v){
               
                a = card_b[j].v;

                card_b[j].v = card_b[j-1].v;

                card_b[j-1].v = a;

                b= card_b[j].s;

                card_b[j].s=card_b[j-1].s;

                card_b[j-1].s=b;

            }
        }
    }
}

void Select(void){
    int i,minj,j,a;
    char b;

    for(i=0;i<N;i++){
        minj=i;
        for(j=i;j<N;j++){
            if(card_s[j].v< card_s[minj].v){
                minj=j;
            }
        }
       
        a=card_s[i].v;

        card_s[i].v=card_s[minj].v;

        card_s[minj].v=a;

        b=card_s[i].s;

        card_s[i].s=card_s[minj].s;

        card_s[minj].s=b;
    }
}

int main(void){
    int i,count=0;
    char p;

    scanf("%d",&N);

    for(i=0;i<N;i++){
        scanf("%c%c%d",&p,&card_b[i].s,&card_b[i].v);

        card_s[i].s=card_b[i].s;
        card_s[i].v= card_b[i].v;

    }

    Bubble();
    Select();

    for(i=0;i<N;i++){
        printf("%c%d",card_b[i].s,card_b[i].v);
        if(i!=N-1)
            printf(" ");
    }

    printf("\nStable\n");

    for(i=0;i<N;i++){
        printf("%c%d",card_s[i].s,card_s[i].v);
        if(i!=N-1)
            printf(" ");
    }
    for(i=0;i<N;i++){
        if(card_b[i].s != card_s[i].s){
            count++;
        }
    }
    if(count!=0)
        printf("\nNot stable\n");
    else
         printf("\nStable\n");

    return 0;
}




Measured memory_bytes: 2140
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var A, B, r int
	fmt.Scan(&A, &B)
	for i := A; i <= B; i++ {
		s := strconv.Itoa(i)
		b := true
		for j := 0; j < len(s); j++ {
			n := len(s) - 1
			if s[j:j+1] != s[n-j:n-j+1] {
				b = false
				break
			}
		}
		if b {
			r++
		}
	}
	fmt.Println(r)
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define debug(x) cerr << "[" << #x <<": " << (x) <<"]"<< endl
#define pii pair<int,int>
#define clr(a,b) memset((a),b,sizeof(a))
#define rep(i,a,b) for(int i = a;i < b;i ++)
#define pb push_back
#define MP make_pair
#define LL long long
#define ull unsigned LL
#define ls i << 1
#define rs (i << 1) + 1
#define fi first
#define se second
#define ptch putchar
#define CLR(a) while(!(a).empty()) a.pop()

using namespace std;
inline LL read() {
    LL s = 0,w = 1;
    char ch = getchar();
    while(!isdigit(ch)) {
        if(ch == '-')
            w = -1;
        ch = getchar();
    }
    while(isdigit(ch))
        s = s * 10 + ch - '0',ch = getchar();
    return s * w;
}
inline void write(LL x) {
    if(x < 0)
        putchar('-'), x = -x;
    if(x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
#ifndef ONLINE_JUDGE
clock_t prostart = clock();
#endif

int main() {
#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif

    int a,b; cin >> a >> b;
    for(int i = 1;i <= 10000000;++ i) {
        if(floor(0.08 * i) == a && floor(0.1 * i) == b){
//            cout << round(0.08 * i) << endl;
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;

#ifndef ONLINE_JUDGE
    cerr << "time: " << 1.0 * (clock() - prostart) / CLOCKS_PER_SEC << " s" << endl;
#endif
    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define ll long long
#define REP(i,a,b) for (int i=a; i<b; i++)

using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pi;

bool ismonth(string s) {
  return (s[0]=='0' and s[1]>='1' and s[2]<='9') or (s[0]=='1' and s[1]>='1' and s[1]<='2');
}

signed main() {
  IOS;
  string S, ans="";
  cin >> S;
  string fir = S.substr(0, 2);
  string sec = S.substr(2, 2);

  if (ismonth(fir)) {
    ans = "MMYY";
  }
  if (ismonth(sec)) {
    ans = (ans.length() > 0 ? "AMBIGUOUS" : "YYMM");
  }
  cout << (ans.length() == 0 ? "NA" : ans) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long ABCD;
    cin >> ABCD;
    long A,B,C,D;
    A = ABCD / 1000;
    B = ABCD / 100 % 10;
    C = ABCD / 10 % 10;
    D = ABCD % 10;
    ll result, i, j, k;
    cerr << A << B << C << D << endl;
    bool isSeven = false;
    for(i=0;i<=1; i++)
    {
        for(j=0;j<=1; j++)
        {
            for(k=0;k<=1; k++)
            {
                if(i==0) result = A+B;
                if(i==1) result = A-B;
                if(j==0) result +=C;
                if(j==1) result -=C;
                if(k==0) result +=D;
                if(k==1) result -=D;

                if(result == 7)
                {
                    isSeven= true;
                    break;
                }
            }
            if(isSeven) break;
        }
        if(isSeven) break;
    }
    cerr << i << j << k << endl;
    string pm = "+-";
    cout << A << pm[i] << B << pm[j] << C << pm[k] << D << "=7" << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
using namespace std;
int main(void){
    string s;
    cin >> s;
    int ans;
    if (s == "RRR") ans = 3;
    if (s == "RRS") ans = 2;
    if (s == "RSR") ans = 1;
    if (s == "RSS") ans = 1;
    if (s == "SRR") ans = 2;
    if (s == "SRS") ans = 1;
    if (s == "SSR") ans = 1;
    if (s == "SSS") ans = 0;
    cout << ans << endl;
}


Measured memory_bytes: 3580
n = int(input())
a = sorted(list(map(int, input().split())))
l = [0] * (a[-1] + 3)
for i in a:
    l[i] += 1
c = 0
for i in range(2, a[-1] + 3):
    c = max(c, l[i - 2] + l[i - 1] + l[i])
print(c)


Measured memory_bytes: 13964
#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if (a==b)
    {
        cout <<c;
    }
    else if (a==c)
    {
        cout <<b;
    }
    else
    {
        cout <<a;
    }
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc094/tasks/abc094_b

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

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int n, m, x, c1 = 0, c2 = 0;

  cin >> n >> m >> x;

  REP(i, m)
  {
    int ai;
    cin >> ai;
    if (ai < x)
      c1++;
    else
      c2++;
  }

  cout << min(c1, c2) << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define m 1000000007
#define de cout<<"debuglandınız\n";
bool ar[1001][1001];
ll int dp[1001][1001];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int W,H,i,j,p;
	string s;
	cin>>H>>W;
	for(i=1;i<=H;i++){
		cin>>s;
		for(p=0;p<=W;p++){
			if(s[p]=='.')ar[i][p+1]=1;
		}
	}
	dp[1][1]=1;
	for(i=1;i<=H;i++){
		for(j=1;j<=W;j++){
			if(i==1 and j==1)continue;
			if(ar[i][j]){
				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%m;
			}
		}
	}
	cout<<dp[H][W]<<endl;


	/*for(i=0;i<=H;i++){
		for(j=0;j<=W;j++){
			cout<<ar[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
	for(i=0;i<=H;i++){
		for(j=0;j<=W;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/

	return 0;
}

Measured memory_bytes: 9088
#include <stdio.h>
#include <iostream>
using namespace std;

int N,K,Q,a,nilai;
int main (){
int nilai[100001];
cin >> N >> K >>Q;
	for (int i=1; i<=N; i++){
		nilai[i]=K-Q;
	}
	for (int i=1; i<=Q; i++){
		cin>>a;
		nilai[a]++;
	}	
	for (int i=1; i<=N; i++){
		if (nilai[i]<=0){
			cout << "No"<< endl;
		}else {
			cout <<"Yes"<< endl;
		}
	}
}

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

int main() {
  char s;
  cin >> s;
  
  string f = "consonant";
  string V = "aeiou";
  
  for (int i=0; i< V.size(); i++){
    if (s == V.at(i)){
      f = "vowel";
      break;
    }
  }
  cout << f << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;

int main(){

  int n;
  ll k;
  cin >> n >> k;
  vector<int> a(n); //a[i] : 町iからテレポーテーションすると町a[i]につく。
  rep(i,n){
    int tmp;
    cin >> tmp;
    a[i] = --tmp;
  }

  vector<ll> t(n,-1); //t[i] : t[i]回目のテレポーテーションで町iに来たことがある。
  ll i = 0;
  int pre = 0;
  t[0] = 0;
  int now;
  while(i < n && i < k){
    i++;
    now = a[pre];
    if(i == k){
      cout << ++now << endl;
      return 0;
    }
    //cout << now << "," << t[now] << endl;
    if(t[now] == -1) t[now] = i;
    else{
      ll loop = (k - t[now]) % (i - t[now]); //繰り返し中のloop回目が答え。
      //cout << loop + t[now] << endl;
      rep(j,n){
	if(t[j] == (loop + t[now])){
	  cout << ++j << endl;
	  return 0;
	}
      }
    }
    pre = now;
  }

  return 0;
}


Measured memory_bytes: 5612
N, T = map(int, input().split())

CT = []
for _ in range(N):
    CT.append(tuple(map(int, input().split())))

CT1 = [ct for ct in CT if ct[1] <= T]

if len(CT1) == 0:
    print('TLE')
else:
    CT2 = sorted(CT1, key=lambda ct1: ct1[0])
    print(CT2[0][0])


Measured memory_bytes: 3060
import sys
import numpy as np

h, w = list(map(int, input().split()))
field = np.array([[c == '.' for c in line.rstrip()] for line in sys.stdin], dtype=np.int32)
li, ri, ui, di = (field.copy() for _ in [0] * 4)

for i in range(1, h):
    ui[i] = (ui[i - 1] + 1) * field[i]
    di[h - i - 1] = (di[h - i] + 1) * field[h - i - 1]
for j in range(1, w):
    li[:, j] = (li[:, j - 1] + 1) * field[:, j]
    ri[:, w - j - 1] = (ri[:, w - j] + 1) * field[:, w - j - 1]
print((li + ri + ui + di).max() - 3)


Measured memory_bytes: 121944
#include <stdio.h>
#include <iostream>
#include <queue>

using namespace std;

int data[20][20];

void PrintData(int n){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			printf("%4d",data[i][j]);
		}
		printf("\n");
	}
}

int main(){
	int unko1;
	queue<int> tmp;
	while(cin>>unko1){
		if(unko1==0)break;
		tmp.push(unko1);
	}
	tmp.push(0);
	int size=tmp.size();
	for(int unko = 0;unko<size;unko++){
		int n = tmp.front();
		tmp.pop();
		if(n==0)break;

		for(int i=0;i<20;i++){
			for(int j=0;j<20;j++){
				data[i][j]=0;
			}
		}
		
		int cnt = 1;
		int i=n/2+1;
		int j=n/2;
		while(1){
			if(data[i%n][j%n]>0){
				j--;
				i++;
			}
			data[i%n][j%n] = cnt;
			i++;
			j++;
			cnt++;
			if(cnt>n*n){
				break;
			}
		}
		PrintData(n);
	}

	return 0;
}

/*
Sample Input
3
5
0
Output for the Sample Input
   4   9   2
   3   5   7
   8   1   6
  11  24   7  20   3
   4  12  25   8  16
  17   5  13  21   9
  10  18   1  14  22
  23   6  19   2  15
 */

Measured memory_bytes: 1200
from collections import *
from itertools import *
from bisect import *
from heapq import *

import math
from fractions import gcd
import sys
#input = sys.stdin.readline

import copy

N,M=map(int,input().split())
UV=[list(map(int,input().split())) for i in range(M)]
S,T=map(int,input().split())

data=[[] for i in range(N+1)]
for u,v in UV:
    data[u].append(v)

visited={S}
visited1=set()
visited2=set()
stack=deque([[S,0]])
while stack:
    a,m=stack.popleft()
    for p in data[a]:
        z=(m+1)

        if z%3==0:
            if p in visited:
                continue
            elif p == T:
                print(z//3)
                exit()
            else:
                visited.add(p)
        if z%3==1:
            if p in visited1:
                continue
            else:
                visited1.add(p)
        if z%3==2:
            if p in visited2:
                continue
            else:
                visited2.add(p)
        stack.append([p,z])

print(-1)


Measured memory_bytes: 51084
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int x, a, b;

int main() {
	// x = a^5 - b^5
	cin >> x;
	for(int i = -1000; i <= 1000; i++) {
		for(int j = -1000; j <= 1000; j++) {
			if(pow(i, 5) - pow(j, 5) == x) {
				a = i;
				b = j;
				break;
			}
		}
	}
	cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 4008
n, m = gets.chomp.split(" ").map(&:to_i)
matrix = []
n.times do |i|
  matrix[i] = gets.chomp.split(" ").map(&:to_i)
end

vector = []
m.times do |i|
  vector[i] = gets.to_i
end

matrix.each do |i|
  sum = 0
  m.times do |j|
    sum += i[j] * vector[j]
  end
  puts sum
end

Measured memory_bytes: 8944
import java.util.Scanner;

class Main{




	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		String x	 = sc.next();
		int m = sc.nextInt();
		if(x.equals("+")){
			System.out.println(n+m);
		}else{
			System.out.println(n-m);

		}



	}
}

class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}




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

class BIT {
private:
	int size;
	vector<long long> bit;
	int mod;

public:
	BIT(int n, int m):size(n), bit(n + 1, 0), mod(m) {}

	void add(int i, int x) {
		while(i <= size) {
			bit[i] += x;
			bit[i] %= mod;
			i += i & -i;
		}
	}

	long long sum(int i) const {
		long long s = 0;
		while(i > 0) {
			s += bit[i];
			s %= mod;
			i -= i & -i;
		}
		return s;
	}
};

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

	for(int a, b, p; cin >> a >> b >> p && a;) {
		const int num = b - a + 2;

		vector<string> order;
		order.reserve(num);

		for(int i = a; i <= b; ++i) {
			order.emplace_back(to_string(i));
		}

		sort(order.begin(), order.end());

		BIT bit(num, p);
		bit.add(1, 1);

		for(const auto &s : order) {
			const int index = stoi(s) - a + 2;
			const auto tmp = bit.sum(index - 1);
			bit.add(index, tmp);
		}

		cout << (bit.sum(num) - 1 + p) % p << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 7444
x, n = map(int, input().split())

if n == 0:
    print(x)

else:
    l = list(map(int, input().split()))
    tmp = x
    i = 1
    while i:
        if not x in l:
            print(x)
            break
        elif not tmp in l:
            print(tmp)
            break
        x -= 1
        tmp += 1


Measured memory_bytes: 8980
#include<bits/stdc++.h>
using namespace std;
map<long long,long long> mp;
int main(){
	for(long long i=-200;i<=200;i++){
		mp[i*i*i*i*i]=i;
	}
	long long x;
	cin>>x;
	for(long long i=-200;i<=200;i++){
		long long k=i*i*i*i*i;
		long long t=x+k;
		if(!mp[t]);
		else {cout<<mp[t]<<" "<<i<<endl;break;}
	}
	return 0;
}

Measured memory_bytes: 3632
n,k = map(int,input().split())
h = input().split()
h_list = [int(s) for s in h]
cost = [0 for i in range(n)]
for i in range(n):
    if i == 0:
        cost[i] = 0
        continue
    if i == 1:
        cost[i] = abs(h_list[i] - h_list[i - 1])
        continue
    k_list = []
    for j in range(k):
        if i - j - 1 < 0:
            break
        k_list.append(cost[i - j - 1] + abs(h_list[i] - h_list[i - j - 1]))
    cost[i] = min(k_list)
print(cost[n - 1])

Measured memory_bytes: 56544
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int n,t;
    cin >> n >> t;

    vector<int> cs;
    for(int i = 0; i < n; i++){
        int c, tt;
        cin >> c >> tt;
        if(tt <= t){
            cs.push_back(c);
        }
    }

    sort(cs.begin(), cs.end());
    if(cs.empty()){
        cout << "TLE" << endl;
    }else {
        cout << cs[0] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
A = input()

N = int(A)

list_4 = []
list_7 = []
list_numbers = []

for i in range(0, 25):
  list_4.append(4 * i)

for j in range(0,14):
  list_7.append(7 * j)

for i in range(0, 25):
  for j in range(0, 14):
    list_numbers.append(list_4[i] + list_7[j])

if N in list_numbers:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

void ins(queue<char> &s , string str){
  rep(i,0,str.size()){
    s.push(str[i]);
  }
  
  ret;
}

char sol(queue<char> &s){
  char c = s.front();
  s.pop();
  ret c;
}

int main(){
  string a,b,c;
  C3(a,b,c);
  queue<char> sa,sb,sc;

  ins(sa,a);
  ins(sb,b);
  ins(sc,c);
  
  char o = 'a';
  
  while(1){
    
    switch(o){
      case 'a':
        //P("sa");
        if(sa.empty()){
          P("A");
          ret 0;
        }
        o = sol(sa);
        break;
      case 'b':
        //P("sb");
        if(sb.empty()){
          P("B");
          ret 0;
        }
        o = sol(sb);
        break;
      case 'c':
        //P("sc");
        if(sc.empty()){
          P("C");
          ret 0;
        }
        o = sol(sc);
        break;
      default:
        break;
    }

  }
  
  ret 0;
}

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

int main()
{
    int N,M,i,j,l;
    int k[10],s[10][10],p[10];
    int swcase,ans,fail,count;
    scanf("%d%d",&N,&M);
    for(i=0;i<M;i++){
        scanf("%d",&k[i]);
        for(j=0;j<k[i];j++){
            scanf("%d",&s[i][j]);
        }
    }
    for(i=0;i<M;i++)
        scanf("%d",&p[i]);
    swcase=1;
    for(i=0;i<N;i++)
        swcase*=2;
    ans=0;
    for(i=0;i<swcase;i++){
        //each situation
        fail=0;
        for(j=0;j<M;j++){
            //each light
            count=0;
            for(l=0;l<k[j];l++){
                //count switch
                if((i>>(s[j][l]-1))%2==1)
                    count+=1;
            }
            if(count%2!=p[j]){
                fail=1;
                break;
            }
        }
        if(fail)
            continue;
        else{
            ans++;
        }
    }
    printf("%d\n",ans);

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

int main()
{


	ll n;
	cin >> n;
	ll dp[n][3];
	ll arr[n][3];
	for (ll i = 0; i < n; i++)
	{
		for (ll j = 0; j < 3; j++)
		{
			cin >> arr[i][j];
		}
	}
	for (ll i = 0; i < n; i++)
	{
		for (ll j = 0; j < 3; j++)
		{
			if (i == 0)
			{
				dp[i][j] = arr[i][j];
			}
			else

			{
				for (ll k = 0; k < 3; k++)
				{
					if (k != j)
					{
						dp[i][j] = arr[i][j] + max(dp[i - 1][k], dp[i - 1][3 - k - j]);
						break;
					}
				}
			}
		}

	}
	cout << max(dp[n - 1][0], max(dp[n - 1][1] , dp[n - 1][2]));


}

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

int main()
{
    int H, N;
    cin >> H >> N;
    int A[1005], B[1005];
    for (int i = 1; i <= N; i++)
    {
        cin >> A[i] >> B[i];
    }

    int dp[10005];
    for (int j = 1; j <= H; j++)
    {
        dp[j] = 1000000000;
    }
    // dp[i] == (体力がiであるモンスターに勝つために必要な魔力の最小値)

    for (int i = 1; i <= N; i++)
    {
        for (int h = 1; h <= min(A[i], H); h++)
        {
            dp[h] = min(dp[h], B[i]);
        }

        for (int h = A[i] + 1; h <= H; h++)
        {
            dp[h] = min(dp[h], dp[h - A[i]] + B[i]);
        }
    }

    cout << dp[H] << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

public class Program{
    public static void Main(){
        string[] a = Console.ReadLine().Split(' ');
      var first = int.Parse(a[0]);
      var second = int.Parse(a[1]);
      if(first > second){
        System.Console.WriteLine("safe");
      }else{
        System.Console.WriteLine("unsafe");
      }
    }
}




Measured memory_bytes: 27376
package main

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

func main() {

	alpha := nextString()

	if alpha == strings.ToLower(alpha) {
		fmt.Println("a")
	} else {
		fmt.Println("A")
	}
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

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

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args)
}


Measured memory_bytes: 1808
#include <iostream>

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

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

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

  int n = S.size();
  int ans{};
  for (auto i = 0; i != n / 2; ++i) {
    if (S[i] != S[n - i - 1]) {
      ++ans;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<iomanip>

using namespace std;

	double prob[3009];
	double dp[3009][3009]; // more heads than tails // probabil of head p 

int main(){

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

	for(int i = 0; i <= n; i++) for(int j = 0; j <= n; j++) dp[i][j] = 0.0;
	
	dp[1][1] = prob[1];
	dp[1][0] = 1.0 - prob[1];
	
	for(int i = 2; i <= n; i++){
		for(int j = 0; j <= i; j++){
			
			dp[i][j] += dp[i-1][j]*(1.0-prob[i]);
			if(j != 0) dp[i][j] += dp[i-1][j-1]*prob[i];
			
			//out << dp[i-1][j] << " " << 1.0 - prob[i]; 
			//cout << dp[i][j] << " " << i << " " << j << endl; system("pause");
		}
	}
	double sol = 0.0;
	for(int i = 0; i <= n; i++){
		if(i > n - i) sol += dp[n][i];
	}
	cout << setprecision(13) << sol;

	return 0;
}


Measured memory_bytes: 70784
#include<stdio.h>

int main(void){

  int n,count = 0;
  while(scanf("%d",&n)!= EOF){

    for(int i = 0; i <= 9;i++){
      for(int j = 0; j <= 9;j++){
        for(int k = 0; k <= 9;k++){
          for(int l = 0 ;l <= 9;l++){
            if(n == i+j+k+l){
              count++;
            }
          }
        }
      }
    }
    printf("%d\n",count);
    count = 0;
  }



  return 0;
}



Measured memory_bytes: 2040
import java.util.Scanner;

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

    int n = sc.nextInt();
  	if(n%sumDigits(n)==0){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}  }
    public static int sumDigits(int n) {
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
        return sum;
	   	}
}


Measured memory_bytes: 21844
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, usize2) => {
        read_value!($next, usize) - 2
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
    s: chars,
    );
    let mut ans = "";
    for i in 0..2 {
        ans = if s[i] != s[i+1] {"Yes"} else { "No" };
        if ans == "Yes"{break}
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int l[n];
    for(int i=0;i<n;i++)
    cin>>l[i];
    sort(l,l+n);
    int r=0;
    for(int i=0;i<n-1;i++)
    r+=l[i];
    if(r>l[n-1])
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 int main(void){
 int a, b;
 int c;

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

 int ispoor = 0;
 if (a == b && b != c) ispoor = 1;
 if (b == c && c != a) ispoor = 1;
 if (c == a && a != b) ispoor = 1;

 if (ispoor) {
 puts("Yes");
 } else {
 puts("No");
 }

 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;
	double mut = 380000;
	double ans = 0;
	for (int i = 0; i < N; i++)
	{
		double money;
		string tmp;
		cin >> money >> tmp;
		if (tmp[0] == 'B')
		{
			money *= mut;
		}
		ans += money;
	}
	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N;
  cin >> N;
  map<int, int> m;
  vector<int> D(N);
  rep(i, N) {
    cin >> D[i];
    m[D[i]]++;
  }


  int M;
  cin >> M;
  vector<int> T(M);
  rep(i, M) {
    cin >> T[i];
    if (m.find(T[i]) == m.end() || m[T[i]] == 0) {
      cout << "NO\n";
      return 0;
    }
    m[T[i]]--;
  }
  cout << "YES\n";
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
# define MOD 1000000000+7
# define INF 1000000000
typedef long long ll;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {

	ll n, a, b, c, d, e, manji;
	cin >> n >> a >> b >> c >> d >> e;

	manji = n / min({ a,b,c,d,e });
	if (n % min({ a,b,c,d,e })) {
		manji++;
	}
	cout << manji + 4 << endl;
	return 0;
}

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

int main() {
    int n,x,i,y,sum=0,x1=0,y1=0,min;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
        sum=sum+a[i];
    }
    x=sum/n;
    y=(sum+n-1)/n;
    for(i=0;i<n;i++){
        x1=x1+(a[i]-x)*(a[i]-x);
        y1=y1+(a[i]-y)*(a[i]-y);
    }
    min=x1;
    if(y1<min){
        min=y1;
    }
    cout<<min<<endl;
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,k,p[200005];
void solve(){
    cin>>n>>k;
    rep(i,0,n) cin>>p[i];
    set<int> st;
    int cnt=0;
    rep(i,0,k){
        st.insert(p[i]);
        if(i and p[i-1]>p[i]) cnt++;
    }
    int ans=1,f=0;
    if(cnt==0) f=1;
    rep(i,k,n){
        int add=p[i];
        int rem=p[i-k];
        if(i-k+1<n and p[i-k]>p[i-k+1]) cnt--;
        if(p[i-1]>p[i]) cnt++;
        if((*st.begin())==rem and (*(--st.end()))<add);
        else if(cnt) ans++;
        else if(f==0) ans++,f=1;
        st.erase(rem);
        st.insert(add);
    }
    cout<<ans<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 10368
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K=MI()
    if N>=10:
        print(K)
    else:
        print(K+100*(10-N))
if __name__ == '__main__':
    main()

Measured memory_bytes: 65772
/*In the name of Allah*/
#include<stdio.h>
#include<math.h>
#include<limits.h>
#include<assert.h>
#include<stdbool.h>
#include<stddef.h>
#include<stdint.h>
#include<string.h>
#include<unistd.h>
#include<stdlib.h>
#include<ctype.h>
#include<time.h>
typedef long long ll;
typedef long double ld;

#define s(a) scanf("%d",&a)
#define p(a) printf("%d",a)
#define nl printf("\n")
#define s_p printf(" ")
#define pi 3.14159

int main()
{ char c[4];
scanf("%s",c);
int A,B;
for(int i=0;i<3;i++)
{if(c[i]=='A') A++;
else B++;}

if(A==0 || B==0) 
printf("No");
else
printf("Yes");




return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define long long long
using namespace std;
const long N = 1e5+1, LINF = 1e18 + 1;

int n, m, deg[N], dp[N];
vector<int> g[N];
queue<int> q;
int main() {
  cin >> n >> m;
  for(int i = 0, u, v; i < m; i++) {
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    ++deg[v];
  }
  for(int i = 0; i < n; i++) {
    if(deg[i] == 0) {
      dp[i] = 0;
      q.push(i);
    } else dp[i] = -N;
  }
  while(!q.empty()) {
    int u = q.front();
    q.pop();
    for(int v: g[u]) {
      dp[v] = max(dp[u] + 1, dp[v]);
      --deg[v];
      if(deg[v] == 0) q.push(v);
    }
  }
  cout << *max_element(dp, dp+n);
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll Mod = 1e9 + 7;

ll Cnt[26];

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

    for(ll i=0;i<n;i++) Cnt[s[i]-'a']++;

    ll Ans = 1;

    for(ll i=0;i<26;i++)    Ans = ( Ans*(Cnt[i]+1) )%Mod;

    cout << ( Ans  - 1 + Mod )%Mod;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
 
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
 
  int n, p;
  cin >> n >> p;
  string s;
  cin >> s;
  reverse(all(s));
  vi v(n);
  for(int i = 0; i < n; i++) {
    v[i] = s[i] - '0';
  }
  if(p == 2 || p == 5) {
    ll res = 0;
    for(int i = 0; i < n; i++) {
      if(v[i] % p == 0) {
        res += n - i;
      } 
    }
    cout << res;
    return 0;
  }
  vi pwr(n);
  int pw = 1;
  for(int i = 0; i < n; i++) {
    pwr[i] = pw;
    pw *= 10;
    pw %= p;
  }
  vi cnt(p);
  int x = 0;
  for(int i = 0; i < n; i++) {
    x += pwr[i] * v[i];
    x %= p;
    cnt[x]++;
  }
  ll res = 0;
  cnt[0]++;
  for(int i = 0; i < p; i++) {
    res += 1ll * cnt[i] * (cnt[i] - 1) / 2;
  }
  cout << res;
}

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

#define N 200010
int n, a[N], Bit[50];
unordered_map <int, int> mp; 

int main()
{
	Bit[0] = 1;
	for (int i = 1; i <= 30; ++i) Bit[i] = Bit[i - 1] << 1;
	while (scanf("%d", &n) != EOF)
	{
		mp.clear();
		for (int i = 1; i <= n; ++i)  
		{
			scanf("%d", a + i);
			++mp[a[i]];
		}
		sort(a + 1, a + 1 + n);
		int res = 0; 
		for (int i = n; i >= 1; --i) 
		{
			int pos = upper_bound(Bit, Bit + 30, a[i]) - Bit;
			//cout << a[i] << " " << Bit[pos] << endl;
		    if (pos >= 31 || mp[a[i]] == 0) continue;
			int tar = Bit[pos] - a[i]; 
			if ((tar != a[i] && mp[tar]) || (tar == a[i] && mp[tar] > 1)) 
			{
				++res; 
				--mp[tar];
			}	
			--mp[a[i]]; 
		}
		printf("%d\n", res);
	}
	return 0;
}


Measured memory_bytes: 17524
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    int h[100001];
    cin>>N>>K;
    for(int i=0;i<N;i++) cin>>h[i];
    sort(h,h+N);
    int ans=1e9;
    for(int i=0;i<=N-K;i++){
        ans=min(ans,abs(h[i]-h[i+K-1]));
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 640
fn main() {
    proconio::input! {
        n: i32,
        k: i32,
    }

    let mut snuke: Vec<i32> = Vec::with_capacity(n as usize);
    for _ in 0..n {
        snuke.push(0);
    }

    for _ in 1..=k {
        proconio::input! {
            d: i32,
            a: [i32; d],
        }

        for ai in a.iter() {
            snuke[(ai - 1) as usize] += 1;
        }
    }

    let result = snuke.iter().filter(|&n| *n == 0).count();

    println!("{}", result);

}


Measured memory_bytes: 2172
package main

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

func nextLine(r *bufio.Reader) string {
	var buf []byte
	for {
		line, isPrefix, err := r.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}

func nextStr(s *bufio.Scanner) string {
	s.Scan()
	ref := s.Bytes()
	cp := make([]byte, len(ref))
	copy(cp, ref)
	return string(cp)
}

func nextInt(s *bufio.Scanner) int {
	n, err := strconv.Atoi(nextStr(s))
	if err != nil {
		panic(err)
	}
	return n
}

func nextInt64(s *bufio.Scanner) int64 {
	n, err := strconv.ParseInt(nextStr(s), 0, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	S := nextStr(s)
	T := nextStr(s)

	ans := len(T);
	for i := 0; i + len(T) <= len(S); i++ {
		cnt := 0
		for j := 0; j < len(T); j++ {
			if S[i + j] != T[j] {
				cnt++;
			}
		}
		if ans > cnt {
			ans = cnt
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1780
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + 10;
void solve() {
    int x, y;
    char c;
    while(cin >> x) {
        cin >> c >> y;
        if(c == '+') cout << x + y << endl;
        else cout << x - y << endl;
    }
}
int main() {
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{

    string t;
    cin >> t;
    int x=0,i;

   for (i = 0; i <  t.size(); i++) {
     	x += t[i]-'0';
    }
    //cout<<x<<endl;

   if(x%9==0) cout<<"Yes\n";
  else cout<<"No\n";


    return 0;
}


Measured memory_bytes: 3672
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
      InputStream inputStream = System.in;
      OutputStream outputStream = System.out;
      Scanner sc = new Scanner(inputStream);
      PrintWriter out = new PrintWriter(outputStream);
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      if(a * b % 2 == 0){
        out.println("Even");
      }else{
      	out.println("Odd");
      }
      out.close();
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <algorithm>

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

  int A1[N], A2[N];
  for(int i = 0; i < N; i++){
    std::cin >> A1[i];
  }
  for(int i = 0; i < N; i++){
    std::cin >> A2[i];
  }

  int score = A1[0];
  for(int i = 0; i < N; i++){
    score += A2[i];
  }

  std::vector<int> diff(N);
  diff[0] = 0;
  for(int i = 1; i < N; i++){
    diff[i] = A1[i] - A2[i-1] + diff[i-1];
  }
  int max = *std::max_element(diff.begin(), diff.end());

  if(max < 0) max = 0;

  std::cout << score + max << '\n';

}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

vector<ll> divisor(ll n) {
  vector<ll> res;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  return res;
}

int main() {
  ll N;
  cin >> N;
  vector<ll> divs = divisor(N);
  ll x = divs[divs.size() - 1], y = N / x;
  cout << (x - 1) + (y - 1) << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
 
#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()
 
using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;
 
vector<VI> h;
vector<int> ba, usd;
 
void dfs(int v, int d , int c){
	if(usd[v] >= d) return;
	if(ba[v] ==0) ba[v] = c;
	usd[v] = d;
	if(d==0) return;
	for(auto x: h[v]){
		dfs(x, d-1, c);
	}
}
 
 
 
int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n,m,q;
	cin >>n >>m;
	h.resize(n);
	ba.assign(n,0);
	usd.assign(n,-1);
	rep(i,m){
		int a,b;
		cin >>a >>b;
		h[a-1].push_back(b-1);
		h[b-1].push_back(a-1);
	}
	cin >> q;
	//if(n>2001 || m>2001 || q>2001) return 0;
	vector<array<int,3>> v(q);
	rep(i,q){
		cin >>v[i][0] >> v[i][1] >> v[i][2];
		v[i][0]--;
	}
	repr(i, q-1, 0){
		dfs(v[i][0] , v[i][1], v[i][2]);
	}
	
	for(auto x : ba) cout << x <<"\n";
	return 0;
}

Measured memory_bytes: 8440
#include <bits/stdc++.h>
#include <iostream>
#define FASTIO std::ios::sync_with_stdio(false);
using namespace std;
const int mod = 1000000007;

int main(){
  FASTIO
  long long int n, k, x=0, y=0;
  cin>>n>>k;
  k--;
  int a[n], b[n], c[n];
  long long ans=0;
  map<int, int>mp;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=n-1;i>=0;i--){
    b[i]=0;
    for(int j=i+1;j<n;j++)if(a[j]<a[i])b[i]++;
  }
  for(int i=0;i<n;i++){
    c[i]=0;
    for(int j=0;j<n;j++)if(a[j]<a[i])c[i]++;
    // cout<<b[i]<<" "<<c[i]<<endl;
  }
  for(int i=0;i<n;i++){
    x+=b[i];
    y+=c[i];
  }
  ans+=(k+1)*x;
  ans%=mod;
  k=(k*(k+1))/2;
  k%=mod;
  k=(k*y)%mod;
  ans+=k;
  ans%=mod;
  cout<<ans<<endl;



}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main() {
	double w, h, x, y; cin >> w >> h >> x >> y;
	printf("%.9f", w * h / 2);
	if (w / 2 == x && h / 2 == y)cout << " " << 1 << endl;
	else cout << " " << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 707;
const int INF = 2147483647;
int flag=0,co[maxn],n,m;
int dis[maxn][maxn],num[3];
void dfs(int u,int c){
	co[u]=c;
	if(c>0)num[1]++;
	else num[2]++;
	for(int i=1;i<=n;i++){
		if(i==u||dis[u][i])continue;
		else if(!co[i])dfs(i,-c);
		else if(co[i]==co[u]){
			printf("-1");
			exit(0);
		}
	}
}

int f[maxn],dp[maxn];

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		dis[x][y]=dis[y][x]=1;
	}
	f[0]=1;
	for(int i=1;i<=n;i++){
		if(co[i]!=0)continue;
		num[1]=num[2]=0;
		dfs(i,1);
		memset(dp,0,sizeof(dp));
		for(int j=0;j<=n;j++){
			dp[j+num[1]]|=f[j];
			dp[j+num[2]]|=f[j];
		}
		for(int j=0;j<=n;j++)f[j]=dp[j];
	}
	if(flag)cout<<"-1";
	int ans=INF;
	for(int i=0;i<=n;i++){
		if(f[i]){
			ans=min(ans,(i*(i-1)/2)+((n-i)*(n-i-1)/2));
		}
	}
	cout<<ans;
}

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

typedef long long ll;

#define FOR(i,a,b) for(ll i = (a);i < (b);++i)
#define REP(i,n) FOR(i,0,n)

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

int main(void){

    int N;
    cin >> N;
    int probScore[N];

    int sum = 0;


    REP(i,N){
        cin >> probScore[i];
        sum += probScore[i];
    }

    if(sum % 10 == 0){

        sort(&probScore[0],&probScore[N]);

        REP(i,N){
            if(probScore[i] % 10 != 0){
                sum -= probScore[i];
                cout << sum << endl;
                return 0;
            }
        }

        // All of the problem is a multiple of 10.
        cout << 0 << endl;

    }else{
        cout << sum << endl;
        return 0;
    }
    
    
    return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

int N,ans;
char A[3][200];
int main(){
    scanf("%d%s%s%s", &N,A[0],A[1],A[2]);

    for (int i = 0; A[0][i] != '\0';i++){
        int ct = 0;
        for (int j = 0; j < 3;j++){
            for (int k = j + 1; k < 3;k++){
                if(A[j][i]==A[k][i]){
                    ct++;
                }
            }
        }
        if(ct==0){
            ans += 2;
        }else if(ct==1){
            ans++;
        }
    }
    printf("%d", ans);
    return 0;
}

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

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

  ll ans = 0;

  unordered_map<string, int> m;
  for(int i = 0; i < n; i++){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(m[s] == 0) m[s] = 1;
    else {
      ans += m[s];
      m[s]++;
    }
    
  }

  cout << ans << endl;
}



Measured memory_bytes: 10660
// C++ code to find number of distinct numbers 
// in a subarray 
#include<bits/stdc++.h> 
using namespace std; 

const int MAX = 5e5 + 5; 

// structure to store queries 
struct Query 
{ 
	int l, r, idx; 
}; 

// cmp function to sort queries according to r 
bool cmp(Query x, Query y) 
{ 
	return x.r < y.r; 
} 

// updating the bit array 
void update(int idx, int val, int bit[], int n) 
{ 
	for (; idx <= n; idx += idx&-idx) 
		bit[idx] += val; 
} 

// querying the bit array 
int query(int idx, int bit[], int n) 
{ 
	int sum = 0; 
	for (; idx>0; idx-=idx&-idx) 
		sum += bit[idx]; 
	return sum; 
} 

void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
	// initialising bit array 
	int bit[n+1]; 
	memset(bit, 0, sizeof(bit)); 

	// holds the rightmost index of any number 
	// as numbers of a[i] are less than or equal to 10^6 
	int last_visit[MAX]; 
	memset(last_visit, -1, sizeof(last_visit)); 

	// answer for each query 
	int ans[q]; 
	int query_counter = 0; 
	for (int i=0; i<n; i++) 
	{ 
		// If last visit is not -1 update -1 at the 
		// idx equal to last_visit[arr[i]] 
		if (last_visit[arr[i]] !=-1) 
			update (last_visit[arr[i]] + 1, -1, bit, n); 

		// Setting last_visit[arr[i]] as i and updating 
		// the bit array accordingly 
		last_visit[arr[i]] = i; 
		update(i + 1, 1, bit, n); 

		// If i is equal to r of any query store answer 
		// for that query in ans[] 
		while (query_counter < q && queries[query_counter].r == i) 
		{ 
			ans[queries[query_counter].idx] = 
					query(queries[query_counter].r + 1, bit, n)- 
					query(queries[query_counter].l, bit, n); 
			query_counter++; 
		} 
	} 

	// print answer for each query 
	for (int i=0; i<q; i++) 
		cout << ans[i] << endl; 
} 

// driver code 
int main() 
{ 
	int n,q;
	cin >> n >> q;
	int a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i]; 

	Query queries[q];
	
	for(int i = 0; i < q; i++){
		cin >> queries[i].l >> queries[i].r;
		queries[i].l--;
		queries[i].r--;
		queries[i].idx = i; 
	}
	sort(queries, queries+q, cmp); 
	answeringQueries(a, n, queries, q); 
	return 0; 
} 


Measured memory_bytes: 17452