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

int main(){
    int n;
    cin >> n;
    int b_max=4;
    int f_max=3;
    int r_max=10;

    vector< vector< vector<int> > > res;
    res.resize(b_max);
    for(int i=0;i<b_max;i++){
        res[i].resize(f_max);
        for(int j=0;j<f_max;j++){
            res[i][j].resize(r_max);
            for(int k=0;k<r_max;k++){
                res[i][j][k]=0;
            }
        }
    }

    int b;
    int f;
    int r;
    int v;
    for(int i=0;i<n;i++){
        cin >> b >> f >> r >> v;
        res[b-1][f-1][r-1]+=v;
    }

    for(int i=0;i<b_max;i++){
        for(int j=0;j<f_max;j++){
            for(int k=0;k<r_max;k++){
                cout << " " << res[i][j][k];
            }
            cout << endl;
        }
        if(i < b_max-1 ) {
            cout << "####################" << endl;
        }
    }

    return 0;
}




Measured memory_bytes: 3112
#include<iostream>
#include<string>

using namespace std;

string S;
bool flag=false;
    
 string dream="dream",dreamer="dreamer",erase="erase",eraser="eraser";

void sarch(int pos,int size){
    if(flag==true)return;

    if(S.find(dream,pos)==pos){
        if(pos+dream.size()==size){
            flag=true;
            return ;
        }            
        sarch(pos+dream.size(),size);
    }

    if(S.find(dreamer,pos)==pos){
        if(pos+dreamer.size()==size){
            flag=true;
            return ;
        }            
        sarch(pos+dreamer.size(),size);
    }

    if(S.find(erase,pos)==pos){
        if(pos+erase.size()==size){
            flag=true;
            return ;
        }            
        sarch(pos+erase.size(),size);
    }

    if(S.find(eraser,pos)==pos){
        if(pos+eraser.size()==size){
            flag=true;
            return ;
        }            
        sarch(pos+eraser.size(),size);
    }

}


