akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long a,b,c,x,i,j,k,nr=0;
    cin>>a>>b>>c>>x;
    for(i=0;i<=a;i++){
        if(i*500>x) break;
        for(j=0;j<=b;j++)
        {
            if(i*500+j*100>x) break;
            for(k=0;k<=c;k++)
            {
                if(i*500+j*100+k*50>x) break;
                if(i*500+j*100+k*50==x) nr++;
            }
        }
    }
    cout<<nr;

    return 0;
}


Measured memory_bytes: 256
n = gets.chomp!.to_i
i = 9
count = 0
while i >= 1
  s = n / i
  if n % i == 0 && s <= 9
    count+=1
  end
  i -= 1
end
if count >= 1
  print("Yes\n")
else
  print("No\n")
end

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

int main()
{
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);
	long long k, n, i, mini, dis;
	cin >> k >> n;
	int a[n];
	for (i = 0; i < n; i++)
		cin >> a[i];
	mini = a[n - 1] - a[0];
	for (i = 0; i < n - 1; i++)
	{
		dis = a[i] + k - a[i + 1];
		mini = min(mini, dis);
	}
	cout << mini;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    deque<ll> a;
    
    rep(i,n){
        ll b;
        cin >> b;
        if(i%2 == n%2)  a.push_back(b);
        else a.push_front(b);
    }
    rep(i,a.size()){
        if(i>0) cout << " ";
        cout << a[i];
    }
    cout << endl;
}
    

Measured memory_bytes: 3840
#include <iostream>
using namespace std;
int main(void){
    int a, b ,t;

    while(1){
        cin >> a >> b;
        if(a == 0 && b == 0) break;
        if (a > b) {
        t = a;
        a = b;
        b = t;
        }
        cout << a << " " << b << endl;
    }

}

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

int main()
{
	int N, K;
	cin >> N >> K;

	long double d = N - (K - 1);
	long double ans = d / N;
	long double neg = 1.0 - ans;
	if( d < 0 ) {
		ans = 0;
		neg = 1;
	}
	int mi = min( N, K - 1 );
	for( int n = 1; n <= mi; n++ ) {
		long double t = (long double)K / n;
		long double p = ceil( log2( t ) );
		p = pow( 2, p );
		p *= mi;
		ans += 1 / p * neg;
	}

	cout << fixed << setprecision(12) << ans << endl;
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
int n, q;
string s;
vector<pair<char, char>> qry;
int sml (int k) {
  if (k < 0) {
    return -1;
  } else if (k >= n) {
    return 1;
  } 
  for (auto p : qry) {
    char t = p.first;
    char d = p.second;
    if (s[k] == t) {
      if (d == 'L') {
        k--;
      } else {
        k++;
      }
    }
    if (k < 0) {
      return -1;
    } else if (k >= n) {
      return 1;
    }
  }
  return 0;
}
int main() {
  cin >> n >> q >> s;
  qry.resize(q);
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    qry[i] = {t, d};
  }
  int lftNg(-1), lftOk(n);
  while (lftOk - lftNg > 1) {
    int md = (lftNg + lftOk) >> 1;
    if (sml(md) == -1) {
      lftNg = md;
    } else {
      lftOk = md;
    }
  }
  int rgtOk(-1), rgtNg(n);
  while (rgtNg - rgtOk > 1) {
    int md = (rgtNg + rgtOk) >> 1;
    if (sml(md) == 1) {
      rgtNg = md;
    } else {
      rgtOk = md;
    }
  }
  cout << rgtNg - lftOk << '\n';
  return 0;
}

Measured memory_bytes: 900
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] x = new int[N];
            for (int i = 0; i < N; i++) {
                x[i] = in.nextInt();
            }

            int min = (int) 1e9;
            for (int l = 0, r = l + K - 1; r < N; l++, r++) {
                min = Math.min(min, Math.abs(x[l]) + Math.abs(x[r] - x[l]));
                min = Math.min(min, Math.abs(x[r]) + Math.abs(x[l] - x[r]));
            }

            System.out.println(min);
        }
    }
}


