akhauriyash/Code-Regression huggingface dataset:
x = int(input())
y = str(x)

sa = None

for i in range(len(y) - 2):
    z = str(x)[i:3+i]
    bbb = abs(int(z) - 753)

    if not sa:
        sa = bbb
    
    if sa > bbb:
        sa = bbb

print(sa)

Measured memory_bytes: 2940
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
    int d = 0;
    int c[26];
    int s[365][26];
    int t[365];
    int last[26] = {0};
    int score = 0;

    cin >> d;

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

    for(int i = 0; i < d; i++)
    {
        for(int j = 0; j < 26; j++)
        {
            cin >> s[i][j];
        }
    }

    for(int i = 0; i < d; i++)
    {
        cout << (i % 26 + 1) << endl;
    }

}

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

n,q = map(int, input().split())
s = input()

t = [0]*(n)
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]

for i in range(q):
    l,r = map(int, input().split())
    print(t[r-1] - t[l-1])


Measured memory_bytes: 6356
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

H,W = imn()

if H == 1 or W == 1:
    print(1)
else:
    print(math.ceil(H*W/2))


Measured memory_bytes: 5812
#include<stdio.h>

int main(){
  int x,n,flag1,flag2;
  scanf("%d %d",&x,&n);
  
  int p[n+1];
  for(int i=1;i<=n;i++){scanf("%d",&p[i]);}
  
  for(int i=0;i>=0;i++){
    flag1=0;
    for(int j=1;j<=n;j++){
      if(x-i==p[j]){flag1=1;break;}
    }
    if(flag1==0){printf("%d",x-i);return 0;}
    
    flag2=0;
    for(int k=1;k<=n;k++){
      if(x+i==p[k]){flag2=1;break;}
    }
    if(flag2==0){printf("%d",x+i);return 0;}
  }
}



Measured memory_bytes: 1736
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int N;
    LL x;
    cin >> N >> x;
    VL a(N);
    REP(i, N) cin >> a[i];
    SORT(a);
    int cnt = 0;
    REP(i, N) {
        if (a[i] <= x) {
            if (i + 1 < N) {
                x -= a[i];
                cnt++;
            } else {
                if (x == a[i]) {
                    cnt++;
                }
            }
        } else {
            break;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi "SEVENS.inp"
#define fo "SEVENS.out"
#define maxn 1000

using namespace std;

int l,r,pl[3],n,a[maxn];
bool kt1[maxn],kt2[maxn];

bool dq(int x, int gt)
{
    bool ans;
    if (x==1)
    {
      ans=true;
      if ((pl[x]==1) && (gt!=0)) return true;
      if ((a[l-1]==1) && (gt==1))
      {
        l--;
        a[l]=0;
        pl[x]--;
      }
      if ((a[r+1]==1) && (gt==2))
      {
        r++;
        a[r]=0;
        pl[x]--;
      }

      if (a[l-1]==2) ans=ans && dq(2,1);
      if (a[r+1]==2) ans=ans && dq(2,2);
      if (a[l-1]!=2 && a[r+1]!=2) ans=ans && dq(2,0);
    }
    else
    {
      ans=false;
      if ((pl[x]==1) && (gt!=0)) return false;
      if ((a[l-1]==2) && (gt==1))
      {
        l--;
        a[l]=0;
        pl[x]--;
      }
      if ((a[r+1]==2) && (gt==2))
      {
        r++;
        a[r]=0;
        pl[x]--;
      }

      if (a[l-1]==1) ans=ans || dq(1,1);
      if (a[r+1]==1) ans=ans || dq(1,2);
      if (a[l-1]!=1 && a[r+1]!=1) ans=ans || dq(1,0);
    }

    if (gt==1) {a[l]=x;l++;pl[x]++;};
    if (gt==2) {a[r]=x;r--;pl[x]++;};
    return ans;
}

void process()
{
    l=7;
    r=7;
    pl[1]=6;
    pl[2]=6;
    bool kq=false;

    if (a[6]==1) kq=kq || dq(1,1);
    if (a[8]==1) kq=kq || dq(1,2);
    if ((a[6]==2) && (a[8]==2)) kq=kq || dq(1,0);

    if (kq==true) printf("yes\n"); else printf("no\n");
}

void open()
{
    //freopen(fi,"r",stdin);
    //freopen(fo,"w",stdout);

    scanf("%d",&n);
    for (int i=1; i<=n; i++)
    {
      for (int j=1; j<=13; j++) a[j]=2;
      a[7]=0;

      for (int j=1; j<=6; j++)
      {
        int x;
        scanf("%d",&x);
        a[x]=1;
      }

      process();
    }
}

int main()
{
    open();
    return 0;
}



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

int main() {

  string x;
  cin >> x;
  
  while (x != "0") {
  int sum = 0;
  for (int i=0; i<x.size(); i++) {
    sum += x.at(i) - '0';
  }
  cout << sum << endl;
  cin >> x;
  }
 

return 0;
}



Measured memory_bytes: 3140
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
//const ll mod = 1000 * 1000 * 1000 + 7;




void solve() {
    ll a, b, x;
    cin >> a >> b >> x;
    ll res = b / x + 1;
    if (a > 0) {
        res -= (a - 1) / x + 1;
    }
  cout << res << endl;
}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int H = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(H, N, A) ? YES : NO);
    }

    private static boolean solve(int H, int N, int[] A) {
        int sum = 0;

        for (int i=0; i<N; i++) {
            sum += A[i];
        }

        return sum >= H;
    }
}

