akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

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

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

#define rep(i,n) for(auto i=0; i<(n); i++)

const int mod = 1000000007;

int xCnt[100005];
char xChar[100005];

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

  long n;
  cin >> n;

  vector<long> a(n);
  fillLong(a, n);

  sortv(a);
  long mxv = a[n-1];

  long b1 = lbv(a, (mxv+1)/2);
  if (b1 == n-1 || abs((mxv+1)/2-a[b1]) > abs((mxv+1)/2-a[b1-1])) {
    cout << mxv << " " << a[b1-1] << endl;
  } else {
    cout << mxv << " " << a[b1] << endl;
  }
}


Measured memory_bytes: 1024
package main

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

func main() {
	var n, x int
	fmt.Scan(&n, &x)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

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

	ans := 0
	d := 0
	for i := 1; i < n+1; i++{
		d = d + l[i-1]
		if x < d {
			ans = i
			break
		}
		if i == n {
			ans = n+1
			break
		}
	}
	fmt.Println(ans)
}



Measured memory_bytes: 1848
#pragma GCC optimize(3,"Ofast","inline")
#define R register
#include<iostream>
#include<set>
#include<cstring>
std::multiset <std::string> M;
std::multiset <std::string> :: iterator del;
int X,Y,Z;
int main(void){
	std::cin>>X>>Y>>Z;
	for(R int i=X;i>0;i--)
		M.insert("a");
	for(R int i=Y;i>0;i--)
		M.insert("b");
	for(R int i=Z;i>0;i--)
		M.insert("c");
	while(M.size()>=2){
		std::string start=*M.begin(),ending=*M.rbegin();
		del=M.lower_bound(start);
		M.erase(del);
		del=M.lower_bound(ending);
		M.erase(del);
		M.insert(start+ending);
	}
	std::cout<<*M.begin()<<std::endl;
	return 0;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  int c = b - a;
  int x = 0;
  for(int i = 1; i <= c; i++) {
    x += i;
  }
  cout << x - b << endl;
  return 0;
}


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

int main(){
  int n,i,sum;
  sum=0;
  cin >> n;
  vector<int> v(n);
  vector<int> c(n);
  vector<int> vc(n);
  for(i=0;i<n;++i){
    cin >> v[i];
  }
  for(i=0;i<n;++i){
    cin >> c[i];
  }
  for(i=0;i<n;++i){
    vc[i]=v[i]-c[i];
    if(vc[i]>0){
      sum=sum+vc[i];
    }
  }
  cout << sum << endl;
  return 0;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

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

int main() {
	int N, M;

	cin >> N >> M;
	vector<int> SW(N);

	for (size_t i=0; i<M; i++) {
		int K = 0;
		cin >> K;
		for (size_t j=0; j<K; j++) {
			int sw_id = 0;
			cin >> sw_id;  //Kに続くsに相当
			sw_id--;
			SW.at(sw_id) = SW.at(sw_id) | (1 << i);
          //電球(SW)にスイッチ（sw_id番目）と連結しているところ
		}
	}
	int P=0;
	for(size_t i=0; i<M; i++) {
		int x;
		cin >> x;
		P |= x << i;//Pという一つの数に変換し、格納
	}

	int total = 0;
	for (size_t s=0; s<(1<<N);s++) {  //(1<<N)でスイッチのパターン全列挙
		int t = 0;
		for (size_t i=0; i<N; i++) {
			if ((s >> i) & 1) {  //sでのi番目の電球が立っているか、一桁ずつ見ていく
				t = t ^ SW.at(i);
              //i番目電球がついているかどうか（ifの条件が成立しているかどうか）を確認して
              //i番目電球が点灯する条件（SW[i]）と答えを照らし合わせる
              //イメージとしてXORは繰り上がらない足し算
              //（点いた状態が重複する→点かない状態になる）
			}
		}
		if (t == P) {  //tが条件に一致するかみる
			total++;
		}
	}

	cout << total << endl;

}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int n) {

    bool isValid(long m) {
        const b357 = (1 << 3) | (1 << 5) | (1 << 7);
        int b = 0;
        while (m > 0) {
            b |= (1 << (m % 10));
            m /= 10;
        }
        return (b & b357) == b357;
    }

    auto stack = DList!long(0);
    int ans = 0;
    while (!stack.empty) {
        long x = stack.back;
        stack.removeBack();
        if (x > n) continue;

        if (isValid(x)) ans++;

        stack.insertBack(10 * x + 3);
        stack.insertBack(10 * x + 5);
        stack.insertBack(10 * x + 7);
    }
    return ans;
}

void main() {
    int n = readint;
    writeln(calc(n));
}


