akhauriyash/Code-Regression huggingface dataset:
ll= lambda : list(map(int,input().split()))
testcases=1
# testcases=int(input())
for testcase in range(testcases):
    [n]=ll()
    a=ll()
    a=[0]+a
    dif=0
    for i in range(1,n+1):
        if a[i]!=i:
            dif+=1
    if dif>2:
        print("NO")
    else:
        print("YES")


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 7;
const double pi = acos(-1);
const int mod = 998244353;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
inline int gcd(int a,int b) {
    return b>0 ? gcd(b,a%b):a;
}
int main(){
	int k;
	scanf("%d",&k);
	ll ans = 0;
	for(int i = 1;i <= k;i++){
		for(int j = 1;j <= k;j++){
			for(int l = 1;l <= k;l++){
				int x = gcd(i,gcd(j,l));
				ans += x;
			}
		}
	}
	cout << ans << endl; 
	return 0;
}

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

int main(){
    ll a,b,n;
    cin >> a >> b >> n;
    ll ans;
    if(b>n){
        ans=(a*n)/b;
    }
    else{
        ans=(a*(b-1))/b;
    }
    cout << ans << endl;

}

Measured memory_bytes: 3632
// Doubly Linked List
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct node{
    int key;
    struct node *prev;
    struct node *next;
}Node;

Node* head;

Node* listSearch(int key){
    Node* node = head->next;
    while(node != head && node->key != key){
        node = node->next;
    }
    return node;
}

void init(){
    if((head = (Node*)malloc(sizeof(Node))) == NULL){
        puts("error");
        return;
    }
    head->next = head;
    head->prev = head;
}

void printList(){
    Node* current = head->next;
    int isf = 1;
    while(1){
        if(current == head)break;
        if(isf == 0)printf(" ");
        printf("%d", current->key);
        current = current->next;
        isf = 0;
    }
    puts("");
}

void deleteNode(Node* t){
    if(t == head)return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(head->next);
}

void deleteLast(){
    deleteNode(head->prev);
}

void delete(int key){
    deleteNode(listSearch(key));
}

void insert(int key){
    Node* x;
    if((x = (Node*)malloc(sizeof(Node))) == NULL){
        puts("error");
        return;
    }
    x->key = key;
    x->next = head->next;
    head->next->prev = x;
    head->next = x;
    x->prev = head;
}
 
int main(void){
    int key, n, i;
    char command[20];
    scanf("%d", &n);
    init();
    for(i=0; i<n; i++){
        scanf("%s%d", command, &key);
        if(command[0] == 'i'){
            insert(key);   
        }else if(command[0] == 'd'){
            if(strlen(command) > 6){
                if(command[6] == 'F')deleteFirst();
                else if(command[6] == 'L')deleteLast();
            }else{
                delete(key);
            }
        }
    }
    printList();
    return 0;
}


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

using ll=long long;
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<double> v(n);
    rep(i,n) cin>>v[i];
    
    sort(v.begin(),v.end());
    
    for(int i=1;i<n;i++){
        v[i]=(v[i]+v[i-1])/2;
    }
    
    cout<<v[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 3820
void main(){
	int x, y;
	scanf("%d %d", &x, &y);
	(x + y/2).writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2484
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
int main() {
    ios_base::sync_with_stdio(false);
        ll t,n,ans=0;
        cin>>n;
        ll a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        for(int i=0;i<n;i++)
            for(int j=i+1;j<n;j++)
             for(int k=j+1;k<n;k++)
        {
            if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k])
                if(a[i]+a[j]>a[k]&&a[j]+a[k]>a[i]&&a[i]+a[k]>a[j])
                ans++;
        }
        cout<<ans;

        }


Measured memory_bytes: 3660
#pragma warning(disable:4996)
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<time.h>
#include<iomanip>
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989

using namespace std;
typedef unsigned long long ull;

template<typename T>
double rad(T r) {
	return r * 180 / PI;
}

int main() {
	double a, b, x_;
	cin >> a >> b >> x_;
	double x = x_ / a;
	if (x * 2 / b <= a) {
		cout << setprecision(200) << rad(atan2(b, x * 2 / b))<< endl;
	}
	else {
		double y = x * 2 / a - b;
		cout << setprecision(200) << rad(atan2(b - y, a)) << endl;
	}
}

/*
*/

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

int main()
{
  string o,e;
  cin >> o >> e;
  
  int ne = e.size();
  int no = o.size(); 
  string ans = "";
  for(int i = 0; i < ne; i++){
    ans += o[i];
    ans += e[i];
  }
  if(no != ne){
    ans += o[no-1];
  }
  
  cout << ans << endl;
    
}

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

using ll = long long;
using ull = unsigned long long;

