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

int main()
{
	int n;
	cin >> n;
	int ans = 0;
	int count = 0;

	for (int i = 1; i <= n; i += 2) {
		for (int j = 1; j <= n; j++) {
			if (i % j == 0) {
				count++;
			}
		}
		if (count == 8) {
			ans++;
		}
		count = 0;
	}
	cout << ans << endl;
	return 0;
}



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

int main(){
  int N,K;
  cin>>N>>K;
  set<int> D;
  for(int i=0;i<K;++i){
    int d;
    cin>>d;
    D.insert(d);
  }

  int n=N;
  while(true){
    set<int> S;
    int m=n;
    bool judge=true;
    while(m>0){
      if(D.count(m%10)) judge=false;
      
      m -= m%10;
      m /= 10;
    }
    
    if(judge){
      cout<<n<<endl;
      break;
      }
    
    ++n;
  }

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
#include <iomanip>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

ll M = 1000000007;

vector<ll> fac(1000001); //n!(mod M)
vector<ll> ifac(1000001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
void setcomb() {
	fac[0] = 1;
	ifac[0] = 1;
	for (ll i = 0; i < 1000000; i++) {
		fac[i + 1] = fac[i] * (i + 1) % M; // n!(mod M)
	}
	ifac[1000000] = mpow(fac[1000000], M - 2);
	for (ll i = 1000000; i > 0; i--) {
		ifac[i - 1] = ifac[i] * i%M;
	}
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
ll perm(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	return fac[a] * ifac[a - b] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
vector<vector<ll>> mul(vector<vector<ll>> a, vector<vector<ll>> b, int n) {
	int i, j, k, t;
	vector<vector<ll>> c(n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			t = 0;
			for (k = 0; k < n; k++)
				t = (t + a[i][k] * b[k][j] % M) % M;
			c[i].push_back(t);
		}
	}
	return c;
}

template< typename Monoid >
struct SegmentTree {

	int sz;
	vector< Monoid > seg;

	const Monoid M1;

	SegmentTree(int n, const Monoid &M1) : M1(M1) {
		sz = 1;
		while (sz < n) sz <<= 1;
		seg.assign(2 * sz, M1);
	}

	void set(int k, const Monoid &x) {
		seg[k + sz] = x;
	}

	void build() {
		for (int k = sz - 1; k > 0; k--) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	void update(int k, const Monoid &x) {
		k += sz;
		seg[k] = x;
		while (k >>= 1) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	Monoid query(int a, int b) {
		Monoid L = M1, R = M1;
		for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
			if (a & 1) L = f(L, seg[a++]);
			if (b & 1) R = f(seg[--b], R);
		}
		return f(L, R);
	}

	Monoid value(const int &k) const {
		return seg[k + sz];
	}

	Monoid f(Monoid a, Monoid b) {
		return a + b;
	}
};

int main() {
	int a;
	cin >> a;
	cout << (a - 1) / 2 << endl;
}


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

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

int main() {
	long int N, C, K, T[100000];
	scanf("%ld%ld%ld", &N, &C, &K);
	for (int i = 0; i < N; i++) scanf("%ld", &T[i]);
	qsort(T, N, sizeof(long int), compare);

	int car = 0, ans = 0, lim = 0;
	lim = T[0] + K, car++, ans++;
	//printf("%d:%d %d %d\n",T[0], car, ans, lim);
	for (int i = 1; i < N; i++) {
    	if (car == C||T[i]>lim) car = 0, ans++;
		if (car == 0)lim = T[i] + K;
		if (car < C && T[i] <= lim) car++;
		//printf("%d:%d %d %d\n",T[i], car, ans, lim);
	}
	printf("%ld", ans);
	return 0;
}

Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

int main(void){
	int K,X;
	cin >> K;
	cin >> X;
	if(K*500>=X){
		cout << "Yes" << endl; 
	}else{
		cout << "No" << endl;
	}
}


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

#define int long long

using namespace std;



int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    char c;
    cin >> c;

    if('a' <= c && c <= 'z')cout << 'a' << '\n';
    else cout << 'A' << '\n';

    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
vector<string>A;
void make(string s,int n)
{
	if(n)
	{
		make(s+'5',n-1);
		make(s+'7',n-1);
		make(s+'3',n-1);
		make(s,n-1);
	}
	else
	{
		A.push_back(s);
	}
}

int32_t main()
{
	int n=9,x;
	make("",n);
	vector<int>B;
	for(int i=0;i<(int)A.size();i++)
	{
	     if(A[i].length())
	     {
			 map<char,int>M;
			 for(int j=0;j<(int)A[i].length();j++)M[A[i][j]]++;
			 if(M['3'] && M['5'] && M['7'])
			 {
			     stringstream s(A[i]);
			     s>>x;B.push_back(x);
			 }
		 }
	 }
	 sort(B.begin(),B.end());
	 B.erase(unique(B.begin(),B.end()),B.end());
	
	
	 int N;cin>>N;
	 cout<<(upper_bound(B.begin(),B.end(),N)-B.begin())<<endl;
}
	
			
	
	
	
	
	

	

	

	
		


Measured memory_bytes: 18160
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int xcomp(pair<LL, LL>& a, pair<LL, LL>& b) {
	if (a.first == b.first) {
		return a.second < b.second;
	}
	return a.first < b.first;
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

LL minn(LL min, LL n) {
	if (min%n >= 1) {
		return min - min % n + n;
	}
	else {
		return min;
	}
}

LL maxn(LL max, LL n) {
	if (max%n >= 1) {
		return max - max % n;
	}
	else {
		return max;
	}
}

int main() {
	LL K;
	cin >> K;
	vector<LL> Ak(K);

	REP(i, K) {
		cin >> Ak[i];
	}

	LL max = 2;
	LL min = 2;

	//min以上で最小のnの倍数
	//max以下で最大のnの倍数

	bool flag = true;

	for (int i = Ak.size() - 1; i >= 0; --i) {
		LL n = Ak[i];

		max = maxn(max, n);
		min = minn(min, n);

		if (max < min) {
			flag = false;
			cout << -1 << endl;
			break;
		}

		max += n - 1;
	}

	if (flag) {
		cout << min << " " << max << endl;
	}
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define isin(i,a,b) ((a) <= (i) && (i) < (b))
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll  = long long;
using unit= unsigned;
using ull = unsigned long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vvi = vector<vi>;
using vp  = vector<P>;
void _main(); int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b){ if (a<b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if (b<a){ a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if (b==0){ return a; }else{ return gcd(b, a%b); }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
constexpr double eps = 1e-10;
constexpr int inf = INT_MAX / 2;
constexpr ll infl = 1LL << 60;

void _main() {
  int A, B;
  cin >> A >> B;

  int ans = A<=5 ? 0 : (A <= 12) ? (B/2) : B;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

char c[10][10];

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    rep(i, h) rep(j, w) cin >> c[i][j];
    int ans = 0;
    for(int i = 0; i < (1<<h); i++){
        for(int j = 0; j < (1<<w); j++){
            int cnt = 0;
            rep(y, h) rep(x, w){
                if (i&(1<<y) && j&(1<<x) && c[y][x] == '#') cnt++;
            }
            if (cnt == k) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


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

# 0
# 1, 0
# 2, 0, 1
# 3, 1, 0, 2
# 4, 2 ,0, 1, 3

front = []
back = []

for i in range(N):
  if i % 2 == 0:
    back.append(A[i])
  else:
    front.append(A[i])
    
ans = None
if N % 2 == 0:
  ans = front[::-1] + back
else:
  ans = back[::-1] + front
  
print(*ans)

Measured memory_bytes: 30900
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
B = [0 for _ in range(N+1)]
for i in range(1,N+1):
    B[i] = B[i-1]+A[i-1]
C = A[:]
for i in range(N-1):
    for j in range(i+1,N):
        C.append(B[j+1]-B[i])
C = sorted(C,reverse=True)
n = math.ceil(math.log2(C[0]))
Cb = []
for i in range(len(C)):
    x = bin(C[i])[2:]
    k = len(x)
    x = "0"*(n-k)+x
    Cb.append(x)
inds = [i for i in range(len(C))]
nlow = 0
while len(inds)>K:
    for j in range(nlow,n):
        E = []
        cnt = 0
        for i in inds:
            if Cb[i][j]=="1":
                E.append(i)
                cnt += 1
        if cnt>=K:
            inds = E[:]
            nlow = j+1
            break
    if cnt<K:break
cnt = int("1"*n,2)
for i in inds: 
    cnt = cnt&C[i]
print(cnt)

Measured memory_bytes: 93808
//#include<bits/stdc++.h>
#include<iostream>
#include<queue>
#include<iomanip>
#include<cctype>
#include<cstdio>
#include<deque>
#include<utility>
#include<cmath>
#include<ctime>
#include<cstring>
#include<string>
#include<cstdlib>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)>(y)?(y):(x))
#define INF 1000000000
#define ll long long
#define RE register
#define mod 1000000007
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline ll read()
{
    RE ll x=0,f=1;char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const ll MAXN=110;
ll n,a,b;
ll ans,w1,w2,w3,w4;
inline ll fast_pow(ll b,ll p)
{
	ll cnt=1;
	while(p)
	{
		if(p&1)cnt=cnt*b%mod;
		p=p>>1;
		b=b*b%mod;
	}
	return cnt;
}
signed main()
{
	//freopen("1.in","r",stdin);
	n=read();a=read();b=read();
	w1=w2=w3=w4=1;
	for(ll i=n;i>=n-a+1;--i)w1=w1*i%mod;
	for(ll i=1;i<=a;++i)w2=w2*i%mod;
	for(ll i=n;i>=n-b+1;--i)w3=w3*i%mod;
	for(ll i=1;i<=b;++i)w4=w4*i%mod;
	w2=fast_pow(w2,mod-2);
	w4=fast_pow(w4,mod-2);
	//cout<<w4*6%mod<<endl;
	w1=w1*w2%mod;
	w3=w3*w4%mod;
	ans=fast_pow(2,n);
	--ans;
	ans=ans-w1-w3;
	ans%=mod;
	ans+=mod;
	ans%=mod;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>

#define rep(i,a,b) for (int i = a;i < b;i++)

using namespace std;

string op[3];
vector<int> num(4);
string ans;
string s;

int calc(int value,int pointer,char sign) {
	
	if (sign == '+') {
		value += num[pointer];
		op[pointer - 1] = '+';
	}
	else if (sign == '-') {
		value -= num[pointer];
		op[pointer - 1] = '-';
	}
	pointer++;

	if (value == 7 && pointer == 4) {
		ans = s[0] + op[0] + s[1] + op[1] + s[2] + op[2] + s[3];
		cout << ans <<"=7" << endl;
		exit(0);
	}
	if (pointer > 3) {
		return 0;
	}

	calc(value, pointer, '+');
	calc(value, pointer, '-');

}

int main() {
	cin >> s;
	num[0] = s[0] - '0';
	num[1] = s[1] - '0';
	num[2] = s[2] - '0';
	num[3] = s[3] - '0';
	
	int value = num[0];
	int pointer = 1;
	while (1) {
		calc(value, pointer,'+');
		calc(value, pointer,'-');
	}
	
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int min = Integer.MAX_VALUE;
		int bit = 0;

		for (int i = 0; i < n; i++) {
			bit = scan.nextInt();
			min = Math.min(min, Integer.numberOfTrailingZeros(bit));
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 21204
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
#define LLINF 2000000000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
// #define int long long

signed main(){
  int n;
  string s,t;
  cin >> n >> s >> t;
  LOOP(i,n){
    cout << s[i] << t[i];
  }
}


Measured memory_bytes: 256
n = int(input())
arr = list(map(int,input().split()))

N = pow(10,9)+7
def gcd(a,b):
    if a==0:return b
    return gcd(b%a,a)

def lcm(a,b):
    tmp =  (a*b)//gcd(a,b)
    return tmp

hcm = arr[0]
for i in range(1,n):
    hcm = lcm(hcm,arr[i])

res = 0
for num in arr:
    res += (hcm//num)
    

print(res%N)
    

    


Measured memory_bytes: 4084
n, k = map(int, input().split())
d = set(map(int, input().split()))
ok = set(range(10))
ans = 0
for i in range(n, 100000):
    ans = i
    flag = False
    while i != 0:
        if i % 10 in d:
            flag = True
            break
        i = i // 10
    if not flag:
        print(ans)
        break






Measured memory_bytes: 9120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            bool flag = false;
            int N;
            N = int.Parse(Console.ReadLine());

            uint[] A = new uint[N];

            string[] input;
            input = Console.ReadLine().Split(' ');

            for(int i = 0; i < N; i++)
            {
                A[i] = uint.Parse(input[i]);
            }

            /*for(int i = 0; i < N; i++)
            {
                for(int j = i + 1; j < N; j++)
                {
                    if(A[i] == A[j])
                    {
                        flag = true;
                        break;
                    }
                }

            }*/

            Array.Sort(A);

            for(int i = 0; i < N-1; i++)
            {
                if (A[i] == A[i + 1])
                {
                    flag = true;
                    break;
                }
            }

            if (flag)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }

        }
    }
}


Measured memory_bytes: 31196
//make sure to make new file!
import java.io.*;
import java.util.*;

public class Main{
   
   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);
      
      StringTokenizer st = new StringTokenizer(f.readLine());
      
      int n = Integer.parseInt(st.nextToken());
      int m = Integer.parseInt(st.nextToken());
      
      
      HashSet<Integer> hset = new HashSet<Integer>();
      
      for(int k = 0; k < m; k++){
         int d = Integer.parseInt(f.readLine());
         st = new StringTokenizer(f.readLine());
         
         for(int j = 0; j < d; j++){
            hset.add(Integer.parseInt(st.nextToken()));
         }
      }
      
      out.println(n-hset.size());
      
      
      
      
      
      
      out.close();
   }
   
      
}

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

int main(){
    string s, t;
    int offset = 1, len;
    bool b = true;
    cin >> s >> t;
    len = s.length();
    for(int i=1; i< len + 1; i++){
        offset = i;
        b = true;
        for(int j=0; j< len; j++){
            if((j+offset) == len) offset = i -len;
            if(s[j + offset] != t[j]){
                b = false;
                break;
            }
        }
        if(b){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;    
    return 0;
}


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 a = sc.nextInt();
    int b = sc.nextInt();
    
    int ansA = n*a;
    int ansB = b;
    
    if(ansA <= ansB){
      System.out.println(ansA);
    }
    else{
      System.out.println(ansB);
    }
  }
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int amari[b] = {0};
  int i=1;
  bool can;
  while(1){
    if((i*a)%b == c){ can = true; break;}
    else {
      amari[(i*a)%b]++;
      if(amari[(i*a)%b] == 2){can = false; break;}
    }
    ++i;
  }
  if(can) {cout << "YES";}
  else {cout << "NO";}
}

Measured memory_bytes: 384
#include<stdio.h>
#include <string.h>
#include <math.h>

int main(){
	int K,S;
	int X,Y,Z;
	int count=0;
	
	scanf("%d %d",&K,&S);
	
	for(X=0;X<=K;X++){
		for(Y=0;Y<=K;Y++){
			if(X+Y+K>=S && X+Y<=S){
					count++;
			}
		}
	}
	printf("%d\n",count);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)
ll h,w;
map<ll,ll> ma;
void foo(ll x, ll y){
    if((x<=1)||(x>=h)||(y<=1)||(y>=w)){
        return;
    }
    ma[x*w+y]++;
}
ll ans[10];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z;
    cin>>h>>w>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        foo(x-1,y);
        foo(x-1,y+1);
        foo(x,y+1);
        foo(x+1,y+1);
        foo(x+1,y);
        foo(x+1,y-1);
        foo(x,y-1);
        foo(x-1,y-1);
        foo(x,y);
    }
    z = 0;
    for(auto it:ma){
        ans[it.S]++;
        z++;
    }
    ans[0] = (h-2)*(w-2) - z;
    for(int i=0;i<10;i++){
        cout<<ans[i]<<endl;
    }
    

    return 0;
}

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

const static ll MOD = (1e+9)+7;

int main(){
    int r;cin>>r;
    double pi = 3.141592653589793;
    double ans = r*2*pi;
    printf("%lf\n",ans);
    return 0;
}

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

int main() {

string N,M;cin>>N;
  for(int i=N.size()-1; i>=0;i--){
    M.push_back(N.at(i));}
  if(N==M){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}



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

int main(){
  int k;
  int count =0;
  cin >> k;

  for(int i=2; i<=k; i=i+2){
    for (int j=1; j<=k; j=j+2){
      if ( (i+j) % 2 == 1 ) count++;
    }
  }
      
  cout << count << endl;
  
  

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int i;
	double n,s,k,sum=0;
	for(;scanf("%lf",&n)!=EOF;sum=0){
		sum+=n;
		for(i=2;i<=10;i++){
			if(i%2)n/=3.0;
			else n*=2;
			sum+=n;
		}
		printf("%.8lf\n",sum);
	}
	return 0;
}

Measured memory_bytes: 0
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def solve():
    N = ii()
    A = il()
    b = [0] * N
    c = [0] * N
    for i in range(1, N):
        b[i] = gcd(b[i - 1], A[i - 1])
    for i in range(N - 1)[::-1]:
        c[i] = gcd(c[i + 1], A[i + 1])
    d = [gcd(b[i], c[i]) for i in range(N)]
    return max(d)


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 16092
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

vector<vector<int>> g;
vector<vector<int>> block;

int group_num = 0;

vector<int> group;
bool seen[100100];
int ans[100100];
int group_size[100100];

void dfs(int v){
	group[v] = group_num;
	++group_size[group_num];
	seen[v] = true;
	for(auto nv : g[v]){
		if(seen[nv])continue;
		dfs(nv);
	}
}

int main(){
  int n, m, k;
  cin >> n >> m >> k;
  g.resize(n);
  block.resize(n);
  vector<int> friend_cnt(n, 0);
  for(int i = 0; i < m; ++i){
  	int a, b;
  	cin >> a >> b;
  	--a;
  	--b;
  	g[a].push_back(b);
  	g[b].push_back(a);
  }
  for(int i = 0; i < k; ++i){
  	int c, d;
  	cin >> c >> d;
  	--c;
  	--d;
  	block[c].push_back(d);
  	block[d].push_back(c);
  }

  group.assign(n, -1);
  for(int i = 0; i < n; ++i){
  	if(group[i] != -1)continue;
  	dfs(i);
  	++group_num;
  }
  
  for(int i = 0; i < n; ++i){
  	ans[i] = group_size[group[i]] - g[i].size() - 1;
  	for(auto b : block[i]){
  		if(group[b] == group[i])--ans[i];
  	}
  	cout << ans[i] << " ";
  }

  return 0;
}


Measured memory_bytes: 13184
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};

ll f(ll a){
    ll rep = 0;
    for(ll i = 1;i <= a/2;++i){
        if(a%i == 0){
            rep++;
        }
    }
    return rep+1;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n;
    cin >> n;
    ll ans = 0;
    vector<ll> dp(20000000,2);
    dp[0] = 0;
    dp[1] = 1;
    rep(i,n/2+1){
        if(i == 0||i==1) continue;
        for(ll j = i+i;j<=n;j+=i){
            dp[j]++;
        }
    }
    rep(i,n+1){
        ans += i*dp[i];
    }
    cout << ans << endl;
    
    cout << endl;
    return 0;
}


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

using namespace std;

int main()
{
	//freopen("input16.txt","r",stdin);freopen("output16.txt","w",stdout);
	string a,b,c;
	int i;
	char t='a';
	cin>>a>>b>>c;
	for (i=0;2*i<a.size()-1;i++){
		swap(a[i],a[a.size()-i-1]);
	}
	for (i=0;2*i<b.size()-1;i++){
		swap(b[i],b[b.size()-i-1]);
	}
	for (i=0;2*i<c.size()-1;i++){
		swap(c[i],c[c.size()-i-1]);
	}
	for (;;){
		if (t=='a'){
			if (a.size()!=0){
				t=a[a.size()-1];
				a.pop_back();
			}
			else {
				cout<<"A";
				break;
			}
		}
		if (t=='b'){
			if (b.size()!=0){
				t=b[b.size()-1];
				b.pop_back();
			}
			else {
				cout<<"B";
				break;
			}
		}
		if (t=='c'){
			if (c.size()!=0){
				t=c[c.size()-1];
				c.pop_back();
			}
			else {
				cout<<"C";
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)

void printVec(std::vector<int> &vec) {
//    std::cout << "";
    for (auto it = vec.begin(); it != vec.end(); ++it) {
        std::cout << *it << " ";
    }
    cout << '\n';
}

void printVec1(std::vector<string> &vec) {
//    std::cout << "";
    for (auto it = vec.begin(); it != vec.end(); ++it) {
        std::cout << *it << " ";
    }
    cout << '\n';
}

void printVec2(std::vector<Int> &vec) {
//    std::cout << "";
    for (auto it = vec.begin(); it != vec.end(); ++it) {
        std::cout << *it << " ";
    }
    cout << '\n';
}

Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

int main() {
    IOS;
    int n;cin>>n;
    vector<int>w(n);
    for (int i=0;i<n;i++){
        cin>>w[i];
    }
    int minz=MAX_N;
    for(int i=1;i<n;i++){
        int a=accumulate(w.begin(),w.end()-i,0);
        int b=accumulate(w.end()-i,w.end(),0);
        minz=min(minz,abs(a-b));
    }
    cout<<minz;


    cout << endl;
    return 0;
}

/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/


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

int main(){
	ll a, b, c, d, lcm;
	cin >> a >> b >> c >> d;
	lcm = c / __gcd(c, d) * d;
	//cerr << "lcm" << lcm << endl;
	ll e = b;
	e -= b/c;
	e -= b/d;
	e += b/lcm;
	ll f = a-1;
	f -= (a-1)/c;
	f -= (a-1)/d;
	f += (a-1)/lcm;
	
	cout << e - f << endl;
	
	return 0;
}

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

int main() {
  int x, y;
  while (true) {
    cin >> x >> y;
    if (x == 0 && y == 0) {
      break;
    } else if (x > y) {
      cout << y << " " << x << endl;
    } else {
      cout << x << " " << y << endl;
    }
  }
}



Measured memory_bytes: 3096
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Array.Sort(H);
		long min = (long) 1e18;
		for(int i=0;i+K-1<N;i++){
			min = Math.Min(min, H[i + K - 1] - H[i]);
		}
		Console.WriteLine(min);
		
		
	}
	int N,K;
	long[] H;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		H = new long[N];
		for(int i=0;i<N;i++) H[i] = rl();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 18012
#include <iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
typedef long long ll;
using namespace std;
int main() {
	ll K, S;
	cin >> K >> S;
	ll cnt = 0;
	for (ll x = 0; x <= K; ++x) {
		for (ll y = 0; y <= K; ++y) {
			ll z = S - x - y;
			if (z >= 0 && z <= K) ++cnt;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
//#include<>
using namespace std;

typedef long long int64;
typedef int int32;
typedef char int8;
typedef int32 int__;
typedef pair<int,int> pii;
#define rep(i,j) for(int__ i=0;i<j;i++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);i++)
#define repeat_eq(i,j,k) for(int__ i=(j);i<=(k);i++)
#define all(v) (v).begin(),(v).end()

const int INF=1<<30;//=10E10

int main()
{
  int w,h;
  while(cin>>w>>h && w && h){
    char tile[20][20];
    int fx,fy;
    rep(i,h)rep(j,w){
      cin>>tile[i][j];
      if(tile[i][j]=='@'){
	fx=j;fy=i;
      }
    }
    
    bool visited[20][20]={};
    stack<pii> p;
    int ans=0;
    p.push(pii(fy,fx));
    while(!p.empty()){
      pii now=p.top();p.pop();
      int nx=now.second,ny=now.first;
      if(!visited[ny][nx]){
	visited[ny][nx]=true;
	ans++;
	if(ny>0 && tile[ny-1][nx]=='.')p.push(pii(ny-1,nx));
	if(ny+1<h && tile[ny+1][nx]=='.')p.push(pii(ny+1,nx));
	if(nx>0 && tile[ny][nx-1]=='.')p.push(pii(ny,nx-1));
	if(nx+1<w && tile[ny][nx+1]=='.')p.push(pii(ny,nx+1));
      }
    }
    cout<<ans<<endl;
  }

  return 0;
}

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

typedef long long ll;
typedef vector<ll> v1;

typedef vector<vector<ll>> graph;

const ll INF = 1ll << 50;
const ll mod = 1000000007;

string s;
ll cnt[128];

int main(){
    cin >> s;
    for(char c : s){
        cnt[c]++;
    }
    if(max({abs(cnt['a']-cnt['b']), abs(cnt['b']-cnt['c']), abs(cnt['c']-cnt['a'])}) <= 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void){

    int n,p[10],max,sum;
    max=0;
    sum=0;
    
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        scanf("%d",&p[i]);
        
        if(max<p[i])
            max=p[i];
    
        sum+=p[i];
    }
    
    printf("%d",sum-max/2);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int> pii;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int n,q;
ll sum;
const int Maxn=1e5+5;
ll a[Maxn];
map<ll,int>mp;
int main(){
	cin>>n;
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
		mp[a[i]]++;
	}
	cin>>q;
	rep(i,q){
		ll B,C;
		cin>>B>>C;
		sum+=(C-B)*mp[B];
		cout<<sum<<endl;
		mp[C]+=mp[B];
		mp[B]=0;
	}
	return 0;
}

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

using namespace std;
string str1,str2,ss;
int main()
{
    int num=0;
    cin>>str1>>str2;
    ss=str1+str2;
    for (int i=0; i<ss.length(); i++)
        num=num*10+ss[i]-49+1;
    int sqer=sqrt(num);
    if (sqer*sqer==num)
        puts("Yes");
    else
        puts("No");
    return 0;
}

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

using namespace std;

int main() {

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


}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;


const ll mod=1e9+7;
const ll inf=1e16; 

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)


int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  ll n,k,s;
  cin >> n >> k >> s;
  
  rep(i,0,k) cout << s << " ";
  
  if(k!=n) {
   if(s!=1) {
     rep(i,0,n-k-1) cout << s-1 << " ";
  cout << s-1 << endl;
   }
    else  {
     rep(i,0,n-k-1) cout << s+1 << " ";
  cout << s+1 << endl;
   } 
  }
  
  }


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

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; }

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  printf("%d %d %d", c, a, b);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    vector<pair<ll, ll>> ab(n); cin >> ab;
    rSORT(ab, [](auto x, auto y) {return x.second < y.second; });

    ll now = 0;
    FOR(i, 0, n) {
        now += ab[i].first;
        if (ab[i].second < now) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}

Measured memory_bytes: 3328
#include <cstdio>
#include <map>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    ll n, a, p = 0, q = 0;
    scanf("%lld", &n);
    map<ll, bool> d;
    for (ll i = 0; i < n; ++i) {
        scanf("%lld", &a);
        if (d[a]) {
            p = max(p, a);
            if (q < p) swap(p, q);
            d.at(a) = false;
        } else d.at(a) = true;
    }
    printf("%lld\n", p * q);
    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include<ios>
#include <vector>
using namespace std;
using ll = long long;
const ll INF=INT64_MAX>>3;
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; }
int main(){
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if(N%10 == 7 || (N/10)%10 == 7 || (N/100)%10 == 7) {
        cout << "Yes\n";
    } else cout << "No\n";
}

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

int main() {
  
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ) cout << "vowel" << endl;
  else cout << "consonant" << endl;
  
}

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

  if(A/2<10 && A%2==0)  cout<<"Yes"<<endl;
  else if  (A/1<10 && A%1==0)  cout<<"Yes"<<endl;
  else if  (A/3<10 && A%3==0)  cout<<"Yes"<<endl;
  else if  (A/4<10 && A%4==0)  cout<<"Yes"<<endl;
  else if  (A/5<10 && A%5==0)  cout<<"Yes"<<endl;
  else if  (A/6<10 && A%6==0)  cout<<"Yes"<<endl;
  else if  (A/7<10 && A%7==0)  cout<<"Yes"<<endl;
  else if  (A/8<10 && A%8==0)  cout<<"Yes"<<endl;
  else if  (A/9<10 && A%9==0)  cout<<"Yes"<<endl;
 
  else cout<<"No"<<endl;

 
}

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

int main(void) {
    int64_t N;
    int64_t sum = 0;
    int64_t l,r;
    cin >> N;
    for(int i=0;i<N;i++) {
        cin >> l >> r;
        sum += (r - l + 1);
    }
    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		out = new PrintWriter(new BufferedOutputStream(System.out));
		
		char[] s = sc.next().toCharArray();
		s[3] = '8';
		String ans = new String(s);
		out.println(ans);
		out.close();
	}

	//-----------http://codeforces.com/blog/entry/7018---------------------------------
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	//--------------------------------------------------------

}



Measured memory_bytes: 23380
#include <bits/stdc++.h>
#define ll long long

using namespace std;
typedef pair<int, int> pint;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    // cout << s << "\n";
    // cout << t << "\n";
    int len_s, len_t;
    len_s = s.size();
    len_t = t.size();
    vector<vector<int>> dp(len_s + 1, vector<int>(len_t + 1, 0));
    vector<vector<int>> parent_ptr(len_s + 1, vector<int>(len_t + 1, -1));
    int len_LCS = 0;
    pint len_LCS_idx = {-1, -1};

    for (int i = len_s - 1; i >= 0; i--) {
        for (int j = len_t - 1; j >= 0; j--) {
            // cout << i << " " << j << "\n";
            vector<int> cand_vals(3, 0);
            cand_vals.at(0) = dp.at(i + 1).at(j);
            cand_vals.at(1) = dp.at(i).at(j + 1);
            cand_vals.at(2) = s.at(i) == t.at(j) ? dp.at(i + 1).at(j + 1) + 1 : dp.at(i + 1).at(j + 1);
            int max_val = 0;
            int max_idx = -1;
            for (int k = 0; k < 3; k++) {
                if (max_val < cand_vals.at(k)) {
                    max_val = cand_vals.at(k);
                    max_idx = k;
                }
            }
            dp.at(i).at(j) = max_val;
            parent_ptr.at(i).at(j) = max_idx;
            if (len_LCS < max_val) {
                len_LCS = max_val;
                len_LCS_idx.first = i;
                len_LCS_idx.second = j;
            }
        }
    }
    vector<char> LCS;
    int i = len_LCS_idx.first;
    int j = len_LCS_idx.second;
    if (i == -1 and j == -1) {
        cout << " " << "\n";
        return 0;
    }
    while (parent_ptr.at(i).at(j) != -1) {
        int ptr_val = parent_ptr.at(i).at(j);
        if (ptr_val == 2) {
            LCS.emplace_back(s.at(i));
            i += 1;
            j += 1;
        }
        else if (ptr_val == 1) {
            j += 1;
        }
        else {
            i += 1;
        }
    }

    for (int i = 0; i < LCS.size(); i++) {
        cout << LCS.at(i);
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 71040
#include <iostream>
#include <vector>
#include <map>
#include <numeric>

using namespace std;

vector<int> parentR, urankR, parentT, urankT;

int rootR(int x) { return (parentR.at(x) == x ? x: parentR.at(x) = rootR(parentR.at(x))); }

bool in_sameR(int x, int y) { return rootR(x) == rootR(y); }
void uniteR(int x, int y) {
    x = rootR(x);
    y = rootR(y);
    if (x != y) {
        if (urankR.at(x) < urankR.at(y)) parentR.at(x) = y;
        else {
            parentR.at(y) = x;
            if (urankR.at(x) == urankR.at(y)) ++(urankR.at(x));
        }
    }
}

int rootT(int x) { return (parentT.at(x) == x ? x: parentT.at(x) = rootT(parentT.at(x))); }

bool in_sameT(int x, int y) { return rootT(x) == rootT(y); }
void uniteT(int x, int y) {
    x = rootT(x);
    y = rootT(y);
    if (x != y) {
        if (urankT.at(x) < urankT.at(y)) parentT.at(x) = y;
        else {
            parentT.at(y) = x;
            if (urankT.at(x) == urankT.at(y)) ++(urankT.at(x));
        }
    }
}

int main() {
    int n, k, l, p, q;
    map< pair<int, int>, int> d;
    cin >> n >> k >> l;

    parentR.resize(n);
    urankR.resize(n);
    iota(parentR.begin(), parentR.end(), 0);
    parentT.resize(n);
    urankT.resize(n);
    iota(parentT.begin(), parentT.end(), 0);

    for (int i = 0; i < k; ++i) {
        cin >> p >> q;
        uniteR(--p, --q);
    }
    for (int i = 0; i < l; ++i) {
        cin >> p >> q;
        uniteT(--p, --q);
    }
    for (int i = 0; i < n; ++i) {
        ++d[{rootR(i), rootT(i)}];
    }
    for (int i = 0; i < n; ++i) cout << d.at({rootR(i), rootT(i)}) << endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    long long S;
    cin >> S;
    long long X1,X2,X3,Y1,Y2,Y3;
    X1=0;
    Y1=0;
    //S=X2*Y3-X3*Y2
    X2=1000000000;
    Y2=1;
    Y3 = ceil((long double)S/(long double)X2);
    X3 = X2 * Y3 - S;
    cout << X1 << " " << Y1 << " " << X2 << " " << Y2 << " " << X3 << " " << Y3 << endl;
    //cout << X2 * Y3 - X3 * Y2 << endl;

    return 0;
}

Measured memory_bytes: 512
x = int(input())
a,b = 0,0
f = 0
for i in range(int(x**0.25)+1):
    for j in range(int(x**0.25)+1):
        if i**5 - j**5 == x:
            a = i
            b = j
            f = 1
            break
        elif i**5 + j**5 == x:
            a = i
            b = -j
            f = 1
            break
    if f:
        break
print(a,b)

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


int main()
{
	long long l,r;
	cin >> l >> r;
	r = min(r,l+4038);
	int ans = 2018;
	for(long long i = l; i <= r; i++)
	{
		for(long long j = i + 1; j <= r; j++)
		{
			int x = i*j%2019;
			ans = min(ans, x);
		}
	}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
import sys
from operator import itemgetter
N = int(input())
a = sorted(tuple(map(int, l.split())) for l in sys.stdin.readlines())
ans = float("inf")

for (x1, y1), (x2, y2) in zip(a, a[1:]):
    dist = (x1-x2)**2 + (y1-y2)**2
    if ans > dist:
        ans = dist

a.sort(key=itemgetter(1))
for (x1, y1), (x2, y2) in zip(a, a[1:]):
    dist = (x1-x2)**2 + (y1-y2)**2
    if ans > dist:
        ans = dist

print(ans)


Measured memory_bytes: 108312
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    char[]ss = S.toCharArray();
 
    if(ss[0]+0>90){
    	System.out.println("a");
    }else{
    	System.out.println("A");
      }
}
}

Measured memory_bytes: 35556
#include "bits/stdc++.h"
using namespace std;
const int M=100010;
int main(){
	int n,a[M];
	long long s1=0,s2=0,ans1=0,ans2=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		s1+=a[i],s2+=a[i];
		if(i%2){
			if(s1<=0)ans1+=abs(s1)+1,s1=1;
			if(s2>=0)ans2+=abs(s2)+1,s2=-1;
		}else{
			if(s1>=0)ans1+=abs(s1)+1,s1=-1;
			if(s2<=0)ans2+=abs(s2)+1,s2=1;
		}
	}
	cout<<min(ans1,ans2)<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

ll calc(ll A){
	if(A <= 0) return 0;
	A++;
	ll ans = 0;
	for(int i = 0; i < 50; i++){
		ll loop = (1LL << (i + 1));
		ll cnt = (A / loop) * (loop / 2);
		cnt += max(0LL, (A % loop) - (loop / 2));
		if(cnt % 2 == 1){
			ans += 1LL << i;
		}
	}
	return ans;
}

int main(){

	ll A, B;
	cin >> A >> B;
	ll ans = calc(B) ^ calc(A - 1);
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ppb pop_back
int a[31];
int b[31];
int ans=0;
int main()
{
	int n,m;
	cin>>n>>m;
	int k;
	for (int i=1;i<=n;i++)
	{
		cin>>k;
		for (int j=1;j<=k;j++)
		{
			cin>>a[j];
			b[a[j]]++;
		}
	}
	for (int i=1;i<=m;i++)
	{
		if (b[i]==n) ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256