Measured memory_bytes: 48676
#include <iomanip>
#include <iostream>
using namespace std;
int x[4][3][10];
int main(void) {
  for(int i = 0; i < 4; i++)
    for(int j = 0; j < 3; j++)
      for(int k = 0; k < 10; k++)
        x[i][j][k] = 0;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    x[b - 1][f - 1][r - 1] += v;
  }
  for(int i = 0; i < 4; i++) {
    for(int j = 0; j < 4; j++) {
      for(int k = 0; k < 10; k++) {
        if(j != 3)
          cout << " " << x[i][j][k];
        else if(i != 3)
          cout << "##";
      }
      if(i != 3 || j != 3)
        cout << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <math.h>
#include <bitset>
#include <vector>
using namespace std;
 
int main() {
    string s,t,u;
    cin >> s >> t;
    bool flag=0;
    for(int i=0;i<s.size();i++){
        u=t.substr(1,t.size()-1);
        u.push_back(t[0]);
        t=u;
        if(s==t)flag=1;
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <climits>
#include <math.h>
#include <utility>
#include <ctime>
#include <cstdlib>
using namespace std;

typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) a.begin(),a.end()

const int NUM = 10e9 + 7;

int main() {
	int a, b; cin >> a >> b;
	cout << (a + b) % 24 << endl;
	
	return 0;
}


Measured memory_bytes: 256
from fractions import gcd

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a, b = list(map(int, input().split()))
fct = factorization(gcd(a, b))
if not (len(fct) == 1 and fct[0][0] == 1):
    fct.append([1, 1])

#print(fct)
print(len(fct))

Measured memory_bytes: 5344
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int a[105];
int main(void){
    int n,x; cin>>n>>x;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int i=0;
    while(true){
        if(i>=n){
            break;
        }
        if(i==n-1){
            if(x==a[i]){
                i++;
                break;
            }else{
                break;
            }
        }
        if(x-a[i]>=0){
            x=x-a[i];
            i++;
        }else{
            break;
        }
    }
    cout<<i<<endl;
    
}


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

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long

void solve() {
    int N; cin >> N;
    vector<ll> A(N), sum(N + 1);
    ll ans = INF;
    sum[0] = 0;
    rep(i, N) {
        cin >> A[i];
        sum[i + 1] = sum[i] + A[i];
    }
    for(int i = 2; i <= N - 2; i++) {
        int j = lower_bound(sum.begin(), sum.end(), sum[i] / 2) - sum.begin();
        int k = lower_bound(sum.begin(), sum.end(), sum[i] + (sum[N] - sum[i]) / 2) - sum.begin();
        ll P1 = sum[j], Q1 = sum[i] - sum[j];
        ll P2 = sum[j - 1], Q2 = sum[i] - sum[j - 1];
        ll R1 = sum[k] - sum[i], S1 = sum[N] - sum[k];
        ll R2 = sum[k - 1] - sum[i], S2 = sum[N] - sum[k - 1];
        ll P, Q, R, S;
        if(abs(P1 - Q1) > abs(P2 - Q2) || j >= i) {
            P = P2; Q = Q2;
        } else {
            P = P1; Q = Q1;
        }
        if(abs(R1 - S1) > abs(R2 - S2) || k >= N) {
            R = R2; S = S2;
        } else {
            R = R1; S = S1;
        }
        ll ret = max({P, Q, R, S}) - min({P, Q, R, S}); 
        ans = min(ans, ret);
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 3456
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, K = map(int, rl().split())
    MOD = 10 ** 9 + 7
    
    a = [0]
    for d in range(1, K + 1):
        a.append(pow(K // d, N, MOD))
    
    for i in range(K, 0, -1):
        j = 2 * i
        while j <= K:
            a[i] = (a[i] - a[j]) % MOD
            j += i
    
    ans = 0
    for i in range(1, K + 1):
        ans = (ans + i * a[i]) % MOD
    print(ans)


if __name__ == '__main__':
    solve()


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

int main(){
  int N,tmp;
  scanf("%d",&N);
  int a[N];
  int i,j;
  int no_primes=0;

  for(i=0; i<N; i++){
    scanf("%d",&a[i]);
  }
  

  for(i=0; i<N; i++){
    tmp = a[i];

    if(tmp<2 || (tmp>2 && tmp%2==0)){
      no_primes += 1;
      continue;
    }else if(tmp==2){
      continue;
    }else{    
      for(j=3; j*j<=tmp; j+=2){
        if(tmp%j==0){
          no_primes += 1;
          break;
        }
      }
    }
  }
  printf("%d\n",N-no_primes);
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

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

    int res = 0;
    rep(i, m) res += 1900;
    rep(i, n-m) res += 100;

    int two = 1;
    rep(i, m) two *= 2;

    res *= two;

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int len=s.size();
	bool check=true;
	for(int i=0;i<len;i++){
		for(int j=i+1;j<len;j++){
			if(s[i]==s[j])check=false;
		}
	}
	if(check==true)puts("yes");
	else puts("no");
	return 0;
}


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

int main() {
  string S;
  cin >> S;
  vector<char> even = {'R', 'U', 'D'};
  vector<char> odd = {'L', 'U', 'D'};
  string ans = "Yes";

  rep(i, S.length()) {
    if ((i % 2 == 0 && find(even.begin(), even.end(), S[i]) != even.end()) ||
        (i % 2 == 1 && find(odd.begin(), odd.end(), S[i]) != odd.end()))
      continue;
    else {
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a, b, k=0,ans,hachipa,jippa;
	scanf("%d%d",&a,&b);
	for(ans=1;ans<200000;ans++){
		hachipa = ans*0.08;
		jippa = ans*0.1;
		if((hachipa==a)&&(jippa==b)) {
			k=1;
			break;
		}
	}
	if(k==1) printf("%d",ans);
	else printf("-1");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<unordered_map>
#include<algorithm>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
	ios::sync_with_stdio(0);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
//===============================================
#define ll long long
#define ld long double
#define mk make_pair
#define loop(i,intial,n)  for(ll i=(intial);i<n;i++)
#define loopn(j,n) for(int j=int(n);j>=0;j--)
#define loopm(name)  for(auto it : name)
#define loopm2(name)  for(auto it2 : name)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
#define PI (ld)(3.14159265358979323846)
//===============================================
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
//===============================================
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const ll oo = (ll) 10e9 + 7;
const ll N = 1e6 + 5;
const double EPS = 1e-4;
//int dx[] = { 0, 1, 0, -1 };
//int dy[] = { 1, 0, -1, 0 }; // 4 Direction*/
//int dx[]={1,1,0,-1,-1,-1,0,1};
//int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction*/
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{
	afify();
	ll n;
	cin >> n;
	vll v(n+1);
	ll cnt = 1;
	loop(i, 1, n+1) {
		cin >> v[i];
	}
	if (v[1] == 2) {
		cout << 1 << endl;
		return 0;
	}
	ll i = v[1];
	while (cnt<1e6)
	{
		cnt++;
		if (v[i] == 2) {
			cout << cnt << endl;
			return 0;
		}
		i = v[i];
	}
	
	cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] cc = new String[] {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
		int[][] k = new int[12][];
		k[0] = new int[31];
		k[1] = new int[29];
		k[2] = new int[31];
		k[3] = new int[30];
		k[4] = new int[31];
		k[5] = new int[30];
		k[6] = new int[31];
		k[7] = new int[31];
		k[8] = new int[30];
		k[9] = new int[31];
		k[10] = new int[30];
		k[11] = new int[31];
		int ck = 3;
		for(int i = 0; i < 12; i++) {
			for(int j = 0; j < k[i].length; j++) {
				k[i][j] = ck++;
				if(ck == 7) {
					ck = 0;
				}
			}
		}
		while(true) {
			int m = stdIn.nextInt();
			int d = stdIn.nextInt();
			if(m == 0 && d == 0) {
				break;
			}
			System.out.println(cc[k[m-1][d-1]]);
		}
		
	}
}

Measured memory_bytes: 17204
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

#define int ll

signed main()
{
    int N;
    cin >> N;
    int data[5];
    for (int i = 0; i < 5; i++)
    {
        cin >> data[i];
    }
    sort(data, data + 5);
    int ans = 5;
    if (N % data[0] == 0)
    {
        ans += N / data[0] - 1;
    }
    else
    {
        ans += N / data[0];
    }

    cout << ans << endl;
}

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

struct ac
{
    int s,c;
};
map<int,int>mp;
ac a[100];
int ans[4];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
          cin>>a[i].s>>a[i].c;
    }
    int flag=0;
    for(int i=1;i<=m;i++)
    {
            if(a[i].s==1&&a[i].c==0&&n!=1)
            {
                flag=1;
                break;
            }
            if(mp[a[i].s]==0)
            {
                ans[a[i].s]=a[i].c;
                mp[a[i].s]++;
            }
            else
            {
                if(ans[a[i].s]!=a[i].c)
                {
                    flag=1;
                    break;
                }
            }
    }

    if(flag)
        cout<<-1<<'\n';
    else
        {
            if(ans[1]==0&&n!=1&&m!=0&&mp[1]==1)
            {
                cout<<-1<<'\n';
            }
            else
            {
                if(ans[1]==0&&n==1)
                    {cout<<0<<'\n';
                    return 0;
                    }

                if(mp[1]==0&&n!=1)
                {
                    ans[1]=1;
                }
                for(int i=1;i<=n;i++)
                {
                    cout<<ans[i];
                }
                cout<<'\n';
            }

        }




}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cctype>
#define int long long
using namespace std;
int read()
{
    int X=0,w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    return w?-X:X;
}
int x,y;
signed main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    cin>>x>>y;
    if(x%y)cout<<x<<endl;
    else cout<<-1<<endl;
    return 0;
}



Measured memory_bytes: 256
from collections import deque
import math
n, d, a = map(int, input().split())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
data.sort()
dam = 0
ans = 0
q = deque()
for i in range(n):
    x,h = data[i]
    while q:
        k = q.popleft()
        if k[1] >= x:
            q.appendleft(k)
            break
        else:
            dam -= k[0]
    h -= dam
    h = max(h, 0)
    count = math.ceil(h / a)
    dam += count * a
    q.append([count * a, x + 2*d])
    ans += count
print(ans)

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

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    switch(n%10){
    case 0:
        cout<<"pon\n";
        break;
    case 1:
        cout<<"pon\n";
        break;
    case 2:
        cout<<"hon\n";
        break;
    case 3:
        cout<<"bon\n";
        break;
    case 4:
        cout<<"hon\n";
        break;
    case 5:
        cout<<"hon\n";
        break;
    case 6:
        cout<<"pon\n";
        break;
    case 7:
        cout<<"hon\n";
        break;
    case 8:
        cout<<"pon\n";
        break;
    case 9:
        cout<<"hon\n";
        break;
    
    default:
        break;
    }

    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        }
    }
}


Measured memory_bytes: 68560
// ABC 063 B Varied

#include <bits/stdc++.h>
using namespace std;

bool is_not_duplicate(string str) {
  for (int i = 1; i < (int)str.size(); i++) {
    for (int j = 0; j < i; j++) {
      if (str[i] == str[j]) return false;
    }
  }
  return true;
}

string solve(string str) {
  return is_not_duplicate(str) ? "yes" : "no";
}

int main() {
  string str;
  cin >> str;
  cout << solve(str) << endl;
  return 0;
}

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

using namespace std;

int n;
int c[505], s[505], f[505];
int main() {
  cin >> n;

  for(int i = 0; i < n - 1; i++) {
    cin >> c[i] >> s[i] >> f[i];
  }

  for(int i = 0; i < n - 1; i++) {
    int sum = c[i] + s[i];
    for(int j = i + 1; j < n - 1; j++) {
      if(sum < s[j]) {
	sum = s[j] + c[j];
	
	continue;
      }
      if(((sum - s[j]) % f[j]) != 0) {
       
	sum = s[j] + (f[j] * ((sum - s[j]) / f[j] + 1));
      }
      sum += c[j];
    }
    cout << sum << endl;
  }
  cout << "0" << endl;
}
      


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n, n) {
    int cnt[7] = {};
    for (int i = 0; i < n; i++) {
      int a;
      cin >> a;
      if (a >= 60) cnt[6]++;
      else cnt[a / 10]++;
    }
    for (int i = 0; i < 7; i++) {
      cout << cnt[i] << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3156
n=int(input())
l1=[]
l2=[]
for i in range(n):
    a,b=map(int,input().split())
    l1.append(a)
    l2.append(b)
l1.sort()
l2.sort()
if n%2==0:
    low=l1[n//2]+l1[n//2-1]
    high=l2[n//2]+l2[n//2-1]
    print(high-low+1)
else:
    low=l1[n//2]
    high=l2[n//2]
    print(high-low+1)

Measured memory_bytes: 25424
import java.util.*;

public class Main {
	
	/*
	 * default function
	 * */	
	int ni() {
		return cin.nextInt();
	}
	
	String nl() {
		return cin.nextLine();
	}
	
	void println(String str) {	
		System.out.println(str);
	}
	
	void print(String str) {
		System.out.print(str);
	}
	
	/*
	 * default variable
	 */
	
	static final int MOD = 1000000007;
	
	Scanner cin = new Scanner(System.in);	
	String  output;
	
	public static void main(String[] args) {			
		new Main().run();						
	}
	/* default above */
		
	public void run() {
			
		input();
		/* 
		 * start
		 */	
		
		long res = dfs(0, 0);
		/*
		 * finish
		 */
		
		output = res+"";
		println(output);
			
	}
	/* 
	 * define variable
	 */
	
	int N;
	long W;
	long[] weight;
	long[] value;
	
	Map<String, Long> map;
	
	void input() {
		
		N = ni();
		W = cin.nextLong();
		
		weight = new long[N];
		value  = new long[N];
		
		for (int i = 0; i < N; i ++) {
			weight[i] = cin.nextLong();
			value[i]  = cin.nextLong();
		}
		
		map = new HashMap<>();
	}
	
	long dfs(int i, long w) {
		
		
		String key = i +" " + w;
		
		long res = 0;
		
		if (i == N) {
			res = 0;
		}
		
		else if (map.containsKey(key)) {
			return map.get(key);
		}
				
		else if (w > W - weight[i]) {
			
			res = dfs(i + 1, w);
		} else {
			
			long r1 = dfs(i + 1, w);
			long r2 = dfs(i + 1, w + weight[i]) + value[i];
			
			res = Math.max(r1, r2);
		}
		
		map.put(key, res);
		return res;		
	}	
}


Measured memory_bytes: 55736
<?php
fscanf(STDIN, '%d', $N);
$info = array();
$subInfo = array();
for($i = 1; $i < $N; $i++) {
	fscanf(STDIN, "%d %d %d", $C, $S, $F);
	array_push($subInfo, $C);
	array_push($subInfo, $S);
	array_push($subInfo, $F);
	array_push($info, $subInfo);
	$subInfo = array();
}

$ans = array();
$bound = 0;
for($i = 1; $i < $N; $i++) {
	$midSum = 0;
	for($j = $bound; $j < ($N-1); $j++) {
		if ($midSum > $info[$j][1]) {
			if($midSum%$info[$j][2] === 0){
				$midSum += $info[$j][0];
			} else {
				$midSum = $midSum + ($info[$j][2] - $midSum%$info[$j][2]) + $info[$j][0];
			}
		} else if ($midSum === $info[$j][1]) {
			$midSum += $info[$j][0];
		} else {
			$midSum = $info[$j][1];
			$midSum += $info[$j][0];
		}
	}
	array_push($ans, $midSum);
	$bound++;
}

array_push($ans, 0);
foreach ($ans as $num) {
	echo $num.PHP_EOL;
}

Measured memory_bytes: 4728
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        N = cin.nextint;
        var H = new HashSet<int>();
        for (int i = 0; i < N; i++)
        {
            int d = cin.nextint;
            if (H.Contains(d))
            {
                H.Remove(d);
            }
            else
            {
                H.Add(d);
            }
        }
        WriteLine(H.Count);
    }

}

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

Measured memory_bytes: 17620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin >> a[i];
    }
    ll q;
    cin >> q;
    vector<ll>b(q);
    for(ll i=0;i<q;i++){
        cin >> b[i];
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    ll ans=0;
    for(ll i=0;i<q;i++){
        ll left=0,right=n;
        while(left<right){
            ll mid=(left+right)/2;
            if(b[i]==a[mid]){
                ans++;
                break;
            }
            if(b[i]>a[mid]){
                left=mid+1;
            }
            else{
                right=mid;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3816
n,m = map(int,input().split())
p = [0] * m
s = ["WA"] * m
result = [[] for _ in range(n)]
for i in range(m):
    p[i],s[i] = input().split()
    p[i] = int(p[i])
    result[p[i]-1].append(s[i])
#
def my_index(l,x,default=False):
    if x in l:
        return str(l.index(x))
    else:
        return default
#
ac = 0
penalty = 0
for j in range(len(result)):
    if my_index(result[j],"AC") != False:
        ac += 1
        penalty += int(my_index(result[j],"AC"))
print(ac,penalty)


Measured memory_bytes: 25088
def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

# 参考
# https://qiita.com/Euglenese/items/260f9ddf513f772d7e42
def examE():
    N = I()
    A = LI()
    n = len(A)
    dp = [[0,0]for _ in range(n)]
    for i,a in enumerate(A):
        dp[i][0] = a
    for j in range(N):
        for i,a in enumerate(A):
            if i&(1<<j)>0:
                dp[i] = sorted(dp[i&~(1<<j)]+dp[i],reverse=True)[:2]
    ans = 0
    for v in dp[1:]:
        ans = max(ans,sum(v))
        print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 237512
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(ll i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int d[1000][1000], cnt[1000][1000];
int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
bool used[1000][1000];
int main() {
	int h, w; scanf("%d%d", &h, &w);
	rep(i, h)rep(j, w)scanf("%d", &d[i][j]);
	stack<P>s;
	rep(i, h)rep(j, w) {
		bool ok = true;
		rep(k, 4) {
			int nx = i + dx[k], ny = j + dy[k];
			if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&d[nx][ny] < d[i][j]) {
				ok = false; break;
			}
		}
		if (!ok)continue;
		memset(used, 0, sizeof(used));
		s.push(P(i, j));
		while (!s.empty()) {
			int x = s.top().first, y = s.top().second; s.pop();
			if (used[x][y] || cnt[x][y] >= 2)continue;
			cnt[x][y]++; used[x][y] = true;
			rep(k, 4) {
				int nx = x + dx[k], ny = y + dy[k];
				if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&d[nx][ny]>d[x][y])s.push(P(nx, ny));
			}
		}
	}
	int ans = 0;
	rep(i, h)rep(j, w) {
		if (cnt[i][j] >= 2)ans++;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 18176
#include <stdio.h>
#include <string.h>

void reverse_array_int(int a[], int n)
{
    for (int i = 0; i < n / 2; i++) {
        int t = a[i];
        a[i] = a[n - 1 - i];
        a[n - 1 - i] = t;
    }
}

void reverse_array_char(char a[], int n)
{
    for (int i = 0; i < n / 2; i++) {
        char t = a[i];
        a[i] = a[n - 1 - i];
        a[n - 1 - i] = t;
    }
}

int main(void)
{
    char s[100001];
    scanf("%s", s);

    int s_len = strlen(s);
    int children_num[s_len];

    for (int i = 0; i < s_len; i++) {
        children_num[i] = 0;
    }

    for (int direction = 0; direction < 2; direction++) {
        int count = 0;
        for (int i = 0; i < s_len; i++) {
            if (s[i] == 'R') {
                count++;
            } else {
                children_num[i - 1] += (count + 1) / 2;
                children_num[i] += count / 2;
                count = 0;
            }
        }

        reverse_array_char(s, s_len);
        reverse_array_int(children_num, s_len);

        for (int i = 0; i < s_len; i++) {
            s[i] = (s[i] == 'R' ? 'L' : 'R');
        }
    }

    for (int i = 0; i < s_len; i++) {
        printf("%d ", children_num[i]);
    }
    putchar('\n');
    return 0;
}


Measured memory_bytes: 896
N=int(input())
W=[]
for i in range(N):
    w=input()
    W.append(w)
#print(W)
t=[]
t=set(W)
for i in range(N-1):
 if W[i][-1]!=W[i+1][0] or len(W)!=len(t):
        #W[i]の最後の文字とW[i+1]の最初の文字は同一か？
        print("No")
        exit(0)
 #elif W==W(set()):
 #入力される文字は重複していないか？
   #  print("No")
    # break
 
print("Yes")

 







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

int dp[200010][2],dp2[200010];
int cnt[200010];
const int mod=1e9+7;

int modPow(int x,int n)
{
    int res=1;
    while(n>0){
        if(n&1) res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

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

    string s,t; cin>>s>>t;
    int N=s.size();
    reverse(s.begin(),s.end());
    reverse(t.begin(),t.end());

    for(int i=0;i<N;i++){
        cnt[i+1]=cnt[i]+(t[i]=='?');
    }

    dp[N][0]=1;
    for(int i=N-1;i>=0;i--){
        if(t[i]=='?'){
            dp[i][1]=dp[i+1][1]*10%mod+dp[i+1][0]*(s[i]-'0')%mod;
            dp[i][1]%=mod;
            dp[i][0]=dp[i+1][0];
        }else{
            dp[i][1]=dp[i+1][1]+(t[i]<s[i]? dp[i+1][0]:0);
            dp[i][1]%=mod;
            dp[i][0]=(t[i]==s[i]? dp[i+1][0]:0);
        }
    }

    dp2[0]=1;
    for(int i=0;i<N;i++){
        if(t[i]=='?'){
            dp2[i+1]=dp2[i]+(s[i]-'0')*modPow(10,cnt[i])%mod;
            dp2[i+1]%=mod;
        }else{
            if(t[i]<s[i]) dp2[i+1]=modPow(10,cnt[i]);
            else if(t[i]==s[i]) dp2[i+1]=dp2[i];
            else dp2[i+1]=0;
        }
    }

    int sum=0;
    for(int i=0;i<N;i++){
        for(int d=0;d<10;d++){
            if(t[i]!='?' and t[i]-'0'!=d) continue;
            int k;
            if(d<s[i]-'0'){
                k=(dp[i+1][0]+dp[i+1][1])*modPow(10,cnt[i])%mod;
            }else if(d==s[i]-'0'){
                k=dp[i+1][1]*modPow(10,cnt[i])%mod+dp[i+1][0]*dp2[i];
                k%=mod;
            }else{
                k=dp[i+1][1]*modPow(10,cnt[i])%mod;
            }
            k=k*d%mod*modPow(10,i)%mod;
            sum=(sum+k)%mod;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 9740
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define mp make_pair 
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define rrep(i,a,b) for(int i = a; i >=b; i--)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
#define all(x) (x).begin(),(x).end()
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_set;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using ii = pair<int, int>;
using pli = pair<ll, int>;
using vi = vector<int>;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using pil = pair<int,ll>;
using vvi = vector<vi>;
using vpi = vector<ii>;

const int N = 100100;
ll mod=1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,0,n-1){
        cin>>a[i];
    }
    sort(a.rbegin(),a.rend());
    ll sum = 0, i = 0, R = n -1;
    for(int i = 0; i < n; i++){
        ll curr = min(R,((i)?2ll:1ll));
        sum+=a[i]*curr;
        R-=curr;
    }
    cout<<sum<<nl;
    return 0;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
#define f(x,y,z) for(long long int x = y ; x < z ; x++)
#define inf 999999999999999
using namespace std;
long long int n ,x,arr[100000],arr2[100000];
int main() 
{
    cin >> n >> x;
    f(i,0,n)
        cin >> arr[i],arr2[i]=arr[i];
    long long int ans = inf;
    f(i,0,n)
    {
        long long int fkans = i*x;
        f(j,0,n)
        {
            long long int fark = (j+n-i)%n;
            arr2[j] = min(arr2[j],arr[fark]);
            fkans += arr2[j];
        }
        ans = min(ans,fkans);
    
    }
    
    cout << ans;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 10005
#define ll long long
int a[N],n,pri[N*20],tot,vis[N];ll sum=0;
void get_pri(int x)
{
	for(int i=2;i<=x/i;i++)
	{
		if(x%i==0)
		{
			pri[++tot]=i;
			while(x%i==0)x/=i;
		}
	}if(x!=1)pri[++tot]=x;
}
int q_pow(int x,int n,int mod){int ret=1;for(;n;n>>=1,x=(ll)x*x%mod)if(n&1)ret=(ll)ret*x%mod;return ret;}
int main()
{
	scanf("%d",&n);
	for(int i=2;i<=n;i++)if(!vis[i])for(int j=i+i;j<=n;j+=i)vis[j]=1;
	for(int i=2;i<=n;i++)if(!vis[i])pri[++tot]=i;
	for(int i=n;~i;i--)scanf("%d",&a[i]),get_pri(abs(a[i]));
	sort(pri+1,pri+tot+1);tot=unique(pri,pri+tot+1)-pri-1;
	for(int k=1;k<=tot;k++)if(a[0]%pri[k]==0)
	{
		bool flag=1;int mod=pri[k];
		for(int i=2;i<=20;i++)
		{
			int ret=0,now=i;
			for(int j=1;j<=n;j++)ret=(ret+(ll)now*a[j])%mod,now=(ll)now*i%mod;
			if(ret!=0){flag=0;break;}
		}
		if(flag)printf("%d\n",pri[k]);
	}
}

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

const int MAX_N = (int)1e5 + 5;

int n;
int p[MAX_N];

int whole;

int main(void) {
  // Here your code !
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &p[i]);
  p[n + 1] = n + 2;

  int tmp = 0;
  for (int i = 1; i <= n + 1; ++i) {
    if (p[i] == i) {
      tmp++;
    }
    else {
      whole += (tmp / 2) + (tmp % 2);
      tmp = 0;
    }
  }
  printf("%d\n", whole);

  return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
// Powered by caide (code generator, tester, and library code inliner)
class Solution {
public:
    void solve(std::istream& in, std::ostream& out) {
        int a, b;
        in >> a >> b;
        bool odd = (a * b) % 2 == 1;
        out << (odd ? "Odd" : "Even") << endl;
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{ long long  a,b,c,d;
   cin>> a >> b >> c >> d;


 long long x;
 x=max(max(a*c,a*d),max(b*c,b*d));
cout<< x <<endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
int main(){
    int H1, M1, H2, M2, ans, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int wakeup, sleep;
    wakeup = 60 * H1 + M1;
    sleep = 60 * H2 + M2;
    ans = sleep - wakeup - K;
    if(ans >= 0){
        cout << ans;
    } 
    else{
        cout << 0 ;
    }
    return 0;
}

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

int main() {
  int a,b,c,e,f,g;
  g=0;
  cin>>a>>b>>c;
  for(int i=0;i<a;i++){
    cin>>e>>f;
    if(e>=b&&f>=c){
      g++;
    }
  }
  cout<<g<<endl;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A+B > C+D){
    cout << "Left" <<endl;
  }
  else if(A+B == C+D){
    cout << "Balanced" <<endl;
  }
  else{
    cout << "Right" <<endl;
  };
}


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

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


	int A, B;
	cin >> A >> B;

	int kotae = 0;
	kotae = (B - 1 + A - 2) / (A - 1);

	co(kotae);

	Would you please return 0;
}

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

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

int eval(int x) {
	int ret=0;
	while(1) {
		if(x%2) return ret;
		x/=2; ret++;
	}
	return -1;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int ret=0, n, a; cin>>n;
	for (int i=0; i<n; i++)
		cin>>a, ret+=eval(a);
	cout << ret << endl;
	return 0;
}


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

int main()
{
    string a, b;
    cin >> a >> b;
    int l1 = a.size();
    int l2 = b.size();
    string ans = "UNRESTORABLE";
    for(int i = l1 - l2; i >= 0; --i)
    {
        bool f = true;
        for(int j = 0; j < l2; ++j)
        if(a[i + j] != b[j] && a[i + j] != '?')
        {
            f = false;
            break;
        }
        if(f)
        {
            ans = a;
            for(int j = 0; j < l2; ++j)
                ans[i + j] = b[j];
            for(int j = 0; j < l1; ++j)
            if(ans[j] == '?')
                ans[j] = 'a';
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int t,sum=0,a,b;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>a>>b;
        sum=b-a+1+sum;
    }
    cout<<sum<<endl;

    return 0;
}


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

isAC = [0] * (N+1)
isWA = [0] * (N+1)

ACnum = 0
WAnum = 0

for _ in range(M):
    p, s = input().split()
    p = int(p)

    if isAC[p] == 1: continue
    if s == 'AC':
        isAC[p] = 1
        ACnum += 1
        WAnum += isWA[p]
    elif s == 'WA':
        isWA[p] += 1

print("%d %d"%(ACnum, WAnum))

Measured memory_bytes: 51288
use std::collections::HashMap;

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().ok().unwrap();
    let bosses = read_vec::<u32>();
    let mut dic: HashMap<u32, u32> = HashMap::new();
    for i in 1..n+1 {
        dic.insert(i as u32, 0);
    }
    for boss in bosses {
        dic.insert(boss, dic[&boss] + 1);
    }
    for i in 1..n+1 {
        println!("{}", dic[&(i as u32)]);
    }
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 7452
#include <bits/stdc++.h>
#include <stdio.h>
#include <ios>     
#include <iomanip> 

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
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; }

//互除法
ll GCD(ll a, ll b){
  return b ? GCD(b,a%b) : a;
}

ll LCM(ll a, ll b){
  return (a / GCD(a,b))*b;
}

//素因数分解
pair<map<ll,ll>,bool> PrimeFactorization(ll N){
  pair<map<ll,ll>,bool> ret;//<素因数分解,素数判定>
  ret.second = true;
  
  //素因数分解
  if(N != 2){
    while(N%2 == 0){//p=2の時。
      N /= 2;
      ret.first[2] ++;
      ret.second = false;
    }
  }
  for(ll i=3; i*i<=N; i+=2){//p>=3の時。
    while(N%i == 0){
      N /= i; 
      ret.first[i] ++;
      ret.second = false;
    }
  }
  if(N != 1){//Nが素数の時
    ret.first[N] ++;
  }
  
  //返り値
  return ret;
}


int main()
{
  //方針
  //bitDP
  
  //input
  int N, M;
  cin >> N >> M;
  vector<int> a(M),b(M),c(M,0); //vector[0~M-1]にbit集合が格納される。
  
  for(int i=0; i<M; i++){
    cin >> a[i] >> b[i];
    for(int j=0; j<b[i]; j++){//inputでビット集合として表現した方が、vectorにpbするよりも実装が楽。
      int d; cin >> d; d --;
      c[i] += (1<<d);
    }
  }
  
  //main
  int INF = 1e9;
  int status = (int)pow(2.0, (double)N);
  vector<vector<int>> dp(M+10,vector<int>(status+10,INF));
  dp[0][0] = 0;
  //dp[i][j]→i番目の鍵まで使って宝箱の状態をjにするときの最小コスト
  
  //output
  for(int i=0; i<M; i++){
    for(int j=0; j<(1<<N); j++){
       chmin(dp[i+1][j], dp[i][j]);//i+1番目の鍵を使わない
       int nj = j|c[i];
       chmin(dp[i+1][nj], dp[i][j]+a[i]);//i+1番目の鍵を使う
    }
  }
  
  cout << (dp[M][(1<<N)-1] < INF ? dp[M][(1<<N)-1] : -1) << endl;
    
  return 0;
}

Measured memory_bytes: 16512
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(c) c.begin(),c.end()

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  vector<vector<pair<int, int>>> v(N + 1);
  REP(i, M) {
    int P, Y;
    cin >> P >> Y;
    v[P].PB(MP(Y, i));
  }

  vector<pair<int, int>> v2(M);
  for (int i = 1; i <= N; i++) {
    if (! v[i].empty()) {
      sort(ALL(v[i]));
      REP(j, v[i].size()) {
        v2[v[i][j].SE] = MP(i, j + 1);
      }
    }
  }
  REP(i, M) {
    cout << setfill('0') << setw(6) << v2[i].FI 
         << setfill('0') << setw(6) << v2[i].SE << endl;
  }
  return 0;
}

Measured memory_bytes: 7808
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <vector>
using namespace std;
#define FOR(__I,__N) for (int __I = 0; __I < __N; ++__I)

typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64, int64> pll;
typedef double db;
typedef long double ldb;

const int INF = 0x3f3f3f3f;
const int64 INF64 = 0x3f3f3f3f3f3f3f3fLL;

const int MOD = 1000000007;

int64 gcd(int64 a,int64 b){
	if(b == 0)	return a;
	return gcd(b,a%b);
}

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


    int ans = 360/gcd(360,X);
    printf("%d\n",ans);
}





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

const int MAXN = 500010;
const int mod = 998244353;
typedef long long LL;
int mul(int a, int b) { return (LL) a * b % mod; }
void reduce(int & x) { x += x >> 31 & mod; }
int fastpow(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}

int fac[MAXN], inv[MAXN];
int C(int a, int b) { return b > a ? 0 : (LL) fac[a] * inv[b] % mod * inv[a - b] % mod; }
int main() {
	fac[0] = fac[1] = inv[0] = inv[1] = 1;
	for (int i = 2; i != MAXN; ++i) {
		fac[i] = mul(fac[i - 1], i);
		inv[i] = mul(inv[mod % i], mod - mod / i);
	}
	for (int i = 2; i != MAXN; ++i)
		inv[i] = mul(inv[i], inv[i - 1]);
	int n, m;
	std::cin >> n >> m;
	int ans = 0;
	for (int i = std::min(n, m); ~i; --i)
		reduce(ans += (LL) fastpow(n + 1, m - i) * fastpow(m + 1, n - i) % mod * (i & 1 ? mod - 1 : 1) % mod * C(n, i) % mod * C(m, i) % mod * fac[i] % mod - mod);
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 4096
N = int(input())
a = list(map(int, input().split()))
sum = 0

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
        
def lcm(x, y):
    return (x * y) // gcd(x, y)
    
x = a[0]
for i in range(N-1):
    x = lcm(x, a[i+1])

for i in range(N):
    sum += (x - 1) % a[i]

print(sum)


Measured memory_bytes: 3316
use std::collections::HashMap;
use std::num;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: [usize; n],
    }
    if a.iter().any(|n| n % 2 != 0) {
        println!("first");
    } else {
        println!("second");
    }
}


Measured memory_bytes: 6396