akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll n = inl();
        vl a(n);

        rep(i, n) cin >> a[i];
        multiset<ll> s; // 最小のもの
        s.insert(a[0]);

        for (ll i = 1; i < n; ++i) {
            ll now = a[i];
            auto itr = s.lower_bound(now);
            if (itr == s.begin()) {
            } else {
                s.erase(--itr);
            }
            s.insert(now);
        }
        cout << s.size() << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 5760
N,M = map(int,input().split())
WAlist = [[0,"WA"]  for i in range(N)]
AC = WA = 0
for i in range(M):
    p,S = input().split()
    p = int(p)
    if S=="WA"and WAlist[p-1][1]=="WA":
        WAlist[p-1][0] += 1
    elif S=="WA" and WAlist[p-1][1]=="AC" or S=="AC"and WAlist[p-1][1]=="AC":
        continue
    elif S=="AC" and WAlist[p-1][1]=="WA":
        WAlist[p-1][1] = "AC"
        AC += 1

for j in range(N):
    if WAlist[j][1]=="AC":
        WA += WAlist[j][0]

print(AC,WA)

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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	int a, b, c, x;
	cin >> a >> b >> c >> x;

	int ans = 0;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (500 * i + 100 * j + 50 * k == x) {
					ans++;
				}
			}
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define DBG 0 //submit 0
#define ll long long
#if DBG
    #include <algorithm>
    #include <array>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <unordered_map>
    #include <iostream>
    #include <cmath>
    #include <queue>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif
 
using namespace std;
 
 
int main(){
    int n=0,ans;
    char s[10];
    for(int i = 0;i<3;i++){
        cin >> s[i];
    }
    for(int i = 0;i<3;i++){
        if(s[i] == 'o') n++;
    }

    ans = 700+100*n;
    //cout << (!flag ? "Yes" : "No") << endl;
    cout << ans << endl;
 
}


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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N,K; cin >> N>>K;
    vector<int> L(N); cin >> L;
    
    sort(ALL(L),greater<int>());
    int ans = accumulate(L.begin(), L.begin()+K, 0);

    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
s1 = input()
s2 = input()

if s1[0] == s2[0]:
  result = 3
  last_pattern = "h"
  place = 1
else:
  result = 6
  last_pattern = "w"
  place = 2
while place < n:
  if last_pattern == "h":
    if s1[place] == s2[place]:
      result *= 2
      last_pattern = "h"
      place += 1
    else:
      result *= 2
      last_pattern = "w"
      place += 2
  else:
    if s1[place] == s2[place]:
      last_pattern = "h"
      place += 1
    else:
      result *= 3
      last_pattern = "w"
      place += 2
print(result % (7 + 10**9))

Measured memory_bytes: 3064
import java.util.*;
class Main{
    Scanner sc=new Scanner(System.in);
    void main(){
	int a=sc.nextInt();
	int b=sc.nextInt();
	int c=sc.nextInt();
	if(a<b&&b<c)System.out.println("Yes");
	else System.out.println("No");
    }
    public static void main(String[]ag){
	new Main().main();
    }
}

Measured memory_bytes: 26096
#include <bits/stdc++.h>
#include <climits>
#include <sstream>
using namespace std;
using Data = pair<long long, vector<int>>;

int main() {
    vector<long long> N(3);
    int K;
    for(int i = 0; i < 3; i++) cin >> N[i];cin >> K;
    vector< vector<long long> > v(3);
    for(int iter = 0; iter < 3; ++iter){
        v[iter].resize(N[iter]);
        for(int i = 0; i < N[iter]; i++) cin >> v[iter][i];
        sort(v[iter].begin(),v[iter].end(),greater<long long>());
    }
    priority_queue<Data> que;
    set<Data> se;
    que.push(Data(v[0][0] + v[1][0] + v[2][0], vector<int>({0, 0, 0})));
    for(int k = 0; k < K; k++){
        auto c = que.top(); que.pop();
        cout << c.first << endl;
        
        //次の三候補
        for(int iter = 0; iter < 3; iter++){
            if(c.second[iter] + 1 < N[iter]){
                long long sum = c.first - v[iter][c.second[iter]] + v[iter][c.second[iter]+1];
                auto num = c.second; num[iter]++;
                auto d = Data(sum,num);
            //既にpushされたもの以外
            if(!se.count(d))se.insert(d),que.push(d);
            }
        }
    }
}



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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

string s;
int t[100010];
int m[100010];
int a = -1, b = -1;

int main() {
    cin >> s;

    rep(c, 26) {
	rep(i, s.size()) {
	    t[i + 1] = t[i] + (s[i] == ('a' + c));
	}

	rep(i, s.size() + 1) {
	    m[i] = t[i] * 2 - i; 
	}

	int mi = 114514, p = -1;

	rep(i, s.size() + 1) {
	    if (m[i] > mi) {
		printf("%d %d\n", p + 1, i);
		return 0;
	    }

	    if (i) {
		if (m[i - 1] < mi) {
		    mi = m[i - 1];
		    p = i - 1;
		}
	    }
	}
    }

    puts("-1 -1");

    return 0;
}

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

int jd[2010][2010] ;
int pp[2010][2010] ;
int pp2[2010][2010] ;