Measured memory_bytes: 1276
using System;
class Program{
	static void Main(){
		const int mod=1000000007;
		long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long a=1,b=1;
		if(Math.Abs(s[0]-s[1])>1){Console.WriteLine("{0}",0);}
		else{
			for(int i=2;i<=s[0];i++){a=(a*i)%mod;}
			for(int i=2;i<=s[1];i++){b=(b*i)%mod;}
			if(Math.Abs(a-b)==0){a*=2;}
			Console.WriteLine("{0}",(a*b)%mod);
		}
	}
}

Measured memory_bytes: 13268
#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int n,l,L[n],ams,low,i;
	ams=0;
	low=101;
scanf("%d%d",&n,&l);
for(i=0;i<n;i++){
	L[i]=l+i;
	ams+=L[i];
	if(L[i]>0&&L[i]<low){low=L[i];}
	if(L[i]<0&&abs(L[i])<abs(low)){low=L[i];}
	if(L[i]==0){low=L[i];}
}
ams-=low;
printf("%d",ams);
	// your code goes here
	return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String S=sc.next();
        
        if(S.charAt(0)=='7'||S.charAt(1)=='7'||S.charAt(2)=='7'){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 35760
from collections import Counter

N, M = map(int, input().split())
tree = []
for _ in range(M):
    a, b = map(int, input().split())
    tree.append(a)
    tree.append(b)

dic = Counter(tree)

f = 1
for v in dic.values():
    if v%2:
        f = 0
        break

if f:
    print("YES")
else:
    print("NO")


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')

typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int len = s.size();
    int cnt = 1;
    for (int i = 1; i < len; i++)
    {
        if (s[i] == s[i - 1])
            continue;
        cnt++;
    }
    cout << cnt << "\n";
    return 0;
}

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

int main(){
    int n,b,f,r,v; 
    int house[4][3][10];
    
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++){
                house[i][j][k] = 0;
            }
        }
    }
    
    cin >> n;
    for (int x = 0 ; x < n; x++) {
        cin >> b >> f >> r >> v;
        
        house[b-1][f-1][r-1] += v;
        
    }  
    
    for (int i = 0; i < 4; i++) {
        if(i > 0) cout << "####################\n";
        for (int b = 0; b < 3; b++) {
            for (int r = 0; r < 10; r++){
                cout << " " << house[i][b][r];
            }
            cout << endl;
        }
        
    }
    
   
    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll LINF = 6e18;

ll c2, c3, c5, c1;
map<ll, ll> mp;

ll dfs(ll n) {
  if (!mp.count(n)) {
    if (n == 0) {
      mp[n] = 0;
    } else if (n == 1) {
      mp[n] = c1;
    } else {
      ll res = LINF;
      if (n <= res / c1) res = min(res, c1 * n);
      res = min(res, dfs(n / 2) + c2 + c1 * (n % 2));
      res = min(res, dfs(n / 3) + c3 + c1 * (n % 3));
      res = min(res, dfs(n / 5) + c5 + c1 * (n % 5));
      if (n > 2) res = min(res, dfs(1 + n / 2) + c2 + c1 * (2 - (n % 2)));
      res = min(res, dfs(1 + n / 3) + c3 + c1 * (3 - (n % 3)));
      res = min(res, dfs(1 + n / 5) + c5 + c1 * (5 - (n % 5)));
      mp[n] = res;
    }
  }
  return mp[n];
}

int main(){
  int T;
  cin >> T;
  while (T--) {
    mp = {};
    ll n;
    cin >> n;
    cin >> c2 >> c3 >> c5 >> c1;
    ll ans = dfs(n);
    cout << ans << endl;
  }
}

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

namespace ConsoleApp5
{
	public struct Circle
	{
		public Circle(int x, int y, int r)
		{
			X = x;
			Y = y;
			R = r;
		}

		public int X;
		public int Y;
		public int R;

		public bool CheckX(int width)
		{
			var left = X - R;
			var right = X + R;

			return (left >= 0 && left <= width) && (right >= 0 && right <= width);
		}

		public bool CheckY(int height)
		{
			var top = Y + R;
			var bottom = Y - R;

			return (top >= 0 && top <= height) && (bottom >= 0 && bottom <= height);
		}

		public string Check(int width, int height)
		{
			return CheckX(width) && CheckY(height) ? "Yes" : "No";
		}
	}
	

	class Program
	{
		static void Main(string[] args)
		{
			var parameter = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

			var c = new Circle(parameter[2], parameter[3], parameter[4]);
			Console.WriteLine(c.Check(parameter[0], parameter[1]));
		}
	}
}



Measured memory_bytes: 9368
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  auto calc = [&](int k) {
    int s = 0;
    rep(i,N) {
      s += (k-A[i])*(k-A[i]);
    }
    return s;
  };
  int ans = INF;
  srep(i,-110,110) {
    chmin(ans,calc(i));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong();
        String a = "";
        long counter = 0;
        while(n>0){
            counter= (n-1)%26;
            char a1 = (char)('a'+counter);
            a=a1+a;
            n = (n-1)/26;
        }
        System.out.println(a);
    }
}