Measured memory_bytes: 48544
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	int r, g, b; cin >> r >> g >> b;

	if ((g * 10 + b) % 4 == 0)cout << "YES";
	else cout << "NO";

	return 0;

}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  string s, t = "";
  cin >> s;
  for(int i = 2; i >= 0; i--){
    t += s[i];
  }
  if(s == t) cout << "Yes" << endl;
  else cout << "No" << endl;
  system("pause");
}

Measured memory_bytes: 504
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

const int N = (int) 1e5 + 5, M = 4e5 + 5, S = 26, mod = (int) 0;

int cnt = 1, mark[M], have[N][S][S], cur[S][S], sz[M], nxt[M][S];

void add(string x, int p) {
    int v = 0;
    for (int i = 0; i < (int) x.size(); ++i) {
        sz[v]++;
        int c = x[i] - 'a';
        if (!nxt[v][c]) nxt[v][c] = cnt++;
        v = nxt[v][c];
    }
    sz[v]++;
    mark[v] = p + 1;
}

void dfs(int v, int d = 0) {
    for (int c = 0; c < 26; ++c) if (nxt[v][c]) {
        cur[0][0] += mark[v] > 0;
        for (int a = 0; a < 26; ++a) if (nxt[v][a] && a != c) {
            cur[a][c] += sz[nxt[v][a]];
        }
        dfs(nxt[v][c], d + 1);
        cur[0][0] -= mark[v] > 0;
        for (int a = 0; a < 26; ++a) if (nxt[v][a] && a != c) {
            cur[a][c] -= sz[nxt[v][a]];
        }
    }
    if (mark[v]) {
        for (int a = 0; a < 26; ++a)
            for (int b = 0; b < 26; ++b)
                have[mark[v] - 1][a][b] = cur[a][b];
    }
}

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        add(s, i);
    }
    dfs(0);
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int p;
        cin >> p;
        string x;
        cin >> x;
        int res = have[p - 1][0][0];
        for (int a = 0; a < (int) x.size(); ++a)
            for (int b = a + 1; b < (int) x.size(); ++b)
                res += have[p - 1][x[a] - 'a'][x[b] - 'a'];
        cout << res + 1 << '\n';
    }
}


Measured memory_bytes: 274944
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=tf-8
#

"""
"""

from collections import defaultdict
from itertools import combinations
import bisect

import sys
input = sys.stdin.readline

def solve(x,k,d):
    x = abs(x)
    a = x // d
    if k <= a:
        ans = x - k * d
    elif (k - a) % 2 == 0:
        ans = x % d
    else:
        ans = d - x%d
    print(ans)

            

def main():
    x,k,d = list(map(int,input().split()))
    solve(x,k,d)


if __name__ == "__main__":
    main()

Measured memory_bytes: 64928
import java.util.Scanner;


import java.util.Comparator;
import java.util.Arrays;
import java.util.ArrayList;