int main() {

    int h, w;
    cin >> h >> w ;
    for(int i = 0; i < h; i++){

        for(int j = 0; j < w; j++){

            char tmp ;
            cin >> tmp ;
            if(tmp == '#'){
                jd[i][j] = 0 ;
            }else{
                jd[i][j] = 1 ;
            }
            if(j>0){
                pp[i][j] = (pp[i][j-1]+1)*jd[i][j] ;
            }else{
                pp[i][j] = jd[i][j] ;
            }
            if(i>0){
                pp2[i][j] = (pp2[i-1][j]+1)*jd[i][j] ;
            }else{
                pp2[i][j] = jd[i][j] ;
            }

        }

    }
    for(int i = h-2; i >= 0; i--){

        for(int j = w-2; j >= 0; j--){

            if(jd[i][j] != 0){
                pp[i][j] = max(pp[i][j+1], pp[i][j]) ;
                pp2[i][j] = max(pp2[i+1][j], pp2[i][j]);
            }

        }

    }
    int ans = 0 ;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            ans = max(ans, pp[i][j]+pp2[i][j]-1);
        }
    }
    cout << ans ;
    return 0;
}


Measured memory_bytes: 47488
using System;
using System.Text;

namespace CGL_1_B_Reflection
{
	class Program
	{
		static void Main ( string[] args )
		{
			int[] inputNum = Array.ConvertAll (Console.ReadLine ().Split (' '), int.Parse);
			int inputCount = int.Parse (Console.ReadLine ());

			StringBuilder output = new StringBuilder (inputCount * 10 * 2);

			Vector2 beginPoint = new Vector2 (inputNum[0], inputNum[1]);
			Vector2 endPoint = new Vector2 (inputNum[2], inputNum[3]);

			for (int lp = 0; lp < inputCount; lp++)
			{
				inputNum = Array.ConvertAll (Console.ReadLine ().Split (' '), int.Parse);

				Vector2 result = Vector2.Reflection (beginPoint, endPoint, new Vector2 (inputNum[0], inputNum[1]));

				output.Append (result.X);
				output.Append (" ");
				output.Append (result.Y);
				output.AppendLine ();
			}

			Console.Write (output);
		}
	}

	class Vector2
	{
		public Vector2 ( decimal x, decimal y )
		{
			this.X = x;
			this.Y = y;
		}

		public decimal X { private set; get; }
		public decimal Y { private set; get; }

		public static Vector2 operator + ( Vector2 ob1, Vector2 ob2 )
		{
			return new Vector2 (ob1.X + ob2.X, ob1.Y + ob2.Y);
		}
		public static Vector2 operator - ( Vector2 ob1, Vector2 ob2 )
		{
			return new Vector2 (ob1.X - ob2.X, ob1.Y - ob2.Y);
		}
		public static Vector2 operator * ( Vector2 ob, decimal scalar )
		{
			return new Vector2 (ob.X * scalar, ob.Y * scalar);
		}

		public decimal Length ()
		{
			return X * X + Y * Y;
		}
		public static decimal DotProduct ( Vector2 ob1, Vector2 ob2 )
		{
			return ob1.X * ob2.X + ob1.Y * ob2.Y;
		}
		public static Vector2 Reflection ( Vector2 beginPoint, Vector2 endPoint, Vector2 point )
		{
			Vector2 segment = endPoint - beginPoint;
			decimal ratio = Vector2.DotProduct (point - beginPoint, segment) / segment.Length ();
			Vector2 projectionPoint = beginPoint + segment * ratio;

			return point + (projectionPoint - point) * 2;
		}
	}
}

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

int main()
{
  int N, W;
  cin >> N >> W;
  vector<int> v(N), w(N);
  for (int i = 0; i < N; i++)
  {
    cin >> v[i] >> w[i];
  }
  vector<vector<int>> dp(N + 1, vector<int>(W + 1, 0));
  for (int i = 1; i <= N; i++)
  {
    for (int j = 0; j <= W; j++)
    {
      dp[i][j] = max(dp[i][j], dp[i - 1][j]);
      if (j - w[i - 1] >= 0)
      {
        dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
      }
    }
  }
  cout << dp[N][W] << endl;
}


Measured memory_bytes: 6800
x1,x2,x3,x4,x5=map(int,input('').split(' '))
if x1!=1:
    print(1)
elif x2!=2:
    print(2)
elif x3!=3:
    print(3)
elif x4!=4:
    print(4)
elif x5!=5:
    print(5)

Measured memory_bytes: 9040
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define jkl int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<int, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7


int main(){
    ll n;
    ll a[200002];
    cin >> n;
    REP(i, n)cin >> a[i];
    VE ans;
    ll q = n - 1;

    while(q >= 0){
        ans.push_back(a[q]);
        q -= 2;
    }
    if(n % 2){q = 1;}
    else q = 0;
    while(q < n){
        ans.push_back(a[q]);
        q += 2;
    }
    REP(i, ans.size() - 1)cout << ans[i] << " ";
    cout << ans[ans.size() - 1];
}

Measured memory_bytes: 5360
//Solution by NurlashKO
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <stack>
#include <list>
#include <map>
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
const int sz = 1e6;
#define pb push_back
 