Measured memory_bytes: 39500
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  int N;
  cin >> N;

  vector<int> a(N);
  REP(i, N) cin >> a[i];

  int ans = 0;
  int cnt = 1;
  REP(i, N){
    if(a[i] == cnt){
      cnt++;
    }else{
      ans++;
    }
  }

  if(ans >= N) ans = -1;
  if(N == 1 && a[0] == 1) ans = 0;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(void){
    int a,b,c,i,count=0;

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

    for(i=a;i<b+1;i++){
        if(c%i==0) count++;
    }

    printf("%d\n",count);

    return 0;
}


Measured memory_bytes: 2104
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>

using namespace std;

struct Node{
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int kiki){

	Node *a=root;
	Node *b=NIL;
	Node *c;


	c=(Node *)malloc(sizeof(Node));

	c->key=kiki;
	c->left=NIL;
	c->right=NIL;

	while(a!=NIL){
		b=a;

		if(c->key < a->key){
			a=a->left;
		}
		else{
			a=a->right;
		}
	}


	c->parent=b;

	if(b==NIL){
		root=c;
	}
	else{
		if(c->key<b->key){
			b->left=c;
		}
		else{
			b->right=c;
		}
	}
}

void nanigashi(Node *g){

	if(g==NIL)
		return;

	nanigashi(g->left);
	printf(" %d",g->key);
	nanigashi(g->right);

}


void samura(Node *g){

	if(g==NIL)
		return;

	printf(" %d",g->key);
	samura(g->left);
	samura(g->right);

}

int main(){

	int n,s,i;
	string momo;

	scanf("%d",&n);

	for(i=0;i<n;i++){
		cin>>momo;
		if(momo=="insert"){

			scanf("%d",&s);

			insert(s);
		}
		else if(momo=="print"){

			nanigashi(root);

			printf("\n");

			samura(root);

			printf("\n");
		}
	}

	return 0;
}


Measured memory_bytes: 26756
#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<sstream>
#include<fstream>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iomanip>
using namespace std;
/*freopen{"input.txt","r",stdin};
freopen{"output.txt","w",stdout};*/
#define mp make_pair
#define pb push_back
const int INF=1000*1000*1000;
const int maxn=2e5; 
typedef long long ll;
typedef long double ld;
typedef pair<int,int>PII;
//priority_queue <int,vector<int>,greater<int> > q1;  //从小到大 
//priority_queue <int,vector<int>,less<int> >q2;  //从大到小 

//set multiset vector queue priority_queue map multimap pair string structure 

//枚举 思维 贪心 搜索 模拟 预处理 二分 排序 
struct node{
	int x,y;
}a[51]; 
bool cmp(struct node p,struct node q){
	if(p.x!=q.x) return p.x<q.x;
	return p.y<q.y;
}
int main(){
	//ios_base::sync_with_stdio(0);
    //cin.tie(0);
    //cout.tie(0);
    int n;
    cin>>n;
    if(n==1){
    	cout<<1;
    	return 0;
	}
    map<PII,int>m;
	for(int i=1;i<=n;i++){
		cin>>a[i].x>>a[i].y;
		m[mp(a[i].x,a[i].y)]=1;
	}
	int ans=INF;
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
	    if(i==j) continue;
		int x1=a[j].x-a[i].x;
		int y1=a[j].y-a[i].y;
        int tmp=n;
        for(int i=1;i<=n;i++){
        	tmp-=m[mp(a[i].x-x1,a[i].y-y1)];
		}
		ans=min(ans,tmp);	
	}
}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 4096
class WUnionFind:
    MAX_N = 0
    PAR  = [] 
    RANK = []
    DIFF_WEIGHT=[]

    def __init__(self,n):
        self.MAX_N = n
        self.PAR = [ i for i in range(n)]
        self.RANK= [ 0 ] * n
        self.DIFF_WEIGHT=[ 0 ] * n

    def root(self,x):
        if self.PAR[x] == x:
            return x
        else:
            r = self.root(self.PAR[x])
            self.DIFF_WEIGHT[x] += self.DIFF_WEIGHT[self.PAR[x]]
            self.PAR[x] = r
            return r
    
    def weight(self,x):
        self.root(x)
        return self.DIFF_WEIGHT[x]

    def issame(self,x,y):
        return self.root(x) == self.root(y)

    def diff(self,x,y):
        return self.weight(y)-self.weight(x)

    def merge(self,x,y,w):
        w += self.weight(x)
        w -= self.weight(y)
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.RANK[x] < self.RANK[y]:
            x,y = y,x
            w = -w
        if self.RANK[x] == self.RANK[y]:
            self.RANK[x] += 1

        self.PAR[y] = x
        self.DIFF_WEIGHT[y] = w
        return True