using namespace std;

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

    ll n,cnt=0;
    string s;

    cin>>n>>s;

    size_t found = -1;

    do
    {
        found = s.find("ABC", found+1);
        cnt++;
    }while(found != string::npos);

    cout<<cnt-1<<'\n';

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
int x = sc.nextInt();
int count = 0;
if (n == 0 && x == 0){
break;
}
for (int i = 1;i <= n;i++) {
for (int j = i + 1;j <= n;j++) {
for (int k = j + 1;k <= n;k++) {
if (i + j + k == x) count++;
}
}
}
System.out.printf("%d\n",count);
}
sc.close();
}
}


Measured memory_bytes: 27204
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

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

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	H, W := sc.nextInt(), sc.nextInt()
	N := sc.nextInt()
	A := sc.nextIntSlice(N)
	G := make([][]int, H)
	for i := 0; i < H; i++ {
		G[i] = make([]int, W)
	}
	h, w := 0, 0
	rev := false
	for i := 0; i < N; i++ {
		for j := 0; j < A[i]; j++ {
			G[h][w] = i + 1
			if !rev {
				if w < W-1 {
					w++
				} else {
					h++
					rev = !rev
				}
			} else {
				if w > 0 {
					w--
				} else {
					h++
					rev = !rev
				}
			}
		}
	}
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if j != 0 {
				fmt.Fprint(wtr, " ")
			}
			fmt.Fprint(wtr, G[i][j])
		}
		fmt.Fprintln(wtr)
	}
}


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

#define ll long long
ll A,B;
int ara[100005];
int bs(int val,int mx)
{
    int l=0,r=val;
    while(l<=r)
    {
        int mid=(l+r)/2;
        if(mid*A+(mx-mid)*B>=val)
            r=mid-1;
        else l=mid+1;
    }
    return l;
}
bool possible(int mx,int n)
{
    int rem=mx;
    for(int i=0;i<n;i++)
    {
        rem-=bs(ara[i],mx);
        if(rem<0)return false;
    }
    return true;
}
int main()
{
    int n;cin>>n;
    cin>>A>>B;
    for(int i=0;i<n;i++)cin>>ara[i];
    sort(ara,ara+n);
    int l=(ara[0]+A-1)/A,r=(ara[n-1]+B-1)/B;
//    cout<<l<<" "<<r<<endl;
    while(l<=r)
    {
        int mid=(l+r)/2;
        if(possible(mid,n))
        {
//            cout<<"ok for "<<mid<<endl;
            r=mid-1;
        }
        else l=mid+1;
    }
    cout<<l<<endl;
}
/*

3 5 3
57 57 57

*/


Measured memory_bytes: 640
// E - Sum of gcd of Tuples (Hard)
#include <bits/stdc++.h>

using namespace std;

#define	MOD	1000000007

long long mpow(long long x, long long n)
{
	long long r = 1;
	for ( ; n > 0; x = x * x % MOD, n >>= 1) if (n & 1) r = r * x % MOD;
	return r;
}

int main(int argc, char *argv[])
{
	int n, k;
	cin >> n >> k;
	vector<long long> a(k + 1);

	for (int i = 1; i <= k; i++) a[i] = mpow(k / i, n);

	for (int i = k; i > 0; i--)
		for (int j = i + i; j <= k; j += i)
			a[i] = (a[i] - a[j] + MOD) % MOD;

	long long ans = 0;
	for (int i = 1; i <= k; i++)
		ans = (ans + a[i] * i % MOD) % MOD;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4052
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;



int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
    }

    multiset<int> s(all(a));
    int ans = 0;
    while(!s.empty()) {
        auto it = prev(s.end());
        int y = *it;
        s.erase(it);
        int x = (1 << (32 - __builtin_clz(y))) - y;
        auto it_ = s.find(x);
        if(it_ != s.end()) {
            ++ans;
            s.erase(it_);
        } 
        
    }

    cout << ans << '\n';
}

Measured memory_bytes: 10368
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
using namespace std;
int main() {
	string S;
	cin >> S;
	int acgt[11] = { 0 };

	int now = 0, max = 0;

	for (int i = 0; i <= S.length(); i++) {
		if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
			now++;
			if (max < now)max = now;
		}
		else now = 0;
	}
	cout << max;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
  ll res = 1;
  while(b){
    if(b&1)res = res * x % MOD;
    x = x * x % MOD;
    b>>=1;
  }
  return res;
}

ll modinv(ll x){
  return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
  if(was_output)cout << " ";
  cout << a;
  was_output = true;
}
void outendl(){
  was_output = false;
  cout << endl;
}
ll in(){
  ll res;
  scanf("%lld", &res);
  return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
  for(auto &i:x)is >> i;
  return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
  is >> x.first >> x.second;
  return is;
}

template<class t>
void in(t&x){
  cin >> x;
}

bool func(){
  int n = in();
  vector<ll> line(n);
  cin >> line;

  auto func1 = [](vector<ll> line) -> bool{
                 ll sum = 0;
                 foreach(i,line){
                   sum += i;
                 }
                 return sum&1;
               };
  if(n&1){
    return func1(line);
  }
  ll mins = *min_element(all(line));
  return func1(line) || (mins&1);
}