int n, m, v, u, cnt[sz][2], was[sz], q[sz], l, r;
string s;
vector <int> a[sz];

int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin >> n >> m;
    cin >> s;
    
    for (int i = 1; i <= m; i++) {
        cin >> v >> u;
        v--;u--;
        a[v].pb(u);
        a[u].pb(v);
        cnt[v][s[u] - 'A']++;
        cnt[u][s[v] - 'A']++;
    }
    for (int i = 0; i < n; i++) {
        if (!cnt[i][0] || !cnt[i][1]) {
            q[r++] = i;
            was[i] = 1;
        }
    }
    
    while (l < r) {
        v = q[l++];
        for (int to: a[v]) {
            cnt[to][s[v] - 'A']--;
            if (!was[to] && (!cnt[to][0] || !cnt[to][1])) {
                was[to] = 1;
                q[r++] = to;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (!was[i]) {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 34384
import java.util.*;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int s= scan.nextInt();
		int w = scan.nextInt();
		
		if(s<=w) {
			System.out.println("unsafe");
		}else {
			System.out.println("safe");
		}
		
	}	
	
	
	//最小公約数
	/*
	static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	*/
	
}

Measured memory_bytes: 35860
#include <stdio.h>

int main(){
    int n;
    int ans=0;
    int total = 0;
    scanf("%d", &n);
    for (int i = 0; i <=n ; ++i) {
        for (int j = 0; j <=n ; ++j) {
            total = 4*i+7*j;
            if(total == n){
                ++ans;
            }
        }
    }
    if(ans>0){
        printf("Yes");
    }else{
        printf("No");
    }
}

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

int * Include_Number(char *);

#define MAX 398
int main() {
  char stack[MAX];
  int i,j=0;
  int number[100] = {};
  int num;
  int len_number=0;
  char type[99];
  int len_stack;
  int result=0;
  int res[100]={};
  int s=0,t;

  //一行の入力
  fgets(stack,MAX,stdin);
  //printf("%s\n",stack);
  len_stack = strlen(stack);
  //printf("%d\n",len_stack);

  for(i=0;i<len_stack;i++) {
    if(stack[i] >=48 && stack[i] <= 57 && stack[i+1] == ' ') {
      number[j] = atoi(&stack[i]);
      j++;
    } else
     if(stack[i] >=48 && stack[i] <= 57 && stack[i+1] != ' ') {
       //printf("check\n");
      number[j] = atoi(&stack[i]);
      num = number[j];
      //桁数が２桁以上の場合、それを一つに格納したあと、次の空\\
白まで飛ぶ
      while(num!=0) {
        num = num / 10;
        len_number++; //桁数
      }
      i+=len_number;
      j++;
    }
    //桁数を０に戻す
    len_number=0;

    //printf("%d ",i);

    t=j;//見ている箱
    //printf("%d;%d\n",i,t);
    switch(stack[i]) {
    case 43: //"+"
      //printf("%d;%d\n",i,t);
        number[t-2] += number[t-1];
        number[t-1] = 0;
        //number[t] = 0;
      j-=1;
      break;
    case 45: //"-"
      //printf("%d;%d\n",i,t);
        number[t-2] -= number[t-1];
        number[t-1] = 0;
        //number[t] = 0;
      j-=1;
      break;
    case 42: //"*"
      //printf("%d;%d\n",i,t);
        number[t-2] *= number[t-1];
        number[t-1] = 0;
        //number[t] = 0;
      j-=1;
      break;
    case 47: //"/"
      //printf("%d;%d\n",i,t);
        number[t-2] /= number[t-1];
        number[t-1] = 0;
        //number[t] = 0;
      j-=1;
      break;
    }
  }


  printf("%d\n",number[0]);

  return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <unistd.h>
#include <stdlib.h>

using namespace std;
// using namespace atcoder;

// using mint = long double;
// using mint = modint998244353;
// using mint = modint1000000007;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;

const ll INF = 2e18;
const ll fact_table = 3200008;

priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

// const ll mod = 998244353ll;
const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll m = mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= m; b >>= 1;}(x *= a) %= m; b--;} return x;}
vec readvec(ll read) { vec res(read); for (int i = 0; i < read; i++) { cin >> res[i]; } return res;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod ) * rfact[n - r]) % mod;
}
*/

bool multicase = false;

void solve() {
    ll k;
    cin >> k;
    for(int i=0;i<k;i++){
        pu("ACL");
    }
    el;
    return;
}


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

    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }

    // solve();
    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;
import java.io.*;

class Main {
    public static void main(String[] args)throws IOException{ 
    	InputStreamReader in = new InputStreamReader(System.in);
        BufferedReader read = new BufferedReader(in);
    	   	                                                 
        String line = read.readLine();
        String [] spli = line.split(" ");
        double x1 = Double.parseDouble(spli[0]);
        double y1 = Double.parseDouble(spli[1]);
        double x2 = Double.parseDouble(spli[2]);
        double y2 = Double.parseDouble(spli[3]);
        double root;

        root = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
        System.out.println(Math.sqrt(root));
    }
}

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

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

	ll tmp = 0, ten = 1;
	ll cnt[2020] = { 0 };
	for (int i = s.size() - 1; i >= 0; i--) {
		tmp = (tmp + ten * (s[i] - '0')) % 2019;
		ten *= 10;
		ten %= 2019;
		cnt[tmp]++;
	}
	ll ans = 0;
	for (int i = 0; i <= 2019; i++) 
		ans += cnt[i] * (cnt[i] - 1) / 2;
	ans += cnt[0];
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3748
import java.util.Scanner;

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

			int k = sc.nextInt();
			int s = sc.nextInt();
			int sum = 0;

			int count = 0;
			for (int i = 0; i <= k; i++) {
				for (int j = 0; j <= k; j++) {
					sum = s - (i + j);
					if (sum >= 0 && sum <= k) {
						count++;
					}
				}
			}

			System.out.println(count);
		}
	}

}