public class Main {

	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int [] p = new int[n];
		for(int i = 0; i<n ;i++) {
			p[i] = sc.nextInt();
		}
		int sum = 0;
		for(int i = 0; i<n-2 ;i++) {
			if(p[i] < p[i+1] && p[i+1]<p[i+2]) {
				sum++;
			}
			else if(p[i] > p[i+1] && p[i+1] > p[i+2]) {
				sum++;
			}
		}
		System.out.println(sum);

		
	}
}


Measured memory_bytes: 23892
A, B = map(int, input().split())

N = 100

A -= 1
B -= 1

S = []
for i in range(N // 2):
  S.append(list("." * N))
for i in range(50):
  S.append(list("#" * N))

flag = 0
for i in range(1, N // 2, 2):
  for j in range(1, N, 2):
    if B == 0:
      flag = 1
      break
    else:
      S[i][j] = "#"
      B -= 1
  if flag:
    break

flag = 0
for i in range(N // 2 + 1, N, 2):
  for j in range(1, N, 2):
    if A == 0:
      flag = 1
      break
    else:
      S[i][j] = "."
      A -= 1
  if flag:
    break

print(N, N)
for i in range(N):
  print("".join(S[i]))
  

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

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main(){
  ll N,M;cin>>N>>M;
  vll p(N);rep(i,N){cin>>p[i];p[i]--;}
  UnionFind uf(N);
  rep(i,M){
    int x,y;cin>>x>>y;x--,y--;
    uf.merge(x,y);
  }
  ll ans=0;
  rep(i,N){
    if(uf.issame(i,p[i]) || (i==p[i])) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
using System;

class PaintingBallsWithAtCoDeer {
    static void Main() {
        
        string[] input  = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);

        // 答え見た
        Console.WriteLine(K * Math.Pow((double)(K - 1), (double)(N - 1)));
    }

}

Measured memory_bytes: 2648
N=int(input())
A=list(map(int,input().split()))
A.sort()
max_a=A[-1]
dp=[True]*(max_a+1)
ans=0
for i in range(N):
  a=A[i]
  #print(a)
  if dp[a]==True: 
    if i==N-1:
      ans+=1
    elif a!=A[i+1]:
      ans+=1
    
    k=a
    while k<=max_a:
      dp[k]=False    
      k+=a
print(ans)

Measured memory_bytes: 116900
#include <stdio.h>

int main(void){
	int x, y;
	
	while(1){
		scanf("%d %d", &x, &y);
		if(x == 0 && y == 0) break;
		
		if(x > y){
			int tmp;
			tmp = x;
			x = y;
			y = tmp;
			printf("%d %d\n", x, y);
		}else{
			printf("%d %d\n", x, y);
		}
	}
	
	return 0;
}

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

int main() {
  int64_t n;
  cin >> n;
  vector<int> a(n);
  rep (i, n) cin >> a.at(i);
  sort(a.begin(), a.end());

  string ans = "YES";
  int currentNo = 0;
  rep (i, n) {
    if (currentNo == a.at(i)) {
      ans = "NO";
      break;
    } else {
      currentNo = a.at(i);
    }
  }

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class graph_bridge{
public:
	static const int MAX=100005;
	vector<int> G[MAX];
	bool visited[MAX];
	int prenum[MAX],parent[MAX],lowest[MAX],timer;
	set<P> bridge;
	int cmp[MAX];

	void dfs(int v,int prev){
		prenum[v]=lowest[v]=timer;
		timer++;
		visited[v]=true;
		int next;
		for(int i=0;i<G[v].size();i++){
			next=G[v][i];
			if(!visited[next]){
				parent[next]=v;
				dfs(next,v);
				lowest[v]=min(lowest[v],lowest[next]);
				if(prenum[v]<lowest[G[v][i]])bridge.insert(P(min(v,G[v][i]),max(v,G[v][i])));
			}else if(next!=prev){
				lowest[v]=min(lowest[v],prenum[next]);
			}
		}
	}

	void dfs2(int v,int k){
		cmp[v]=k;
		for(int i=0;i<G[v].size();i++){
			int nv=G[v][i];
			if(cmp[nv]>=0)continue;
			if(bridge.find(P(min(v,nv),max(v,nv)))==bridge.end()){
				dfs2(nv,k);
			}
		}
	}

	int construct_TwoEdgeConnectedComponent(int N){
		for(int i=0;i<N;i++){
			visited[i]=false;
		}
		timer=1;
		for(int i=0;i<N;i++){
			if(!visited[i]){
				dfs(i,-1);
			}
		}
		memset(cmp,-1,sizeof(cmp));
		int k=0;
		for(int i=0;i<N;i++){
			if(cmp[i]==-1){
				dfs2(i,k);
				k++;
			}
		}
		return k;
	}
};

graph_bridge b;

int n,m;
int u[100005],t[100005];
ll w[100005];
ll nw[100005];
vector<P> G[100005];
map<P,int> mp;
ll dif=0;
P ans;
ll sum;

ll labs(ll v){
	if(v<0LL)return -v;
	return v;
}

ll dfs(int v,int p){
	ll val=nw[v];
	for(int i=0;i<G[v].size();i++){
		P e=G[v][i];
		if(e.first==p)continue;
		ll cv=dfs(e.first,v);
		val+=cv+w[e.second];
		ll cdif=labs(sum-cv*2LL-w[e.second]);
		//printf("%d %d %lld\n",v,e.first,cdif);
		if(cdif<dif){
			dif=cdif;
			ans=P(u[e.second],t[e.second]);
		}else if(cdif==dif){
			ans=min(ans,P(u[e.second],t[e.second]));
		}
	}
	//printf("%d %lld\n",v,val);
	return val;
}

int main(void){
	scanf("%d%d",&n,&m);
	sum=0;
	for(int i=0;i<m;i++){
		scanf("%d%d%lld",&u[i],&t[i],&w[i]);
		u[i]--;
		t[i]--;
		b.G[u[i]].push_back(t[i]);
		b.G[t[i]].push_back(u[i]);
		mp[P(u[i],t[i])]=i;
		sum+=w[i];
		if(dif<w[i]){
			dif=w[i];
			ans=P(u[i],t[i]);
		}else if(dif==w[i]){
			ans=min(ans,P(u[i],t[i]));
		}
	}
	dif=sum-dif;
	//printf("%lld\n",dif);
	int siz=b.construct_TwoEdgeConnectedComponent(n);
	for(int i=0;i<m;i++){
		if(b.cmp[u[i]]==b.cmp[t[i]]){
			nw[b.cmp[u[i]]]+=w[i];
		}
	}
	for(set<P>::iterator it=b.bridge.begin();it!=b.bridge.end();it++){
		P p=*it;
		//printf("b %d %d\n",p.first,p.second);
		int ev=mp[p];
		p.first=b.cmp[p.first];
		p.second=b.cmp[p.second];
		G[p.first].push_back(P(p.second,ev));
		G[p.second].push_back(P(p.first,ev));
	}
	dfs(0,-1);
	printf("%d %d\n",ans.first+1,ans.second+1);
	return 0;
}


Measured memory_bytes: 28968
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,a[MAXN];
int main()
{
    int ans=0;
    scanf("%d",&n); n*=2;
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(int i=(n&1?2:1);i<=n;i+=2) ans+=a[i];
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io
    
    int n;
    cin>>n;

    ll sum=0;
    for(int i=1;i<=n;i++){
        if(i%3==0 || i%5==0 || i%15==0){
            continue;
        }
        sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}

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

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;
const ll _INF = 1e18+7;


int main(){
	setIO();
	ll n, mx = 0, sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		ll x; cin >> x;
		if (!i) mx = x;
		else{
			if (x < mx) sum += (mx-x);
			mx = max(x, mx);
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 3652
from collections import deque
s = input()
q = int(input())
f = ""
b = ""
forward = True
for _ in range(q):
    que = list(input().split())
    if int(que[0]) == 1:
        if forward:
            forward = False
        else:
            forward = True
    else:
        if (int(que[1]) == 1 and forward) or (int(que[1]) == 2 and not forward):
            f+=que[2]
        else:
            b+=que[2]

if forward:
    print(f[::-1]+s+b)
else:

    print(b[::-1]+s[::-1]+f)

Measured memory_bytes: 4664
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{s:chars};
    println!("{}{}{}", s[0], s.len()-2, s[s.len()-1]);
}


Measured memory_bytes: 4352
n=int(input())
su=0
a = list(map(int, input().split())) 
da={}
for i in range(len(a)):
    if a[i] in da:
        da[a[i]]+=1
    else:
        da[a[i]]=1
 
for p in da.keys():
    su+=da[p]*(da[p]-1)/2

for k in range(len(a)):
    sut=su-(da[a[k]]-1)
    print(int(sut))


Measured memory_bytes: 25716
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == "?":
        break
    elif op == "+":
        ans = a + b
    elif op == "-":
        ans = a - b
    elif op == "*":
        ans = a * b
    elif op == "/":
        ans = a // b
    print(ans)



Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
vector<int> G[50];
int connect[50][50]={};
bool visited[50];
int n,m;
int ans=0;
//グラフの連結判定
int cnt=0;
void dfs(int now){
    visited[now] = true;
    for(int i=0;i<n;i++){
        if(!visited[i] && connect[now][i]){
            dfs(i);
        }
    }
    
}
int main(){
    cin>>n>>m;
    //vector<int> visited(n,false);
    //vector<vector<bool>> connect(n,vector<bool>(n,false));
    vector<int> a(m),b(m);
    rep(i,m){
        cin>>a[i]>>b[i];
        a[i]--,b[i]--;
        connect[a[i]][b[i]]=true;
        connect[b[i]][a[i]]=true;
    }
    rep(i,m){
        //dfs(0,visited,connect);
        connect[a[i]][b[i]]=false;
        connect[b[i]][a[i]]=false;
        rep(j,n){
            visited[j]=false;
        }
        dfs(0);
        bool bridge=false;
        rep(j,n){
            if(!visited[j]){
                bridge=true;
            }
        }
        if(bridge){
            cnt++;
        }
        //a[i]-b[i]の辺を取り除いた状態で、グラフが連結か
        connect[a[i]][b[i]]=true;
        connect[b[i]][a[i]]=true;
    }
    cout<<cnt<<endl;
}

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

void out(int*A, int N) {
	cout << A[0];
	for (int i = 1; i < N; i++) {
		cout << " " << A[i];
	}
	cout << endl;
}

void bubblesort(int*A, int N) {
	int temp;
	int count = 0;
	int flag = 1;
	while (flag){
		flag = 0;
		for (int j = N - 1; j > 0; j--) {
			if (A[j] < A[j - 1]) {
				temp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = temp;
				count++;
				flag = 1;
			}
		}
	}
	out(A, N);
	cout << count << endl;
}

int main() {
	int N;
	cin >> N;
	int* A = new int[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	bubblesort(A, N);
}



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

namespace ABC099
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> list = new List<string>();
            while (true)
            {
                string line = Console.ReadLine();
                if (line == null) break;
                list.Add(line);
            }

            bool chk = true;
            var str = list.Where(z => z.ToString() != list[0]);

            var c = str.Distinct().Count();

            if (c!=int.Parse(list[0]))
            {
                chk=false;
                
            }

            string hokan = "";
            foreach (var item in str.Select((Value, Index) => new { Value, Index }))
            {
                if (item.Index==0)
                {
                    hokan = item.Value.Substring(item.Value.Length - 1, 1);
                }
                else
                {
                    if (!hokan.Equals(item.Value.Substring(0, 1)))
                    {
                        chk = false;
                    
                    }
                    else
                    {
                        hokan = item.Value.Substring(item.Value.Length - 1, 1);
                    }
                }
            }
            if (chk==true)
	        {
		        Console.WriteLine("Yes");
	        }else
	        {
                Console.WriteLine("No");
	        }
            
        }
    }
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 2e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	string s;
	cin >> s;
	int n = s.size();
	int m = pow(2, n - 1);
	int i, j;
	ll ans = 0;
	for (i = 0; i < n; i++) {
		for (j = 0; i + j < n; j++) {
			ans += (s[i] - '0') * pow(10, j) * pow(2, i) * pow(2, max(0, n - 2 - i - j));
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int ans=0;
        int arr[]=new int[n];
        int arr1[]=new int[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=sc.nextInt();
        }
        for(int i=0;i<n;i++)
        {
            ans=ans^arr[i];
        }
        for(int i=0;i<n;i++)
        {
            arr1[i]=ans^arr[i];
        }
        for(int i=0;i<n;i++)
        {
            System.out.println(arr1[i]);
        }

    }
}

Measured memory_bytes: 61288
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pob pop_back
#define MP make_pair
#define VI vector<int>
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.F<<","<<_p.S<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e2+5;
const ll MOD=1000000007;
const ll INF=(ll)1e18;

int main(){
	IOS();
	ll n;cin>>n;
	REP(i,n){
		char c;cin>>c;
		if(c=='Y') return cout<<"Four"<<endl,0;
	}
	cout<<"Three"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e5;
int aa[N+2],bb[N+2],cc[N+2];
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;
  for(int i=1;i<=n;i++)cin>>aa[i];
  for(int i=1;i<=n;i++)
    bb[i]=__gcd(aa[i],bb[i-1]);
  for(int i=n;i>=1;i--)
    cc[i]=__gcd(aa[i],cc[i+1]);
  int ans=max(bb[n],cc[1]);
  for(int i=1;i<=n;i++)
    ans=max(ans,__gcd(bb[i-1],cc[i+1]));
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1408
#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 <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
    os << p.first << ":" << p.second;
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "[";
    for (auto it = mp.begin(); it != mp.end(); ++it) {
        if (it != mp.begin()) {
            os << ", ";
        }
        os << *it;
    }
    return os << "]";
}

// edit

void ope(vector<int> &A) {
    vector<int> B(A.size());
    for (int i = 0; i < A.size(); ++i) {
        int l = max(0, i - A[i]);
        int r = i + A[i] + 1;
        B[l]++;
        if (r < A.size()) B[r]--;
    }
    for (int i = 0; i + 1 < A.size(); ++i) {
        B[i + 1] += B[i];
    }


    A = move(B);
}

void solve() {
    int N, K;
    cin >> N >> K;

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

    REP(i, K) {
        ope(A);
//        cout << A << endl;
        int min_v = *min_element(all(A));
        if (min_v == N) {
            break;
        }
    }

    for (int i = 0; i < N; ++i) {
        cout << A[i] << " ";
    }
    cout << endl;


}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


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

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N, answer = 1;
    string S;
    cin >> N >> S;
    unordered_map<char,long long> mp;
    for (int i = 0; i < N; i++) {
        mp[S.at(i)]++;
    }
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        answer *= itr->second + 1;
        answer %= 1000000007;
    }
    answer += 1000000006;
    answer %= 1000000007; 
    cout << answer << endl;
}

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


#define M_MAX 20
#define N_MAX 50000
#define INFTY 1 << 29

int f(int n){
if(n%2==0)return n/2;
else return 3*n+1;
}


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

vector<int> lis;

lis.push_back(s);
int count=1;
int flag=0;
while(flag==0){


s=f(s);
count++;
for(int i:lis){
if(i==s){
cout << count;
flag=1;
break;
}

}

lis.push_back(s);
}

//cout << count;

}


Measured memory_bytes: 256
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug_v(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"debug.hpp"
#include"print.hpp"
#endif
// }}}

Int Q;
vector<Int> A;
vector<Int> B;

Int calc(Int A, Int B){
	if(A>B)swap(A,B);
	if(A==B){
		return A*2-2;
	}
	Int t = (Int)(sqrt((rn)(A*B-1))+1e-13L);
	if(t*(t+1)>=A*B){
		return t*2-2;
	}else{
		return t*2-1;
	}
}

void solve(){
	REP(i,Q)cout<<calc(A[i],B[i])<<endl;
}

//{{{ main function
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> Q;
    A.resize(Q);
    B.resize(Q);
    for(int i = 0 ; i < Q ; i++){
        cin >> A[i];
        cin >> B[i];
    }
	solve();
	return 0;
}

//}}}



Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
int i,j,a=0;
scanf("%d", &i);
for(j = 0;j <= i/4 ; j++){//jはケーキの数
  int k = i - 4*j;
  if (k%7==0){
  printf("Yes");
  a = 999;
  break;
}
}
if (a!=999){
  printf("No");
}
}


Measured memory_bytes: 128
#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>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;
 
int main() {
    int x;
    cin >> x;
    cout << (x+1)%2 << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;

    for(int i=1;i<s.size();i++){
        if(s[i]==s[i-1]){
            cout<<"Bad";
            return 0;
        }
    }
    cout<<"Good";
    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 pii = pair<int,int>;
const long long INF = 1LL << 60;

string s;

int main()
{
  cin >> s;
  if(s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int fact8(int n)
{
	int sum=0;
	for(int i=1;i<=n;i++)
		if(n%i==0)
			sum++;
	if(sum==8)
		return 0;
	else
		return 1;			
}
int main()
{
	int n;
	int i,s=0;
	scanf("%d",&n);
	for(i=1;i<=n;i+=2)
		if(!fact8(i))
			s++;
	printf("%d",s);   		
	return 0;
}

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

#define vec(v) vector<int>(v)
#define be(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define mapci(mp) map<char*,int>(mp)
#define mapcc(mp) map<char*,char*>(mp)
typedef long long ll;
using namespace std;

int main() {
    ll n,a[5]={0},ans=0;
    string s,m="MARCH";
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        for(int j=0;j<5;j++){
            if(s[0]==m[j]){
                a[j]++;
            }
        }
    }
    for(int i=0;i<3;i++){
        for(int j=i+1;j<4;j++){
            for(int k=j+1;k<5;k++){
                ans+=a[i]*a[j]*a[k];
            }
        }
    }
    cout << ans<<endl;
    return 0;
}


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

#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
int main(){
    string s,t;
    int n;
    cin >> n >> s >> t;
    
    rep(i,n){
        cout << s.at(i) << t.at(i);
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
int a[500],i,l=1;char c[50];
main(){scanf("%s",c);for(;c[i]!='\0';a[c[i++]]=1)l++;for(i='z';i>='a';i--)if(!a[i])c[l++]=i;std::next_permutation(c,c+l)?puts(c):puts("-1");}

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

int main()
{
	int n, k; cin >> n >> k;

	string s; cin >> s;
	
	if (s.at(k - 1) == 'A') {

		s.at(k - 1) = 'a';

	}
	else if (s.at(k - 1) == 'B') {

		s.at(k - 1) = 'b';

	}
	else {

		s.at(k - 1) = 'c';
	}

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
 
    long long int l,r;
    long long int i,j;
    int min = 2020;
 
    scanf("%lld %lld",&l,&r);
 
    
    if(r/2019 -l/2019 >= 1){
        min = 0;           
    }else{
        for(i = l; i < r; i++){
         for(j = i+1 ; j <= r ; j++){
               if((i*j)%2019 < min){
                 min = (i*j)%2019;
               }
               if(min == 0)
                break;
           }
           if(min == 0)
            break;
       }
    }
 
    printf("%d\n",min);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int tim(int h, int m, int s) {
	return 3600 * h + 60 * m + s;
}
int tio(int s) {
	cout << s / 3600 <<" "<< (s / 60) % 60 <<" "<< s % 60 << endl;
	return 0;
}
int main() {
	for (int i = 0; i < 3; i++) {
		int a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		tio(tim(d, e, f) - tim(a, b, c));
	}
}



Measured memory_bytes: 3100
import java.util.Scanner;

public class Main {
    
    static long count;

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }
        count = 0;
        
        mergeSort(a, 0, n);
        
        System.out.println(count);
    }
    
    static void merge(int[] a, int left, int mid, int right){
        
        int n1 = mid - left;
        int n2 = right - mid;
        int[] l = new int[n1 +1];
        int[] r = new int[n2 +1];
        for(int i = 0; i < n1; i++){
            l[i] = a[left +i];
        }
        for(int i = 0; i < n2; i++){
            r[i] = a[mid +i];
        }
        l[n1] = Integer.MAX_VALUE;
        r[n2] = Integer.MAX_VALUE;
        int i = 0;
        int j = 0;
        for(int k = left; k < right; k++){
            if(l[i] <= r[j]){
                a[k] = l[i];
                i++;
            }else{
                a[k] = r[j];
                j++;
                count += n1 -i;
            }
        }
    }
    
    static void mergeSort(int[] a, int left, int right){
        
        if(left+1 < right){
            int mid = (left + right)/2;
            mergeSort(a, left, mid);
            mergeSort(a, mid, right);
            merge(a, left, mid, right);
        }
    }
}


Measured memory_bytes: 73220
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  rep(i,N) cin>>A[i];
  ll mod=998244353;
  ll dp[90010]={};
  dp[0]=2;
  dp[A[0]]=1;
  ll dp10[90010];
  rep(i,N-1){
    rep(j,90010) dp10[j]=dp[j];
    rep(j,90010){
      dp[j]=dp10[j]*2%mod;
      if(j>=A[i+1]) dp[j]=(dp[j]+dp10[j-A[i+1]])%mod;
    }
  }
  ll S=0;
  rep(i,N) S+=A[i];
  ll dp2[90010]={};
  if(S%2==0){
    dp2[0]=1;
    dp2[A[0]]=1;
    ll dp20[90010];
    rep(i,N-1){
      rep(j,90010) dp20[j]=dp2[j];
      rep(j,90010){
        dp2[j]=dp20[j];
        if(j>=A[i+1]) dp2[j]=(dp2[j]+dp20[j-A[i+1]])%mod;
      }
    }
  }
  ll R=0;
  rep(i,90010) if(i>=(S+1)/2) R=(R+dp[i])%mod;
  ll P=1;
  rep(i,N) P=P*3%mod;
  ll ans=(P-R*3)%mod;
  ans=(ans+dp2[S/2]*3)%mod;
  if(ans<0) ans+=mod;
  cout<<ans<<endl;
}

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

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

int main() {
    int n; cin >> n;
    vector<int> l(n); 
    int total = 0;
    rep(i, n){
        cin >> l[i];
        total += l[i];
    }
    sort(l.begin(), l.end());
    int max_l = l[l.size()-1];
    cout << (max_l < total-max_l ? "Yes" : "No") << endl;
    return 0;
}


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

int main() {
    int n, d;
    int cnt = 0;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d, 0));
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < d; j++) {
            cin >> x[i][j]; 
        }
    }
    for(int i = 0; i < n-1; i++) {
        for(int j = i+1; j < n; j++) {
            float num = 0;
            float ans = 0;
            for(int k = 0; k < d; k++) {
                num += pow((x[j][k]- x[i][k]), 2);
            }
            ans = sqrt(num);

            if(ans == floor(ans)) {
                cnt++ ;
            }
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
#define REP(i,n) FOR(i, 0, n)

int main() {
	int N;
	while(cin >> N, N) {
		vvi data(N, vi(N));

		int M, tmp;
		REP(i, N) {
			cin >> M;
			REP(j, M) {
				cin >> tmp;
				data[i][tmp-1] = 1;
			}
		}

		int K;
		cin >> K;
		vi rdata(K);
		REP(i, K) {
			cin >> tmp;
			rdata[i] = tmp-1;
		}

		int ans = -1;
		REP(i, N) {
			bool flag = true;
			REP(j, K) {
				if(data[i][rdata[j]] != 1) {
					flag = false;
					break;
				}
			}
			if(flag) {
				if(ans != -1) {
					ans = -1;
					goto show;
				} else {
					ans = i+1;
				}
			}
		}

show:
		cout << ans << endl;
	}
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int64_t x,y;
    cin>>x>>y;
    int i=1;
    while(x*2<=y){
        x *= 2;
        i++;
    }
    cout<<i<<endl;
}

Measured memory_bytes: 256
q=int(input())
l=[]
r=[]
for i in range(q):
    lr=list(map(int,input().split()))
    l.append(lr[0])
    r.append(lr[1])
n=sorted(r,reverse=True)[0]
prime=[True]*(n+1)
prime[0]=False
prime[1]=False
for i in range(2,int(n**(0.5))+1):
    if prime[i]:
        for j in range(i*2,n,i):
            prime[j]=False
a=[0]*(n+1)
for i in range(n+1):
    if i%2==0:
        continue
    if prime[i] and prime[(i+1)//2]:
        a[i]=1
s=[0]*(n+2)
for i in range(n+1):
    s[i+1]=s[i]+a[i]
for i in range(q):
        print(s[r[i]+1]-s[l[i]])

Measured memory_bytes: 89276