N,M  = map(int,input().split())
Ans = []
tree = WUnionFind(N+1)
b = True
for _ in range(M):
    l,r,d = map(int,input().split())
    if tree.issame(l,r) and tree.diff(l,r) != d:
        b = False
        break
    tree.merge(l,r,d)

if b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 11048
#include <bits/stdc++.h>
using namespace std;
int main()
{
 int i,n;
 cin >> n;
 int a[n];
 for(i=0;i<n;i++)
 cin >> a[i];
 sort(a,a+n);
 cout << a[n/2]-a[(n/2)-1];
 return 0;
}

Measured memory_bytes: 640
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
*/

main:-
    get_number(A1),
    get_number(A2),
    get_number(A3),
    (A1 + A2 + A3 >= 22) -> writeln("bust") ; writeln("win").


Measured memory_bytes: 8060
#include <stdio.h>

void BubbleSort(int A[],int N){
    int flag = 1,i,j,temp,count=0;
    while(flag){
        flag=0;
        for(j=N-1;0<j;j--){
            if(A[j]<A[j-1]){
                temp=A[j];
                A[j]=A[j-1];
                A[j-1]=temp;
                
                flag=1;
                count++;
            }
        }
    }
    for(i=0;i<N;i++){
        printf("%d",A[i]);
        if(i<N-1) printf(" ");
    }
    printf("\n%d\n",count);
}

int main(){
    int i,N;
    scanf("%d",&N);
    int A[N];
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    BubbleSort(A,N);
    return 0;
}

Measured memory_bytes: 1768
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define mp make_pair
#define pb push_back
#define pf push_fron
#define INF 1000000000
typedef long long ll;



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

	cout << ((a + b >= c) ? "Yes" : "No") << endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int H, W;


  while(1){
    scanf("%d %d", &H, &W);
    if(W==0&&H==0) break;
  for(int i=1;i<=H;i++){

    for(int j=1;j<=W;j++) {
    if(i==1||i==H||j==1||j==W) printf("#");
    else printf(".");
    }
    printf("\n");
  }
  printf("\n");
}


  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define quick ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
