akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    int h[3][2];
    int count[4];
    int count_1=0;
    int count_2=0;
    int i,j;
    for(j=0;j<4;j++)
    {
        count[j] = 0;
    }
    for (i=0;i<3;i++)
    {
        cin >>h[i][0] >> h[i][1];
        for (j=0;j<4;j++)
        {
        if(h[i][0] == j+1|| h[i][1] == j+1)
        {
            count[j] ++;
        }
        }
            
    }
    for(j =0;j<4;j++)
    {
        if(count[j] == 1)
        {
            count_1 ++;
        }
        if(count[j] ==2)
        {
            count_2 ++;
        }
    }
    if(count_1 == 2&& count_2 ==2)
    {
        cout << "YES" <<endl;
    }
    else
    {
        cout <<"NO" <<endl;
    }
    return 0;
    
    
}

Measured memory_bytes: 256
A = int(input())
B = input().split()
H = [int(b) for b in B]

for i in range(A):
    if i == 0:
        continue

    if H[A - i] == H[A - i - 1] - 1:
        H[A - i - 1] -= 1

    elif H[A - i] < H[A - i - 1] - 1:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
int main()
{
      ios::sync_with_stdio(false);
      cin.tie(0);
    int a,b;
    cin>>a>>b;
    if(a>b){
        for(int i=0; i<a; i++){
            cout<<b;
        }
    }
    else if(b>a){
        for(int i=0; i<b; i++){
            cout<<a;
        }
    }
    else{
        for(int i=0; i<a; i++){
            cout<<a;
        }
    }
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

struct uf{
  private:
    vi par, rank, size;
  public:
    uf(i64 n){ init(n); }
    void init(i64 n){
      par.resize(n);
      rank.resize(n,0);
      size.resize(n,1);
      rep(i,n) par[i] = i;
    }
    i64 root(i64 x){
      if(par[x] == x) return x;
      return par[x] = root(par[x]);
    }
    bool same(i64 x, i64 y){ return root(x) == root(y); }
    void unite(i64 x, i64 y){
      x = root(x), y = root(y);
      if(x==y) return;
      if(rank[x]==rank[y]) rank[x]++;
      if(rank[x]<rank[y]) swap(x,y);
      par[y] = x;
      size[x] += size[y];
    }
    i64 num(i64 x){ return size[root(x)]; }
};

void Main()
{
  v(char) s(3);
  rep(i,3) cin >> s[i];
  if(s[0] == s[1] && s[1] == s[2]) cout << "No\n";
  else cout << "Yes\n";

}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


Measured memory_bytes: 256
package main

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

func solution(s string) int {
        l := len(s)
        f, r := 0, 0
        for i := 0; i < l; i++ {
                if s[i] == 'A' {
                        f = i
                        break
                }
        }

        for i := l - 1; i >= 0; i-- {
                if s[i] == 'Z' {
                        r = i
                        break
                }
        }
        return r - f + 1
}

func main() {
        r := bufio.NewReader(os.Stdin)
        var s string
        fmt.Fscan(r, &s)
        fmt.Println(solution(s))
}

Measured memory_bytes: 3220
K,N = map(int,input().split())
A_list = [int(i) for i in input().split()]

# 時計回りで動くことを考えて。。。

# K以上はないので、Kにしておく
max_distance = K
# 最後の家だけは別途評価することとする
for start_house_index in range(N) :
    if (start_house_index == 0) :
        # 最初の家
        d = A_list[N-1] - A_list[0]
    elif (start_house_index == N-1) :
        # 最後の家
        d = (K - A_list[N-1]) + A_list[N-2]
    else :
        # 最初でも最後でもない家
        d = (K - A_list[start_house_index]) + A_list[start_house_index-1]
        
    
    # print(d)
    if (d < max_distance) :
        max_distance = d

print(max_distance)



Measured memory_bytes: 26444
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            char[] c = sc.nextLine().toCharArray();
            if(c[0] == '-') break;
            int t = 0;
            int m = sc.nextInt();
            for(int i = 0;i < m;++i) t += sc.nextInt();
            for(int i = 0,l = c.length;i < l;++i) System.out.print(c[(t + i) % l]);
            System.out.println();
            sc.nextLine();
        }
    }

}

Measured memory_bytes: 26184
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MS(A) memset(A, 0, sizeof(A))
#define MSV(A,a) memset(A, a, sizeof(A))
#define MAX(a,b) ((a >= b) ? (a) : (b))
#define MIN(a,b) ((a >= b) ? (b) : (a))
#define ABS(a) (((a) > 0) ? (a) : (-a))
#define MP make_pair
#define PB push_back
#define getcx getchar_unlocked
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))