int main(){
  cout << (func()?"First":"Second") << endl;
  return 0;
}



Measured memory_bytes: 6044
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta (bas + (son-bas)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1e18
#define N 1000005

using namespace std;
 
typedef long long ll;

int a,b;

int main()
{
    cin >> a >> b;

	cout << max(a+b, max(a-b,a*b));

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>




int main(){
	
	int n;
	int a[101];
	char b[100];
	int i;
	int z=0;
	int x=0;
	scanf("%d",&n);
for(i=0;i<n;i++){
	
	
	scanf("%d",&a[i]);
	
	
}
for(i=n-1;i>=0;i--){
	
	printf("%d",a[i]);
	
	
	if(i!=0){
		
		
		
		printf(" ");
	}
	
}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#define MAX_VALUE 10000;
#define min(x,y) (x < y? x : y)

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

int doIt(){
	int input = 0;
	//グラム数を100で割ったもの
	int gram[6] = {2,3,5,10,12,15};
	int yen[6] = {380,550,850,1520,1870,2244};
	int dp[51];
	int i,j;
	for(i = 1; i < 51; i++){
		dp[i] = MAX_VALUE;
	}
	dp[0] = 0;
	for(i = 2; i < 51; i++){
		for(j = 0; j < 6; j++){
			int w = i - gram[j];
			if(w >= 0){
				dp[i] = min(dp[i],dp[w] + yen[j]);
			}
			else{
				break;
			}
		}
	}
	
	
	scanf("%d", &input);
	
	while(input != 0){
		//dpで最安値を求める
		input /= 100;
		printf("%d\n", dp[input]);
		
		
		scanf("%d", &input);
	}
	
	return 0;
}

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

string a;

int main(){
	int left,right;
	cin>>a;
	for(int i=0;i<a.length();i++)
		if(a[i]=='A'){
			left=i;
			break;
		}
	for(int i=a.length()-1;i>=0;i--)
		if(a[i]=='Z'){
			right=i;
			break;
		}
	cout<<right-left+1<<endl;
	return 0; 
} 

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int k[2020],f[2000005],a[2000005],g[2000005];
long long sum;
int main() {
	string s;
	cin>>s;
	int n=s.size();
	for(int i=0;i<n;i++){
		a[i+1]=s[i]-'0';
	}
	int l=1;
	for(int i=n;i>=1;i--){
		g[i]=l;
		l*=10;
		l%=2019;
	}
	for(int i=n;i>=1;i--){
		f[i]=(f[i+1]+a[i]*g[i])%2019;
		k[f[i]]++;
	}
	sum=k[0];
	sum+=(k[0]*(k[0]-1)/2);
	for(int i=1;i<=2018;i++){
		sum+=(k[i]*(k[i]-1)/2);
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 6108
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#define L long long
using namespace std;
int n,m,x[100010],f[10],q,r;
vector<int> a[100010],b[100010];
long long p;
inline void dfs(int i)
{
	int j;
	f[x[i]]++;
	q++;
	for(j=0;j<a[i].size();j++)
	  {
	   r++;
	   if(!x[a[i][j]])
	     {
	      x[a[i][j]]=x[i]%3+1;
	      dfs(a[i][j]);
	     }
	   else if(x[a[i][j]]!=x[i]%3+1)
	     f[0]=1;
	  }
	for(j=0;j<b[i].size();j++)
	  {
	   r++;
	   if(!x[b[i][j]])
	     {
	      x[b[i][j]]=(x[i]+1)%3+1;
	      dfs(b[i][j]);
	     }
	   else if(x[b[i][j]]!=(x[i]+1)%3+1)
	     f[0]=1;
	  }
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;i++)
	  {
	   scanf("%d%d",&j,&k);
	   a[j].push_back(k);
	   b[k].push_back(j);
	  }
	for(i=1;i<=n;i++)
	  if(!x[i])
	    {
	     for(j=0;j<=3;j++)
	       f[j]=0;
	     q=r=0;
	     x[i]=1;
	     dfs(i);
	     if(f[0])
	       p+=(L)q*q;
	     else if(f[1] && f[2] && f[3])
	       p+=(L)f[1]*f[2]+(L)f[2]*f[3]+(L)f[3]*f[1];
	     else
	       p+=r/2;
	    }
	printf("%lld\n",p);
	return 0;
}


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

int main(){
int n;
cin>>n;
int b[n+4];
REP(i,n-1){
  cin>>b[i];
}
int a[n];
b[n-1]=1000000;
for (int i = 1; i < n-1; i++)
{
  a[i]=min(b[i],b[i-1]);
  
}
a[0]=b[0];
a[n-1]=b[n-2];
int ans=0;
REP(i,n){
ans+=a[i];
}
cout<<ans<<endl;




}

Measured memory_bytes: 256
var lines = []; var result = Infinity;
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
})

rl.on('close', function () {
    var N = Number(lines[0]);
    lines.shift();

    var p = lines.map(value => Number(value));

    p.sort((a, b) => b - a);

    result = Math.floor(p[0] / 2);

    for (var i = 1; i < N; i++){
        result += p[i];
    }
    console.log(result);
});


Measured memory_bytes: 7628
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int sum = 0;
  int max = 0;
  int p;
  for (int i = 0; i < N; i++) {
    cin >> p;
    sum += p;
    if (max < p) max = p;
  }
  cout << sum - max / 2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#define rep(i,n) for(int i=0;i<=(n);i++)
using namespace std;

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

  int yyyy = stoi(s.substr(0,4));
  int mm = stoi(s.substr(5,2));
  int dd = stoi(s.substr(8,2));

  string heisei = "Heisei";
  string tbd = "TBD";

  if ( yyyy < 2019){
    cout << heisei << endl;
  } else if ( yyyy > 2019){
    cout << tbd << endl;
  } else if ( yyyy == 2019 ){
    if ( 1 <= mm && mm <= 3 ){
      cout << heisei << endl;
    } else if ( mm > 4){
      cout << tbd << endl;
    } else if( mm == 4 ){
      if( 1 <= dd && dd <= 30){
        cout << heisei << endl;
      }else if( 30 < dd && dd <= 31){
        cout << tbd << endl;
      }
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n;
    int c[20], v[20];
    int ans=0;
    
    cin >> n;
    for(int i=0;i < n; i++){
        cin >> c[i];
    }
    for(int i=0;i < n; i++){
        cin >> v[i];
        if(c[i]>v[i])ans += c[i]-v[i];
    }
    
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
/*
By Tianyi Chen. All rights reserved.
Date: 2017-01-28
*/
#include<bits/stdc++.h>
using namespace std;
int64_t x,ans;
int main() {
 cin>>x;
 ans=x/11*2;
 x%=11;
 if(x)++ans;
 if(x>6)++ans;
 cout<<ans;
}

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

int main(){
	
	int n;

	int P[150][150]={};
	while(1){
	for(int i=1;i<=140;i++)
		for(int j=1;j<=140;j++)
		{
			P[j][i]=0;
		}

	cin>>n;if(n==0)break;
	int A,B;
	cin>>A>>B;

	
	
	for(int i=0;i<n;i++){
		int x;cin>>x;int y;cin>>y;
		P[x][y]=1;
	}
	
	//int PP[505][505]={};
	
	for(int i=1;i<=B;i++)
		for(int j=2;j<=A;j++)
		{
			P[j][i]+=P[j-1][i];
		}
	/*	
	for(int i=1;i<=B;i++){cout<<endl;
		for(int j=1;j<=A;j++)
		{
			cout<<P[j][i];
		}}
		*/


	int a,b;
	cin>>a>>b;
	int max=0;/*
	for(int i=1;i<=B;i++){cout<<endl;
		for(int j=1;j<=A;j++)
		{int S=0;//cout<<endl;
		for(int I=i;I<=i+b&&I<=B;I++){
			
			int SS=0;
			for(int J=j;J<=J+a&&J<=A;J++)
				SS+=P[J][I];
			if(SS>max)max=SS;
			cout<<SS;
		}
		}
	}*/
	for(int i=1;i<=B;i++){//cout<<endl;
		for(int j=1;j<=A;j++)
		{int SS=0;
			for(int I=i;I<=B&&I<i+b;I++)
			{if(j+a<=A)SS+=P[j+a-1][I];
			else SS+=P[A][I];
			SS-=P[j-1][I];
			}
			if(SS>max)max=SS;
			//cout<<SS;
	}
	}
	
		
	cout<<max<<endl;
	}
	return 0;
}
				

Measured memory_bytes: 1256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def main():
    s = input()
    l = len(s)
    if s[0] == s[-1]:
        if l%2 == 0:
            return 'First'
        return 'Second'
    if l%2 == 1:
        return 'First'
    return 'Second'



print(main())


Measured memory_bytes: 7840
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


# globals
N = 0
S = ""


def set_inputs():
    global N, S
    N = get_int()
    S = get_str()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    turn_e = [0] + list(itertools.accumulate([s == "W" for s in S[:-1]]))
    turn_w = list(reversed(list(itertools.accumulate(
        [s == "E" for s in reversed(S[1:])]
    )))) + [0]
    print(min(e + w for e, w in zip(turn_e, turn_w)))
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


if __name__ == '__main__':
    main()


Measured memory_bytes: 32280
import itertools
N = int(input())
L = list(map(int, input().split()))
ans = 0
for a, b, c in itertools.combinations(L, 3):
  if a+b>c and b+c>a and c+a>b and len(set([a, b, c]))==3:
    ans += 1
print(ans)

Measured memory_bytes: 73680
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 500005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

map< int, int > mp;

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

    int n;
    cin >> n;
    int a[SIZE];
    vector< int > v;
    for( int i = 0; i < n; ++i ) {
        cin >> a[i];
        v.pb( a[i] );
        mp[a[i]] = i;

    }
    
    sort( all( v ) );
    int res = 0;
    for( int i = 0; i < n; ++i ) {
        if( abs( i - mp[v[i]] ) % 2 == 1 ) {
            ++res;

        }
    }
    cout << res / 2 + res % 2 << endl;
    return 0;
}



Measured memory_bytes: 5752
import string

def get_input():
  while True:
    try:
      line = input()
      if line == '':
        break
      else:
        yield line
    except EOFError:
      break

ans = []
sentence_list = list(get_input())
sentence = "".join(sentence_list).lower()

alphabet = list(string.ascii_lowercase)
for i in alphabet:
  ans.append(sentence.count(i))
for j, k in zip(alphabet, ans):
  print("{} : {}".format(j, k))


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

int main(){
  string s;
  cin >> s;
  int ans = 700;
  if(s[0] == 'o'){
    ans += 100;
  }
  if(s[1] == 'o'){
    ans += 100;
  }
  if(s[2] == 'o'){
    ans += 100;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll X, N;
    cin >> X >> N;
    vector<ll> p(N);
    rep(i, N) cin >> p.at(i);
    set<ll> P;
    rep(i, N){
      P.insert(p.at(i));
    }
    if(!P.count(X)){
      cout << X << endl;
      return 0;
    }
    ll i = 1;
    while(true){
      if(!P.count(X-i)){
        cout << X-i << endl;
        return 0;
      }
      if(!P.count(X+i)){
        cout << X+i << endl;
        return 0;
      }
      i++;
    }
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
//#define ll long long int32_t 
//#define int long long int
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
using namespace std;
const double PI = atan(1.0)*4;
const int64_t INF=20000000000003;
const int32_t LOG=21;
const int MOD=MOD1;
int a[200005];
int ans[200005];
vector<int> v[200005];
int cnt[2];
void dfs(int i,int prev,int color)
{
	 a[i]=color;
	 cnt[color]++;
	 rep(j,0,v[i].size())
	 {
	 	if(v[i][j]!=prev)
	 	dfs(v[i][j],i,1-color);	
	 }
}
int32_t main()
{ 
	  getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {
           int n;
           cin>>n;
           rep(i,0,n-1)
           {
           	  int x,y;
           	  cin>>x>>y;
           	  v[x].push_back(y);
           	  v[y].push_back(x);
           }
           dfs(1,-1,0);

           if(cnt[0]>cnt[1])
           {
           	   swap(cnt[0],cnt[1]);
           	   rep(i,1,n+1)a[i]=1-a[i];
           } 

           set<int> s;
           rep(i,1,n+1)s.insert(i);
           int cur=3;
           int tot=n/3;
           if(cnt[0]<=tot)
           {
           	   rep(i,1,n+1)
           	   {
           	   	   if(!a[i])
           	   	   {
           	   	   	   ans[i]=cur;
           	   	   	   s.erase(cur);
           	   	   	   cur+=3;
           	   	   }	
           	   }
           	   rep(i,1,n+1)
           	   {
           	   	   if(a[i])
           	   	   {
           	   	   	   ans[i]=*s.begin();
           	   	   	   s.erase(s.begin());
           	   	   }	
           	   }
           }
           else
           {
           	    cur=1;
           	    int cur1=3;
           	    rep(i,1,n+1)
           	    {
           	    	 if(!a[i] && cur<=n)
           	    	 {
           	    	 	 ans[i]=cur;
           	    	 	 s.erase(cur);
           	    	 	 cur+=3;
           	    	 }
           	    	 else if(!a[i])
           	    	 {
           	    	 	ans[i]=cur1;
           	    	 	s.erase(cur1);
           	    	 	cur1+=3;
           	    	 }	
           	    }
           	    rep(i,1,n+1)
           	    {
                     if(a[i])
                     {
                     	 ans[i]=*s.begin();
                     	 s.erase(s.begin());
                     }        
           	    }
           }
           rep(i,1,n+1)cout<<ans[i]<<" ";
           cout<<endl;	
      }
      return 0;     
}


Measured memory_bytes: 28800
import java.util.Scanner

object Main {

  def check2(num: Int, input: Array[Array[Int]]): Int = {
    var ret = 0
    for (j <- 0 until input(0).length) {
      var N = 0
      for (i <- 0 until input.length) {
        if ((num >> i) % 2 == 1) {
          N += 1 - input(i)(j)
        } else {
          N += input(i)(j)
        }
      }
      ret += math.max(N, input.length - N)
    }
    ret
  }

  def make(input: Array[Array[Int]]): Int = {
    var max: Int = 0
    for (i <- 0 to (1 << (input.length - 2))) {
      max = math.max(max, check2(i, input))
    }
    max
  }

  def solve(sc: Scanner): Boolean = {
    val R: Int = sc.nextInt
    val C: Int = sc.nextInt
    if (R != 0 && C != 0) {
      println(make(Array.fill(R)(Array.fill(C)(sc.nextInt))))

      true
    } else {
      false
    }
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    while (solve(sc)) ()
  }
}

Measured memory_bytes: 166280
#include <bits/stdc++.h>
#define INF 1e7
#define mod 1000000007

using namespace std;
typedef long long int ll;
typedef tuple<int,int,int> tii;
typedef tuple<long long int,long long int,long long int> tll;
typedef tuple<double,double,double> tdd;


int main()
{
    ll N; cin >> N;
    vector<ll>A(N+1); 
    for(int i = 0; i <= N; i++) A[i] = 0;
    A[0] = 3;
    ll ans = 1;
    for(int i = 0; i < N; i++)
    {
        ll a; cin >> a;
        ans *= A[a];
        ans %= mod;
        A[a]--;
        A[a+1]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4052
w,h,n=map(int,input().split())
wl=hl=0
for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        wl=max(wl,x)
    elif a==2:
        w=min(w,x)
    elif a==3:
        hl=max(hl,y)
    else:
        h=min(h,y)
print(max(0,(h-hl))*max(0,(w-wl)))

Measured memory_bytes: 3064
# coding: utf-8

data_set = input()
while(data_set > 0):
    a = 0
    b = 0
    for i in range(data_set):
        num = map(int, raw_input().split())
        if num[0] > num[1]:
            a = a + sum(num)
        elif num[0] < num[1]:
            b = b + sum(num)
        else:
            a = a + num[0]
            b = b + num[1]
    print a,b
    data_set = input()

Measured memory_bytes: 4828
import math
A, B, H, M = map(float,input().split())

p = M*2*math.pi/60
q = H/12*2*math.pi + p/12
Mx = B*math.sin(p)
My = B*math.cos(p)
Hx = A*math.sin(q)
Hy = A*math.cos(q)
L = math.sqrt((Mx-Hx)**2 + (My-Hy)**2)
print(L)

Measured memory_bytes: 9448
#include<iostream>
#include<iomanip>
#include<stdio.h>

using namespace std;

int main()
{
    int r,c,sum,all=0;
    cin >> r >> c;
    int a[r+1][c+1];
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin >> a[i][j];
        }
    }
    for(int i=0;i<r;i++){
        sum = 0;
        for(int j=0;j<c;j++){
            sum += a[i][j];
        }
        a[i][c] = sum;
        all += sum;
    }
    for(int i=0;i<c;i++){
        sum = 0;
        for(int j=0;j<r;j++){
            sum += a[j][i];
        }
        a[r][i] = sum;
    }
    a[r][c] = all;
    for(int i = 0;i <= r;i++){
        for(int j = 0;j <= c;j++){
            if(j) cout << " ";
            cout  << a[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3136
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{
    class Program
    {
        static void Main(string[] args)
        {
            var md = Console.ReadLine().Split(' ');
            var m = int.Parse(md[0]);
            var d = int.Parse(md[1]);
            var count = 0;
            for(int i = 1; i <= m; i++)
            {
                for(int j = 1; j <= d; j++)
                {
                    var d1 = j % 10;
                    var d2 = j / 10;
                    if( d1>=2 && d2>=2 && d1*d2 == i)
                    {
                        count++;
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    ll a[100010];
    cin>>n>>m;
    for(int i=0;i<n;i++) cin>>a[i];
    vector<pair<ll,int>> p;
    vector<ll> d;
    int b;
    ll c;
    for(int i=0;i<m;i++){
        cin>>b>>c;
        p.push_back(make_pair(c, b));
    }
    
    sort(a,a+n);
    sort(p.begin(),p.end(),greater<>());
    int k=0;
    while(d.size()<n){
        if (k<m) {
            c = p.at(k).first;
            b = p.at(k).second;
            for(int j=0;j<b;j++) d.push_back(c);
        } else {
            while(d.size()<n) d.push_back(0);
        }
        k++;
    }
    ll ans=0;
    for(int i=0;i<n;i++) {
        if(d.at(i)>a[i]) ans+=d.at(i);
        else ans+=a[i];
    }
    
    cout<<ans<<endl;
}

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

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

const int N = 1e1 + 5, M = 1e3 + 5;

int A[M], B[M], DP[1 << N];

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n, m; cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int t; cin >> A[i] >> t;
		while (t--) {
			int x; cin >> x; x--;
			B[i] |= (1 << x);
		}
	}
	memset(DP, 63, sizeof DP);
	DP[0] = 0;
	for (int mask = 0; mask < (1 << n); mask++) for (int i = 0; i < m; i++) DP[mask | B[i]] = min(DP[mask | B[i]], DP[mask] + A[i]);
	if (DP[(1 << n) - 1] == DP[(1 << N) - 1]) cout << -1 << endl;
	else cout << DP[(1 << n) - 1] << endl;

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    cin >> S;
    int N = S.size(), ans = 0;
    for (int i = 0; i < N / 2; i++) {
        if (S[i] != S[N - i - 1]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a;
  cin>>a;
  vector<int> b(a);
  fo(i,a)
    cin>>b[i];
  long long c;
  fo(i,a-1){
    if(b[i]<0){
      b[i]=-1*b[i];
      b[i+1]=-1*b[i+1];
    }
    c+=b[i];
  }
   c+=abs(b[a-1]);
  if(b[a-1]<0){
    b[a-1]=-1*b[a-1];
    Sort(b);
    c-=b[0]*2;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
P r[105],b[105];
bool R[105];
int ans;
int mr2;
int main(void){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>r[i].first>>r[i].second;
	}
	for(int i=0;i<n;i++){
		cin>>b[i].first>>b[i].second;
	}
	sort(r,r+n); sort(b,b+n);
	for(int i=0;i<n;i++){
		int j=0;
		mr2=-1;
		int l=-1;
		while(b[i].first>r[j].first&&j<n){
			j++;
		}
		for(int k=0;k<j;k++){
			if(b[i].second>r[k].second&&r[k].second>mr2&&R[k]==false){
				mr2=r[k].second;
				l=k;
			}
		}
		if(l!=-1){
			R[l]=true;
			ans++;
			//cout<<"h"<<endl;
		}
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
    int n,win=0;cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(a[i]%2==1)win=1;
    }
    if(win)cout << "first" << endl;
    else cout << "second" << endl;
    return 0;
}


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

using namespace std;

int main(int argc, char const *argv[])
{
    const int num[10] = {10001, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    int n, m; cin >> n >> m;

    bool a[10] = {0};
    for(int i=0,_;i<m;++i) {
        cin >> _;
        a[_] = true;
    }

    vector<int> dp(n+1);
    dp[0] = 0;
    for(int i=1;i<=n;++i) {
        dp[i] = -1000000000;
        for(int j=1;j<10;++j) {
            if (!a[j]) continue;
            if (i-num[j]<0) continue;
            dp[i] = max(dp[i], dp[i-num[j]]+1);
        }
    }

    while(n>0) {
        for(int j=9;j>0;--j) {
            if(!a[j]) continue;
            if(n-num[j]>=0 && dp[n-num[j]] == dp[n]-1) {
                cout << j;
                n -= num[j];
                break;
            }
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
i = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[i-1])

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

int W;
const int MAX_W = 101;
int hei[MAX_W];

void init() {
  fill(hei, hei+MAX_W, -1);
}


void show() {
  for(int i = 0; i < W; ++i)
    cout << hei[i] << " ";
  cout << endl;
}

void sleep(int id, int w) {
  for(int i = 0; i < W; ++i) {
    for(int j = 0; j < w && i+j < W; ++j) {
      if(hei[i+j] != -1) break;
      if(j+1 == w) {
	fill(hei+i,hei+i+w,id);
	cout << i << endl;
	return;
      }
    }
  }
  cout << "impossible" << endl;
}

void wakeup(int id) {
  for(int i = 0; i < W; ++i) {
    if(hei[i] == id) {
      while(hei[i] == id) {
	hei[i++] = -1;
      }
      return;
    }
  }
}

int main() {
  int Q;
  while(cin >> W >> Q && (W|Q)) {
    init();
    while(Q--) {
      char c;
      int id, w;
      cin >> c;
      switch(c) {
      case 's':
	cin >> id >> w;
	sleep(id,w);
	break;
      case 'w':
	cin >> id;
	wakeup(id);
	break;
      }
    }
    cout << "END" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans = 0
k = int(input())
for i in range(1,k+1):
    for j in range(i,k+1):
        for p in range(j,k+1):
            if (i!=j) and (j!=p) and (i!=p):
                #print(i,j,p, 'pattern3')
                ans += gcd(i,j,p) * 6
            elif (i==j) and (j==p):
                #print(i,j,p, 'pattern1')
                ans += gcd(i,j,p)
            else:
                #elif (i==j) or (j==k) or (i==k):
                #print(i,j,p, 'pattern2')
                ans += gcd(i,j,p) * 3

print(ans)

Measured memory_bytes: 69740
mod = 10**9+7
def prime_decomposition(n):
  i = 2
  d = {}
  while i * i <= n:
    while n % i == 0:
      n //= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d
N,M = map(int,input().split())

fact = [1]*(10**6+1)
for n in range(1,10**6+1):
    fact[n] = n*fact[n-1]%mod

d = prime_decomposition(M)

ans = 1
for k in d:
    m = d[k]
    ans *= fact[N+m-1]*pow(fact[m],mod-2,mod)*pow(fact[N-1],mod-2,mod)
    ans %= mod

print(ans)

Measured memory_bytes: 42612
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    int c = 0;
    rep(i, 3){
        if (s[i] == t[i]) c++;
    }
    println(c)
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> vec(n);
  for(int i=0;i<n;i++) cin>>vec[i];
  int dp[n+1];
  dp[0]=0;
  dp[1]=0;
  
  for(int j=2;j<=n;j++)
  {
    if(j>2)
  dp[j]=min(dp[j-1]+abs(vec[j-1]-vec[j-2]),dp[j-2]+abs(vec[j-1]-vec[j-3]));
    else dp[j]=dp[j-1]+abs(vec[j-1]-vec[j-2]);
  }
  cout<<dp[n]<<endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,k;
pii ps[52];
map<int,int> y2x;
vi ys;

int main(){
  scanf("%d%d",&n,&k);
  REP(i,n){
    int x,y;
    scanf("%d%d",&x,&y);
    ps[i] = pii(x,y);
    ys.push_back(y);
    y2x[y] = x;
  }
  sort(ALL(ys));
  sort(ps,ps+n);
  ll ans = 4ll * 1000000000ll * 1000000000ll;
  REP(u,n){
    vi xs;
    FOR(d,u,n){
      xs.push_back(y2x[ys[d]]);
      if(xs.size()>=k){
        sort(ALL(xs));
        ll height = ys[d] - ys[u];
        REP(i,xs.size()-k+1){
          ll width = xs[i+k-1] - xs[i];
          CHMIN(ans, height*width);
        }
      }
    }
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

using namespace std;
template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const int MAXN = (1 << 10);

int n, m;
vector<int> adj[MAXN];
vector<int> nadj[MAXN];

void read()
{
	cin >> n >> m;
	for(int i = 0; i < m; i++)
	{
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
}

int col[MAXN], C, cnt;

void dfs(int u, int c)
{
	if(col[u] != -1 && col[u] != c)
	{
		cout << -1 << endl;
		exit(0);
	}
	else if(col[u] != -1) return;

	C += c;
	cnt++;

	col[u] = c;
	for(int v: nadj[u])
		dfs(v, c ^ 1);
}

bitset<MAXN> bs;

void solve()
{
	for(int i = 1; i <= n; i++) 
	{
		sort(adj[i].begin(), adj[i].end());
		for(int j = 1; j <= n; j++)
			if(j != i && (lower_bound(adj[i].begin(), adj[i].end(), j) == adj[i].end() || *lower_bound(adj[i].begin(), adj[i].end(), j) != j))
				nadj[i].push_back(j);
	}

	bs[0] = 1;
	memset(col, -1, sizeof(col));
	for(int i = 1; i <= n; i++)
		if(col[i] == -1)
		{
			C = cnt = 0;
			dfs(i, 1);
			bs = (bs << C) | (bs << (cnt - C));
		}

	int answer = n * n;
	for(int cnt1 = 0; cnt1 <= n; cnt1++)
		if(bs[cnt1]) chkmin(answer, cnt1 * (cnt1 - 1) / 2 + (n - cnt1) * (n - cnt1 - 1) / 2);

	cout << answer << endl;
}

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

	read();
	solve();
	return 0;
}



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

int main(){
    ll n,k;
    cin>>n>>k;
    double num[n];
    for (ll i=0; i<n; i++){
        double p;
        cin>>p;
        num[i]=(p+1)/2;
    }
    
    double sum_data[n+1];
    sum_data[0]=num[0];
    for (ll i=1; i<n; i++){
        sum_data[i]=sum_data[i-1]+num[i];
    }
    
    vector<double> data;
    data.push_back(sum_data[k-1]);
    for (ll i=k; i<n; i++){
        double p=0;
        p=sum_data[i]-sum_data[i-k];
        data.push_back(p);
    }
    
    sort(data.begin(),data.end());
    
    cout<<fixed<<setprecision(50)<<data.back()<<endl;
}

Measured memory_bytes: 5492
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int main(){
	ll n;
	scanf("%lld",&n);n++;
	vector<int>v;
	while(n>=2){
		if(n%2==0)
			v.pb(1),n/=2;
		else
			v.pb(2),n--;
	}reverse(all(v));
	deque<int>d;
	for(int i=0;i<int(v.size());i++){
		if(v[i]==1)
			d.pb(i+1);
		else
			d.push_front(i+1);
	}
	printf("%d\n",2*int(d.size()));
	for(int i=0;i<int(d.size());i++)
		printf("%d ",d[i]);
	for(int i=0;i<int(d.size());i++)
		printf("%d ",i+1);
	puts("");	
	return 0;
}


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

int main()
{
    int N;
    int answer = 0;
    vector<int> a;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    sort(a.begin(), a.end(), greater<int>());
    for (int i = 0; i < N; i++)
    {
        answer += a[i] * (i & 1 ? -1 : 1);
    }

    cout << answer << endl;
}

Measured memory_bytes: 256