int main(void){
   
    cin>>S;
    sarch(0,S.size());
    if(flag==true){
        cout<<"YES";
    }else{
        cout<<"NO";
    }

    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <functional>

int main()
{
    std::string S,T;
    std::cin >> S >> T;
    int count=0;
    for(int i=0; i<3; i++){
        if(S[i]==T[i]){
            count++;
        }
    }
    std::cout << count << std::endl;
    return 0;
}

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

bc = [0] * 51
pc = [0] * 51
l = [0] * 51
pc[0] = 1
l[0] = 1
for i in range(1, 51):
    bc[i] = bc[i-1] * 2 + 2
    pc[i] = pc[i-1] * 2 + 1
    l[i] = bc[i] + pc[i]

def ans(nn, xx):
    if nn == 0:
        return 1
    if xx == 1:
        return 0
    elif xx < (l[nn] + 1) //2:
        return ans(nn-1, xx-1)
    elif xx == (l[nn] + 1) //2:
        return pc[nn-1] + 1
    else:
        return pc[nn-1] + 1 + ans(nn-1, xx-((l[nn]+1)//2) )

print(ans(n, x))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector <ll>
#define vii vector <int>
#define vpii vector <pii>
#define vpll vector <pll>
#define ff first
#define ss second
#define matrix vector <vll>
#define all(v) v.begin(),v.end()
#define PQ priority_queue
using namespace std;
ll pow(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b&1) res*=a;
		b/=2;
		a*=a;
	}
	return res;
}
int main()
{
	//ios::sync_with_stdio(0);
	//cin.tie(0);
	int n;
	cin >> n;
	int h[n], dp[n];
	for(int i = 0; i < n; i++) {
		cin >> h[i];
	}
	dp[0] = 0;
	dp[1] = abs(h[1]-h[0]);
	for(int i = 2; i < n; i++){
		dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
	}
	cout << dp[n-1] << "\n";
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct day { int a, b, c; };

int main() {
  int N; cin >> N;
  day d[N]; rep(i,N) { int a, b, c; cin >> a >> b >> c; d[i]={a,b,c}; }
  int dp[N+1][3] = {};
  rep(i,N) {
    dp[i+1][0] = max(dp[i][1],dp[i][2]) + d[i].a;
    dp[i+1][1] = max(dp[i][0],dp[i][2]) + d[i].b;
    dp[i+1][2] = max(dp[i][0],dp[i][1]) + d[i].c;
  }
  int result = 0; rep(i,3) result = max(result, dp[N][i]);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <string>
#include <algorithm>
#include <map>
#include <iostream>
#include<math.h>
using namespace std;

int main() {
	string s;
	cin >> s;
	int ans=0,j;
	for (int i = 0; i < s.size();) {
		j = i;
		while (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
			i++;
		}
		ans =max(ans, i - j);
		i++;
		if (i == s.size() - 1);
	}
	cout << ans << endl;



}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
p = 1000000007
 
z = 0
for i in range(n):
    z += a[i]
    z = z % (2 * p)
z = (z ** 2) % (2 * p)
 
x = 0
for j in range(n):
    x += a[j] ** 2
    x = x % (2 * p)
 
w = int(((z - x) / 2) % p)
print(w)

Measured memory_bytes: 31568
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0;
  cin >> N;
  vector<ll>A(N);
  rep(i,N){
    cin >> A[i];
  }
  sort(A.begin(), A.end()); //小さい順
  reverse(A.begin(), A.end());
  ll i = 0,ans = 0;
  if(N % 2 == 0){
    rep(i,N/2){
      ans += A[i]*2;
    }
    cout << ans - A[i];
  }
  else{
    rep(i,N/2){
      ans += A[i]*2;
    }
    cout << ans - A[i] + A[N/2];
  }
}
    
  
    

Measured memory_bytes: 4848
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int>a;
    int b;
    for(int i=0;i<N;i++){
        scanf("%d",&b);
        a.push_back(b);
    }
    int p=1;
    for(int i=0;i<N+1;i++){
        if(p==2){cout<<i<<endl;exit(0);}
        p=a[p-1];
    }
    cout<<-1<<endl;
}

Measured memory_bytes: 892
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
 typedef struct Node{
        int key;
        struct Node *next;
        struct Node *prev;
        }*NodePointer;
 
 

 
 NodePointer nil;
 
/*
 リストの検索
*/
 NodePointer listSearch(int key){
         NodePointer i;
// 初めから最後まで探す
         for(i=nil;i->next!=nil;i=i->next){
                 if(i->next->key==key)return i->next;
                 }
        return NULL;
        }
 
/*
 新規ノードの作成
*/
 void init(){
        nil=malloc(sizeof(struct Node));
// 新規ノードのリンクを初期化
        nil->next=nil;
        nil->prev=nil;
        }
 
 void printList(){
        NodePointer cur=nil->next;
        int isf=1;
        while(1){
// 初めから最後まで探す
              if(cur==nil)break;
              if(isf==0)printf(" ");
              printf("%d",cur->key);
              cur=cur->next;
              isf=0;
              }
        printf("\n");
        }
 
 void deleteNode(NodePointer t){
        t->next->prev=t->prev;
        t->prev->next=t->next;
        free(t);
        }
     
 void deleteFirst(){
        NodePointer t=nil->next;
        if(t==nil)return;
        deleteNode(t);
        }
  
 void deleteLast(){
         NodePointer i;
         i=nil->prev;
         deleteNode(i);
        }
 
 void delete(int key){
         NodePointer i;
         i=listSearch(key);
         if(i!=NULL)deleteNode(i);
        }
 
 void insert(int key){
        NodePointer x;
        x=malloc(sizeof(struct Node));
        x->key=key;
        x->next=nil->next;
        nil->next->prev=x;
        nil->next=x;
        x->prev=nil;
        }
 
 int main(){
        int key,n,i;

        char com[20];

        scanf("%d",&n);
        init();
        for(i=0;i<n;i++){
                scanf("%s%d",com,&key);
                if(com[0]=='i'){insert(key);}
                else if(com[0]=='d'){
                          if(strlen(com)>6){
                                 if(com[6]=='F')deleteFirst();
                                 else if(com[6]=='L')deleteLast();
                                 }
                           else{delete(key);}
                           
                           }
                }
        printList();
        return 0;
        }


Measured memory_bytes: 32956
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int bin[102]={0},flag=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		bin[s[i]-'a']++;
	}
	for(int i=0;i<102;i++)
	{
		if(bin[i]%2==1) flag=1;
	}
	if(flag==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<iomanip>
#include<cstring>
#include<string>
#include<set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll = long long int;

const ll INF = 1<<30;
const ll LINF = 1LL<<60;
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(void) {
    int n; cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    int cnt = 0;
    for (int i = 0; i < n; i += 2) if (a[i] % 2 == 1) cnt++;
    cout << cnt << endl;
}

Measured memory_bytes: 3624
# Problem https://atcoder.jp/contests/abc072/tasks/abc072_b
# Python 2nd Try


class Problem:
    def __init__(self, problemstring):
        self.problemstring = problemstring
        self.length = len(self.problemstring)

    def solve(self):
        result = ''
        resultlist = []
        for j in range(0, self.length):
            if j % 2 == 0:
                resultlist.append(self.problemstring[j])
        result = ''.join(resultlist)
        return result


if __name__ == "__main__":
#    S = "atcoder"
#    print("{} => {}".format(S, Problem(S).solve()))
#    S = "aaaa"
#    print("{} => {}".format(S, Problem(S).solve()))
#    S = "z"
#    print("{} => {}".format(S, Problem(S).solve()))
    S = input()
    print(Problem(S).solve())

Measured memory_bytes: 3572
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    int A = 1000;
    int B = -1000*(w*h-1)-1;
    vector<vector<int> > res(H, vector<int>(W, A));
    for(int y=h-1; y<H; y+=h){
        for(int x=w-1; x<W; x+=w){
            res[y][x] = B;
        }
    }
    vector<vector<int> > sum(H+1, vector<int>(W+1, 0));
    REP(y, H)REP(x, W){
        sum[y+1][x+1] = res[y][x] + sum[y+1][x] + sum[y][x+1] - sum[y][x];
    }

    bool ok = sum[H][W] > 0;
    //cerr << "sum: " << sum[H][W] << endl;
    REP(y, H)REP(x, W){
        if(y+h>H || x+w>W)continue;
        int s = sum[y+h][x+w] - sum[y+h][x] - sum[y][x+w] + sum[y][x];
        //printf("(%d,%d)-(%d,%d): %d\n", x, y, x+w, y+h, s);
        if(s>=0)ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;
    if(ok){
        REP(y, H)REP(x, W){
            cout << res[y][x] << (x==W-1 ? '\n' : ' ');
        }
    }

    return 0;
}


Measured memory_bytes: 3584
#include<stdio.h>
int main()
{
	int a,b;
	int i;
	scanf("%d %d",&a,&b);
	if(a>b){
		for(i=0;i<a;i++){
			printf("%d",b);
		}
		printf("\n");
	}
	else{
		for(i=0;i<b;i++){
			printf("%d",a);
		}
		printf("\n");
	}
	return 0;
}

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

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

/* main */
void Main(void)
{
    int n;
    cin >> n;
    vll a;
    a.resize(n);
    for (int rv = 0; rv < n; rv++)
    {
        cin >> a[rv];
    }
    ll min = 1000000 + 1, max = -1000000 - 1, sum = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[i] < min)
            min = a[i];
        if (max < a[i])
            max = a[i];
        sum += a[i];
    }
    cout << min << " " << max << " " << sum << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();

    return 0;
}