int main() {

	int n, arr[100001], ans = 0, evehash[100001] = {0}, oddhash[100001]= {0}, i;
	int evemax = -1, evemaxnum, evesecmax = -1, evesecmaxnum, oddmax = -1, oddmaxnum, oddsecmax = -1, oddsecmaxnum;

	cin>>n;
	
	for(i = 0 ; i < n ; i++) {
		cin>>arr[i];

		if(i % 2) {
			oddhash[arr[i]]++;
		} else {
			evehash[arr[i]]++;
		}
	}

	for(i = 0 ; i < 100001; i++) {

		if(evehash[i] >= evemax) {

			evesecmax = evemax;
			evesecmaxnum = evemaxnum;
			evemax = evehash[i];
			evemaxnum = i;
		} else if (evehash[i] > evesecmax) {
			evesecmax = evehash[i];
			evesecmaxnum = i;
		}

		if(oddhash[i] >= oddmax) {

			oddsecmax = oddmax;
			oddsecmaxnum = oddmaxnum;
			oddmax = oddhash[i];
			oddmaxnum = i;
		} else if (oddhash[i] > oddsecmax) {
			oddsecmax = oddhash[i];
			oddsecmaxnum = i;
		}
	}

	// for(i = 1 ; i < 100000; i += 2) {

	// 	i
	// }

//	cout<<evemaxnum<< " "<< evesecmaxnum<<endl;
	if(evemaxnum != oddmaxnum) {
		ans = n - evehash[evemaxnum] - oddhash[oddmaxnum];
	} else {
		ans = min(n - evehash[evemaxnum] - oddhash[oddsecmaxnum], n - evehash[evesecmaxnum] - oddhash[oddmaxnum]);
	}

	cout<<ans<<endl;

	return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

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

ll count(ll X){

	string N = to_string(X);
	int digits = N.size();

	// 桁DP
	// dp0[j][i] : i桁目まで決めてi桁目がjであり、
	// N未満確定
	// dp1[j][i] : i桁目まで決めてi桁目がjであり、
	// N未満確定せず
	#define vll vector<ll>
	vector<vll> dp0(10, vll(digits + 1, 0));
	vector<vll> dp1(10, vll(digits + 1, 0));

	// -------------	
	// もし入力Xがルンルン数なら
	// dp1は各桁iにおいてN[i-1]の場所のみ1、それ以外はゼロになる
	// Xがルンルン数出ないなら
	// 上から見ていって破綻した時点でそこから先はすべて0
	// -------------

	// 最初の一桁について
	ll first = N[0] - '0';
	FOR(i,1,first + 1){
		// first以下の数字を選べば即「未満確定」
		if(i != first) dp0[i][1] = 1;
		// firstを選ぶと「未満確定」しない
		else dp1[i][1] = 1;
	}

	FOR(i,1,10){
		FOR(j,2,digits + 1){
			dp0[i][j] += 1;
		}
	}

	FOR(i,1,digits){
		// next : 次の桁を見る
		ll next = N[i] - '0';

		// 0~9について走査
		REP(j,10){
			// 1~9なら
			if(j-1 >= 0){
				// ケース<未満 --> 未満>
				// (自分+1)から寄与を受ける
				dp0[j-1][i+1] += dp0[j][i];
				// ケース<未満でない --> 未満>
				// (自分+1)が存在するなら寄与を受ける
				if(j-1 < next){
					dp0[j-1][i+1] += dp1[j][i];
				}
				// ケース<未満でない --> 未満でない>
				// Xをきれいにトレースするときだけ寄与を受ける
				else if(j-1 == next){
					dp1[j-1][i+1] += dp1[j][i];
				}
			}

			// いつでも数字が連続するなら
			// 前述のような寄与を受ける
			dp0[j][i+1] += dp0[j][i];
			if(j < next){
				dp0[j][i+1] += dp1[j][i];
			}
			else if(j == next){
				dp1[j][i+1] += dp1[j][i];
			}

			// 0~8なら
			// 前述のような寄与を(自分-1)から受ける
			if(j+1 <= 9){
				dp0[j+1][i+1] += dp0[j][i];
				if(j+1 < next){
					dp0[j+1][i+1] += dp1[j][i];
				}
				else if(j+1 == next){
					dp1[j+1][i+1] = dp1[j][i];
				}
			}

		}
	}

	/*
	// チェック用表示部分
	if(X == 97){
		cout << "dp0\n";
		REP(i,10){
			REP(j,digits + 1){
				cout << dp0[i][j] << " ";	
			}
			cout << "\n";
		}
		cout << "dp1\n";
		REP(i,10){
			REP(j,digits + 1){
				cout << dp1[i][j] << " ";
			}
			cout << "\n";
		}
	}
	*/

	ll ans = 0;
	REP(i,10){
		ans += dp0[i][digits];
		ans += dp1[i][digits];
	}

	return ans;

}

int main(){
	#define int ll
	cin.tie(0);
	ios::sync_with_stdio(false);
	// ここに処理を記述

	int K;
	cin >> K;

	// cout << count(97) << "\n";

	// 整数Xについて
	// ルンルン数がK個以上ある最小のXを求める
	// 2分探索＆桁DP
	ll ok = 1e18;
	ll ng = 0;
	while(ok - ng > 1){
		ll mid = (ok + ng) / 2;
		ll check = count(mid);
		if(check < K){
			ng = mid;
		}
		else{
			ok = mid;
		}
	}

	cout << ok << "\n";

	return 0;
}

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

x = [A[i-1]-i for i in range(1, N+1)]
x.sort()

mid = x[len(x)//2]
ans = 0
for i in range(1, N+1):
    ans += abs(A[i-1]-(mid+i))
print(ans)

Measured memory_bytes: 99796
#include<stdio.h>
int main(void){
  int a,b,i;
  scanf("%d %d", &a, &b);
  char s[a+b+1];
  scanf("%s", s);
  for(i=0;i<a;i++){
    if(s[i]!='-'){}
    else{
      printf("No\n");
      return 0;
    }
  }
  if(s[a]=='-'){}
  else{
    printf("No\n");
    return 0;
  }
  for(i=a+1;i<a+b+1;i++){
    if(s[i]!='-'){}
    else{
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 128
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
vector<int>arr(100001, 0);
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, count = 0; cin >> N;
	for (int i = 0; i < N; i++)
	{
		int a; cin >> a;
		if (a > 100000)
		{
			count++;
		}
		else
		{
			arr[a]++;
		}
	}
	for (int i = 0; i < 100001; i++)
	{
		if (i <= arr[i])
		{
			count += arr[i] - i;
		}
		else
		{
			count += arr[i];
		}
	}
	cout << count << "\n";
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)

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

int main(void) {
    string t[4] = {"dream", "dreamer", "erase", "eraser"};
    REP(i, 4){
        reverse(t[i].begin(), t[i].end());
    }
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    bool isSlice = false;
    for(int i=0; i<s.size();){
        REP(j, 4){
            if(s.substr(i, t[j].size())==t[j]){
                isSlice = true;
                i += t[j].size();
                break;
            }
        }
        if(isSlice == false){
            cout << "NO" << endl;
            return 0;
        }
        isSlice = false;
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 512
// 課題4_2 AtCoder Beginner Contest 168 C - : (Colon)
// nk777
 
#include<stdio.h>
#include<math.h>
 
int main(void){
    // 林檎の木n_tree本、(監視できる本数)/2-0.5を表すd_watch、結果の格納result
    int n_tree, d_watch, result;
 
    // n_tree, d_watchを受け取る
    scanf("%d %d", &n_tree, &d_watch);
 
    // 監視員が見れる木の本数
    d_watch = d_watch * 2 + 1;
    // 木の本数を監視できる木の本数で割ったものを小数第1位で切り上げたものが監視員の数
    result = ceil((double)n_tree / (double)d_watch);

    printf("%d\n", result);
    
    return 0;
}

Measured memory_bytes: 128
n = int(input())
cards = [i for i in map(int, input().split())]
alice = []
bob = []
for i in range(n):
    if i % 2 == 0:
        alice.append(max(cards))
        cards.pop(cards.index(max(cards)))
    else:
        bob.append(max(cards))
        cards.pop(cards.index(max(cards)))
print(sum(alice) - sum(bob))

Measured memory_bytes: 9104
#include<cstdio>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
ll N,K,H[2000005],sum=0;
int main() {
	scanf("%lld%lld",&N,&K);
	for(int i=1;i<=N;i++)
		scanf("%lld",&H[i]);
	sort(H+1,H+1+N);
	for(int i=1;i<=N-K;i++)
		sum+=H[i];
	printf("%lld\n",sum);
}

Measured memory_bytes: 1792
#include "iostream"
#include "string"


int main()
{
	int listA[101][101], listB[101][101];
	unsigned long int result = 0;
	int n, m, l;
	std::cin >> n >> m >> l;

	for (int i = 0; i < n; i++) 
		for (int j = 0; j < m; j++)
			std::cin >> listA[i][j];

	for (int j = 0; j < m; j++)
		for (int k = 0; k < l; k++)
			std::cin >> listB[j][k];

	for (int i = 0; i < n; i++) {
		for (int k = 0; k < l; k++) {
			for (int j = 0; j < m; j++) {
				result += listA[i][j] * listB[j][k];
			}
			if (k < l - 1)
				std::cout << result << " ";
			else
				std::cout << result;
			result = 0;
		}
			std::cout << std::endl;
	}

    return 0;
}

Measured memory_bytes: 3136
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
from itertools import accumulate

cum = list(accumulate(As))
ans = 10**18
for i in range(N-1):
    ans = min(ans, abs(cum[i]-(cum[-1]-cum[i])))
print(ans)

Measured memory_bytes: 94200
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        int A = cin.nextint;
        int B = cin.nextint;
        int C = cin.nextint;
        int X = cin.nextint;
        int ans = 0;
        for (int i = 0; i < A + 1; i++)
        {
            for (int j = 0; j < B + 1; j++)
            {
                for (int k = 0; k < C + 1; k++)
                {
                    if (500 * i + 100 * j + 50 * k == X)
                    {
                        ans++;
                    }
                }
            }
        }
        WriteLine(ans);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 11092
#include <stdio.h>

int main(){
	int a, b, c;
	int N=0, M=0;
	while(scanf("%d", &a)!=EOF){
		scanf(",%d,%d", &b, &c);
		if(a*a+b*b==c*c){
			N++;
		}
		if(a==b){
			M++;
		}
	}
	printf("%d\n%d\n", N, M);
	return 0;
}

Measured memory_bytes: 596
//written by libra9z
int main()
{
	int n,ans=0;
	__builtin_scanf("%d",&n);
	while (n--)
	{
		int x,y;
		__builtin_scanf("%d%d",&x,&y);
		ans=ans+y-x+1;
	}
	__builtin_printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>

int judge(int a) {
	if (a == 2) return 0;
	if (a == 4 || a == 6 || a == 9 || a == 11) return 1;
	return 2;
}


int main()
{
	int n, m;

	std::cin >> n >> m;

	if (judge(n) == judge(m)) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}

	return 0;

}


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

char cn[320010], * ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
const int AS = 500000;
char * di = cn;
int dat[2 * AS];

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


	int N = 0;
	while ((ct = getchar_unlocked()) >= '0') N = N * 10 + ct - '0';
	int N1 = N / 2;
	fread(cn, 1, N1, stdin);
	auto da = dat + AS;
	rep(i, N1) *da++ = (1 << *ci++ - 'a');
	fread(cn, 1, N - N1, stdin);
	ci = cn;
	rep(i, N - N1) *da++ = (1 << *ci++ - 'a');
	da = dat + AS - 1;
	for (auto db = dat + AS * 2 - 1; da > dat; da--) *da = *db-- | *db--;
	getchar_unlocked();
	ci = cn;
	fread(cn, 1, 320010, stdin);
	int Q = getint();

	const char a[27] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6' };

	rep(j, Q) {
		char q = *ci++;
		ci++;
		if (q == '1') {
			int i = getint() - 1 + AS;
			for (dat[i] = 1 << *ci++ - 'a'; i > 1; i >>= 1) dat[i >> 1] = dat[i] | dat[i ^ 1];
			ci++;
		}
		else {
			int ret = 0;
			for (int l = getint() - 1 + AS, r = getint() + AS; l < r; l >>= 1, r >>= 1) {
				if (l & 1) ret |= dat[l++];
				if (r & 1) ret |= dat[--r];
			}
			int kotae = __builtin_popcount(ret);
			if (kotae >= 20) *di++ = '2';
			else if (kotae >= 10) *di++ = '1';
			*di++ = a[kotae];
			*di++ = '\n';
		}
	}
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 4480
<?php

while (true) {
    fscanf(STDIN, '%d', $n);
    if (feof(STDIN)) {
        break;
    }
    $count = 0;
    for ($a = 0; $a < 10; $a++) {
        for ($b = 0; $b < 10; $b++) {
            for ($c = 0; $c < 10; $c++) {
                for ($d = 0; $d < 10; $d++) {
                    if ($a + $b + $c + $d === $n) {
                        $count++;
                    }
                }
            }
        }
    }

    echo $count . PHP_EOL;
}

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

int main(){
    int64_t N, D, cnt=0;
    cin>>N>>D;
    for(int i=0;i<N;i++){
        int64_t x, y;
        cin>>x>>y;
        if(x*x+y*y <= D*D) cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3524
#include<cstdio>
int abs(int x) {return x>0?x:-x;}
int max(int x,int y) {return x>y?x:y;}
int x[105],y[105],h[105];
int main() 
{
	int n,p;scanf("%d",&n);
	for(int i=1;i<=n;i++) 
	{
		scanf("%d%d%d",&x[i],&y[i],&h[i]);
		if(h[i]) p=i;
	}
	for(int i=0;i<=100;i++)
	for(int j=0;j<=100;j++)
	{
		int H=h[p]+abs(i-x[p])+abs(j-y[p]),f=1;
		for(int k=1;k<=n;k++)
		if(h[k]!=max(H-abs(i-x[k])-abs(j-y[k]),0)) f=0;
		if(f) {printf("%d %d %d\n",i,j,H);break;} 
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int a[12][10];

int main(){
    int n;
    cin >> n;
    rep(i, n) {
        int b, f, r, v;
        cin >> b >> f >> r >> v;
        a[(b-1)*3+f-1][r-1] += v;
    }
    rep(i, 12){
        if(i == 3 || i == 6 || i == 9) cout << "####################" << endl;
        rep(j, 10) {
            if(j == 9) cout << " " << a[i][j] << endl;
            else cout << " " << a[i][j];
        }
    }

    return 0;
}


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

const ll mod = 1000000007;
const double eps = 1e-8;
const ll INF = 1e9+1;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    for (int i=0; i<N; ++i) cin >> h[i];

    vector<int> dp(N+2, INF);
    dp[0] = 0;
    for (int i=1; i<N; ++i) {
        dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if (i-2 >= 0) dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout << dp[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;//list用
using System.Text;//StringBuilder用
using System.Collections;
using System.Linq;
class Program
{
    static List<int> s = new List<int>();
    static double result;
static Hashtable ht=new Hashtable();
static StringBuilder sb = new StringBuilder();
static int N,M,K;
  static int W,H,x,y;
static long[,] table;
    static void Main()
    {
      Read3();
W=s[0];
      H=s[1];
      x=s[2];
      y=s[3];
      result=(double)W*H/2;      
      Console.WriteLine(result.ToString());
      if(x*2==W && y*2==H){Console.WriteLine("1");}else{Console.WriteLine("0");}
    }


    static void Read1()//1項
    {
        string tmp = Console.ReadLine();
        N = int.Parse(tmp);
    }
 
    static void Read2()//複数項（項目数Ｎ）
    {
        string[] tmp = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) { s.Add(int.Parse(tmp[i])); }
    }
    static void Read3()//1行複数項
   {
       string[] tmp = Console.ReadLine().Split(' ');
       for (int i = 0; i < tmp.Length; i++) { s.Add(int.Parse(tmp[i])); }
    }
    static void Read4()//NK１行
    {
        string[] tmp = Console.ReadLine().Split(' ');
       N = int.Parse(tmp[0]);
       K = int.Parse(tmp[1]);
    }
    static void Read5()//N行K項
    {

 
    }


}

Measured memory_bytes: 11220
/*       Rohan Balot
    NSIT, New Delhi, India  */
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
 
#define FIND(c, e) (c).find(e) != (c).end()
#define NFIND(c, e) (c).find(e) == (c).end()
#define ALL(t) (t).begin(), (t).end()
#define ALLR(t) (t).rbegin(), (t).rend()
#define MP make_pair

const int N = int( 1e5 ) + 1;
const int M = int( 1e6 ) + 1;
const int MOD = int( 1e9 ) + 7;
const double PI = acos(-1.0);
const double eps = 1e-6;
template<typename T> T gcd(T a,T b){while (b){T r=a%b;a=b;b=r;}return a;}
template<typename T> T lcm(T a,T b){return (a*b)/gcd(a,b);}

void __answer()
{
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	sort(ALL(v));
	cout << accumulate(v.end() - k, v.end(), 0LL) << endl;
}  
int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #ifdef LOCAL
        freopen("sample_input.txt", "r", stdin);
        // freopen("data.txt", "w", stdout);
        // freopen("log.txt", "w", stderr);
    #endif
    __answer();
    return 0;
}  

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

using namespace std;
using LL = long long;
using P = pair<int,int>;
const int Max_N=1010;

int A[Max_N][Max_N];


int main(){
	int N;
	cin >> N;
	rep(i,N){
		rep(j,N-1){
			int a;
			cin >> a;
			a--;
			A[i][j]=a;
		}
	}
	vector<int> op(N);
	int ans=0, sum=N;
	queue<int> q1, q2;	
	rep(a,N){
		int n=A[a][0], m=op[n];
		if(n<a) continue;
		if(A[n][m]==a) q1.push(a);
	}
	while(sum){
		ans++;
		if(q1.empty()){
			cout << -1 << endl;
			return 0;
		}
		while(!q1.empty()){
			int a=q1.front(); q1.pop();
			int n=A[a][op[a]], m=op[n];
			q2.push(a), q2.push(n);
			op[a]++; op[n]++;
			if(op[a]==N-1) op[a]=-1, sum--;
			if(op[n]==N-1) op[n]=-1, sum--;
		}
		vector<bool> pushed(N);
		while(!q2.empty()){
			int a=q2.front(); q2.pop();
			if(op[a]==-1) continue;
			int n=A[a][op[a]], m=op[n];
			if(pushed[n]) continue;
			if(A[n][m]==a) q1.push(a), pushed[a]=true;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4224
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans_base = 0
ans_base_rev = 0
big = (10**9)+7
for i in range(N-1):
    for k in range(i + 1, N):
        if A[i] > A[k]:
            ans_base += 1
        elif A[i] < A[k]:
            ans_base_rev += 1

#ans_base = ans_base % big
#ans_base_rev = ans_base_rev % big
val_p = (K * (K + 1)) // 2
val_m = (K * (K - 1)) // 2
#val_m = val_m % big
#val_p = val_p % big
ans = ans_base * val_p + ans_base_rev * val_m
ans = ans % big
print(int(ans))


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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

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

    int n, m, q;
    cin >> n >> m;

    vvi g(n);

    rep(i, 0, m) {
        int s, t;
        cin >> s >> t;

        g[s].push_back(t);
        g[t].push_back(s);
    }

    vi map(n, -1);
    vector<bool> seen(n, false);

    int t = 0;
    rep(i, 0, n) {
        if (seen[i]) { continue; }
        queue<int> st;
        st.push(i);
        seen[i] = true;
        map[i] = t;

        while (!st.empty()) {
            int v = st.front();
            st.pop();

            for (auto itr = g[v].begin(); itr != g[v].end(); ++itr) {
                if (!seen[*itr]) {
                    st.push(*itr);
                    seen[*itr] = true;
                    map[*itr] = t;
                }
            }
        }
        ++t;
    }

    cin >> q;
    rep(i, 0, q) {
        int s, t;
        cin >> s >> t;
        cout << (map[s] == map[t] ? "yes" : "no") << endl;
    }

    return 0;
}


Measured memory_bytes: 8536
h,w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))
a_=[]
for i in range(n):
    l=a[i]
    for j in range(l):
        a_.append(i+1)
ans=[]
now=0
for i in range(h):
    if (i+1)%2==1:
        for j in range(w):
            ans.append(a_[now])
            now+=1
    else:
        for j in range(now+(w-1),now-1,-1):
            ans.append(a_[j])
            now+=1
now=0
for i in range(h):
    for j in range(w):
        print(ans[now],end=" ")
        now+=1
    print()

Measured memory_bytes: 45160
import sys
input = sys.stdin.readline

from queue import *
N, M = map(int, input().split())
N *= 3
es = [[] for i in range(N)]
for i in range(M):
    u, v = map(lambda x : (int(x)-1)*3, input().split())
    es[u].append(v+1)
    es[u+1].append((v+2))
    es[u+2].append((v))
S, T = map(lambda x : (int(x)-1)*3, input().split())
dist = [-1 for i in range(N)]
dist[S] = 0
q = Queue()
q.put(S)
while not q.empty():
    v = q.get()
    for u in es[v]:
        if dist[u] == -1:
            dist[u] = dist[v] + 1
            q.put(u)
if dist[T] != -1:
    print(dist[T] // 3)
else:
    print(-1)

Measured memory_bytes: 98056
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long LL;
const int MaxN = 1e5;
const int Inf = 1 << 30;

int main()
{
	int s,k,ans;
	while(~scanf("%d%d",&k,&s)){
		ans = 0;
		for(int i = 0;i <= k;i++)
			for(int j = 0;j <= k;j++)
				if(s - i - j >= 0 && s - i - j <= k) ans++;
		printf("%d\n",ans);
	}
    return 0;
}

Measured memory_bytes: 128
// Author: Wenxing Mei
//   File: b.cpp
//   Date: 2019-03-11 22:42
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define per(i, b, a) for (int i = (int)b; i >= (int)a; --i)
#define repv(ele, cont) for (auto &ele : cont)
#define all(x) x.begin(), x.end()
#define mp make_pair
#define eb emplace_back
#define ep emplace
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<ll> vll;
// END OF TEMPLATE

int main() {
#ifndef LOCAL
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
    int a, b, k;
    cin >> a >> b >> k;
    if (a > b) swap(a, b);
    int n = 0;
    per(i, a, 1) {
        if (a % i == 0 && b % i == 0) ++n;
        if (n == k) {
            cout << i << endl;
            exit(0);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main(void){
    string s;cin>>s;
    vector<int>C(26,0);
    rep(i,s.size()){
        C[s[i]-'a']++;
    }
    int sum=0;
    int n=s.size();
    rep(i,26)sum+=C[i]*C[i];
    cout<<(n*n-sum)/2+1<<endl;
}

Measured memory_bytes: 644
#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define nl cout<<'\n'
#define pb push_back
#define vi vector<lli>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

void solve(){
	lli n; cin >> n;
	lli ans = 0, tp = 0, mx = 0;
	NA(i,0,n) {
		cin >> tp;
		if(tp < mx) ans += (mx - tp);
		else mx = tp;
	}
	cout << ans;
	return;
}

int main(){
    fastIO;
    lli t = 1;
	// cin >> t;
	NA(i,0,t) solve();
	return 0;
}



Measured memory_bytes: 3652
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]

ad = [[0]*n for i in range(n)]

for x in ab:
    ad[x[0]-1][x[1]-1] = 1
    ad[x[1]-1][x[0]-1] = 1

nodes = [0]*n
ans = 0
flag = True
while flag:
    flag = False
    for i in range(n):
        if nodes[i] == 0 and sum(ad[i]) == 1:
            ans +=1
            nodes[i] = 1
            flag = True
            for j in range(n):
                if ad[i][j] == 1:
                    ad[j][i] =0
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,w,i,j;
   cin>>n>>w;
   ll wt[n],v[n];
   for(i=0;i<n;i++)
   cin>>wt[i]>>v[i];
   ll dp[n][w+1];
   for(i=0;i<n;i++)
   {
       for(j=0;j<=w;j++)
       {
           dp[i][j]=0;
           if(j==0)
           dp[i][j]=0;
           else if(wt[i]>j)
           {
               if(i>0)
               dp[i][j]=dp[i-1][j];
           }
           else
            {
               if(i==0)
               dp[i][j]=v[i];
               else
               dp[i][j]=std::max(v[i]+dp[i-1][j-wt[i]],dp[i-1][j]);
           }
       }
   }
   cout<<dp[n-1][w];
   
  
 
    return 0;
    
}
    



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

void kick()
{
    string s;
    cin>>s;
    if(s[1]=='S'){
        if(s[0]=='R' || s[2]=='R') puts("1");
        else puts("0");
    }
    else{
        if(s[0]=='R' && s[2]=='R') puts("3");
        else if(s[0]=='R' || s[2]=='R') puts("2");
        else puts("1");
    }

}
int main()
{
    kick();
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
    vector <int> A(6);
    for (int i = 0; i < 6; i++) {
        cin >> A[i];
    }
    int ans = 0, total = 0;
    for (int a = 0; a <= 30; a++) {
        for (int b = 0; b <= 30; b++) {
            for (int c = 0; c <= 100; c++) {
                for (int d = 0; d <= 100; d++) {
                    int dn = a * A[0] * 100 + b * A[1] * 100 + c * A[2] + d * A[3];
                    if(dn <= A[5]) {
                        int nm = c * A[2] + d * A[3];
                        if(nm <= A[4] * (a * A[0] + b * A[1])) {
                            if (ans * dn <=  total * nm) {
                                ans = c * A[2] + d * A[3];
                                total = a * A[0] * 100 + b * A[1] * 100 + c * A[2] + d * A[3];
                            }
                        }
                    }
                }
            }
        }
    }
    cout << total << " " << ans;
}


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

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

    int c;

    if(b == 100){
        c = 1000 * a + b;
    }

    if(10 <= b && b <= 99){
        c = 100 * a + b;
    }

    if(b <= 9){
        c = 10 * a + b;
    }

    int rootc = std::pow(c,0.5);

    if (rootc * rootc == c){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 512
<?php

while (true) {
	$input = trim(fgets(STDIN));
	$input = explode(" ", $input);
	foreach ($input as $value) {
		if (ctype_alnum($value)) {
			$args[] = (int)$value;
		}
		if (count($args) >= 3) {
			break;
		}
	}
	if (count($args) >= 3) {
		break;
	}
}

rsort($args);

$result = $args[0] * 10 + $args[1] + $args[2];

echo $result;

Measured memory_bytes: 4728
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{
 

    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            Console.WriteLine(a / b + " " + a % b + " " + ((double)a / b).ToString("f5"));

        }
        
    }
}

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

#define M 1000000007
#define pb emplace_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; ++i)
#define repn(i, st, ed) for(ll i=st; i<=ed; ++i)
#define repb(i, ed, st) for(ll i=ed; i>=st; --i)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define mp(a, b) make_pair(a, b) 

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vec;
typedef vector<pll> vecp;
typedef map<ll, ll> mpll;

const long double PI  = 3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << to_string(H) << endl;
  debug_out(T...);
}
#define LOCAL 3
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:" << endl, debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


void solve()
{
	ll m, n;
	cin>>m>>n;
	rep(i, 0, n)
	{
		ll x;
		cin>>x;
		m -= x;
		if(m <= 0) 
		{
			cout<<"Yes"<<endl;
			return;
		}
	}
	cout<<"No"<<endl;
}


int main()
{
	ll Tests = 1;
    //cin>>Tests;
    while(Tests--)
    {
    	solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
  string n;
  cin >> n;
  for (int i = 0; i < 3; i++){
    if (n[i] == '7'){
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;   
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

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

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述

	string S;
	cin >> S;

	if(S == "SAT"){
		cout << 1 << "\n";
	}
	else if(S == "FRI"){
		cout << 2 << "\n";
	}
	else if(S == "THU"){
		cout << 3 << "\n";
	}
	else if(S == "WED"){
		cout << 4 << "\n";
	}
	else if(S == "TUE"){
		cout << 5 << "\n";
	}
	else if(S == "MON"){
		cout << 6 << "\n";
	}
	else{
		cout << 7 << "\n";
	}

return 0;
}

Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;

int main(){
    FASTIO
    ll a, b;
    cin >> a >> b;
    if((a + b) % 2 == 0)
    cout << (a + b) / 2 << endl;
    else
    cout << "IMPOSSIBLE\n";
    
    return 0;
}

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

int main(){
  while(1){
    string str;
    cin >> str;
    if(str=="0"){
      break;
    }
    int sum=0;
    for(int i=0;i<(int)str.size();i++){
      sum+=str[i]-'0';
    }
    cout<<sum<<endl;
  }
  return 0;
}


Measured memory_bytes: 3132
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<int>>
constexpr auto mod = 1000000007;


//2のn乗を求めるよ！！！
int ni(int n) {
	if (n == 0)return 1;
	int x = ni(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

//フィボナッチ数列のx番目を求めるよ！
int f(int x, vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1, s) + f(x - 2, s);
	return s[x];
}

//aとｂの最大公約数を求めるよ！
llint gcd(llint a, llint b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}



// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long 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;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//m進数のn桁を全列挙やで
void dfs(int m, int n) {

	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			cout << now << endl;
		}
		else {
			for (int i = m - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}

int main() {
	int n;
	int ans = 10000000;
	cin >> n;
	hei(int) a(n);
	rep(i, 0, n) {
		cin >> a[i];
	}
	sort(a);
	rep(i, a[0], a[n-1]+1) {
		int sum=0;
		rep(j, 0, n) {
			sum += pow(i - a[j], 2);
		}
		ans = min(sum, ans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
#define FF(i,a,b) for (int i=a;i<=b;i++)
#define F(i,b,a)  for (int i=b;i>=a;i--)
#define mes(a,b)  memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
typedef long long ll;
const int N = 2e5+10;

int main()
{
    int a, b;
    cin>>a>>b;
    if(a==1) a=14;
    if(b==1) b=14;
    if(a>b) puts("Alice");
    else if(a==b) puts("Draw");
    else puts("Bob");

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
using namespace std;

int main() {
	int R, G, B, N,ans=0; cin >> R >> G >> B >> N;
	for (int i = 0; i <= N; i += R) {
		for (int j = 0; j <= N - i; j += G) {
			if ((N-i-j)%B==0) ans++;
		}
	}
	cout << ans << endl;
}





Measured memory_bytes: 256
n = int(input())
d = list(map(int, input().split()))
m = 998244353

if d[0]!=0:
    print(0)
    exit()

a = [0]*10**6
for i in range(n):
    a[d[i]]+=1

if a[0]!=1:
    print(0)
    exit()

ans = 1
for i in range(1,n):
    ans*=pow(a[i-1],a[i],m)

print(ans%m)

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

using namespace std;

int f(long long n){
    string temp = to_string(n);
    int ans = temp.size();
    for(long long i = 1; i <= pow(10, ((temp.size() / 2) + 1)); i++){
        if(n % i == 0 && ans > max(to_string(i).size(), to_string(n / i).size())){
            ans = max(to_string(i).size(), to_string(n / i).size());
        }
    }
    return ans;
}

int main()
{
    long long n;
    cin >> n;
    cout << f(n);
    return 0;
}


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

map<int,bool> vis;
bool flag=1;
signed main(){

    int n;
    cin >>n;
    
    for(int i = 1;i<=n;i++){
        int b;
        cin >> b;
        if(vis[b])flag = 0;
        vis[b] = 1;
        //if(a==b)flag = 0;
        //a = b;
    }

    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 12800