Measured memory_bytes: 22868
# A - 和風いろはちゃんイージー
def main():
    abc = list(map(int, input().split()))
    c5 = 0
    c7 = 0

    for i in abc:
        if i == 5:
            c5 += 1
        elif i == 7:
            c7 += 1
    else:
        if c5 == 2 and c7 == 1:
            print('YES')
        else:
            print('NO')

            
if __name__ ==  "__main__":
    main()

Measured memory_bytes: 8944
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
#define PP 1000000007
using namespace std;

ll S, sum = 0;

int main(){
cin >> S;
vector<ll> DP{0, 0, 1, 1, 1};


rep(i, 2, S + 1){

  sum += DP[i];sum %= PP;

  DP.push_back(sum + 1);

}

cout << DP[S - 1];

}

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

using namespace std;
int n,k;
const long long Mod = 1e9+7;
long long G[200001];
long long power(long long n,long long x)
{
    if(x==0)
        return 1;
    if(x&1)
        return n*power(n*n%Mod,x/2)%Mod;
    return  power(n*n%Mod,x/2);
}
long long nck(int n,int k)
{
    return G[n] *(power(G[k]*G[n-k]%Mod,Mod-2))%Mod;
}
long long res = 0;
int main()
{
    cin>>n>>k;
    G[0]=1;
    for(int i=1;i<=n;i++)
    {
        G[i]=G[i-1]*i%Mod;
    }
    for(int x = 0 ; x<=min(k,n-1);x++)
    {
        res += nck(n-1,n-x-1) * nck(n,x)%Mod;
        res%=Mod;
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000


int main(){

	int N;
	cin>>N;
	
	vector<int> C(N);
	for(int i=0;i<N;i++){
		cin>>C[i];
	}
	
	vector<int> dp(N,1);
	
	vector<int> cnt(200002,0);
	cnt[C[0]]=1;
	
	for(int i=1;i<N;i++){
		if(C[i]==C[i-1]){
			dp[i] = dp[i-1];
		}
		else{
			int K = dp[i-1];
			K = mod(K + cnt[C[i]]);
			dp[i] = K;
			cnt[C[i]] = mod(cnt[C[i]] + dp[i-1]);
		}
	}
	
	cout<<dp.back()<<endl;
	
	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define pf push_front
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
int M,K;
deque <int> ans;

bool vis[300001];

int ans1[6] = {3,1,3,2,1,2};

int main(){
	fast;
  	cin>>M>>K;
	
	if (K > (1<<M) - 1){
		cout<<-1;
		return 0;
	}
	
	if (ceil(log2(K)) == floor(log2(K)) && K != 0){
		if (K+1 > (1<<M) - 1){
			cout<<-1;
			return 0;
		}
		
		if (K == 1){
			if (3 > (1<<M) - 1){
				cout<<-1;
				return 0;
			}
			ans.pb(K); ans.pb(3); ans.pf(3); ans.pb(2); ans.pf(2);
			vis[3] = vis[2] = vis[1] = 1;
		}else{
			ans.pb(K); ans.pb(K+1); ans.pf(K+1); ans.pb(1); ans.pf(1);
			vis[K] = vis[K+1] = vis[1] =  1;
		}
		
		FOR(i,0,(1<<M) - 1){
			if (!vis[i]) ans.pb(i), ans.pf(i);
		}
		
		ans.pb(K);
		while (!ans.empty()) cout<<ans.front()<<' ', ans.pop_front();
		return 0;
		
	}
	
	if (K == 0){
		FOR(i,0,(1<<M) - 1) ans.pb(i),ans.pf(i);
		
		while (!ans.empty()) cout<<ans.front()<<' ',ans.pop_front();
		return 0;
	}
	ans.pb(K);
	
	vis[K] = 1;
	
	
	
	
	FOR(i,0,(1<<M)-1){
		if (!vis[i]){
			ans.pb(i);
			ans.pf(i);
		}
	}
	ans.pb(K);
	
	while (!ans.empty()){
		cout<<ans.front()<<' ';
		ans.pop_front();
	}
	
}
      	
	




Measured memory_bytes: 3200
import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]-=i
a.sort()

a.sort()
ans=0
median=a[n//2]
for i in range(n):
    ans+=abs(a[i]-median)
print(ans)



Measured memory_bytes: 78804
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int a,b,c,x;
  cin >> a >> b >> c >> x;
  
  int ans = 0;
    
  REP(i,a+1){
    REP(j,b+1){
      REP(k,c+1){
        if(x == i*500 + j*100 + k*50) ans++;
      }
    }
  }
  
  cout << ans << endl;

 return 0;
}

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

int main(){
  int n,a=0;
  cin >> n;

  vector<int> x(n);
  vector<int> y(n);

  long double ans=0,cou;
 
  for(int i=0;i<n;i++){
    cin >> x.at(i) >> y.at(i);
  }

  if(n==2){
    long double f=sqrtl((x.at(0)-x.at(1))*(x.at(0)-x.at(1))+(y.at(0)-y.at(1))*(y.at(0)-y.at(1)));
    cout << setprecision(12) << f << endl;
    return 0;
  }
  else{
  for(int i=0;i<n-1;i++){
    for(int l=i+1;l<n;l++){
      ans+=sqrtl((x.at(i)-x.at(l))*(x.at(i)-x.at(l))+(y.at(i)-y.at(l))*(y.at(i)-y.at(l)));
    }
  }

  if(n==3){cou=2.0/3.0;}
  if(n==4){cou=3.0/6.0;}
  if(n==5){cou=4.0/10.0;}
  if(n==6){cou=5.0/15.0;}
  if(n==7){cou=6.0/21.0;}
  if(n==8){cou=7.0/28.0;}

  ans=ans*cou;

  cout << setprecision(12) << ans <<endl;
  return 0;
  }





}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
signed main(){
	
	int n;
	cin>>n;
	int a[1111];
	rep(i,5)cin>>a[i];
	sort(a,a+5);
	int ans=5+ceil((double)n/(double)a[0])-1;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    
    if(a*b*c%2==0){
        cout<<0;
    }else{
        cout<<min(min(a*b,a*c),b*c);
    }
    
    
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
unittest
{
	assert( [ "5 3", "1 2 3 4 5" ].parse.expand.solve == 12 );
	assert( [ "15 14", "50 26 27 21 41 7 42 35 7 5 5 36 39 1 45" ].parse.expand.solve == 386 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( long[] );
	input.popFront;
	auto ls = input.front.split.to!( long[] );
	return tuple( nk[ 1 ], ls );
}

auto solve( long k, long[] ls )
{
	return ls.sort!( ( a, b ) => b < a ).take( k ).sum;
}


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

//ans = 境界の数

int main() {
    string s;
    cin >> s;
    char c = s[0];
    int ans = 0;
    for (int i = 0; i < s.size()-1; i++) {
        if (c != s[i+1]) {
            ans++;
            c = s[i+1];
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 512
from collections import Counter


def factorize(n):
    a = 2
    fct = []
    while a * a <= n:
        while n % a == 0:
            n //= a
            fct.append(a)
        a += 1
    if n > 1:
        fct.append(n)
    return fct


N, P = map(int, input().split())
f = factorize(P)
c = Counter(f)
ans = 1
for k, v in c.items():
    ans *= k ** (v // N)
print(ans)

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


int main(void) {
	int N, M;
	cin >> N >> M;

	long long ans = 1;
	if (abs(N-M) > 1) {
		cout << 0 << endl;
		return 0;
	}

	if (abs(N-M) == 1) {
		ans *= std::max(N, M);
		N = std::min(N, M);
	} else {
		ans *= 2;
	}
	for (int i = N; i > 1; i--) {
		ans *= i;
		ans %= 1000000007;
		ans *= i;
		ans %= 1000000007;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
for i in range(20):
    n = int(input())
    
    if n == 0:
        break
    
    data = list()
    for j in range(n):
        a = int(input())
        data.extend([a])
    #print(data)
    
    x = sum(data) - min(data) - max(data)
    #print(x)
    print(x // (n-2) )


Measured memory_bytes: 5592
# coding: utf-8

(n, k) = map(int, input().rstrip().split(" "))


class Result:
    def __init__(self, win: int, lose: int):
        self.win = win
        self.lose = lose
        self.total = win + lose


dic = {}


def get_ans(current: int):
    if current >= k:
        return Result(1, 0)
    if current in dic:
        return dic[current]
    ret = get_ans(current * 2)
    ret = Result(ret.win, ret.lose + ret.total)
    dic[current] = ret
    return ret


result_list = [get_ans(i) for i in range(1, n+1)]
max_total = max([i.total for i in result_list])

win_total = 0
lose_total = 0
for i in result_list:
    mul = int(max_total / i.total)
    win_total += i.win * mul
    lose_total += i.lose * mul

print(win_total/(win_total+lose_total))

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

int main(){
    int d, n;
    cin >> d >> n;
    int b = pow(100, d);
    if (n < 100) cout << n * b << endl;
    else cout << 101 * b << endl;
    return 0;
}

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

int main(){
  int s;
  cin>>s;
  vector<char> plmi(3);
  plmi.at(0)='+';
  plmi.at(1)='+';
  plmi.at(2)='+';
  int A=s/1000;
  int B=s/100-A*10;
  int C=s/10-A*100-B*10;
  int D=s%10;
  int E=(A+B+C+D-7)/2;
  if(B==E){
    plmi.at(0)='-';
  }else if(C==E){
    plmi.at(1)='-';
  }else if(D==E){
    plmi.at(2)='-';
  }else if(B+C==E){
    plmi.at(0)='-';
    plmi.at(1)='-';
  }else if(B+D==E){
    plmi.at(0)='-';
    plmi.at(2)='-';
  }else if(C+D==E){
    plmi.at(1)='-';
    plmi.at(2)='-';
  }else if(B+C+D==E){
    plmi.at(0)='-';
    plmi.at(1)='-';
    plmi.at(2)='-';
  }
  cout<<A<<plmi.at(0)<<B<<plmi.at(1)<<C<<plmi.at(2)<<D<<"=7"<<endl;
  
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
  public static void main(String[] args) {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      long n, m, result = 0;
      int ind;
      String str;

      str = reader.readLine();
      ind = str.indexOf(" ");
      n = Long.parseLong(str.substring(0, ind));
      m = Long.parseLong(str.substring(ind+1));

      if(n == 1){
        if(m == 1){
          result = 1;
        }else{
          result = m-2;
        }
      }else if(n == 2){
        result = 0;
      }else{
        if(m == 1){
          result = n-2;
        }else if(m == 2){
          result = 0;
        }else{
          result = (n-2)*(m-2);
        }
      }

      System.out.println(result);
    }
    catch (Exception e) {

    }
  }
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=1e9+7;
#define N 2010

int n,m;
ll dp[N][N],fac[N*N],inv[N*N];

ll power(ll x,ll y) {
	ll ret=1;
	for (;y;y>>=1,x=x*x%mod)
		if (y&1) ret=ret*x%mod;
	return ret;
}

ll C(ll x,ll y) {
	if (y>x) return 0;
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}

int main()
{
	scanf("%d%d",&n,&m);
	if (m==1) return puts("1"),0;
	fac[0]=1; for (int i=1;i<=n*m;i++) fac[i]=fac[i-1]*i%mod;
	inv[n*m]=power(fac[n*m],mod-2);
	for (int i=n*m-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
	dp[0][1]=1;
	for (int i=2;i<=n;i++) dp[0][i]=dp[0][i-1]*C(i*(m-1)-1,m-2)%mod;
	for (int i=1;i<=n;i++)
		for (int j=i;j<=n;j++)
			dp[i][j]=(dp[i-1][j]+dp[i][j-1]*C(j*(m-1)+i-1,m-2)%mod)%mod;
	printf("%lld\n",dp[n][n]*fac[n]%mod);
	return 0;
}

Measured memory_bytes: 94592
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;

int main() {
	int x, a, b; cin >> x >> a >> b;
	if (a >= b)cout << "delicious" << endl;
	else if (x >= b - a)cout << "safe" << endl;
	else cout << "dangerous" << endl;
}

Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
a,b,c,d = iim()

print(max(min(b,d)-max(a,c),0))

Measured memory_bytes: 3060
require 'pp'
require 'set'

n = gets.chomp!.to_i
works = { 
    # limit => total_time
}
limits = SortedSet.new
n.times do |i|
    time, limit = gets.chomp!.split(" ").map(&:to_i)
    works[limit] = (works[limit] || 0) + time
    limits << limit
end

#pp works
#pp limits

now = 0
success = true
limits.each do |limit|
    time = works[limit]
    now += time
    if now > limit
        success = false
        break
    end
    #puts now
end

puts success ? "Yes" : "No"


Measured memory_bytes: 31480
def gcd1(x,y):
    d = x % y
    while d != 0:
        x,y = y,d
        d = x % y
    return y

def gcd(x,y):
    if x < y:
        x,y = y,x
    return gcd1(x,y)

N,X = map(int,input().split())
xList = list(map(int,input().split()))

xList.append(X)
xList.sort()
dList = []
for i in range(len(xList)-1):
    d = xList[i+1]-xList[i]
    dList.append( d )

if len(dList) == 1:
    print( dList[0])
else:
    d = gcd(dList[0],dList[1])
    for i in range(2,len(dList)):
        d = gcd(d,dList[i])
    print(d)

Measured memory_bytes: 14480
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define modulo 998244353
#define endl '\n'
#define pb push_back
using namespace std;
vector <int> adj[100001];
ll fxp(ll a, ll b)
{
    if(b == 0)return 1;
	if(b%2 == 0){
		ll c = fxp(a,b/2);
		return (c*c)%1000000007;
	}
	return (a*fxp(a,b-1))%1000000007;
}
int lcm(int c,int d)
{
    int a=c;
    int b=d;
    int ans;
    if(a>=b)
    {
        while(b!=0)
        { 
            int x=b;
            b=a%b;
            a=x;
        }
        ans = ( c*d)/a;
    }
    else
    {
        while(a!=0)
        {
            int x=a;
            a=b%a;
            b=x;
        }
        ans = ( c*d)/b;  
    }
    return ans;
}
int root_find()
{
    ll x;
    for(int i=1;i<100001;i++)
    {
        if(adj[i].size()==1)
        {
            x = i;
            break;
        }
    }
    return x;
}
void dfs(int s,int y)
{
    for(int i=0;i<adj[s].size();i++)
    {
        if(adj[s][i]==y)
        continue;
        dfs(adj[s][i],s);
    }
}
bool isPrime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
ll smallestDivisor(ll n) 
{ 
    // if divisible by 2 
    if (n % 2 == 0) 
        return n/2; 
  
    // iterate from 3 to sqrt(n) 
    for (int i = 3; i * i <= n; i += 2) { 
        if (n % i == 0) 
            return n/i; 
    } 
  
    return n; 
}  
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    char ch[26];
    ch[0]='a';
    for(int i=1;i<26;i++)
        ch[i]=ch[i-1]+1;
    vector <ll> v;
    v.push_back(0);
    ll x = 1;
    for(int i=1;i<=11;i++)
    {
        x = x*26;
        v.push_back(v.back()+x);
    }
    ll y = lower_bound(v.begin(),v.end(),n)-v.begin();
    //cout<<y;
    n = n - v[y-1];
    vector <char> arr;
    while(y>0)
    {
        vector <ll> pos;
        pos.pb(0);
        for(int i=1;i<=26;i++)
        pos.pb(i*(pow(26,y-1)));
        ll k = lower_bound(pos.begin(),pos.end(),n)-pos.begin();
        n = n - pos[k-1];
        arr.push_back(ch[k-1]);
        y--;

    }
    for(int i=0;i<arr.size();i++)
    cout<<arr[i];
    cout<<endl;

    return 0;
}

Measured memory_bytes: 6440
// *INDENT-OFF*
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef pair<int, int>pii;typedef pair<ll, int>pli;typedef pair<ll,ll>pll;typedef pair<double,double>pdd;typedef long double ld;
pll exgcd(const ll x,const ll y){if(!y)return{1,0};pll cur=exgcd(y,x%y);return {cur.second,cur.first-(x/y)*cur.second};}
template<typename T>ostream &operator<<(ostream &out,const vector<T>&vec){const int n=vec.size();out<<'[';for(int i=0;i<n;i++)out<<vec[i]<<(i==n-1?"":", ");out<<']';return out;}
template<typename T,typename U>ostream &operator<<(ostream&out,const pair<T,U>&p){out<<'<'<<p.first<<", "<<p.second<<'>';return out;}
const ll __mod__=998244353ll;ll mod(ll x,ll p=__mod__){return((x%p)+p)%p;}ll mmod(){return 1ll;}ll fpow(ll a,ll b,ll m){ll ans=1ll;for(a%=m;b;a=a*a%m,b>>=1)if(b&1)ans=ans*a%m;return ans;}
template<typename...U>ll mmod(const ll&hd,const U&...tl){return mod((hd%__mod__)*mmod(tl...),__mod__);}
void print(){cout<<"\n";}template<typename T,typename...U>void print(const T&hd,const U&...tl){cout<<hd<<(sizeof...(tl)?" ":"");print(tl...);}
inline ll fmul(ll a,ll b,ll m){ll d=(ll)floor(a*(ld)b/m+0.5);ll r=(a*b-d*m)%m;if(r<0)r+=m;return r;}void Main();
#ifdef ConanYu
void err(){cerr<<"\n";}template<typename T,typename...U>void err(const T&hd,const U&...tl){cerr<<hd<<(sizeof...(tl)?", ":"");err(tl...);}
#define debug(x...) {cerr<<""#x" = ";err(x);}
#else
#define debug(...) 0
#endif
#define SZ(o) (int(o.size()))
#define all(o) o.begin(), o.end()
int main() {
#ifdef ConanYu
  clock_t clock_start = clock();assert(freopen("test.txt", "r", stdin));
#else
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
  int T = 1;
  // cin >> T;
  while(T--) Main();
#ifdef ConanYu
  cerr << "time: " << ((clock() - clock_start) * 1.0 / CLOCKS_PER_SEC) << "\n";
#endif
  return 0; }
// *INDENT-ON*
// ********************************************************************************************************

ll Get(ll a, ll b, ll x) {
  return b / x - (a - 1) / x;
}

void Main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll lcm = c * d / __gcd(c, d);
  ll ans = b - a + 1 - (Get(a, b, c) + Get(a, b, d) - Get(a, b, lcm));
  print(ans);
}


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

int main() {
  int N;
  cin>>N;
  int ans=0;
  for(int i=0;i<N;i++){
    int l,r;
    cin>>l>>r;
    ans+=r-l+1;
  }
  cout<<ans<<endl;
}


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

using namespace std;

int main()
{
  int testcase = 1;
  int N, B;
  while(scanf("%d %d", &N, &B), N) {
    vector< int > g[100000];
    for(int i = 1; i < N; i++) {
      int P;
      scanf("%d", &P);
      --P;
      g[P].emplace_back(i);
      g[i].emplace_back(P);
    }

    cout << "Case " << testcase++ << ":" << endl;

    if(N <= 2) {
      if(N == 1) cout << 1 << endl;
      else if(B == 1) cout << 2 << endl << 2 << endl;
      else cout << 1 << endl << 1 << endl;
      continue;
    }

    int root;
    for(int i = 0; i < N; i++) {
      if(g[i].size() >= 2) root = i;
    }

    vector< int > sz(N), dep(N), ans(N);

    function< void(int, int) > dfs1 = [&](int idx, int par)
    {
      int depmax = 1, size = 0;
      for(auto &to : g[idx]) {
        if(to != par) {
          dfs1(to, idx);
          if(depmax < dep[to]) depmax = dep[to], size = sz[to];
          else if(depmax == dep[to]) size += sz[to];
        }
      }
      if(size + 1 <= B) {
        sz[idx] = size + 1;
        dep[idx] = depmax;
      } else {
        sz[idx] = 1;
        dep[idx] = depmax + 1;
      }
    };


    function< void(int, int, int, int) > dfs2 = [&](int idx, int pardep, int parsz, int par)
    {
      map< int, int > vs;
      if(~par) vs[pardep] += parsz;
      for(auto &to : g[idx]) {
        if(to != par) vs[dep[to]] += sz[to];
      }
      const auto latte = prev(vs.end());
      if(latte->second + 1 <= B) ans[idx] = latte->first;
      else ans[idx] = latte->first + 1;

      for(auto &to : g[idx]) {
        if(to != par) {
          if(vs.find(dep[to]) == latte) {
            if(latte->second - sz[to] == 0) {
              assert(begin(vs) != latte);
              const auto malta = prev(latte);
              if(malta->second + 1 <= B) dfs2(to, malta->first, malta->second + 1, idx);
              else dfs2(to, malta->first + 1, 1, idx);
            } else {
              if(latte->second - sz[to] + 1 <= B) dfs2(to, latte->first, latte->second - sz[to] + 1, idx);
              else dfs2(to, latte->first + 1, 1, idx);
            }
          } else {
            if(latte->second + 1 <= B) dfs2(to, latte->first, latte->second + 1, idx);
            else dfs2(to, latte->first + 1, 1, idx);
          }
        }
      }
    };

    dfs1(root, -1);
    dfs2(root, 1, 0, -1);

    for(int i = 0; i < N; i++) {
      printf("%d\n", ans[i]);
    }
    fflush(stdout);

  }

}

Measured memory_bytes: 45576
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int k;
  map<int, bool> check;
  cin >> k;
  int memo = 7;
  reps(i, 1e8){
    if(check[memo]){
      cout << "-1\n";
      return 0;
    }
    check[memo] = true;
    memo %= k;
    if(memo == 0){
      cout << i << '\n';
      return 0;
    }
    memo = memo * 10 + 7;
  }
  return 0;
}


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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	int h, w;
	cin >> h >> w;
	char field[105][105];
	rep(j, w + 2) field[0][j] = '#';
	rep(j, w + 2) field[h + 1][j] = '#';
	rep(i, h + 2) field[i][0] = '#';
	rep(i, h + 2) field[i][w + 1] = '#';
	REP(i, h)REP(j, w) cin >> field[i][j];
	
	rep(i, h + 2) {
		rep(j, w + 2) {
			cout << field[i][j];
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.next();
        String str2 = sc.next();
        int count = 0;
        for (int i = 0; i < str1.length(); i++) {
            count += str1.charAt(i) != str2.charAt(i) ? 1 : 0;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 41424
n = int(input())
initial_vals = list(map(int, input().split(" ")))


# print(calc(0, n - 1))


arr = [0 for x in range(n)]

arr[1] = abs(initial_vals[0] - initial_vals[1])

for i in range(2, len(arr)):
    arr[i] = min(
        arr[i - 1] + abs(initial_vals[i - 1] - initial_vals[i]),
        arr[i - 2] + abs(initial_vals[i - 2] - initial_vals[i]),
    )

print(arr[n - 1])


Measured memory_bytes: 13928
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<math.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define N (1000000000+7)
#define INF (ll)1e16
typedef long long ll;
char board[1010][1010];
int d[1010][1010];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int h,w;

ll f[110][20];
ll p[110][20];

int main(void){
    int n,x;
    ll ans=-10000000000;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
            cin>>x;
            f[i][j]=x;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<11;j++){
            cin>>x;
            p[i][j]=x;
        }
    }
    for(ll i=1;i<(1<<10);i++){
        ll tmp=0;
        for(ll j=0;j<n;j++){
            ll x=i;
            ll num=0;
            for(ll k=0;k<10;k++){
                ll bit=x&1;
                num+=(bit&f[j][k]);
                x=x>>1;
            }
            tmp+=p[j][num];
        }
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main()
{
	int i, j;
	int n;
	char s[105];
	int vis[105][30] = {0};
	scanf("%d", &n);
	scanf("%s", s);
	for(i = 0  ; i < n ; i++)
	{
		for(j = 0 ; j <= i ; j++)
		{
			vis[i][s[j] - 'a' + 1] = 1; 
		}
		for(j = i + 1 ; j < n ; j++)
		{
			if(vis[i][s[j] - 'a' + 1] == 1) vis[i][s[j] - 'a' + 1] = 2;
		}
	}
	int ans = 0;
	int count;
	for(i = 0 ; i < n ; i++)
	{
		count = 0;
		for(j = 1 ; j <= 26 ; j++)
		{
			if(vis[i][j] == 2)count++;
		}
		if(ans < count) ans = count;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
double x[100],y[100],t,u,a,b,s;n,i,j,k,c;main(m){for(;scanf("%d",&n),i=j=n;printf("%d\n",m)){for(m=1;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;--i;)for(j=i-1;j--;)if(s=(u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(a=x[i]+cos(t+s*u),b=y[i]+sin(t+s*u),k=n;k--;)hypot(a-x[k],b-y[k])<1.1&&++c>m?m=c:0;}}

Measured memory_bytes: 0