int main()
{
	quick;
	int year,month,day;
	char a,b;
	cin>>year>>a>>month>>b>>day;
	if(year<2019)
	{
		cout<<"Heisei"<<endl;
		return 0;
	}
	else if(year==2019 && month<4)
	{
		cout<<"Heisei"<<endl;
		return 0;
	}
	else if(year==2019 && month==4 && day<=30)
	{
		cout<<"Heisei"<<endl;
		return 0;
	}
	else
	{
		cout<<"TBD"<<endl;
		return 0;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

using std::min;
using std::max;

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

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

ll inq(ll x, ll y, ll mod)
{
    if (y == 0) return 1;
    ll l = inq(x, y / 2, mod);
    if (y % 2) return l * l % mod * x % mod;
    return l * l % mod;
}

ll rev(ll x, ll mod)
{
    return inq(x, mod - 2, mod);
}

inline int nextInt()
{
    int x = 0;
    char c = getchar();
    int mi = (c == '-');
    if (c == '-') c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    if (mi) return x * -1;
    return x;
}

int n, m;
int a[500][500];
int ans;
int on[500];
int cnt[500];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    ans = n;
    for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> a[i][j];
    F(i, n) F(j, m) a[i][j]--;
    F(j, m) on[j] = 1;
    for (int i = 0; i < n; i++)
    {
        cnt[a[i][0]]++;
    }
    for (int j = 0; j + 1 < m; j++)
    {
        int id = 0;
        for (int k = 0; k < m; k++)
        {
            if (cnt[k] > cnt[id]) id = k;
        }
        //cout << id << " " << cnt[id] << endl;
        ans = min(ans, cnt[id]);
        for (int i = 0; i < n; i++)
        {
            int t = 1;
            int pos = 0;
            for (int j = 0; j < m; j++)
            {
                if (a[i][j] != id && on[a[i][j]] == 1)
                {
                    t = 0;
                    break;
                }
                if (a[i][j] == id)
                {
                    pos = j + 1;
                    while (on[a[i][pos]] == 0) pos++;
                    break;
                }
            }
            if (t)
            {
                //cout << i << " " << pos << " " << a[i][pos] << endl;
                cnt[id]--;
                cnt[a[i][pos]]++;
            }
        }
        on[id] = 0;
    }
    cout << ans;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

bool ispalindrome(const string& s){
  rep(i,s.length()){
    if(s[i] != s[s.length()-1-i]) return false;
  }
  return true;
}

int main(){
  string S;
  cin >> S;
  string T;
  rep(i,S.size()){
    if(S[i] == 'x') continue;
    else T += S[i];
  }

  if(!ispalindrome(T)){
    cout << -1 << endl;
    return 0;
  }

  S += "$";
  T += "$";
  
  vector<int> v;
  int cnt = 0;
  int idx = 0;
  rep(i,S.size()){
    if(S[i] == T[idx]){
      v.push_back(cnt);
      cnt = 0;
      idx++;
    }else{
      cnt++;
    }
  }

  int ret = 0;
  rep(i,v.size()){
    int j = v.size()-1-i;
    if(i >= j) break;
    ret += abs(v[i]-v[j]);
  }
  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 1216
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

constexpr int bm = 2500;
ll BIT[51][bm];
int zero[51];
void add(int A, int gin, ll co) {
	co = 4e12 - co;
	while (gin > 0) {
		BIT[A][gin] = max(BIT[A][gin], co);
		gin -= gin & -gin;
	}
}
ll query(int A, int gin) {
	if (zero[A] < gin) {
		zero[A] = gin;
		return 4e12;
	}
	ll kotae = 0;
	while (gin < bm) {
		kotae = max(BIT[A][gin], kotae);
		gin += gin & -gin;
	}
	return 4e12 - kotae;
}

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


	int N, M, S;
	cin >> N >> M >> S;
	if (S >= 2460) S = 2460;

	vector<ll> E[51];
	rep(i, M) {
		int u, v, a;
		ll b;
		cin >> u >> v >> a >> b;
		b = a << 8 | b << 16;
		E[u].pb(v | b);
		E[v].pb(u | b);
	}
	int C[51], D[51];
	rep1(i, N) {
		cin >> C[i] >> D[i];
	}

	add(1, S + 1, 0);
	priority_queue<ll, vector<ll>, greater<ll> > PQ;
	PQ.push((1 << 12) + S + 1);

	while (PQ.size()) {
		auto p = PQ.top();
		PQ.pop();
		ll ti = p >> 18;
		int i = p >> 12 & 63;
		int gin = p & 4095;



		if (ti > query(i, gin)) continue;

		ll ti2 = ti + D[i];
		int gin2 = gin + C[i];
		if (gin2 > 2460) gin2 = 2460;
		if (ti2 < query(i, gin2)) {
			add(i, gin2, ti2);
			PQ.push(ti2 << 18 | i << 12 | gin2);
		}

		for (auto pp : E[i]) {
			int to = pp & 255;
			ti2 = ti + (pp >> 16);
			gin2 = gin - (pp >> 8 & 255);
			if (gin2 > 0) {
				if (ti2 < query(to, gin2)) {
					add(to, gin2, ti2);
					PQ.push(ti2 << 18 | to << 12 | gin2);
				}
			}
		}

	}

	for (int i = 2; i <= N; i++) {
		co(query(i, 1));
	}



	Would you please return 0;
}

Measured memory_bytes: 4628
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;
int n, p;
LL dp[55][2];
int a[55];

LL DP(int at, int _p) {
	LL &ret = dp[at][_p];
	if (ret != -1) return ret;
	ret = 0;

	if (at == n) {
		if (_p == p) return ret = 1;
		return ret = 0;
	}

	ret += DP(at + 1, _p);
	ret += DP(at + 1, (_p + a[at]) % 2);
	return ret;
}

int main()
{
	scanf("%d %d", &n, &p);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}

	MEM(dp, -1);
	LL ans = DP(0, 0);
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	a := make([]string, h)

	for i := 0; i < h; i++ {
		fmt.Scan(&a[i])
	}

	ok := true
	prevRight := 0
	for _, aa := range a {

		var nowLeft int
		for i := 0; i < len(aa); i++ {
			if aa[i] == '#' {
				nowLeft = i
				break
			}
		}
		var nowRight int

		for i := len(aa) - 1; i >= 0; i-- {
			if aa[i] == '#' {
				nowRight = i
				break
			}
		}

		if prevRight > nowLeft {
			ok = false
			break
		}

		prevRight = nowRight
	}
	if ok {
		fmt.Println("Possible")
	} else {
		fmt.Println("Impossible")
	}
}


Measured memory_bytes: 512
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <unordered_map>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const int MAX_N = 50;
const ll dev = 1E+09;

ll N, A, B;

ll v[MAX_N];

ll combi(ll n, ll r);
ll solve(unordered_map<int, int>& mp);

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

    cin >> N >> A >> B;

    unordered_map<int, int> mp;

    for (int i = 0; i < N; i++) {
        cin >> v[i];
        if (mp.count(v[i])) {
            mp[v[i]]++;
        } else {
            mp.insert(make_pair(v[i], 1));
        }
    }

    sort(v, v + N);

    double sum = 0;
    for (int i = N - 1; i >= N - A; i--) {
        sum += v[i];
    }
    double dmax = sum / A;

    cout << fixed << setprecision(6) << dmax << "\n"
         << solve(mp) << "\n";

    return 0;
}