Measured memory_bytes: 3252
#include "math.h"
#include "queue"
#include "algorithm"
#include "iostream"
using namespace std;




int main()
{

	int ou = 0,ji = 0 ,si = 0;
	int a[100003];
	int num;
	scanf("%d",&num);
	for(int i = 0;i < num;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i = 0; i < num;i++)
	{
		if(a[i]%4 == 0)
			si++;
		else if(a[i]%2 == 0)
			ou++;
		else
			ji++;
	}
	int flag = 0;
	if(ou > 0)
		flag = 1;
	if(si + 2 >= ji + 1 + flag)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] arr = new long[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextLong();
		}
		long count = 1;
		boolean flg = true;//前で切られたか(単調増加/減少かわからないとき
		boolean isTanchoUP = true;
		for(int i = 1; i < n; i++) {
			if(flg) {
				flg = false;
				if(arr[i] > arr[i-1]) {
					isTanchoUP = true;
				} else if(arr[i]==arr[i-1]) {
					flg = true;
				} else {
					isTanchoUP = false;
				}
				continue;
			}
			if(isTanchoUP) {
				if(arr[i] < arr[i-1]) {
					flg = true;
					count++;
				}
			} else {
				if(arr[i] > arr[i-1]) {
					flg = true;
					count++;
				}
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 50256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int k=scan.nextInt();
		int a[]=new int[n];
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		Arrays.sort(a);
		int x=0;
		for(int i=0;i<k;i++) {
			x+=a[i];
		}
		System.out.println(x);
	}

}


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

using namespace std;

typedef long long ll;

const ll M = 1e9 + 7;
const int N = 100100;

vector<int> g[N];

int way[N], used[N];
int t[3];

void dfs(int v) {
    for (int u : g[v]) {
        if (way[u] == 0) {
            way[u] = v;
            dfs(u);
        }
    }
}

