akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC083B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int n = input[0];
            int a = input[1];
            int b = input[2];

            int ans = 0;

            for(int t = 1; t <= n; t++)
            {
                int[] tArray = IntToArray(t);
                int sum = 0;
                for(int s = 0; s < tArray.Length; s++)
                {
                    sum += tArray[s];
                    
                }

                if (a <= sum && sum <= b)
                {
                    ans += t;
                }
            }

            Console.WriteLine(ans);
        }

        static int[] IntToArray(int s)
        {
            return s.ToString().ToCharArray().Select(x => x.ToString()).Select(x => int.Parse(x)).ToArray();
        }
    }
}


Measured memory_bytes: 17488
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,answer,hikaku;
  
  cin >> N;
  vector<int> mochi(N);
  for (int i=0;i < N;i++) {
    cin >> mochi.at(i);
  }
  sort(mochi.begin(),mochi.end());
  
  hikaku = mochi.at(0);
  answer = 1;
  for (int i=1;i < N;i++) {
      if (hikaku != mochi.at(i)) {
        hikaku = mochi.at(i);
        answer++;
      }
   }  
   
  cout << answer << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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++)

int main() {
  string s,t;
  cin >> s >> t;
  cout << t << s << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  rep(i, n){
    int x, y;
    cin >> x >> y;
    a[i] = x; b[i] = y;
  }
  ll cnt = 0;
  for(int i=n-1; i>=0; i--){
    if((a[i]+cnt) % b[i] != 0){
      cnt += b[i] - (a[i]+cnt) % b[i];
    }
  }
  cout << cnt << endl;
  return 0;
}
  
  

Measured memory_bytes: 4056
from sys import stdin,stdout

for _ in range(1):
	#n,shift,ch=stdin.readline().split()
	#days,ass=map(int,stdin.readline().split())
	n=int(stdin.readline())
	a=[0,0]+list(map(int,stdin.readline().split()));sub={}
	for i in range(2,n+1):
		sub[a[i]]=sub.get(a[i],0)+1
	for k in range(1,n+1):
		stdout.write(str(sub.get(k,0))+'\n')

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

int main(){
    int n, i, j, k, a, b, count = 0;
    int res[10] = {};
    ll h, w, non_zero = 0;
    cin >> h >> w >> n;
    pair<int, int> mem, p[900000];
    for(i=0; i<n; i++){
        cin >> a >> b;
        //printf("%d %d\n", a, b);
        for(j=-1; j<=1; j++){
            for(k=-1; k<=1; k++){
                if(1 <= a+j && a+j <= h && 1 <= b+k && b+k <= w){
                    p[count] = make_pair(a+j, b+k);
                    count++;
                }
            }
        }
    }
    sort(p, p+count);
    j = 0;
    mem = p[0];
    for(i=0; i<count; i++){
        if(mem != p[i]){
            if(1 < mem.first && mem.first < h && 1 < mem.second && mem.second < w){
                res[j]++;
                non_zero++;
            }
            mem = p[i];
            j = 1;
        }else{
            j++;
        }
    }
    if(1 < mem.first && mem.first < h && 1 < mem.second && mem.second < w){
        res[j]++;
        non_zero++;
    }
    printf("%ld\n", (h-2)*(w-2)-non_zero);
    for(i=1; i<=9; i++){
        printf("%d\n", res[i]);
    }
}

Measured memory_bytes: 7296
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  string s;
  cin>>s;
  int ans=1e9;
  for(int i=0;i<s.size()-2;i++){
    int a=s[i]-'0';
    a*=10;
    a+=s[i+1]-'0';
    a*=10;
    a+=s[i+2]-'0';
    ans=min(ans,abs(a-753));
  }
  cout<<ans<<endl;
}


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

int d[10]={};
int P[10];
int Q[10];
int N;
int a,b;
int sw[10];
int c=0;

void perm(int T){
  if(T>N){
    int ps=1,qs=1;
    for(int i=1;i<=N;i++){
      if(P[i]!=d[i]) ps=0;
      if(Q[i]!=d[i]) qs=0;
    }
    c++;
    if(ps==1) a=c;
    if(qs==1) b=c;
  }else{
    for(int i=1;i<=N;i++){
      if(sw[i]!=1){
        d[T]=i;
        sw[i]=1;
        perm(T+1);
        sw[i]=0;
      }
    }
  }
}