ll solve(unordered_map<int, int>& mp)
{
    auto lwite = lower_bound(v, v + N, v[N - A]);
    auto upite = upper_bound(v, v + N, v[N - A]);
    ll mn = upite - lwite;

    lwite = lower_bound(v + N - A, v + N, v[N - A]);
    upite = upper_bound(v + N - A, v + N, v[N - A]);
    ll mn2 = upite - lwite;

    ll ans = 0;
    if (mn2 == A) {
        for (int i = A; i <= min(B, mn); i++) {
            ans += combi(mn, i);
        }
    } else {
        ans = combi(mn, mn2);
    }
    return ans;
}

ll combi(ll n, ll r)
{
    ll i = 1;
    ll k = min(r, n - r);
    ll ans = 1;
    while (i <= k) {
        ans *= n - i + 1;
        ans /= i;
        i++;
    }
    return ans;
}


Measured memory_bytes: 3860
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main(){
  int i, k, len, n, x, count;
  char word[10], txt[100][100], c[100];
  scanf("%s", word);
  for(i=0;;i++){
    scanf("%s", txt[i]);
    if(strcmp(txt[i], "END_OF_TEXT") == 0){
      n = i;
      break;
    }
  }
  for(i=0;i<n;i++){
    len = strlen(txt[i])-1;
    x = 0;
    for(k=0;k<=sizeof(c);k++){
      c[k] = '\0';
    }
    for(k=0;k<=len;k++){
      if(isupper(txt[i][k])==0){
        c[x] = txt [i][k];
        x++;
      }else if(islower(txt[i][k])==0){
        c[x] = tolower(txt [i][k]);
        x++;
      }
    }
    if(strcmp(word,c) == 0){
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 1780
#include <stdio.h>

int main(void) {
    int N, K, R, S, P;
    int A, B, x, i, j;
    char T[100005], t[100005];
    scanf("%d%d%d%d%d%s", &N, &K, &R, &S, &P, T);
    x=0;
    j=0;
    for (i=0; i<K; i++) {
        j=0;
        while (1) {
            if (i+K*j<=N-1) t[j]=T[i+K*j];
            else break;
            // printf("%d %c\n", i+K*j, t[j]);
            j++;
        }
        t[j]=0;
        // printf("%s\n", t);
        
        A=j; B=0;
        for (j=0; j<A; j++) {
            if (j==0 || t[j]==t[j-1]) {
                B++;
            }
            else {
                //printf("%d ", j);
                if (t[j-1]=='r') x+=P*((B+1)/2);
                if (t[j-1]=='s') x+=R*((B+1)/2);
                if (t[j-1]=='p') x+=S*((B+1)/2);
                B=1;
            }
        }
        if (t[j-1]=='r') x+=P*((B+1)/2);
        if (t[j-1]=='s') x+=R*((B+1)/2);
        if (t[j-1]=='p') x+=S*((B+1)/2);
        // printf("\n");
        // printf("%d\n", x);
    }
    printf("%d", x);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <unordered_map>
#include <cmath>
#include <set>
#include <queue>
using namespace std;

int main(){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
    string s;
    cin >> s;
    s = '0' + s;
    int n = s.size();
    int ans[n][2];
    ans[n-1][0] = s[n-1] - '0';
    ans[n-1][1] = 10 - ans[n-1][0];
    for(int i = n-2; i >= 0; i--){
      	int tmp = s[i] - '0';
      	ans[i][0] = min(ans[i+1][0], ans[i+1][1] + 1) + tmp;
		ans[i][1] = min(ans[i+1][0] + 1, ans[i+1][1]) + 9 - tmp;
    }
    cout << ans[0][0] << '\n';
}


Measured memory_bytes: 9160
import java.util.*;
public class Main {
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		int [] month = {0,31,29,31,30,31,30,31,31,30,31,30,31};
		String [] date = {"Thursday", "Friday", "Saturday","Sunday", "Monday", "Tuesday","Wednesday"};
		int [] monthAcc = new int[13];
		for(int i=1; i < 13; i++){
			monthAcc[i] = monthAcc[i-1] + month[i];
		}
		while(true){
			int a = sc.nextInt();
			int b = sc.nextInt();
			if((a|b) == 0) break;
			int today = monthAcc[a-1] + b;
			int ans = (today - 1) % 7;
			System.out.println(date[ans]);
		}
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<chrono>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds; 
#define lli long long int
#define fr(i,a,b) for(lli i=a;i<b;i++)
#define bfr(i,a,b) for(lli i=a;i>=b;i--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
#define tc int t;cin>>t;while(t--)
#define mod 1000000007LL
#define mod2 998244353LL
#define all(vec) vec.begin(),vec.end()  
#define ld long double
#define pb push_back
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update> 

int main()
{
    
                        
     fio

          
     lli x,n;
     cin>>n;
     lli a[1000100]={0},var[n];
     fr(i,0,n){cin>>var[i];a[var[i]]++;}

     lli cnt=n;
     if(a[1]==1){cout<<1;return 0;}
     if(a[1]>1){cout<<0;return 0;}


     fr(i,0,n)
     {
     	  fr(j,1,sqrt(var[i])+1)
     	  if(var[i]%j==0)
     	  {
     	  	 lli fac = j;
     	  	 if(fac==var[i] && a[var[i]]>1){cnt--;break;}
     	  	 else if(fac!=var[i] && a[fac]>=1){cnt--;break;}

     	  	 fac = var[i]/j;
     	  	 if(fac==var[i] && a[var[i]]>1){cnt--;break;}
     	  	 else if(fac!=var[i] && a[fac]>=1){cnt--;break;}
     	  }
     	  //cout<<var[i]<<" "<<cnt<<'\n';
     }
      
     cout<<cnt;


              


return 0;}    


Measured memory_bytes: 13072
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first.first
#define yy first.second
#define __V vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace __gnu_pbds;
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifdef LOCALc
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
template<typename T, typename l>
void getv(T& a, int n, l f) {
	a.resize(n);
	for (auto& i : a)
		cin >> i, f(i);
}
template<typename T>
void getv(T& a, int n) {
	a.resize(n);
	for (auto& i : a)
		cin >> i;
}
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll n, m, l, r, f, t;
vi a;
vpi o;
int main() {
	doin();
	cin >> n >> m;
	getv(a, n);
	multiset<ll> s(all(a));
	o.resize(m);
	for(auto& i : o) cin >> i.second >> i.first;
	sort(all(o), greater<pi>());
	for(auto& i : o) swap(i.second, i.first);
	ll ans = 0;
	for(ll i = 0; i < m && !s.empty(); i++) {
		while(!s.empty()&&o[i].first--) {
			if(*s.begin() > o[i].second) break;
			else ans += o[i].second, s.erase(s.begin());
		}
	}
	while(!s.empty()) ans += *s.begin(), s.erase(s.begin());
	cout << fixed << ans;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define N 15000001

int main()
{
   ll n;
   cin>>n;
   ll a[n];
   for(ll i=0;i<n;i++)    cin>>a[i];
   a[0]--;
   for(ll i=1;i<n;i++)
   {
        if(a[i]<a[i-1])   return cout<<"No",0;
        if(a[i]>a[i-1])   a[i]--;
   }
   cout<<"Yes";
}

Measured memory_bytes: 1024
import numpy as np

def main():
  N,M = map(int,input().split())
  ab=[]
  for _ in range(M):
    a,b = map(int,input().split())
    ab.append([b,a])
  ab.sort()
  tmp=0
  count = 0
  for i in range(M):
    if ab[i][1] >= tmp:
      tmp = ab[i][0]
      count += 1
  print(count)

main()

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

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
int main() {
    bool ok = false;
    string s;cin >> s;
    rep1(i, s.size()-1) {
        ok = false;
        string k=s.substr(0,s.size()-i);
        if(k.size()%2==1) continue;
        rep(i, k.size()/2) {
            if(k[i]!=k[i+k.size()/2]) {
                // continue; 
                ok=true;
                // cout << ":(" << endl;
                break;
            }
        }
        // cout << ":(" << endl;
        if(!ok){
            cout << k.size() << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int N;
int dp[105][50][50][50];
bool ok (string last3){
  if (last3.find("AGC") != string::npos) return false;
  for (int i = 0; i < last3.size() - 1; i++){
    swap(last3[i], last3[i + 1]);
    if (last3.find("AGC") != string::npos) return false;
    swap(last3[i], last3[i + 1]);
  }
  return true;
}
string dna = "ACTG";
int solve(int I, string last3){
  if (!ok(last3)) return 0;
  if (dp[I][last3[0] - 'A'][last3[1] - 'A'][last3[2] - 'A'] != -1) return (dp[I][last3[0] - 'A'][last3[1] - 'A'][last3[2] - 'A'] % MOD);
  if (I >= N) return 1;
  long long ans = 0;
  if (I < 3){
    for (int i = 0; i < 4; i++){
      if (last3[I] == 'z') {
        last3[I] = dna[i];
        ans += (solve(I + 1, last3) % MOD);
        last3[I] = 'z';
      }
    }
  } else {
    for (int i = 0; i < 4; i++){
      if (ok(last3 + dna[i])) {
        string bak = last3;
        last3[0] = last3[1];
        last3[1] = last3[2];
        last3[2] = dna[i];
        ans += (solve(I + 1, last3) % MOD);
        last3 = bak;
      }
    }
  }
  return (dp[I][last3[0] - 'A'][last3[1] - 'A'][last3[2] - 'A'] = (ans % MOD));
}

int main(){
  cin >> N;
  memset(dp, -1, sizeof(dp));
  cout << solve(0, "zzz") << '\n';
  return 0;
}

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


int main(){
    string s; cin >> s;
    int a = stoi(s.substr(0, 2));
    int b = stoi(s.substr(2, 2));

    if(1<=a && a<=12 && 1<=b && b<=12){
        cout << "AMBIGUOUS" << endl;
    }
    else if(1<=a && a<=12){
        cout << "MMYY" << endl;
    }
    else if(1<=b && b<=12){
        cout << "YYMM" << endl;
    }
    else cout << "NA" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, M, X[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, M) cin >> X[i];
    sort(X, X + M);

    vector<int> d;
    rep(i, 0, M - 1) d.push_back(X[i + 1] - X[i]);
    sort(all(d));

    ll ans = 0;
    int cnt = max(0, M - N);
    rep(i, 0, cnt) ans += d[i];
    cout << ans << endl;
}

Measured memory_bytes: 1276
program diverta_city
  integer :: n, i, j
  integer(8) :: a(0:9) = (/0,1,2,4,7,12,20,29,38,52/), f(10) = 0
  read(*,*) n
  f(3) = 1
  do i = 4, n
    f(i) = f(i-1)*(a(i-2)+a(i-3)+1)
  end do
  do i = 1, n
    do j = 1, n
      if (i == j) then
        write(*,'(i0,x)',advance='no') 0
        cycle
      end if
      write(*,'(i0,x)',advance='no') f(max(i,j))*a(min(i,j))+1
    end do
    write(*,*)
  end do
end program diverta_city

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int f[100010];
int main()
{
	int n,m,d,ans=0;
	scanf("%d%d%d",&n,&m,&d);
	for(int i=1; i<=n; i++)
		scanf("%d",&f[i]);
	for(int i=1; i<=n; i++)
		ans+=(m-1)/f[i];
	printf("%d",ans+n+d);
	return 0;
}

Measured memory_bytes: 256
import collections
s = collections.Counter(input()).most_common()
t = collections.Counter(input()).most_common()
if len(s) == len(t):
    for i in range(len(s)):
        if s[i][1] != t[i][1]:
            print("No")
            exit()
    print("Yes")
else:
    print("No")


Measured memory_bytes: 42588
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func readInt() int {
	i, _ := strconv.Atoi(read())
	return i
}

func max(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func min(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Split(bufio.ScanLines)
	a := readInt()
	b := readInt()
	c := readInt()

	if c <= a+b {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main(){
    
    int n ;
    cin>>n;
    vector <int> dp(3,0);
    while(n--){
        vector <int> newdp(3,0);
        vector <int> c(3);
        for(auto &i : c)
            cin>>i;
        
        for(int i = 0 ; i < 3 ; i++) // if i did task i today
        {
            for(int j = 0 ; j < 3 ; j++) // yesterday's task = j
            {
                if( j != i ){
                    newdp[i] = max(newdp[i] , dp[j] + c[j]);
                }
            }
        }
        
        dp = newdp;
    }
    
    cout<<max(dp[0] , max (dp[1] , dp[2] )  );
    return 0;
    
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

ll d[400][400];

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  rep(i, N){
    rep(j, N){
      cin >> d[i][j];
    }
  }
  ll ans = 0;
  rep(i, N){
    FOR(j, i+1,N){
      bool flag=true;
      rep(k, N){
        if(k==i or k==j)continue;
        if(d[i][j]==d[i][k]+d[k][j]){
          flag = false;
          break;
        }
        if(d[i][j]>d[i][k]+d[k][j]){
          cout << -1;
          return 0;
        }
      }
      if(flag){
        ans += d[i][j];
      }
    }
  }
  if(ans==0)cout << -1;
  else cout << ans;

  return 0;
}


Measured memory_bytes: 1280
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<char>>();

    let mut flag = 0;
    if s[0] == 'A' {
        for i in 1..s.len() {
            if 'A' <= s[i] && s[i] <= 'Z' {
                if flag == 1 {
                    flag = 0;
                    break;
                } else if 2 <= i && i <= s.len()-2 && s[i] == 'C' {
                    flag = 1;
                } else {
                    break;
                }
            }
        }
    }

    println!("{}", if flag == 1 {"AC"} else {"WA"}.to_string())

}

Measured memory_bytes: 4476