void cnt(int v) {
    ++t[used[v]];
    for (int u : g[v]) {
        if (!used[u]) {
            used[u] = used[v];
            cnt(u);
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    way[1] = -1;
    dfs(1);
    vector<int> order;
    for (int v = n; v != -1; v = way[v]) {
        order.push_back(v);
    }
    int m = order.size();
    used[order[m / 2 - 1]] = 2;
    used[order[m / 2]] = 1;
    cnt(order[m / 2 - 1]);
    cnt(order[m / 2]);
    if (t[1] > t[2]) {
        cout << "Fennec";
    } else {
        cout << "Snuke";
    }
    return 0;
}

Measured memory_bytes: 10104
#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <bitset>

using namespace std;
const int64_t INF=10000000000000000;
template<class T>
void read_1d(std::vector<T>& a,int64_t num){
	a.reserve(num);
	for(int64_t i1=0;i1<num;i1++){
		T temp;
		cin>>temp;
		a.push_back(temp);
	}
}
template<class T>
void read_2d(std::vector<std::vector<T> >&a,int64_t x,int64_t y ){
	a.resize(x);
	for(int64_t i1=0;i1<x;i1++){
		a[i1].reserve(y);
		for(int64_t i2=0;i2<y;i2++){
			T temp;
			cin>>temp;
			a[i1].push_back(temp);
		}
	}
}
template<class InputIterator>
void debug(InputIterator first,InputIterator last){
	for(auto i1=first;i1!=last;i1++){
		cout<<(*i1)<<endl;
	}
}

int main(){
	int64_t n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	n--;
	b=b-a;
	int64_t max_num=n*d;
	int64_t min_num=n*c;
	bool possible=false;
	for(int64_t i1=0;i1<n+1;i1++){
		if(min_num<=b&&b<=max_num){
			possible=true;
			break;
		}else{
			min_num-=(d+c);
			max_num-=(d+c);
		}
	}
	if(possible){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}


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

sum_ = sum(A)
element_count_dict = {}
for elm in A:
    element_count_dict[elm] = element_count_dict.get(elm, 0) + 1
for _ in range(Q):
    B, C = list(map(int, input().split()))
    if B in element_count_dict:
        count_B = element_count_dict[B]
        element_count_dict[C] = element_count_dict.get(C, 0) + count_B
        sum_ = sum_ - B * count_B + C * count_B
        element_count_dict[B] = 0
    print(sum_)
    

Measured memory_bytes: 21112
#include<iostream>

int main()
{
    int x[100],y[100],i=0,j=0,k,imax;
    
    
    for (;;)
    {
        std::cin >> x[i] >> y[i];

        if ((x[i] == 0) && (y[i] == 0)) break;

        i++;
    }
    imax = i;


        for (i = 0; i < imax; i++)
        {
            for (j = 0; j < x[i]; j++)
            {
                for (k = 0; k < y[i]; k++)
                {
                    std::cout << "#";
                }
                std::cout << std::endl;
            }
            std::cout << std::endl;


        }
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    int n;
    string s;
    int r = 0;
    int g = 0;
    int b = 0;
    cin >> n;

    for (int i = 0; i < n; i++) {
        char c;
        cin >> c;
        s.push_back(c);
        if (c == 'R') {
            r += 1;
        } else if (c == 'G') {
            g += 1;
        } else {
            b += 1;
        }
    }

    long ans = (long)r * g * b;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int k = j + j - i;
            if (!(k < n)) continue;
            if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) ans -= 1;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3636
// AOJ 1154: Monday-Saturday Prime Factors
// 2017.9.13 bal4u@uu
// 2017.12.22

#include <stdio.h>
#include <math.h>

#define MAX 300000
#define SQ  547				// 547 = sqrt(300000)

char mk[MAX+2];
int spool[550];

int main()
{
	int n, i, j, k;
	
	for (i = 7; i <= MAX; i += 7) mk[i-1] = mk[i+1] = 1;
	for (i = 0; i <= SQ; i++) if (mk[i]) {
		for (j = i*i; j <= MAX; j+=i) mk[j] = 0;
	}

	while (scanf("%d", &n) && n > 1) {
		printf("%d:", n);
		k = (int)sqrt(n);
		j = 0; if (mk[n]) spool[j++] = n;
		for (i = 2; i <= k; i++) {
			if (n % i == 0) {
				if (mk[i]) printf(" %d", i);
				if (mk[n / i]) spool[j++] = n / i; 
			}
		}
		if (j > 0 && spool[j-1] == k) j--;
		if (j > 0) while (j--) printf(" %d", spool[j]);

		putchar('\n');
	}
	return 0;
}

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

int main(){
	int x,i,n,l,r,ans;
  cin>>x>>n;
  vector<int> a(n);
  map<int,int> b;
  for(i=0;i<n;++i){
    cin>>a[i];
    b[a[i]]=1;
  }
  l=r=x;
  while(b[l]) l--;
  while(b[r]) r++;
  cout<<(abs(l-x)<=abs(r-x)?l:r);
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	vb ans(1000,false);
	string s;
	cin>>n>>s;
	vvb a(n+2,vb(10,false));
	vvb b(n+2,vb(10,false));
	range(i,1,n+1){
		rep(j,10)a[i][j]=a[i-1][j];
		a[i][s[i-1]-'0']=true;
	}
	rrep(k,n){
		int i=k+1;
		rep(j,10)b[i][j]=b[i+1][j];
		b[i][s[i-1]-'0']=true;
	}
	range(i,1,n-1){
		rep(j,10){
			if(a[i][j]){
				rep(k,10){
					if(b[i+2][k]){
						ans[j*100+(s[i]-'0')*10+k]=true;
					}
				}
			}
		}
	}
	ll cnt=0;
	rep(i,1000)if(ans[i])cnt++;
	puta(cnt);
}


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

int main() {
    ll n; cin >> n;
    ll ans = 1000000000000;
    for (ll i=1; i*i<=n; ++i){
        ll tmp = n / i;
        ll tmp2 = tmp + i;
        if (n%i==0 && tmp2<ans) {
            ans = tmp2;
        } else {
            continue;
        }
    }
    cout << ans - 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
#define __ ios_base::sync_with_stdio(false); cin.tie(NULL);


int main() {
//    __

    ll n;
    cin >> n ;
    cout << n + n*n + n*n*n << endl ;


    return 0 ;
}





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

class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String str="";
		str=bfr.readLine();
		boolean doublei=false;
		char[] moji=new char[str.length()];
		for(int i=0; i<str.length(); i++) {
			moji[i]=str.charAt(i);
		}

		for(int i=0; i<str.length(); i++) {
			for(int j=i+1; j<str.length(); j++) {
				if(moji[i]==moji[j]) {
					System.out.println("no");
					doublei=true;
					System.exit(0);
				}
			}
		}

		if(doublei==false) {
			System.out.println("yes");
		}
		else {}
	}
}

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

int main() {
    string s,t;
    cin >> s >> t;
    if(s[0]==t[2]&&s[1]==t[1]&&s[2]==t[0]){
        cout << "YES";
    }
    else cout << "NO";
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC112_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            if (N==1)
            {
                Console.WriteLine("Hello World");
                return;
            }
            else
            {
                var a = int.Parse(Console.ReadLine());
                var b = int.Parse(Console.ReadLine());
                Console.WriteLine(a+b);
            }
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    string s; cin >> s;
    set<char> st;
    rep(i, SZ(s)) { st.insert(s[i]); }
    if (SZ(s) == SZ(st)) out("yes");
    else out("no");
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>

std::string getFizzBuzz(int n)
{
	if (n % 15 == 0)
	{
		return "FizzBuzz";
	}
	else if (n % 5 == 0)
	{
		return "Buzz";
	}
	else if (n % 3 == 0)
	{
		return "Fizz";
	}
	else
	{
		return std::to_string(n);
	}
}

void fizzbuzz(int m, int n)
{
	std::list<int> lst;

	for (int i = 1; i <= m; ++i)
	{
		lst.push_back(i);
	}

	for (int i = 1; i <= n; ++i)
	{
		std::string rem;
		std::cin >> rem;

		if (lst.size() <= 1)
		{
			continue;
		}

		int player = *(lst.begin());
		lst.pop_front();

		std::string ret = getFizzBuzz(i);

		if (rem == ret)
		{
			lst.push_back(player);
		}
	}

	lst.sort();
	for (auto itr = lst.begin(); itr != lst.end(); ++itr)
	{
		if (itr != lst.begin())
		{
			std::cout << " ";
		}
		std::cout << *itr;
	}
	std::cout << std::endl;

	return;
}

int main(void)
{
	int m;
	int n;

	while (std::cin >> m >> n && m != 0 && n != 0)
	{
		fizzbuzz(m, n);
	}
	return 0;
}



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

typedef long long ll;
typedef long double ld;

ll niz[200005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n;
    cin >> n;
    ll x = 0, y = 0;
    for(int i=1; i<=n; i++){
        cin >> niz[i];
        x += niz[i];
    }
    ll res = 2000000000;
    for(int i=1; i<n; i++){
        x -= niz[i];
        y += niz[i];
        res = min(res, abs(x-y));
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    ll n;
    cin>>n;
    vector<vector<P>> v(n);
    for(ll i=0;i<n-1;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        v[a].push_back({b,c});
        v[b].push_back({a,c});        
    } 
    //BFS
    vector<ll> col(n),visit(n);
    queue<ll> q;
    ll sum=0;
    col[0]=0;
    q.push(0);
    visit[0]=1;
    while(q.empty()!=1){
        ll tmp=q.front(); 
        q.pop();
        for(ll j=0;j<v[tmp].size();j++){
            if(visit[v[tmp][j].first]==0){
                if(v[tmp][j].second%2==0) col[v[tmp][j].first]=col[tmp];
                else col[v[tmp][j].first]=1-col[tmp];
                q.push(v[tmp][j].first);
                visit[v[tmp][j].first]=1;
            }
        }
    }
    for(ll i=0;i<n;i++){
        cout<<col[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 9472
#include<bits/stdc++.h>
#define pb push_back
#define mod int(1e9+7)
#define N int(1e5+100)
#define pi 3.141592653589793238
#define ll unsigned long long int
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define si second
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int r;
	cin>>r;
	printf("%.5f\n",(2*pi*r));
   return 0;
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int gcd(int a,int b){
	if(a<b) swap(a,b);
	if(b==0) return a;
	return gcd(b,a%b);
}

int lcm(int a,int b){
	return a*b/gcd(a,b);
}

signed main(){
	int a,b;
	while(cin>>a>>b){
		o(gcd(a,b)<<" "<<lcm(a,b));
	}
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

typedef long long ll;

using namespace std;
int main()
{
    int N;
    cin >> N;
    ll a[N];
    int countOdd = 0;
    int count4Mul = 0;
    REP(i, N)
    {
        cin >> a[i];
        if (a[i] % 2 == 1)
        {
            countOdd++;
        }
        if (a[i] % 4 == 0)
        {
            count4Mul++;
        }
    }

    int count2Mul = N - countOdd - count4Mul;
    if (count2Mul >= 1)
    {
        count4Mul--;
    }
    
    string ans;
    if (countOdd <= count4Mul + 1)
    {
        ans = "Yes";
    }
    else
    {
        ans ="No";
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
// Aizu Vol-3 0305: Yuekis' Audio Room
// 2017.8.26 bal4u@uu

#include <stdio.h>

int d[4], a[4], k;

void reply()
{
    int i;
    
    for (i = 0; i < k; i++) {
        if (i > 0) putchar(' ');
        printf("%d", d[i] + 5*a[i]);
    }
    putchar('\n');
}

int main()
{
	int N, r, t;
    int dd, aa;

    scanf("%d", &N);
    while (N-- > 0) {
        scanf("%d%d", &r, &t), dd = r / 100, aa = t / 30;
        if (r % 100 == 0 && t % 30 == 0)
            d[0] = dd, a[0] = aa, k = 1;
        else if (r % 100 == 0)
            d[0] = d[1] = dd, a[0] = aa, a[1] = aa + 1, k = 2;
        else if (t % 30 == 0)
            d[0] = dd, d[1] = dd + 1, a[0] = a[1] = aa, k = 2;
        else {
            d[0] = dd,     a[0] = aa;
            d[1] = dd + 1, a[1] = aa;
            d[2] = dd,     a[2] = aa + 1;
            d[3] = dd + 1, a[3] = aa + 1, k = 4;
        }
        reply();
    }
	return 0;
}

Measured memory_bytes: 604
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d,e,f,g,h,s,t;
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    s=a+b+c+d;
    t=e+f+g+h;
    if (t>s){
        cout << t << endl;
    }
    else cout << s << endl;
    return 0;
}



Measured memory_bytes: 3092
#!/usr/bin/env python3
import sys


def solve(K: int, S: str):
    print(S if len(S) <= K else S[:K] + "...")


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(K, S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
#include <iostream>

using namespace std;

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) {  // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N;
  cin >> N;
  int min_sum_digits = findSumOfDigits(N - 1) + 1;
  for (int A = 1; A <= N / 2; A++) {
    int sum_AB = findSumOfDigits(A) + findSumOfDigits(N - A);
    if (sum_AB < min_sum_digits) {
      min_sum_digits = sum_AB;
    }
  }
  cout << min_sum_digits << endl;
}

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


int main(){
    while(1){
        int h,w;
        cin>>h>>w;
        if(h==0 && w==0) break;
        else{
            for(int i=0;i<h;i++){
                for(int j=0;j<w;j++){
                    cout<<"#";
                }
                cout<<endl;
            }
            cout<<endl;
        }
    }
}


Measured memory_bytes: 3096
N = int(input())
alphabet = "zabcdefghijklmnopqrstuvwxy"
num = N
cnt = 0
div = 26
res = ""
while True:
  # print(num, div)
  sho = num // div
  amari = num % div
  # print(sho, amari, alphabet[amari])
  # print("--")
  res += alphabet[amari]
  if amari != 0:
    num = sho
  else:
    num = sho -1
  if sho == 0:
    break
  elif sho == 1 and amari == 0 and alphabet[amari] == "z":
    break
print(res[::-1])

Measured memory_bytes: 9040
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
	int d;
	string ans;
	cin >> d;
	switch (d)
	{
	case 25:
		ans = "Christmas";
		break;
	case 24:
		ans = "Christmas Eve";
		break;
	case 23:
		ans = "Christmas Eve Eve";
		break;
	case 22:
		ans = "Christmas Eve Eve Eve";
		break;
	}


	cout << ans << endl;

	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        int m = cin.nextInt();
        int a[] = new int[n+1];
        int sum = 0;
        for(int i = 1; i <= n; i++){
            a[i] = cin.nextInt();
            sum += a[i];
        }
        int cnt = (sum)/(4*m);
        if(sum%(4*m) > 0) cnt++; 
        
        int num = 0;
        for(int i = 1; i <= n; i++){
            if(a[i] >= cnt) num++; 
        }
        if(num >= m) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 23124
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($A,$B,$K) =  explode(" ",trim(fgets(STDIN)));
//$A = explode(" ",trim(fgets(STDIN)));

$resutl=array();
for($i=1;$i<=max($A,$B);$i++) {
  if ((($A % $i)==0) && (($B % $i)==0)) {
    $result[]=$i;
  }
}
rsort($result);
printf("%d\n",$result[$K-1]);


Measured memory_bytes: 4728
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int MOD = 1e9+7;
const int INF = 1<<30;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int k;
    cin >> k;
    string s;
    cin >> s;

    int n = s.length();
    rep(i, n) {
        if (i >= k) {
            cout << "...";
            break;
        }
        else cout << s[i];
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e12;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
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(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;
    cin >> N;
    string S = to_string(N);
    int d = 0;
    for(int i=0; i<S.size(); i++){
        d += S[i] - '0';
    }
    if(N%d == 0){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
/*
	Behind every successful man 
	there's a lot of unsuccessful years
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define E endl
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 1e4+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N],n;
int cache[1010][10010];
int solve(int w,int pos) 
{   if(pos ==n){
    if(w <=0)return 0;
 	 return 1e18;
	}
	if(w<=0)return 0;
	if(cache[pos][w]!=-1)return cache[pos][w];
	int x =1e18;
	x =dp[pos]+solve(w-ar[pos],pos+1);
	x = min(x, dp[pos]+solve(w-ar[pos],pos));
	x = min(solve(w,pos+1),x);
	 cache[pos][w]=x;
	 return x;
} 
signed main(){
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int wt;
		cin >> wt >> n;
		for(int i =0 ;i <n;i++){
			cin >> ar[i] >> dp[i];			
		}
		memset(cache,-1,sizeof(cache));
		int ans = solve(wt,0ll);
		cout<<ans<<endl;
	
	}
	
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  ll T1, T2; cin >> T1 >> T2;
  ll A1, A2; cin >> A1 >> A2;
  ll B1, B2; cin >> B1 >> B2;
  if (A1*T1+A2*T2==B1*T1+B2*T2)  { cout << "infinity" << endl; return 0; }
  if (A1<B1) { swap(A1,B1); swap(A2,B2); }
  ll d1 = A1*T1 - B1*T1;
  ll d2 = (B1*T1+B2*T2) - (A1*T1+A2*T2);
  if (d2<0) cout << 0 << endl;
  else cout << d1/d2*2+(d1%d2!=0) << endl;
  // cout << d1 << " " << d2 << endl;
  return 0;
}

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

int main() {
	int N;
	double count=0;
	cin >> N ;
	vector<int> A(N);
	for(int i=0;i<N;i++){
		cin >> A.at(i);
		count+=1.0/A.at(i);
	}
	cout << 1.0/count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main(){
	string s;
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s[i] == '7') {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3628
def gcd(a,b):
    if b==0:
        return(a)
    else:
        return(gcd(b,a%b)) 
def lcm(a,b):
    return a*b//gcd(a,b)

n=int(input())
cur=0
if n==1:
    cur=int(input())
else:
    cur=lcm(int(input()),int(input()))
    for _ in range(n-2):
        cur = lcm(int(input()),cur)
print(cur)


Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
	int H,W,i,j;
	
   
    
while(1){
    scanf("%d %d", &H, &W);
    
    if(W == 0 && H == 0)break;

    for(i = 0; i < H ; i++){  
	 
		    for(j =0 ; j < W; j++){	
		    printf("#");
	
    		} 
	    printf("\n");
	    }
	    printf("\n");
    }

    return 0;
}

Measured memory_bytes: 1000
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N;
ll A[200005];
ll B[200005];

int main() {
  INCANT;
  cin >> N;
  rep(i, N) cin >> A[i];
  sort(A, A+N, greater<int>());
  B[0] = A[0];
  rep(i, N) {
    if (i==0) continue;
    if (2*i-1 < N) {
      B[2*i-1] = A[i];
    } 
    if (2*i-2 < N) {
      B[2*i] = A[i];
    }
  }
  ll sum = 0ll;
  rep(i, N-1) sum+=B[i];
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 6696
class SegmentTree():
    '''
    非再帰
    segment tree
    '''

    def __init__(self, n, func, init=float('inf')):
        '''
        n->配列の長さ
        func:func(a,b)->val,　func=minだとRMQになる
        木の高さhとすると,
        n:h-1までのノード数。h段目のノードにアクセスするために使う。
        data:ノード。data[0]:root<-leaf:data[-1]
        parent:k->child k*2+1とk*2+2
        '''
        self.n = 2**(n-1).bit_length()
        self.init = init
        self.data = [init]*(2*self.n)
        self.func = func

    def set(self, i, v):
        '''
        leafの初期化
        i: 0-origin idx
        v: value
        '''
        self.data[i+self.n-1] = v

    def build(self):
        '''
        setの後に一斉更新
        '''
        #leaf->rootに向かって、apply func していく
        for k in reversed(range(self.n-1)):
            self.data[k] = self.func(self.data[k*2+1], self.data[k*2+2])

    def update(self, k, a):
        '''
        data[k]=aに更新する。
        更新をrootまで更新
        '''
        k += self.n-1 #k=segTree上での k-th leafのidx
        self.data[k] = a

        while k > 0: #while not reach to root
            k = (k-1)//2 #goto its parent
            self.data[k] = self.func(self.data[k*2+1], self.data[k*2+2]) #update

    def query(self, l, r):
        '''
        [l,r)のfuncを求める
        '''
        L = l+self.n
        R = r+self.n
        ret = self.init
        while L < R:
            if R & 1: #R%2==1 
                R -= 1
                ret = self.func(ret, self.data[R-1]) #親が丸々区間に含まれない->はみ出したところを更新
            if L & 1:
                ret = self.func(ret, self.data[L-1])
                L += 1
            L >>= 1 #to parent
            R >>= 1
        return ret


    def lower_bound_index(self,x,v):
        """
        x:0-origin
        [x,N)の範囲で、v<=data[j]を満たす最小のjを探す(二分探索)

        存在しないなら、float("inf")をreturn している。
        """
        #区間の左端
        x+=self.n-1

        #data[x]が、v以上なるまで登る
        while self.data[x]<v:
            if x%2==0: #xが右のnodeなら、候補外になる
                if len(bin(x+1))==len(bin(x+2)):#一つ右に移動できるなら
                    x+=1
                else:#右に行けない->とりま大きい値をreturnしとく。(多分、全ての値が条件を満たさない時に、無限whileするのを防ぐ
                    return float("inf")

            else:#登る
                x>>=1

        # v<=data[x]を満たすように、できるだけ左(idxが小さい)に降る
        while x<self.n-1:#どこかの葉にたどり着くまで
            if self.data[2*x+1]>=v:#左の子が v<=data[x]を満たすなら、優先して左に。
                x=2*x+1
            else:#シャーなしの右
                x=2*x+2
        return x-self.n+1 #seg木のidxから、元のlistのidxに変換



N,Q = map(int,input().split())
Seg = SegmentTree(N,lambda x,y:max(x,y),init=-1)
A = list(map(int,input().split()))
for i,a in enumerate(A):
    Seg.set(i,a)



Seg.build()

for _ in range(Q):
    t,a,b = map(int,input().split())
    if t==1:
        Seg.update(a-1,b)
    elif t==2:
        print(Seg.query(a-1,b))
    elif t==3:
        print(min(Seg.lower_bound_index(a-1,b),N)+1)




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

using namespace std;


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

    int n,i,j,arr[55],sum=0;
    cin>>n;
    for(i=0;i<n;i++)cin>>arr[i];
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            sum+=(arr[i]*arr[j]);
        }
    }
    cout<<sum<<'\n';
	return 0;
}


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

using namespace std;

int main()
{
    long long int x, i, k, d;
    cin >> x >> k >> d;
    x=abs(x);
    if(x/d<=k){
        k-=x/d;
        x-=x/d*d;
    }
    else{
        x-=k*d;
        k=0;
    }
    if(k%2){
        x-=d;
        k-=1;
    }
    cout << abs(x) << '\n';
    return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define int long long
#define fi first
#define sc second
#define pii pair<int,int>
#define vi vector<int>
#define msi map<string,int>
#define si set<int>
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define dep(i,a,b)  for(int i=a;i>=b;i--)
#define isinarr(i,n) ((i>=0)?((i<n)?1:0):0)
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppb pop_back
#define hell 1000000007
#define mp make_pair
#define endl '\n'

using namespace std;
void solve()
{
    int n,w;
    cin>>n>>w;
    int a[n],wt[n],dp[n+1][w+1];
    rep(i,0,n)
    {
    	cin>>wt[i]>>a[i];
    }
    rep(i,0,n+1)
    {
    	rep(j,0,w+1)
    	{
    		if(i==0 || j==0)
    		{
    			dp[i][j]=0;
    		}
    		else
    		{
    			if(wt[i-1]<=j)
    			{
    				dp[i][j]=max(a[i-1]+dp[i-1][j-wt[i-1]], dp[i-1][j])
;    			}
    			else
    			{
    				dp[i][j]=dp[i-1][j];
    			}
    		} 
    		//cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
    	}
    	//cout<<endl;
    }
    cout<<dp[n][w];
} 



signed main()
{
    fastio
    int t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 79232
def ABC_84_B():
    A,B=map(int, input().split())
    S=input()
    f=1

    for i in range(len(S)):
        if  S[i]!='-' and i<A and int(S[i])>=0 and int(S[i])<=9:
            f+=0
        elif i == A and S[i] =='-':
            f-=1
        elif S[i]!='-' and int(S[i])>=0 and int(S[i])<=9:
            f+=0
        else:
            f+=1

    if f==0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':

    ABC_84_B()

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

int main() {
    int n,out=0,tomin=0,Min=1e9,var;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        out+=a[i]*a[i];
        tomin+= (-2*a[i]);
    }
    for(int b=1;b<=100;b++)
    {
        var = n*b*b;
        var += (tomin*b);
        if(var<Min)
        {
            Min = var;
        }
    }
    out+=Min;
    cout<<out<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{

int a ;
cin >> a ;

if (a==111) {
    cout << 999 << endl;
}
    else if (a==999) {
        cout << 111 << endl;
    }
    else if (a ==119) {
        cout << 991 << endl;
    }
    else if (a == 991 ) { 
        cout << 119 << endl;
    }
    else if (a == 199) {
        cout << 911 << endl;
    }
    else if (a==911) {
        cout << 199 << endl;
    }
    
    else if (a==919) {
        cout << 191 << endl;
    }
    else if (a==191) {
        cout << 919 << endl;
    }




//1からnまでの合計を求める
//int sum = 0;
//REP(i, n) sum += i + 1;
// for (i = 0; i < n; i++) sum += i + 1;


      //初期 {4, 3, 2, 1} を {1, 2, 3, 4} へ昇順ソートする
//vector<int> a{4, 3, 2, 1};
//REP(i, 4) cout << a[i] << " ";
//cout << endl;
//sort(ALL(a));
     //sort(a.begin(), a.end());
//REP(i, 4) cout << a[i] << " ";
//cout << endl;


return 0;
}

Measured memory_bytes: 256