akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main() {
    int r, c;
    cin >> r >> c;

    int **matrix = new int*[r];
    for (int i = 0; i < r; ++i) {
        matrix[i] = new int[c];
        for (int j = 0; j < c; ++j) {
            cin >> matrix[i][j];
        }
    }

    for (int i = 0; i < r; ++i) {
        int _c = 0;
        for (int j = 0; j < c; ++j) {
            cout << matrix[i][j] << " ";
            _c += matrix[i][j];
        }
        cout << _c << endl;
    }

    int sum = 0;
    for (int j = 0; j < c; ++j) {
        int _r = 0;
        for (int i = 0; i < r; ++i) {
            _r += matrix[i][j];
        }
        cout << _r << " ";
        sum += _r;
    }
    cout << sum << endl;

    for (int i = 0; i < r; ++i) {
        delete[] matrix[i];
    }
    delete[] matrix;
    return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
string s,p;
int main() {
	cin>>s>>p;
	s=s+s;
	rep(i,s.size()-p.size()){
		if(p==s.substr(i,p.size())){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 3196
#include<stdio.h>
#define ll long long int
int main(){
	ll n;
	scanf ("%lld",&n);
	ll num[n]={};
	ll res=1;
    for (ll i=0;i<n;i++){
    	scanf("%lld",&num[i]);
	}
	for (ll i=0;i<n;i++){
		if (num[i]==0){
			printf("0\n");
			return 0;
		}
	}
	
	for (int i=0;i<n;i++){
		if (num[i]<=1000000000000000000/res){
			res*=num[i];
		}else{
			printf ("-1\n");
			return 0;
		}
	}
	printf ("%lld",res);
	return 0;
}


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

int main(){
    ll N; cin >> N;
    ll cur = 1;
    rep(i,N){
        ll a; cin >> a;
        if(a == cur) cur++;
    }
    ll res = N-cur+1;
    if(res == N) res = -1;
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int n;
long long h[100010];

long long dp[100010];

int main() {
  cin >> n;
  rep(i,n) cin >> h[i];
  rep(i,100010) dp[i] = INF;
  dp[0] = 0;
  for(int i = 1;i < n;i++) {
    chmin(dp[i],dp[i-1] + abs(h[i] - h[i-1]));
    if(i > 1) chmin(dp[i],dp[i-2] + abs(h[i] - h[i-2]));
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 5044
#include <iostream>
using namespace std;
int main(){
  int n,q;cin>>n>>q;
  string s;cin>>s;
  int mx = 0;
  for(int i = 0; n > i; i++){
    if(s[i] == 'A' && s[i+1] == 'C'){
      mx++;
      cerr << i << " ";
    }
  }
  int kosu[n];kosu[0]=mx;
  for(int i = 1; n > i; i++){
    if(s[i-1] == 'A' && s[i] == 'C')mx--;
    kosu[i] = mx;
  }
  for(int i = 0; q > i; i++){
  	int l,r;cin>>l>>r;
    //cout << kosu[l-1] << " " << kosu[r-1] << endl;
    int ret = kosu[l-1]-kosu[r-1];
    cout << ret << endl;
  } 
}

Measured memory_bytes: 1408
N,K = map(int,input().split())
a = list(map(int,input().split()))

ans = 10**12
for i in range(2**N):
    if bin(i).count('1')!=K:
        continue
    cost = 0
    now = 0
    for j in range(N):
        if i>>j&1:
            if now>=a[j]:
                cost += now-a[j]+1
                now += 1
            else:
                now = a[j]
        else:
            now = max(now,a[j])
    ans = min(ans,cost)
print(ans)



Measured memory_bytes: 42220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int R, G, B, N;
  cin >> R >> G >> B >> N;
  int ans = 0;
  rep(r, 3001) rep(g, 3001)
  {
    int b_ball = N - r * R - g * G;
    if (0 <= b_ball && b_ball % B == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val x = sc.nextInt()

  val MaxAB = 119

  for {
    a <- -MaxAB to MaxAB
    b <- -MaxAB to MaxAB
    if fiveSquare(a) - fiveSquare(b) == x
  } answer(a, b)


  def fiveSquare(n: Int) = n * n * n * n * n
  def check(flg: Boolean, a: Int, b: Int): Unit = {
    if(flg) answer(a, b)
  }
  def answer(a: Int, b: Int): Nothing = {
    println(s"${a} ${b}")
    sys.exit(0)
  }
}


Measured memory_bytes: 55632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	int64_t sum1[n], sum2[n];
	for(int i = 0; i < n; ++i) {
		int64_t x, y; cin >> x >> y;
		sum1[i] = x + y;
		sum2[i] = x - y;
	}
	sort(sum1, sum1 + n);
	sort(sum2, sum2 + n);
	cout << max(sum1[n - 1] - sum1[0], sum2[n - 1] - sum2[0]) << '\n';
	return 0;
}


Measured memory_bytes: 6760
#include <stdio.h>

int main(void)
{
	int scoreA[4];
	int scoreB[4];
	int S = 0, T = 0;
	int i;
	
	scanf("%d %d %d %d", &scoreA[0], &scoreA[1], &scoreA[2], &scoreA[3]);
	scanf("%d %d %d %d", &scoreB[0], &scoreB[1], &scoreB[2], &scoreB[3]);
	for (i = 0; i < 4; i++){
		S += scoreA[i];
		T += scoreB[i];
	}
	
	if (S == T){
		printf("%d\n", S);
	}
	else if (S > T){
		printf("%d\n", S);
	}
	else {
		printf("%d\n", T);
	}
	
	return (0);
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    set<int> a;
    string ans = "No";
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            a.insert(i * j);
        }
    }
    for (auto x : a){
        if (x == n) {
            ans = "Yes";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

int P,Q,A,N;

ll dfs(ll p,ll q,int depth,int used){
	ll ret =0;
	if(p*Q==P*q)return 1;
	if(p*Q>P*q)return 0;
	if(depth==N)return 0;
	
	for(int i=used;q*i<=A;i++){
		ret+=dfs(p*i+q,q*i,depth+1,i);
	}
	return ret;
}

int main(){
	while(cin>>P>>Q>>A>>N&&(P||Q||A||N)){
		cout<<dfs(0,1,0,1)<<endl;
	}
}

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

int main() {
    int N;
    string W[100];

    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> W[i];
    }

    string ans = "Yes";

    for (int i = 0; i < N - 1; i++){
        if (W[i][W[i].length() - 1] != W[i + 1][0]){
            ans = "No";
        }
    }  

    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++){
            if (i != j){
                if (W[i] == W[j]){
                    ans = "No";
                }
            }
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
ll n,dp[205][205][205],ans,cnt;
int main()
{
    //IOS;
    cin>>n;
    /*for(int i=2; i<=n; i++)
    {
        for(int j=i; j<=n;)
        {
            for(int k=i; k<=n;)
            {
                dp[i][j][k]=i;
                dp[i][k][j]=i;
                dp[j][i][k]=i;
                dp[k][i][j]=i;
                dp[j][k][i]=i;
                dp[k][j][i]=i;
                k+=i;
            }
            j+=i;
        }
    }*/
    for(int i=1; i<=n; i++)
    {
        for(int j=i; j<=n;j++)
        {
            for(int k=j; k<=n;k++)
            {
                cnt=gcd(gcd(i,j),k);
                dp[i][j][k]=cnt;
                dp[i][k][j]=cnt;
                dp[j][i][k]=cnt;
                dp[k][i][j]=cnt;
                dp[j][k][i]=cnt;
                dp[k][j][i]=cnt;
            }
        }
    }
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n;j++)
        {
            for(int k=1; k<=n;k++)
            {
                if(dp[i][j][k]==0)
                {
                    /*if(gcd(gcd(i,j),k)!=1)
                    {
                        cout<<i<<' '<<j<<' '<<k<<' '<<1<<' '<<gcd(gcd(i,j),k)<<endl;
                    }*/
                    ans++;
                }
                else
                {
                    /*if(gcd(gcd(i,j),k)!=dp[i][j][k])
                    {
                        cout<<i<<' '<<j<<' '<<k<<' '<<dp[i][j][k]<<' '<<gcd(gcd(i,j),k)<<endl;
                    }*/
                    ans+=dp[i][j][k];
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
/*

*/




Measured memory_bytes: 68280
X,Y = map(int, input().split())
min_leg = X * 2
max_leg = X * 4
if Y < min_leg or Y > max_leg:
  ans = False
elif Y == min_leg or Y == max_leg:
  ans = True
elif Y % 2 != 0:
  ans = False
else:
  ans = True
  
if ans == True:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9076
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

void solve(int w,int h){
    string s[h];
    rep(i,h)cin>>s[i];
    vector<vector<int>> dw(h,vector<int>(w,inf)),db(h,vector<int>(w,inf));
    queue<pair<int,int>> que;
    rep(i,h)rep(j,w){
        if(s[i][j]=='W'){
            dw[i][j]=0;
            que.emplace(i,j);
        }
    }
    int d[]{1,0,-1,0,1};
    while(que.size()){
        auto p=que.front();que.pop();
        int x=p.first,y=p.second;
        rep(i,4){
            int nx=x+d[i],ny=y+d[i+1];
            if(nx<0||nx>=h||ny<0||ny>=w)continue;
            if(s[nx][ny]!='.')continue;
            if(dw[nx][ny]>dw[x][y]+1){
                dw[nx][ny]=dw[x][y]+1;
                que.emplace(nx,ny);
            }
        }
    }
    rep(i,h)rep(j,w){
        if(s[i][j]=='B'){
            db[i][j]=0;
            que.emplace(i,j);
        }
    }
    while(que.size()){
        auto p=que.front();que.pop();
        int x=p.first,y=p.second;
        rep(i,4){
            int nx=x+d[i],ny=y+d[i+1];
            if(nx<0||nx>=h||ny<0||ny>=w)continue;
            if(s[nx][ny]!='.')continue;
            if(db[nx][ny]>db[x][y]+1){
                db[nx][ny]=db[x][y]+1;
                que.emplace(nx,ny);
            }
        }
    }
    int aw=0,ab=0;
    rep(i,h)rep(j,w){
        if(dw[i][j]!=inf&&db[i][j]==inf&&s[i][j]!='W')++aw;
        if(dw[i][j]==inf&&db[i][j]!=inf&&s[i][j]!='B')++ab;
    }
    cout<<ab<<" "<<aw<<endl;
}

int main(){
    int w,h;
    while(cin>>w>>h,w!=0)solve(w,h);
    return 0;
}


Measured memory_bytes: 3220
#include<bits/stdc++.h>
#define mxn 1000010
#define db double
#define LL long long
#define ldb long double
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair<int,int> 
#define mp make_pair
#define fr first
#define sc second
#define x1 faqx1
#define y1 faqy1
#define x2 faqx2
#define y2 faqy2
using namespace std;
const int inf=1e9,mod=1e9+7;
int n,sl,fh,ans,a[mxn];
int rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
void upd(int &x,int y) {x+=y; if(x>=mod) x-=mod;}
int main()
{
	n=rd();int x;ans=1;a[0]=3;
	for(int i=1;i<=n;++i)
	{
		x=rd();
		ans=1ll*ans*(a[x]-a[x+1])%mod;
		a[x+1]++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int l = scan.nextInt();
        int[] taste = new int[n];
        int sum = 0;
        int minAbs = 10000;
        int eat = 0;
        for(int i = 0; i < n; i++){
            taste[i] = l + i;
            sum += taste[i];
            if(minAbs > Math.abs(taste[i])){
                minAbs = Math.abs(taste[i]);
                eat = taste[i];
            }
        }
        Arrays.sort(taste);
        System.out.println(sum - eat);
        scan.close();
    }
}


Measured memory_bytes: 26952
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int a[3]; rep(i, 3) cin >> a[i]; sort(a, a + 3);
    cout << a[2] - a[0] << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int X;cin>>X;
    ll S[100000];
    S[0]=0;
    for(int i=1;i<100000;i++){
        S[i]=S[i-1]+i;
        if(S[i-1]<X && X<=S[i]){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    string S;
    std::cin >> S;

    auto ans = INF;
    for(size_t i = 0; i <= S.size() - 3; i++) {
        ans = min(ans, abs(753 - stoi(S.substr(i, 3))));
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main (){
	int a,b;
	char x;
	
	while(1){
	scanf("%d %c %d",&a,&x,&b);
	if (x=='+'){
	printf("%d\n",a+b);
	}else if (x=='-'){
	printf("%d\n",a-b);
	}else if (x=='*'){
	printf("%d\n",a*b);
	}else if (x=='/'){
	printf("%d\n",a/b);
	}else if (x=='?'){
	break;
	}
	}
	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		int c = sc.nextInt();


		if(c>=a && b>=c-a){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <math.h>
 
 
main()
{
int h,w;
while(1){
    scanf("%d %d",&h,&w);
    if((h|w)==0)break;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            printf("%c",j==0||j==w-1||i==0||i==h-1?'#':'.');
        }
        printf("\n");
    }
    printf("\n");
}
}


Measured memory_bytes: 2596
#include<iostream>
#include<string>
#include<tuple>
#include<set>

int main(){
	int n,h;
	while(std::cin>>n>>h,n,h){
		std::set<std::tuple<int,int,int> >data;
		std::tuple<int,int,int>tup=std::tuple<int,int,int>(0,0,0);
		std::string str;
		int a,b;
		for(int i=0;i<h;i++){
			std::cin>>str>>a>>b;
			for(int j=0;j<n;j++){
				if(str=="xy")tup=std::tuple<int,int,int>(a-1,b-1,j);
				else if(str=="xz")tup=std::tuple<int,int,int>(a-1,j,b-1);
				else if(str=="yz")tup=std::tuple<int,int,int>(j,a-1,b-1);
				data.insert(tup);
			}
		}
		std::cout<<n*n*n-data.size()<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 4332
#include <iostream>
#include <algorithm>
#include <numeric>

const int MAXN = 30'0004;

int N, A, B;
int D[MAXN];

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

  cin >> N >> A >> B;
  if (N <= A + B - 2 || N > A * (long long)B) {
    cout << "-1" << '\n';
    return 0;
  }

  iota(D, D + N, 1);

  reverse(D, D + B);
  if (A != 1) {
    int np = B;
    int x = (N - B) / (A - 1);
    int y = (N - B) % (A - 1);
    for (int i = 0; i < A - 1; ++i) {
      if (i < y) {
        reverse(D + np, D + np + x + 1);
        np += x + 1;
      } else {
        reverse(D + np, D + np + x);
        np += x;
      }
    }
  }

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


Measured memory_bytes: 3328
while 1:
    a=[i+1 for i in range(10)]
    try:b=list(map(int,input().split()))
    except:break
    for i in b:a.remove(i)
    c=sum(b[:2])
    print(['NO','YES'][sum([1 for i in a if c+i<=20])/7>=0.5])

Measured memory_bytes: 7656
#include<stdio.h>

int isPrime(int);

int main(){
    int n,i,result=0;
    int number;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&number);
        result += isPrime(number);
    }
    printf("%d\n",result);

    return 0;
}

int isPrime(int number){
    int i = 3;

    if(number == 2)return 1;

    if((number < 2) || number % 2 == 0)return 0;

    while(i*i <= number){
        if(number % i == 0)return 0;
        i += 2;
    }
    return 1;
}


Measured memory_bytes: 2104
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	double x, y;
	int currentAngle = 0;
	string buffer;


	while ( true )
	{
		cin >> buffer;

		for ( unsigned int i = 0; i < buffer.size(); i++ )
		{
			if ( buffer[i] == ',' )
			{
				buffer[i] = ' ';
				break;
			}
		}

		int pedometer, angle;

		istringstream is( buffer );
		is >> pedometer >> angle;

		if ( pedometer == 0 && angle == 0 )
		{
			break;
		}

		x += sin( currentAngle * M_PI / 180 ) * pedometer;
		y += cos( currentAngle * M_PI / 180 ) * pedometer;
		currentAngle += angle;
	}

	cout << (int)x << endl;
	cout << (int)y << endl;

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
vector<long long> g[222222];
vector<pair<long long,long long> > f[222222];
long long n,a[222222],x,y,l,r,mid,dep[222222];
void dfs(long long i,long long fa)
{
	dep[i]=dep[fa]+a[i];
	for (long long j=0;j<g[i].size();j++)
	{
		long long to=g[i][j];
		if (to==fa) continue;
		dfs(to,i);
	}
}
void merge(vector<pair<long long,long long> > &a,vector<pair<long long,long long> > &b,vector<pair<long long,long long> > &c,long long dep)//big,small,target
{
	long long l,r,m,Mid=mid+2*dep;
	vector<pair<long long,long long> > nw;
	for (long long i=0;i<b.size();i++)
	{
		l=0;r=(long long)a.size()-1;
		while(l<=r)
		{
			m=(l+r)>>1;
			if (a[m].first+b[i].second<=Mid) l=m+1;
			else r=m-1;
		}
		if (r>=0) nw.push_back(make_pair(b[i].first,a[r].second)); 
	}
	for (long long i=0;i<b.size();i++)
	{
		l=0;r=(long long)a.size()-1;
		while(l<=r)
		{
			m=(l+r)>>1;
			if (a[m].second+b[i].first<=Mid) r=m-1;
			else l=m+1;
		}
		if (l<a.size()) nw.push_back(make_pair(a[l].first,b[i].second)); 
	}
	sort(nw.begin(),nw.end());
	for (long long i=0;i<nw.size();i++)
	{
		if (c.empty()) c.push_back(nw[i]);
		else if (nw[i].second<c.back().second) c.push_back(nw[i]);
	}
}
void dft(long long i,long long fa)
{
	long long x=-1,y=-1;
	if (g[i].size()==1) 
	{
		f[i].push_back(make_pair(dep[i],dep[i]));
		return;
	}
	for (long long j=0;j<g[i].size();j++)
	{
		long long to=g[i][j];
		if (to==fa) continue;
		if (!~x) x=to;
		else y=to;
		dft(to,i);
	}
	if (f[x].size()<f[y].size()) merge(f[y],f[x],f[i],dep[i]);
	else merge(f[x],f[y],f[i],dep[i]);
	f[x].clear();f[y].clear();
}
bool check()
{
	f[1].clear();
	dft(1,0);
	if (!f[1].empty()) return 1;
	return 0;
}
int main()
{
	scanf("%lld",&n);
	for (long long i=1;i<n;i++)
	{
		scanf("%lld%lld",&x,&y);
		a[i+1]=y;
		g[x].push_back(i+1);
		g[i+1].push_back(x);  
	}
	dfs(1,0);
	l=0;r=1e11;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if (check()) r=mid-1;
		else l=mid+1;
	}
	printf("%lld\n",l);
	return 0;
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef long long ll;

#define N_MAX 12
#define M_MAX 1000

int n, m;
int a[M_MAX], b[M_MAX], c, key_bit[M_MAX] = {};

void input(){
	cin >> n >> m;
	REP(i, m){
		cin >> a[i] >> b[i];
		REP(j, b[i]){
			cin >> c;
			key_bit[i] += 1 << c-1;
		}
	}
}

int dp[1 << N_MAX];

void init(){
	REP(i, 1 << N_MAX){
		dp[i] = INT_MAX;
	}
	dp[0] = 0;
}

void print_dp(){
	REP(i, 1 << n){
		cout << dp[i] << ' ';
	}
	cout << endl << endl;
}

int solve(){
	init();

	REP(i, (1 << n)-1){
		if(dp[i] == INT_MAX) continue;
		REP(j, m){
			dp[i|key_bit[j]] = MIN(dp[i]+a[j], dp[i|key_bit[j]]);
		}
	}

	//print_dp();

	int ans = dp[(1 << n)-1];
	if(ans != INT_MAX) cout << ans << endl;
	else cout << -1 << endl;
}

int main(void){
	input();

	solve();

	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = list(input())
cnt = 0

cnt = s.count("R") * s.count("B") * s.count("G")
# j - i = k -j を求める。
sub = 0 
for i in range(n):
    for j in range(i, n):
        k = 2 * j - i
        if k <= n - 1:
            if (s[i] != s[j]) and (s[j] != s[k]) and (s[i] != s[k]):
                sub += 1

print(cnt-sub)


Measured memory_bytes: 9200
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<int, int> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
/*#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("pyramid.in", "r", stdin);
#endif*/
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e6 + 15;
int dx[8] = { -1, 0, 0, 1, 1, -1, 1, -1 };
int dy[8] = { 0, -1, 1, 0, 1, -1, -1, 1 };


int main()
{
	fast();
	int n;
	cin >> n;
	vector<int> arr(n);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	ll mn = oo*oo;
	for (int i = -100; i <= 100; i++)
	{
		ll sum = 0;
		for (int j = 0; j < n; j++)
		{
			sum += pow(arr[j] - i, 2);
		}
		mn = min(mn, sum);
	}
	cout << mn << endl;
	return 0;
}

Measured memory_bytes: 256
input_int = int(input())
# print(input_int_list)
# print(input_int_list[1])
# print(input_int_list[2])

ans = 0

n = input_int
for number1 in range(1,n + 1):
	for number2 in range(1,n + 1):
		for number3 in range(1,n + 1):
			ans += 1



		

print(ans)

Measured memory_bytes: 3060
//shan61916
#include <bits/stdc++.h>
    using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n" 
typedef long long ll;
typedef unsigned long long ull ;
typedef double dll ;
const ll mod = (ll)(1e9+7);
ll h, w;
vector<string> a;
ll dp[1001][1001];
ll recurse(ll x, ll y) {
	if(x < 1 or y < 1 or x > h or y > w) return 0;
	if(a[x-1][y-1] == '#') return dp[x][y] =  0;
	if(x == h and y == w) return 1;
	if(dp[x][y] != -1) return dp[x][y];
	dp[x][y] = 0;
	// cout << x << " " << y << endl;
	return dp[x][y] = (recurse(x+1, y)%mod + recurse(x, y+1)%mod)%mod;
}
int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  cin >> h >> w;
  memset(dp, -1, sizeof(dp));
  a.resize(h);
  for(ll i = 0; i < h; i++) cin >> a[i];
  ll ans = recurse(1,1)%mod; 
  cout << ans;	
  return 0;
} //good night.

Measured memory_bytes: 9216
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int n,a,b;
int ans;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b;
        ans+=b-a+1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

const ll MOD = 1e9 + 7;

int main() {
  string S;
  while (cin >> S) {
    int N = S.size();
    vector<ll> dpL(N + 1, 0), dpA(N + 1, 0), dpB(N + 1, 0), dpC(N + 1, 0);
    dpL[0] = 1;
    for (int i = 0; i < N; i++) {
      dpL[i + 1] = dpL[i];
      dpA[i + 1] = dpA[i];
      dpB[i + 1] = dpB[i];
      dpC[i + 1] = dpC[i];
      if (S[i] == 'A') {
        (dpA[i + 1] += dpL[i]) %= MOD;
      }
      if (S[i] == 'B') {
        (dpB[i + 1] += dpA[i]) %= MOD;
      }
      if (S[i] == 'C') {
        (dpC[i + 1] += dpB[i]) %= MOD;
      }
      if (S[i] == '?') {
        (dpL[i + 1] += 2 * dpL[i]) %= MOD;
        (dpA[i + 1] += 2 * dpA[i]) %= MOD;
        (dpB[i + 1] += 2 * dpB[i]) %= MOD;
        (dpC[i + 1] += 2 * dpC[i]) %= MOD;
        (dpA[i + 1] += dpL[i]) %= MOD;
        (dpB[i + 1] += dpA[i]) %= MOD;
        (dpC[i + 1] += dpB[i]) %= MOD;
      }
    }
    cout << dpC.back() << endl;
  }
  return 0;
}


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

fn power(mut x: i64, mut a: i64, mod_: i64) -> i64 {
    let mut res: i64 = 1;
    while a > 0 {
        if a % 2 == 1 {
            res = res * x % mod_;
        }
        x = x * x % mod_;
        a /= 2;
    }
    res
}

fn ncr(n: usize, r: usize, fact: &Vec<i64>, invf: &Vec<i64>, mod_: i64) -> i64 {
    (fact[n] * invf[r] % mod_) * invf[n - r] % mod_
}

fn main() {
    let mod_ = 10_i64.pow(9) + 7;
    let n: usize = read();
    let m: i64 = read();
    let mut po = m;
    let mut num = 2;
    let mut ans = 1;
    let size = 200000;
    let mut fact: Vec<i64> = vec![1; size];
    let mut invf: Vec<i64> = vec![1; size];
    for i in 2..200000 {
        fact[i] = i as i64 * fact[i - 1] % mod_;
        invf[i] = power(fact[i], mod_ - 2, mod_);
    }
    while po > 1 {
        if po % num == 0 {
            let mut cnt: usize = 0;
            while po % num == 0 {
                po /= num;
                cnt += 1;
            }
            ans *= ncr(cnt + n - 1, cnt, &fact, &invf, mod_);
            ans %= mod_;
        }
        num += 1;
    }
    println!("{}", ans);
}

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


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

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string str, ord, kari, p;
    int n, a, b;
    cin >> str >> n;
    for(int i = 0; i < n; i++){
        cin >> ord >> a >> b;
        if(ord == "print"){
            for(int j = a; j <= b; j++){
                cout << str[j];
            }
            cout << endl;
        } else if (ord == "reverse"){
            kari = "";
            for(int j = 0; j <= b - a; j++){
                kari += str[b-j];
            }
            str = str.substr(0, a) + kari + str.substr(b + 1);
        } else if (ord == "replace"){
            cin >> p;
            str = str.substr(0, a) + p + str.substr(b + 1 );
        }
    }
    return 0;
}



Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


int main() {
    
    string s;
    cin >> s;
    
    ll ans = 0;
    rep(i, (1 << (sz(s) - 1))) {
        ll sum = s[0] - '0';
        rep(j, sz(s) - 1) {
            if (i & (1 << j)) {
                ans += sum;
                sum = s[j + 1] - '0';
            } else {
                sum *= 10;
                sum += s[j + 1] - '0';
            }
            
        }
        ans += sum;
    }
    cout << ans << endl;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int r = 0, g = 0, b = 0;
  for (char c : S) (c == 'R' ? r++ : c == 'G' ? g++ : b++);
  long ans = (long) r * g * b;
  for (int i = 0; i < N; i++) {
    for (int sp = 1; i + sp + sp < N; sp++) {
      if ((S.at(i) ^ S.at(i + sp) ^ S.at(i + sp + sp)) == 87) ans--;
    }
  }
  cout << ans << "\n";
}

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

ll f(ll left, ll right, ll back, vector<ll>& array){
    priority_queue<ll, vector<ll>, greater<ll>> q;

    ll total = 0;
    for(ll i = 0; i < left; i++ ){
        q.push(array[i]);
        total+=array[i];
    }
    for(ll i = 0; i < right; i++ ){
        q.push(array[array.size()-i-1]);
        total+=array[array.size()-i-1];
    }
    for(ll i = 0; i < back; i++){
        ll v = q.top();
        total -= v;
        q.pop();
    }
    // DEBUG("left:%lld, right:%lld, back:%lld, total:%lld", left ,right, back, total);
    return total;
}

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;
    ll K;

    cin >> N >> K;
    vector<ll> array(N, 0);
    REP(i, N){ cin >> array[i]; }

    ll ans = -INF;
    for( ll left = 0; left <= K && left <= N; left++){
        for(ll right = 0; right <= K-left && (left+right) <= N; right++){
            for( ll back = 0; back <= (left+right) && (back+left+right) <= K; back++){
                ll total = f(left, right, back, array);
                ans = max(ans,total);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
typedef long long ll;
ll x;
ll p(ll x)
{
    return x*x*x*x*x;
}
int main()
{
    scanf("%lld",&x);
    for(int i=1;i<=200;i++)
        for(int j=-200;j<=i;j++)
    {
        if(p(i)-p(j)==x)
        {
            printf("%d %d\n",i,j);return 0;
        }
    }
}


Measured memory_bytes: 3812
#include <stdio.h>
#include <string.h>
 
int main(){
  char english[1024],correct[]="Hoshino",*c;
  int i,n;
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
    fgets(english,sizeof(english),stdin);
    while((c=strstr(english,correct))!=NULL) c[6]='a';
    printf("%s",english);
  }
  return 0;
}

Measured memory_bytes: 608
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
    String str;
    while ((str = buf.readLine()) != null) {
      String[] nums = str.split(" ");
      int sum = Integer.parseInt(nums[0]) + Integer.parseInt(nums[1]);
      System.out.println(Integer.toString(sum).length());
    }
  }
}

Measured memory_bytes: 23948
x, n = map(int , input().split())

p = list(map(int, input().split()))

cnt = [0] * 102

for i in range(n):
    cnt[p[i]] = 1

ans = 0
sa = x
for i in range(1, 102):
    if cnt[i] == 0:
        if sa > abs(x - i):
            ans = i
            sa = abs(x - i)
print(ans)


Measured memory_bytes: 9192
a, b, c, x, y = map(int, input().split())

if a+b < 2*c:
    ans = a*x + b*y
else:
    if x < y:
        ans = 2*c * x + b*(y-x)
    elif y < x:
        ans = 2*c * y + a*(x-y)
    else:
        ans = 2*c*x
    ans = min(ans, 2*c*max(x,y))

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

ll f(ll b, ll n){
  if(n == 0) return 0;
  return f(b, n/b) + (n%b);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll n,s,d;
  cin >> n >> s;
  d = n-s;
  if(d < 0){
    cout << -1 << endl;
    return 0;
  }
  if(d==0){
    cout << n+1 << endl;
    return 0;
  }
  for(ll b=2;b*b<=n;b++){
    if(f(b,n) == s){
      cout << b << endl;
      return 0;
    }
  }
  ll ans = INF;
  for(ll p=1;p*p<n;p++){
    if(d%p==0 && d/p>0){
      ll b=d/p+1;
      if(f(b,n) == s) ans = min(ans,b);
    }
  }
  if(ans == INF) ans=-1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
 
#define rep(i,n) for(int i=0; i<n; i++)
 
int main() {
  int A, B;
  ;
  cin >> A >> B;
  ;
  if(A<=B) {
    rep(i,B) {
      cout << A;
    }
    cout << endl;
  } else {
    rep(i,A) {
      cout << B;
    }
  cout << endl;
  }
  
 return 0; 
}

Measured memory_bytes: 888
def min(a,b); a < b ? a : b; end

N = gets.to_i
S = N.times.map{ gets.chomp }
H = Hash.new(100)

S.each do |s|
  ('a' .. 'z').each{|c| H[c] = min(s.count(c), H[c]) }
end
puts ('a' .. 'z').inject(""){|s,c| s + c * H[c]}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int main() {
   set<int> s;
   int a, b, k;
   cin >> a >> b >> k;
   for (int i = a; i < a+k; i++) {
      s.insert(i);
      if (i == b) break;
   }
   for (int i = b; i > b-k; i--) {
      s.insert(i);
      if (i == a) break;
   }

   for (int x : s) {
      cout << x << endl;
   }

   return 0;
}

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vii = vector<pii>;
using vs = vector<string>;
#define all(x) x.begin(), x.end()
// int di[] = {0, 1, 0, -1};
// int dj[] = {1, 0, -1, 0};
const ll MOD = 1e9 + 7;
const ll INF = 1e9;

int n, m;
vvi adj;
vb vis;

int dfs(int node) {
	if (vis[node]) return 0;
	vis[node] = true;

	int ret = 1;
	for (auto& i : adj[node]) {
		ret += dfs(i);
	}
	return ret;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	cin >> n >> m;
	adj.assign(n, vi());
	vis.assign(n, false);
	for (int i = 0; i < m; ++i) {
		int u, v; cin >> u >> v; u--, v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	int ans = 0;
	for (int i = 0; i < n; ++i) {
		ans = max(ans, dfs(i));
	}
	cout << ans << endl;
}


Measured memory_bytes: 20240
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
typedef long long ll;
typedef long double ld;
#define trace(x)  cerr << #x << ": " << x << endl;
const ll MOD = 1e9+7;
#define vl vector<ll> 
int main()
{
	fast;
	int n;cin>>n;
	int a[n];for(ll i=0;i<n;i++)cin>>a[i];
	ll curmon=1000;ll curstock=0;
	//if(n==1){cout<<curmon;return 0;}
	for(ll i=0;i<n;i++)
	{
		if(i==0)
		{
			if(a[i]<=a[i+1])
			{
				curstock+=curmon/a[i];
				curmon-=(curstock*a[i]);
			}
		}
		else if(i==n-1)
		{
			if(a[i]>=a[i-1])
			{
				curmon+=(curstock*a[i]);curstock=0;
			}
		}
		else
		{
			//if(a[i]==a[i-1] && a[i]==a[i+1])continue;
			if(a[i]>=a[i-1] && a[i]>=a[i+1])
			{
				curmon+=(curstock*a[i]);curstock=0;
			}
			else if(a[i]<=a[i-1]  && a[i]<=a[i+1])
			{
				ll temp=curmon/a[i];
				curmon-=(temp*a[i]);
				curstock+=temp;	
			}
		}
		//trace(curmon);trace(curstock);
	}
	cout<<curmon;
}

Measured memory_bytes: 3628
X=int(input())
while X>0:
  if X%100>=5 :X-=105
  elif X%100==4:X-=104
  elif X%100==3:X-=103
  elif X%100==2:X-=102
  elif X%100==1:X-=101
  elif X%100==0:break

if X>=0:print(1)
else:print(0)

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

int main(){
    ll d,g;
    cin >> d >> g;
    vector<pair<ll,ll>> pc(d);
    for (ll i = 0; i < d; i++){
        cin >> pc[i].first >> pc[i].second;
    }
    ll sum;
    ll solve;
    ll maxi;
    ll ans = 10000;
    ll x;
    for (ll bit = 0; bit <= (1<<d); bit++){
        sum = 0;
        maxi = 0;
        solve = 0;
        for (ll i = 0; i < d; i++){
            if (bit & (1 << i)){
                sum += pc[i].first*(i+1)*100 + pc[i].second;
                solve += pc[i].first;
            }else{
                maxi = i+1;
            }
        }
        
        if (g > sum){
            ll s = 100*maxi;
            //x = (g-sum+s-1)/s;
            x = (g-sum)/s;
            if ((g-sum)%s != 0){
                x++;
            }
            if (x >= pc[maxi-1].first){
                continue;
            }
            solve += x;
        }
        
        ans = min(ans,solve);
    }
    cout << ans << endl;
}

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

const int INF = 1001001001;

int main(){
  int h,w,d;
  cin >> h >> w >> d;
  vector<vector<pair<int,int>>> mem(d,vector<pair<int,int>>((h*w/d)+1));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      int emt; cin >> emt;
      emt--;
      mem.at(emt%d).at(emt/d) = make_pair(i,j);
    }
  }
  vector<vector<int>> mp(d,vector<int>((h*w/d)+1));
  for(int i=0;i<d;i++){
    for(int j=1;j<((h*w/d)+1);j++){
      mp.at(i).at(j) = mp.at(i).at(j-1) + abs(mem.at(i).at(j).first - mem.at(i).at(j-1).first) + abs(mem.at(i).at(j).second - mem.at(i).at(j-1).second);   
    }
  }
  int q; cin >> q;
  for(int i=0;i<q;i++){
    int l,r;
    cin >> l >> r;
    l--; r--;
    cout << mp.at(r%d).at(r/d) - mp.at(l%d).at(l/d) <<endl;
  }
}

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

using namespace std;

int main()
{
    int n,stmna=0;
  	float p,sum=0;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum+=a[i];}
    p = (sum/n);
  	p = round(p);
    for(int i=0;i<n;i++)
        stmna += pow((a[i]-p),2);
    cout << stmna;
        
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N;
  cin >> N;
  
  vector<int>h(N);
  for(int i=0; i<N; i++) cin >> h[i]; ///入力完了

  int range=0;
  for(int i=0; i<N; i++) range = max(range,h[i]);  ///範囲取得のための最大値
  
  int count=0;
  for(int j=0; j<range; j++){

    count++;
    
    for(int i=0; i<N-1; i++){
      if(h[i]>0 && h[i+1]<=0) count++;
    }
    
    if(h[N-1]<=0) count--;
       
    for(int i=0; i<N; i++)h[i]--;
    
  }
  
  cout << count << endl;
  
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 30

int main(){
  int h, w, a[SIZE][SIZE];

  scanf("%d%d",&h,&w);

  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      scanf("%d",a[i]+j);

  priority_queue<pair<ll,pair<int, int> > > pq;

  pq.push({0,{0, 0}});

  bool visited[SIZE*SIZE][SIZE*SIZE] = {};

  int dx[4] = {0,0,1,-1};
  int dy[4] = {1,-1,0,0};
  
  while(pq.size()){
    auto p = pq.top();
    pq.pop();

    ll cost = p.first;
    int y = p.second.first/30;
    int x = p.second.first%30;
    int dist = p.second.second;

    if(y == h-1 && x == w-1){
      printf("%lld\n",-cost);
      break;
    }
    
    if(visited[p.second.first][dist] || dist > h*w) continue;
    visited[p.second.first][dist] = true;
    
    for(int i=0;i<4;i++){
      int ny = y + dy[i], nx = x + dx[i];
      if(ny < 0 || h <= ny || nx < 0 || w <= nx) continue;

      pq.push({cost - ((ll)a[ny][nx] * (dist * 2 + 1)), {ny*30+nx, dist+1}});
    }
  }
  
  return 0;
}



Measured memory_bytes: 12008
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

X  = int(input())
while True:
    if is_prime(X):
        print(X)
        break
    else:
        X += 1    


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

#define  int        long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
 #define PQS priority_queue <pair <int, pii> , vector<pair <int, pii>>, greater<pair <int, pii>> > 
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}
int dist[1005][1005];
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
int32_t main()
{
    fast
    int n, m;
    cin >> n >> m;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    char mat[n+2][m+2];
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++) 
        {
            cin >> mat[i][j];
            dist[i][j] = 1e18;
        }
    PQS Q;
    Q.push({0,{x1,y1}});
    dist[x1][y1] = 0;
    while(!Q.empty())
    {
        int d = Q.top().ff;
        int x = Q.top().ss.ff, y = Q.top().ss.ss;
        Q.pop();
        for(int i = 0; i < 4; i++)
        {
            int a = x+dx[i], b = y+dy[i];
            if(a <= 0 || a > n || b <= 0 || b > m || mat[a][b] == '#')
                 continue;
            if(dist[a][b] > d) 
            {
                dist[a][b] = d;
                Q.push({{dist[a][b]}, {a,b}});
            }
        }
    
        for(int i = x-2; i <= x+2; i++) 
        {
            for(int j = y-2; j <= y+2; j++) 
            {
                int a = i, b = j;
                if(a <= 0 || a > n || b <= 0 || b > m || mat[a][b] == '#')
                    continue;
                if(dist[a][b] > d+1)
                {
                    dist[a][b] = d+1;
                    Q.push({{dist[a][b]}, {a,b}});
                }
            }
        }
   }
    if(dist[x2][y2] == 1e18) dist[x2][y2] = -1;
    cout << dist[x2][y2] << '\n';
}

Measured memory_bytes: 12648