int main(){
  scanf("%d\n",&N);
  for(int i=1;i<=N;i++)
    scanf("%d\n",P+i);
  for(int i=1;i<=N;i++)
    scanf("%d\n",Q+i);
  for(int i=1;i<=N;i++)
    sw[i]=0;
  perm(1);
  printf("%d\n",a>=b?a-b:b-a);
  return 0;
}

Measured memory_bytes: 1732
package main

import (
	"fmt"
)

func solution(a, b, c int) string {
	var ans string = "No"
	if a == b {
		if a == c {
			ans = "No"
		} else {
			ans = "Yes"
		}
	} else if a == c {
		ans = "Yes"
	} else if b == c {
		ans = "Yes"
	}

	return ans
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(solution(a, b, c))
}


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



int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int>b(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	bool lowerA = true;
	for (int i = 0; i < n; i++) {
		if (a[i] < b[i]) break;
		if (a[i] > b[i]) lowerA = false;
	}
	int cnt = 0;
	if (lowerA) {
		do {
			bool ok = true;
			for (int i = 0; i < n; i++) {
				if (a[i] != b[i]) ok = false;
			}
			if (ok) break;
			cnt++;
		} while (next_permutation(a.begin(), a.end()));
	}
	else {
		do {
			bool ok = true;
			for (int i = 0; i < n; i++) {
				if (a[i] != b[i]) ok = false;
			}
			if (ok) break;
			cnt++;
		} while (next_permutation(b.begin(), b.end()));
	}
	
	

	cout << cnt;
	return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

enum Type{
	LABEL,
	go_to,
};

int N;

struct Info{
	char name[11];
	int to;
	Type type;
};

struct Data{
	Data(int arg_line,int arg_sum_cost){
		line = arg_line;
		sum_cost = arg_sum_cost;
	}
	bool operator<(const struct Data &arg) const{
		return sum_cost > arg.sum_cost;
	}
	int line,sum_cost;
};

bool strCmp(char* base, char* comp){
	int length1,length2;
	for(length1=0;base[length1] != '\0';length1++);
	for(length2=0;comp[length2] != '\0';length2++);
	if(length1 != length2)return false;

	for(int i=0;base[i] != '\0'; i++){
		if(base[i] != comp[i])return false;
	}
	return true;
}

void strcpy(char* to,char* str){
	for(int i=0;str[i] != '\0';i++){
		to[i] = str[i];
		to[i+1] = '\0';
	}
}

int main(){

	scanf("%d",&N);
	Info info[N];

	char buf[50],work[11];

	int length;

	getchar();

	for(int i = 0; i < N; i++){
		fgets(buf,50,stdin);

		for(length = 0; buf[length] != ':' && buf[length] != ';'; length++);
		if(length <= 4){
			info[i].type = LABEL;
			buf[length] = '\0';
			strcpy(info[i].name,buf);
			continue;
		}

		if(buf[0] == 'g' && buf[1] == 'o' && buf[2] == 't' && buf[3] == 'o' && buf[4] == ' '){
			for(int k = 5; buf[k] != ';'; k++){
				work[k-5] = buf[k];
				work[(k+1)-5] = '\0';
			}
			info[i].type = go_to;
			strcpy(info[i].name,work);
		}else{
			info[i].type = LABEL;
			buf[length] = '\0';
			strcpy(info[i].name,buf);
		}
	}

	for(int i = 0; i < N; i++){
		if(info[i].type == go_to){
			for(int k = 0; k < N; k++){
				if(info[k].type == LABEL && strCmp(info[i].name,info[k].name) == true){
					info[i].to = k;
					break;
				}
			}
		}
	}

	int min_cost[N+1];
	min_cost[0] = 0;
	for(int i = 1; i <= N; i++)min_cost[i] = BIG_NUM;

	priority_queue<Data> Q;

	Q.push(Data(0,0));

	while(!Q.empty()){

		if(Q.top().line == N){
			break;
		}else if(Q.top().sum_cost > min_cost[Q.top().line]){
			Q.pop();
		}else{

			if(info[Q.top().line].type == LABEL){
				if(min_cost[Q.top().line+1] > Q.top().sum_cost){
					min_cost[Q.top().line+1] = Q.top().sum_cost;
					Q.push(Data(Q.top().line+1,Q.top().sum_cost));
				}
			}else{ //go_to???
				if(min_cost[Q.top().line+1] > Q.top().sum_cost+1){
					min_cost[Q.top().line+1] = Q.top().sum_cost+1;
					Q.push(Data(Q.top().line+1,Q.top().sum_cost+1));
				}

				if(min_cost[info[Q.top().line].to] > Q.top().sum_cost){
					min_cost[info[Q.top().line].to] = Q.top().sum_cost;
					Q.push(Data(info[Q.top().line].to,Q.top().sum_cost));
				}
			}
			Q.pop();
		}
	}

	printf("%d\n",min_cost[N]);

	return 0;
}

Measured memory_bytes: 3232
#include "bits/stdc++.h"
 
using namespace std;
int main(void){
  long long int N,num,ans,med;
  vector<int> vecB;
  cin >> N;
  for(int i=1; i<=N; i++){
    cin >> num;
    vecB.push_back(num-i);
  }
  sort(vecB.begin(), vecB.end());
  med = vecB[vecB.size()/2];
  ans = 0;
  for(int i=0; i<N; i++){
    ans += abs(vecB[i]-med);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1528
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int main(){
  int ans=0;
  ll x,y;
  cin>>x>>y;
  ll tmp=x;
  while(x<=tmp&&tmp<=y){
    ans++;
    tmp*=2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  int n; cin >>n;
  vector<ll> A(3*n); rep(i, 3*n) cin >>A[i];
  sort(all(A));
  ll res = 0;
  rep(i, n){
    res += A[i*2 + n];
  }
  cout <<res <<endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll ksm(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1) res=res*x%mod;
        x=x*x%mod;
        y>>=1;
    }
    return res%mod;
}
ll cal(ll n,ll m){
    ll sum1=1;
    ll sum2=1;
    for(ll i=1;i<=m;i++) sum1=sum1*i%mod;
    for(ll i=n;i>=n-m+1;i--) sum2=sum2*i%mod;
    return sum2*ksm(sum1,mod-2)%mod;
}
int  main(){
    ll n,k;
    cin>>n>>k;
    if(n-k<=1) {
        cout<<cal(2*n-1,n-1)%mod<<endl;
    }
    else{
        ll toll=cal(2*n-1,n-1)%mod;
        ll tmp1=cal(n,1)%mod;
        ll tmp2=1;
        toll=(toll-tmp1*tmp2%mod+mod)%mod;
        for(ll i=2;i<n-k;i++){
            tmp1=tmp1*(n-i+1)%mod;
            tmp1=tmp1*ksm(i,mod-2)%mod;
            tmp2=tmp2*(n-i+1)%mod;
            tmp2=tmp2*ksm(i-1,mod-2)%mod;
            toll=(toll-tmp1*tmp2%mod+mod)%mod;
        }
        cout<<toll<<endl;

    }
    return 0;
}


Measured memory_bytes: 256
S = input()
if ((int(S[:2]) == 0) and (int(S[2:4])) == 0):
    print("{}".format("NA"))
elif (int(S[:2]) == 0) and (12< int(S[2:4])):
    print("{}".format("NA"))
elif(12< (int(S[:2])) and (int(S[2:4]) == 0)):
    print("{}".format("NA"))
elif (12 < int(S[:2])) and (12 < int(S[2:4])):
      print("{}".format("NA"))
elif(int(S[:2]) == 0) and (int(S[2:4]) < 13):
    print("{}".format("YYMM"))
elif(int(S[:2]) < 13) and (int(S[2:4]) == 0):
    print("{}".format("MMYY"))
elif (0<(int(S[:2]) <13) and (0< int(S[2:4]) < 13)):
    print("{}".format("AMBIGUOUS"))
elif(int(S[:2]) < 13):
     print("{}".format("MMYY"))
else:
     print("{}".format("YYMM"))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> d(n);
    rep(i,n){
        cin>>d[i];
    }
    long long ans=0;
    rep(i,n-1){
        for(int j=i+1;j<n;j++){
            ans+=d[i]*d[j];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, a, b = LI()

print(min(a, b), max(0, a + b - n))


Measured memory_bytes: 3060
#include <iostream>
#include <queue>

using namespace std;

int main() {
  int k;
  cin >> k;
  queue<long long> q;

  for (long long i = 1; i < 10; i++) {
    q.push(i);
  }

  long long ans;
  for(int i = 1; i <= k; i++) {
    long long x = q.front();
    q.pop();
    if (i == k) ans = x;

    long long mod = x % 10;
    if (mod != 0) q.push(10*x + mod - 1);
    q.push(10 * x + mod);
    if (mod != 9) q.push(10*x + mod + 1);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    for (i in n..1111) {
        if (i.toString().toSet().size == 1) {
            out.println(i)
            return
        }
    }
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

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

using namespace std;

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

ll N,M;
ll i, j, k;
vector<pll> anss;

int main(){
    scanf("%lld%lld", &N,&M);
    i = 0;
    while(M>0){
        if(M%2==1){
            anss.push_back({i, i + M});
            ++i;
        }else{
            anss.push_back({i + N / 2, i + N / 2 + M});
        }
        --M;
    }
    
    fornum(i,0,anss.size()){
        printf("%lld %lld\n", anss[i].first + 1, anss[i].second + 1);
    }
    
    return 0;
}

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

int main() {
int k; int r;
cin>>k;
if(k==1){cout<<1;return 0;}
int arr[k+1];
for(int u=0;u<k+1;u++){arr[u]=0;}
for(int i=1;i<=k;i++){

if(i%2==0){
int tmp=i;arr[tmp]++;
r = i/2;
while(true){
if(r%2==0){arr[tmp]++;r=r/2;}
else break;

}

}


}int max=0; int in=0;

for(int e=1;e<=k;e++){
	
if(arr[e]>max){max=arr[e];in=e;}	
//cout<<arr[e]<<" ";
}
cout<<in;
}

Measured memory_bytes: 256
/*
  AOJ 2131
  Title:Pi is Three
  @kankichi573
*/
#include <stdio.h>
#include <math.h>
#include <float.h>

// #define max(x,y) (((x)>(y))?(x):(y))
// #define min(x,y) (((x)<(y))?(x):(y))

main()
{
  double pai=atan(1)*4;
  double x,d1,d2;
  int m,n;

  while(scanf("%lf",&x) && (x != 0.0))
    {
      if(x >= pai-3)
	{
	  printf("3/1\n");
	  continue;
	}
      for(m=2;m<10000000;m++)
	{
	  n = (double)m*pai;
	  d1=pai-(double)n/(double)m;
	  d2=((double)n+1.0)/(double)m-pai;

	  if(fabs(d1)<x)
	    {
	      printf("%d/%d\n",n,m);
	      break;
	    }
	  if(fabs(d2)<x)
	    {
	      printf("%d/%d\n",n+1,m);
	      break;
	    }
	}
    }
  return(0);
}

Measured memory_bytes: 628
/*input
1 1
1 0
*/
#include <bits/stdc++.h>
using namespace std;
#define MAX 5

int a[MAX] = {}, vis[MAX] = {};
int n, m;

int main() {
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int p, x; cin >> p >> x;

		if (vis[p] && a[p] != x) {
			cout << -1 << '\n';
			return 0;
		}
		if (p == 1 && x == 0 && n != 1) {
			cout << -1 << '\n';
			return 0;
		}

		vis[p] = 1;
		a[p] = x;
	}
	if (!vis[1] && n != 1) a[1] = 1;

	for (int i = 1; i <= n; i++) cout << a[i];
	cout << '\n';
	return 0;
}

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

//#define int int64_t

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

#define breakif(cond) if(cond) break; else

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

const int INF = 1 << 29;

signed main() {
	int n; cin >> n;
	V v(n);
	rep(i, n)cin >> v[i];
	int ans = 0;
	rep(i, n) {
		if (v[v[i] - 1] - 1 == i) ans++;
	}
	cout << ans / 2 << endl;
	system("pause");
}

Measured memory_bytes: 888
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define SIZE(a) int((a).size();
const int INF=INT_MAX;
int main(){
  vll a(3);
  rep(i,0,3){cin>>a[i];}
  sort(a.begin(),a.end());
  cout<<a[2]*10+a[0]+a[1]<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sync ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main(){
	sync
	int a,b,flag=0,count[4]={0};
	for(int i=0;i<3;i++){
		cin >> a >> b;
		count[a-1]++;
		count[b-1]++;
	}
	for(int i=0;i<4;i++){
		if(count[i]>=3){
			flag=1;
			break;
		}
	}
	if(flag==1) cout << "NO\n";
	else cout << "YES\n";
	return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = [input() for _ in range(H)]

dp = [[float('inf') for _ in range(W)] for _ in range(H)]

if S[0][0] == '#':
    dp[0][0] = 1
else:
    dp[0][0] = 0

for i in range(1, W):
    if S[0][i] == '.':
        dp[0][i] = dp[0][i-1]
    else:
        if S[0][i-1] == '.':
            dp[0][i] = dp[0][i-1] + 1
        else:
            dp[0][i] = dp[0][i-1]

for j in range(1, H):
    if S[j][0] == '.':
        dp[j][0] = dp[j-1][0]
    else:
        if S[j-1][0] == '.':
            dp[j][0] = dp[j-1][0] + 1
        else:
            dp[j][0] = dp[j-1][0]

for j in range(1, H):
    for i in range(1, W):
        if S[j][i-1] == '.' and S[j][i] == '#':
            dp[j][i] = min(dp[j][i], dp[j][i-1] + 1)
        else:
            dp[j][i] = min(dp[j][i], dp[j][i-1])
        if S[j-1][i] == '.' and S[j][i] == '#':
            dp[j][i] = min(dp[j][i], dp[j-1][i] + 1)
        else:
            dp[j][i] = min(dp[j][i], dp[j-1][i])

print(dp[H-1][W-1])


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

int main(){
	string S;
	cin >> S;
	ll ans = 0;
	int now = 0;
	int g = 0;
	int l = 0;
	rep(i,S.size()) {
		if (S[i] == '<') {
			now++;
			g = now;
			ans += now;
		}
		else {
			if (now == 0) l++;
			else l = 0;
			if (g==l) {
				g++;
				ans++;
			}
			now = 0;
			ans += l;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4248
n = int(input())
 
def prime_factorise(n):
    a = []
    tmp = n
    for i in range(2, int(n**0.5//1 + 1)):
        if tmp % i == 0:
            index = 0  # 指数
            while tmp % i == 0:
                index += 1
                tmp //= i
            a.append([i, index])
 
    if tmp != 1:
        a.append([tmp, 1])

    if a == []:
        a.append([n,1])

    return a
 
x = prime_factorise(n)
count = 0
 
 
for i in range(len(x)):
    if x[0][0] == 1:
        break
 
    k = x[i][1]  # 指数の値
    for j in range(k):
        if n % (x[i][0] ** (j+1)) == 0:
            n //= x[i][0] ** (j+1)
            count += 1
            k -= (j+1) #指数の値をへらす
 
        elif n % (x[i][0]**(j+1)) != 0:
            break
        
        if k <= 0:
            break
 
print(count)

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

#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;

#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

inline void setin(string s) {
	freopen(s.c_str(), "r", stdin);
}

inline void setout(string s) {
	freopen(s.c_str(), "w", stdout);
}

template <typename T> inline T range(T l, T r) {
	return uniform_int_distribution <T>(l, r)(rng);
}

template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}

const int inf = 2e9;
const int mod = 998244353;
const int N = 5e3 + 15;
int n, k, fact[N], c[N][N], pw[N];

inline int add(int a, int b) {
	a += b;
	if(a >= mod)
		a -= mod;
	if(a < 0)
		a += mod;
	return a;
}

inline void add_t(int &a, int b) {
	a = add(a, b);
}

inline int mt(int a, int b) {
	return 1ll * a * b % mod;
}

inline int binpow(int n, int k) {
	int res = 1;
	while(k) {
		if(k & 1)
			res = mt(res, n);
		n = mt(n, n);
		k >>= 1;
	}
	return res;
}

inline int dv(int a, int b) {
	return mt(a, binpow(b, mod - 2));
}

inline int C(int n, int k) {
	if(n < 0 || k < 0)
		return 0;
	// assert(n >= 0 && k >= 0);
	return c[n][k];
}

inline void precalc() {
	c[0][0] = 1;
	pw[0] = 1;
	for(int i = 1; i < N; ++i) {
		c[i][0] = 1;
		for(int j = 1; j <= i; ++j)
			c[i][j] = add(c[i-1][j], c[i-1][j-1]);
		pw[i] = add(pw[i-1], pw[i-1]);
	}
}

int dp[N][N]; // dp[i][cur_sum]
int comb[N][N];

inline int choose(int n, int k) {
	return C(n + k - 1, k - 1);
}

int pr[N];

main() {
	precalc();
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	// setin("input.txt");
	cin >> k >> n;
	for(int i = 1; i <= k; ++i)
		for(int j = i + 1; j <= k; ++j)
			pr[i+j]++;
	for(int t = 2; t <= 2 * k; ++t) {
		int ans = 0;
		int p = pr[t];
		for(int q = 0; q <= min(p, n); ++q) {
			int val = mt(C(p, q), pw[q]);
			if(t & 1)
				add_t(ans, mt(val, choose(n - q, k - 2 * p + q)));
			else {
				add_t(ans, mt(val, choose(n - q, k - 2 * p + q - 1)));
				add_t(ans, mt(val, choose(n - q - 1, k - 2 * p + q - 1)));
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	int a;
	cin >> a;
	cout << a * a << endl;

	return 0;
}


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

int main()
{
    int i,j,z;
    long long w,n;
    long long a[2005];
    cin>>n>>z>>w;
    for(i=0;i<n;i++)
        cin>>a[i];
    if(n==1)
    {
        cout<<abs(a[0]-w)<<endl;
        return 0;
    }
    cout<<max(abs(a[n-1]-w),abs(a[n-1]-a[n-2]))<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	cout << max(A + B, max(A - B, A * B)) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }

    int mizu = 0;
    while(1){
        if(*max_element(h.begin(),h.end()) == 0) break;

        int i = 0;
        while(i < n){
            if(h[i] == 0) i++;
            else{
                mizu++;
                while(i < n && h[i] > 0){
                    h[i]--;
                    i++;
                }
            }
        }
    }
    cout << mizu << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define rev(a,b,c) for(int a=b;a>=c;a--)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define F first
#define S second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define get(a) cin>>a
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n";
const ll mod = 1000000007;
const ll maxn = 1000005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
ll ncr(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j] + C[j-1])%mod;
    }
    return C[k];
}
void solve()
{
    ll a,b;
    cin>>a>>b;
    if(a==1&&b==1) pr("1000000");
    else if(a==1&&b==2||b==1&&a==2) pr("500000");
    else if(a==1&&b==3||b==1&&a==3) pr("400000");
    else if(a==3&&b==2||b==3&&a==2) pr("300000");
    else if(a==2&&b==2) pr("400000");
    else if(a==3&&b==3) pr("200000");
    else if(a==1||b==1) pr("300000");
    else if(a==2||b==2) pr("200000");
    else if(a==3||b==3) pr("100000");
    else pr("0");
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nextl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll X, ans=1, a;

    cin >> X;

    a = X;

    while(a%360!=0){
        a += X;
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N; cin >> N;
    cout << (N / 10 % 111 == 0 or N % 1000 % 111 == 0 ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().rstrip().split()))
X = 1
count = 0
for i in range(1,N):
    count = 0
    for k in range(i):
        if A[k] <= A[i]:
            count = count + 1
            if count == i:
                X = X + 1
                
                
print(X)
    
    

Measured memory_bytes: 2940
using System;
using System.Linq;
using System.Collections.Generic;

class Mondai
{
    static void Main()
    {
        var waru= 1000000007;
        var nm = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        var N = nm[0];
        var M = nm[1];
        var a = new long[M];
        for (int i=0;i<M;++i) a[i] = Int64.Parse(Console.ReadLine());
        var dp = new long[N + 1];
        for (int i = 0; i < N; ++i) dp[i] = 0L;
        dp[0] = 1L;
        var index = 0;
        for (int i=1;i<=N;++i)
        {
            if (index<M && a[index] == i)
            {
                index++;
                continue;
            }
            dp[i] = (dp[i]+dp[i - 1])% waru;
            if(2<=i)dp[i] = (dp[i]+dp[i - 2])% waru;
        }
        Console.WriteLine(dp[N]);
    }
}

Measured memory_bytes: 16352
N = int(input())
A=list(map(int, input().split()))




def sol(i,want):
    num=N//(i+1)
    wa=B[i]

    for j in range(num):
        k=i+j*(i+1)
        wa+=B[k]
#         print(i,wa,B[i])
#         print((i+1)+j*(i+1)-1)
#     print(i,wa,B[i])
    wa=wa%2
#     print(i,wa,A[i])
    
    if wa==want:
        x=0
    else:
        x=1
#     print(num)
    return x 

B=A[:]
half=N//2
for i in range(half):
    j=half-1-i
#     print(j)
    B[j]=sol(j,A[j])
    
C=[i+1 for i, x in enumerate(B) if x ==1]

m=sum(B)
print(m)
print(*C)

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

int main(){
string X; cin >> X; int N=X.size(), S=0, T=0;
for(int i=0; i<N; i++){ 
if(X[i]=='T'){ if(S){S--;}else{T++;} }else{ S++; }
}  
cout << 2*T << "\n";
}

Measured memory_bytes: 640
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt(),k=sc.nextInt();
        int[] nums=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
        }
        Arrays.sort(nums);
        int output=0;
        for(int i=n;i>n-k;i--){
            output+=nums[i-1];
        }
        System.out.println(output);
    }

}

Measured memory_bytes: 25172
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
	string a,b,c;cin>>a>>b>>c;
	string ans;
	ans+=(a[0]-'a'+'A');
	ans+=(b[0]-'a'+'A');
	ans+=(c[0]-'a'+'A');
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x, y;
    cin >> x >> y;
    string ans = "No";
   for(int i=0; i<=x; i++)
    {
        if (2*i+4*(x-i)==y)
        {
            ans = "Yes";
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c,k,ans = 0;
	cin >> a >> b >> c >> k;
	if (a > k) ans += k,k = 0;
	else k -= a,ans += a;
	if (k > 0)
		if (b > k) k = 0;
		else k -= b;
	else ;
	if (k > 0)
		if (c > k) ans -= k,k = 0;
		else ans -= c,k -= c;
	else ;
	cout << ans;
	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int,char>> sc(M);
    rep(i, M){
        int s;
        char c;
        cin >> s >> c;
        s--;
        sc[i] = {s,c};
    }
    int ans = 100000;

    for(int i = 0; i < pow(10,N); i++){
        string t = to_string(i);
        if(t.size() < N) continue;
        bool ac = true;
        for(int m = 0; m < M; m++){
            int s, c;
            tie(s, c) = sc[m];
            ac &= (t[s] == c);
        }
        if(ac) ans = min(ans, i);
    }

    if(ans == 100000) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
typedef pair<int, ll> i_ll;
struct edge { int u, v; ll w; };

ll INF = LLONG_MAX / 2;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if (x > y) swap(x, y);
		v[x] += v[y]; v[y] = x;
	}
	bool root(int x) { return v[x] < 0; }
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

ll pow_mod(ll x, ll n, int M) {
	ll ans = 1;
	for (; n; n>>=1) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
	}
	return ans;
}

map<vector<int>, int> mp[200];

int main() {
	int N, M, A; cin >> N >> M >> A;
	union_find a(M);
	int ans = 0;
	for (int i = 0; i + M <= N; i++) {
		mp[i][a.v] = (mp[i][a.v] + pow_mod(A, i, MOD)) % MOD;
		for (auto p: mp[i]) {
			vector<int> a = p.first;
			int x = p.second, z = x;
			for (int j = 0; j < M; j++)
				if (a[j] < 0)
					z = (ll)z * A % MOD;
			ans = (ans + z * pow_mod(A, N - (i + M), MOD)) % MOD;
			for (int d = 1; i + d + M <= N; d++)
				if (d <= M - 1) {
					union_find uf(M); uf.v = a;
					for (int j = 0; j + d < M; j++)
						uf.unite(j, j + d);
					for (int j = 0; j < M; j++)
						uf.find(j);
					int& _x = mp[i + d][uf.v];
					_x = (_x - x) % MOD;
				}
				else {
					int& _x = mp[i + d][a];
					_x = (_x - x * pow_mod(A, d - M, MOD)) % MOD;
				}
		}
	}
	cout << (ans + MOD) % MOD << endl;
}

Measured memory_bytes: 29120
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H & b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H & b) const { return x == b.x && y == b.y; }
	bool operator!=(const H & b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T & a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T & a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int a[3000];
signed main() {
	int r, d, x;
	cin >> r >> d >> x;
	for (int i = 2001; i <= 2010; i++) {
		x = r * x - d;
		cout << x << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
 
void solve(){
    ll n;
    cin >> n; 
    ll ans = 0;
    for(ll i = 1; i <= n; ++i) {
        if(i % 3 != 0 && i % 5 != 0)
            ans += i;
    }
    cout << ans;
} 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	string s;
	cin>>s;
	string out="CODEFESTIVAL2016";
	int co=0;
	rep(i,s.size())if(s[i]!=out[i])co++;
	cout<<co<<endl;
}








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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

signed main() {
    
    string a, b,c;
    cin >> a >> b >> c;
    
    if(a[a.length()-1] == b[0] &&
       b[b.length()-1] == c[0]) YES;
    else NO;
    
    return 0;
}


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

int main() {
    vector<vector<int>> card(3, vector<int>(3));
    vector<int> list(9);
    int i, j, N;
    int k = 0;
    for (i = 0; i < 3; i++) {
        for (j = 0; j < 3; j++) {
            cin >> card.at(i).at(j);
            list.at(k + j) = card.at(i).at(j);
        }
        k += 3;
    }
    cin >> N;
    vector<int> num(N);
    for (i = 0; i < N; i++) {
        cin >> num.at(i);
        for (j = 0; j < 9; j++){
            if (num.at(i) == list.at(j)) list.at(j) = 0;
        }
    }
    
    //ビンゴ判定
    long long cal = 1;
    vector<int> jdg(8);
    jdg.at(0) = list.at(0) + list.at(1) + list.at(2);
    jdg.at(1) = list.at(3) + list.at(4) + list.at(5);
    jdg.at(2) = list.at(6) + list.at(7) + list.at(8);
    jdg.at(3) = list.at(0) + list.at(3) + list.at(6);
    jdg.at(4) = list.at(1) + list.at(4) + list.at(7);
    jdg.at(5) = list.at(2) + list.at(5) + list.at(8);
    jdg.at(6) = list.at(0) + list.at(4) + list.at(8);
    jdg.at(7) = list.at(2) + list.at(4) + list.at(6);
    
    for (i  = 0; i < 8; i++) {
        cal *= jdg.at(i);
    }
    if (cal == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
    int n;
    int ans = 0;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        if (i % 2 == 0) {
            continue;
        }
        int div = 0;
        for(int j = 1; j <= i; j++) {
            if (i % j == 0) {
                div++;
            }
        }
        if (div == 8) {
            ans++;
        }
    }
    printf("%d", ans);
    return 0;
}

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

int cmp(const void *a,const void *b){
  return *(int*)a - *(int*)b;
}

int main(void){
  int a[3],ans=0;
  scanf("%d %d %d",&a[0],&a[1],&a[2]);
  qsort(a,3,sizeof(int),cmp);
  ans+=(a[2]-a[1])+(a[2]-a[0]);
  if(ans%2!=0)ans+=4;
  ans/=2;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

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

  int L = s / 100;
  int R = s % 100;

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

Measured memory_bytes: 256