akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;
using namespace std;

int main() {
    ll a, b, c, d, result;
    cin >> a >> b >> c >> d;
    ll ac = a * c;
    ll ad = a * d;
    ll bc = b * c;
    ll bd = b * d;
    vector<ll> vec = { ac,ad,bc,bd };
    sort(vec.begin(), vec.end());
    cout << vec.at(3) << endl;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (size_t i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (size_t i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define INF 1e7

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

  /*REP(i,s.size()-1) {
    FOR(j,i+2,s.size()) {
      string ss = s.substr(i,j-i+1);
      vector<int> v(26, 0);
      REP(i,ss.size()) {
        v[(int)(ss[i]-'a')]++;
      }

      if(*max_element(v.begin(), v.end()) > ss.size()/2 && ss.size() >= 2){
        cout<<i+1<<" "<<j+1<<endl;
        return 0;
      }
    }
  }*/

  if (s.size()==2 && s[0]==s[1]) {
    cout<<1<<" "<<2<<endl;
    return 0;
  }

  REP(i,s.size()-2) {
    char a = s[i], b = s[i+1], c = s[i+2];
    if (a==b || b==c || c==a) {
      cout<<i+1<<" "<<i+3<<endl;
      return 0;
    }
  }

  cout<<-1<<" "<<-1<<endl;

  return 0;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long L){
    double x = L / 3.0;
    printf("%.7f\n", x * x * x);
}

int main(){
    long long L;
    scanf("%lld",&L);
    solve(L);
    return 0;
}


Measured memory_bytes: 256
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

res = -float("inf")
for i in range(2**N):
  X = 0
  Y = 0
  for j in range(N):
    if (i>>j)&1 == 1:
      X += V[j]
      Y += C[j]
  res = max(res, X-Y)
  
print(res)

Measured memory_bytes: 73608
//
// Created by kashi on 26-05-2020.
//
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define Endl endl

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int maxsum=0;
    maxsum+=min(a,k)*1;
    k=k-min(a,k);
    k=k-min(b,k);
    maxsum+=min(c,k)*-1;
    cout<<maxsum<<endl;
    return 0;
}

Measured memory_bytes: 3592
divide = ['dreamer', 'dream', 'eraser', 'erase'].map(&:reverse)
str = gets.chomp.reverse
can = true
i = 0
while i < str.size
  can2 = false
  
  divide.each do |d|
    if str.slice(i, d.size) == d
      can2 = true
      i += d.size
    end
  end
  
  if !can2
    can = false
    break
  end
end

if can
  puts "YES"
else
  puts "NO"
end

Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());
const long long INF = 1LL << 60;
// map<int,int> mp;

int main() {
  string S, T;
  cin >> S >> T;
  ll ans = 0;
  for (ll i = 0; i < S.size(); i++) {
    if (S[i] != T[i]) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3916
#include <stdio.h>
int main(void){
    int S,b,h,m,e,s;
    b=3600;
    e=60;
    scanf("%d\n",&S);
    h=S/b;
    m=(S/e)%e;
    s=S%e;
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;
    
    
}



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

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

		int suretu_kazu=0;
		int[] suretu;
		int bubun_nokazu=0;
		int[] bubun;
		String moji="";
		String[] srt;
		String[] bbn;
		int gacchi=0;

		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));

		try {
			moji=bfr.readLine();
			suretu_kazu=Integer.parseInt(moji);
			moji=bfr.readLine();
			srt=moji.split(" ");
			suretu=new int[suretu_kazu];
			for(int i=0; i<suretu_kazu; i++) {
				suretu[i]=Integer.parseInt(srt[i]);
			}
			moji=bfr.readLine();
			bubun_nokazu=Integer.parseInt(moji);
			moji=bfr.readLine();
			bbn=moji.split(" ");
			bubun=new int[bubun_nokazu];
			for(int i=0; i<bubun_nokazu; i++) {
				bubun[i]=Integer.parseInt(bbn[i]);
			}

			int hidari=0;
			int migi=suretu_kazu;
			int mid=0;

			for(int i=0; i<bubun_nokazu; i++) {
				hidari=0;
				migi=suretu_kazu;
				mid=0;
				while(hidari<migi) {
					mid=(hidari+migi)/2;
					if(suretu[mid]==bubun[i]) {		//探したい値と探す配列のまん中の数字と一致した時合致
						gacchi++;
						break;
					}
					else if(bubun[i]<suretu[mid]) {		//真ん中の数字と探したい数字の大小　真ん中のほうが大きいときは　右（MAX）が真ん中
						migi=mid;
					}
					else {				//中央が探すものより小さい時、一番左を大きくする。
						hidari=mid+1;
					}
				}
			}
			System.out.println(gacchi);
		}catch(IOException e) {

		}
	}
}


Measured memory_bytes: 51716
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  string S;
  cin >> S;
  string keyence = "keyence";

  long foo = -1;
  long bar = -1;

  while (true) {
    if (foo > 6) break;
    if (S[foo+1] == keyence[foo+1]) foo++;
    else break;
  }

  while (true) {
    if (bar > 6) break;
    if (S[S.size() - 1 - (bar+1)] == keyence[keyence.size() - 1 - (bar+1)]) bar++;
    else break;
  }

  foo++;
  bar++;

  if (foo + bar >= 7) puts("YES"); else puts("NO");
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n,out int
	var s string
	fmt.Scanf("%d",&n)
	fmt.Scanf("%s",&s)
	out = 1
	for i:=1;i<n;i++{
		if s[i-1:i] != s[i:i+1]{
			out++
		}
	}
	fmt.Println(out)
}


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

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

    char a,b,c;

    cin>>a>>b>>c;

    if(a=='7' || c=='7' || b=='7'){
        cout<<"Yes";
    }
    else cout<<"No";

    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  int K;
  cin>>K;
  char ans = '1';
  for(int i=0;i<K;++i) {
    if(S[i]!='1') {
      ans = S[i];
      break;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3604
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }

        
         public static long gcd(long x, long y)
        {
            if (x < y) gcd(y, x);
            while (y != 0)
            {
                var z = x;
                x = y;
                y = z % y;
            }
            return x;
        }

        public static long lcm(long x, long y)
        {
            return x * y / gcd(x, y);
        } 

        public static long C(long n, long k)
        {
            long x = 1;
            for (long i = 1; i <= k; i++)
            {
                x *= n - i + 1;
                x /= i;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var q = Reads();
            var n = q[0];
            var m = q[1];
            var s = ReadLine().ToArray();
            var t = ReadLine().ToArray();
            var l = lcm(n, m);
            var x = l / n; 
            var y = l / m;
            var r = x*y;
            var f = true;
            for (long i = 0; i / x < n && i / y < m; i += r)
            {
                if (s[i / x] != t[i / y]) f = false;
            }
            WriteLine(f?l:-1);
           

            Console.Out.Flush();
        }
    }
}


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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        double A, B;
        cin >>A >>B;
        int H, M;
        cin >>H >>M;
        double TH1=30.0*H+30.0*M/60;
        double TH2=6.0*M;
        TH1 *=M_PI/180.0;
        TH2 *=M_PI/180.0;
        double x1=A*sin(TH1);
        double y1=A*cos(TH1);
        double x2=B*sin(TH2);
        double y2=B*cos(TH2);
        double L=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
        cout <<fixed <<setprecision(10) <<L <<endl;
        return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int N;
    cin >> N;
    map<long long,long long> ma;
    ma[0]++;
    long long sum = 0;
    rep(i,N){
        int a;
        cin >> a;
        sum += a;
        ma[sum]++;
    }
    long long res = 0;
    for(auto itr = ma.begin();itr != ma.end();itr++){
        long long n = itr->second;
        res += n * (n-1) / 2;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<pair<double, double>> p(n);
  rep(i, n) {
    double x, y;
    cin >> x >> y;
    p[i] = make_pair(x, y);
  }
  double sum = 0;
  rep(i, n) for (int j = i + 1; j < n; j++) {
    sum += sqrt((p[i].first - p[j].first) * (p[i].first - p[j].first) +
                (p[i].second - p[j].second) * (p[i].second - p[j].second));
  }
  cout << setprecision(12) << sum * 2 / n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	int a, p;

	cin >> a >> p;	
	cout << (3 * a + p) / 2 << endl;

	return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    vector<int> p(a),q(b),r(c);
    rep(i,a) cin>>p[i];
    rep(i,b) cin>>q[i];
    rep(i,c) cin>>r[i];
    sort(p.begin(), p.end(), greater<int>());
    sort(q.begin(), q.end(), greater<int>());
    sort(r.begin(), r.end(), greater<int>());

    priority_queue<int, vector<int>, greater<int>> pq;
    ll sum = 0;
    rep(i, x){
        sum+=p[i];
        pq.push(p[i]);
    }
    rep(i, y){
        sum+=q[i];
        pq.push(q[i]);
    }
    // cout<<pq.top()<<endl;
    // while(!pq.empty()){
    //     cout<<pq.top()<<endl;
    //     pq.pop();
    // }
    for(int i=0;i<c;i++){
        if(pq.top() < r[i]){
            sum = sum-pq.top()+r[i];
            pq.pop();
            pq.push(r[i]);
        }
    }
    cout<<sum<<endl;
}

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

using namespace std;
using ll=long long;

int main(){
    int n,k;
    cin>>n>>k;
    string ans="";
    while(n>0){
        ans.push_back('0'+n%k);
        n/=k;
    }
    reverse(ans.rbegin(),ans.rend());
    cout<<ans.size()<<endl;
    return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t n; cin>>n;
	vector<int64_t>a(5);
	for(auto&i:a)cin>>i;
	sort(a.begin(),a.end());
	int64_t ans=n/a.front()+4;
	if(n%a.front())++ans;
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
S = input()
counter = 0
for i in range(1, len(S)):
    previous_color = S[i - 1]
    checking_color = S[i]
    if previous_color == checking_color:
        counter += 1
        if previous_color == '0':
            S = S[:i] + '1' + S[i + 1:]
        else:
            S = S[:i] + '0' + S[i + 1:]
print(min(counter, abs(len(S) - counter)))


Measured memory_bytes: 10452
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int k = Integer.parseInt(in.next());
            Integer p[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                p[i] = Integer.parseInt(in.next());
                p[i]++;
            }

            long s[] = new long[n + 1];
            for (int i = 0; i < n; i++) {
                s[i + 1] = s[i] + p[i];
            }

            long ans = 0;
            for (int i = 0; i + k <= n; i++) {
                ans = Math.max(s[i + k] - s[i], ans);
            }


            // 出力
            out.println(String.format("%.12f", (double) ans / 2));

        }

    }
}



Measured memory_bytes: 64420
n = int(input())
P = list(map(int, input().split()))

P = [p-1 for p in P]
ans = 0
for i in range(n):
    if P[i] == i:
        if i != n-1:
            ans += 1
            P[i+1] = P[i]
        else:
            ans += 1
print(ans)


Measured memory_bytes: 14008
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int dh[2] = {0, 1};
int dw[2] = {1, 0};

int main() {
    int H, W; cin >> H >> W;
    vector<string> S(H);
    REP(i, 0, H) cin >> S[i];

    vector<vector<int>> dp(H, vector<int>(W, 1 << 28));
    if (S[0][0] == '.') dp[0][0] = 0;
    else dp[0][0] = 1;

    REP(i, 0, H) {
        REP(j, 0, W) {
            REP(k, 0, 2) {
                int nh = i + dh[k];
                int nw = j + dw[k];
                if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
                dp[nh][nw] = min(dp[nh][nw], dp[i][j] + (S[i][j] == '.' && S[nh][nw] == '#'));
            }
        }
    }

    cout << dp[H - 1][W - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def kaibun(s):
    l=len(s)
    for i in range(l//2):
        if s[i]!=s[-1*(i+1)]:
            return False
    return True

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    ss=readline().rstrip()
    #yn(1)
    n=len(ss)
    yn(kaibun(ss) and kaibun(ss[0:(n-1)//2]) and kaibun(ss[(n+3)//2-1:n]))

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 5692
# coding: utf-8

def North(dice):
	new_dice = [0,0,0,0,0,0]
	new_dice[0] = dice[3]
	new_dice[1] = dice[0]
	new_dice[2] = dice[2]
	new_dice[3] = dice[5]
	new_dice[4] = dice[4]
	new_dice[5] = dice[1]
	return new_dice

def East(dice):
	new_dice = [0,0,0,0,0,0]
	new_dice[0] = dice[4]
	new_dice[1] = dice[1]
	new_dice[2] = dice[0]
	new_dice[3] = dice[3]
	new_dice[4] = dice[5]
	new_dice[5] = dice[2]
	return new_dice

def West(dice):
	new_dice = [0,0,0,0,0,0]
	new_dice[0] = dice[2] #3
	new_dice[1] = dice[1] #5
	new_dice[2] = dice[5] #6
	new_dice[3] = dice[3] #2
	new_dice[4] = dice[0] #1
	new_dice[5] = dice[4] #4
	return new_dice

def South(dice):
	new_dice = [0,0,0,0,0,0]
	new_dice[0] = dice[1] #5
	new_dice[1] = dice[5] #6
	new_dice[2] = dice[2] #3
	new_dice[3] = dice[0] #1
	new_dice[4] = dice[4] #4
	new_dice[5] = dice[3] #2
	return new_dice

def Right(dice):
	new_dice = [0,0,0,0,0,0]
	new_dice[0] = dice[0] #1
	new_dice[1] = dice[4] #4
	new_dice[2] = dice[1] #5
	new_dice[3] = dice[2] #3
	new_dice[4] = dice[3] #2
	new_dice[5] = dice[5] #6
	return new_dice

def Left(dice):
	new_dice = [0,0,0,0,0,0]
	new_dice[0] = dice[0] #1
	new_dice[1] = dice[2] #3
	new_dice[2] = dice[3] #2
	new_dice[3] = dice[4] #4
	new_dice[4] = dice[1] #5
	new_dice[5] = dice[5] #6
	return new_dice

while True:
	n = int(raw_input())
	if n == 0:
		break
	dice = [1,5,3,2,4,6] # ??? ??? ??± ??? ?\? ??? ??????
	sum = 1
	for i in range(n):
		instruct = raw_input()
		if instruct[0] == "N":
			dice = North(dice)
		elif instruct[0] == "E":
			dice = East(dice)
		elif instruct[0] == "S":
			dice = South(dice)
		elif instruct[0] == "W":
			dice = West(dice)
		elif instruct[0] == "R":
			dice = Right(dice)
		elif instruct[0] == "L":
			dice = Left(dice)
		#print("** {:} **".format(dice[0]))
		sum += dice[0]
	print(sum)

Measured memory_bytes: 4792
#include <bits/stdc++.h>
#define sz(x) (int)((x).size())
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define FOR(i, a, n, step) for (int (i) = (a); (i) < (int)(n); (i) += (step))
#define ROF(i, a, n, step) for (int (i) = (a); (i) >= (int)(n); (i) -= (step))
#define FOREACH(it, v) for (auto (it) : (v))

using namespace std;

typedef unsigned long long ull;
typedef long long ll ;
typedef long double ld;
typedef pair <int, int> pii;

template <class T>
const bool is_impar(const T &x) {return (bool) (x & 1);}

int R;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> R;
    if (R < 1200)
        cout << "ABC";
    else if (R < 2800)
        cout << "ARC";
    else cout << "AGC";
}


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

int main(){
    ll a, b;
    cin >> a >> b;
    if(a <= 8 && b <= 8) cout << "Yay!" << endl;
    else cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
int main(void){
    char s[110], p[110], s_cp[220];
    
    scanf("%s", &s);
    scanf("%s", &p);
    
    strcpy(s_cp, s);    //文字列sをs_cpにコピー
    strcat(s_cp, s);    //s_cpの後ろに文字列sを追加
    
    if(strstr(s_cp, p) != NULL) printf("Yes\n");    //文字列s_cpの中から文字列pを探しアドレスを（見つからなければNULLを）返す。
    else printf("No\n");
    
    return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll mod = 1000000007;
const int N = 100005;
ll f[N];
int mu[N], lpf[N];

inline ll modPow(ll a, ll b){
	ll ret = 1;
	while(b){
		if(b&1)(ret *= a) %= mod;
		(a *= a) %= mod;
		b >>= 1;
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, k;
	cin>>n>>k;
	memset(f, 0, sizeof(f));
	memset(lpf, -1, sizeof(lpf));
	for(int i = 1; i <= k; i++){
		f[i] = modPow(k/i, n);
	}
	mu[1] = 1;
	for(int i = 2; i <= k; i++){
		if(lpf[i] == -1){
			for(int j = i; j <= k; j += i){
				if(lpf[j] == -1)lpf[j] = i;
			}
		}
		int x = i/lpf[i];
		if(x%lpf[i] == 0)mu[i] = 0;
		else mu[i] = -mu[x];
	}
	// cout<<"HEY"<<endl;
	ll ans = 0;
	for(int i = 1; i <= k; i++){
		ll cnt = 0;
		for(int j = i; j <= k; j += i){
			if(mu[j/i] == 1)cnt += f[j];
			else if(mu[j/i] == -1)cnt += mod - f[j];
		}
		cnt %= mod;
		ans += cnt*i%mod;
	}
	ans %= mod;
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 5228
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define V vector<int>
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))




signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, t; cin >> n >> t;
	V a(n); rep(i, n)cin >> a[i];
	V dp(n); rep(i, n)dp[i] = INF;
	dp[0] = a[0];
	rep(i, n) {
		if (i == 0)continue;
		dp[i] = min(dp[i - 1], a[i]);
	}
	V b(n); rep(i, n)b[i] = a[i] - dp[i];
	int maxb = 0;
	rep(i, n)chmax(maxb, b[i]);
	int ans = 0;
	rep(i, n) {
		if (maxb == b[i])ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	char S[120];
	scanf("%s", &S);
	getchar();
	
	S[0] = '2';
	S[1] = '0';	
	S[2] = '1';
	S[3] = '8';
	
	printf("%s", S);
	return 0;
}

Measured memory_bytes: 1700
#include<bits/stdc++.h>
using namespace std;
#define int long long 
int32_t main(){
  int n;
  cin>>n;
 int arr[2*n];
  for(int i=0;i<2*n;++i)
    cin>>arr[i];
  sort(arr,arr+2*n);
  int ans=0;
  for(int i=2*n-1;i>0;i-=2)
    ans+=min(arr[i],arr[i-1]);
  cout<<ans;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int n,m;
	scanf("%d%d",&n,&m);
	int ans = 0;
	while(m--)
	{
		int a;
		scanf("%d",&a);
		ans += a;
	}	
	printf("%d\n",n-ans>=0?n-ans:-1);
	return 0;
}

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

#define el '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back

typedef long long ll;
vector<int> sw[10];

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

  int n, m;
  cin >> n >> m;
  ll ans = 0;
  for(int i = 1; i <= m; i++){
    int x;
    cin >> x;
    while(x--){
      int v;
      cin >> v;
      sw[i].pb(v);
    }
  }
  vector<int> p(m+1);
  for(int i = 1; i <= m; i++){
    cin >> p[i];
  }

  bool on[n+1];
  memset(on,0,sizeof(on));
  for(int i = 0; i < (1<<n); i++){
    memset(on,0,sizeof(on));
    int k = 0;
    while((1<<k) <= i){
      if((1<<k)&i){
        on[k+1] = 1;
      }
      k++;
    }
    bool ok = true;
    for(int l = 1; l <= m; l++){
      int cek = 0;
      for(int x: sw[l]){
        if(on[x]){
          cek++;
        }
      }
      if(cek%2 != p[l]){
        ok = false;
        break;
      }
    }
    if(ok) ans++;
  }
  cout << ans << el;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <cmath>
#include <bitset>
#include <deque>
#include <queue>
#define INF (1LL<<31)
#define fst first
#define snd second
typedef long long ll;
typedef std::pair<int,int> ii;
using namespace std;

int main(){
  ll k,d,r;
  ll ans[50];
  for(int i=0;i<50;i++){
    ans[i]=49-i;
  }
  cin>>k;
  d=k/50LL;
  r=k%50LL;
  for(int i=0;i<50;i++){
    ans[i]+=d+((i<r)?1:0);
  }
  cout<<50<<endl;
  for(int i=0;i<50;i++){
    if(i!=0)cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 764
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  ll n;
  cin >> n;
  
  vector<ll> p(n);
  ll ans = 0;
  
  rep(i,n){
  cin >> p[i]; 
    ll cnt = 0;
    rep(j,50){
      if(p[i]%2==0) {
      p[i]/=2;
      cnt++;
      }
      else break;
    }
    ans+=cnt;
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using ld = long double;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

// 最大公約数
ll gcd(ll a, ll b)
{
    if(a%b == 0){
        return(b);
    }
    else{
        return(gcd(b, a%b));
    }
}

int main(void)
{
    ll N, K, i, A[100001], max=0, gc;

    cin >> N >> K;
    
    for(i=1; i<=N; i++){
        cin >> A[i];

        chmax(max,A[i]);

        if(i==1) gc = A[1];
        else gc = gcd(gc,A[i]);
    }

    if(K%gc==0 && K<=max){
        cout << "POSSIBLE" << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

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

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

  int N;
  cin>>N;
  vector<int> a(N);
  int answer=0;
  rep(i,N){
    cin>>a[i];
    if(a[i]%2==0){
      if(a[i]%3!=0&&a[i]%5!=0)
        answer=1;
    }
  }
  if(answer==0)
    cout<<"APPROVED";
  else
    cout<<"DENIED";
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <string>     // std::string, std::to_string


int main(){

    int long x,y;

    cin>>x>>y;
    string find = "No";
    for(int i = 0; i<=x;i++){
        if(i*2+4*(x-i)==y){
            find = "Yes";
        }
    }
    cout<<find;

}


Measured memory_bytes: 3124
k, n = map(int, input().split())
x = [int(x) for x in input().split()]
arr = []

arr.append(x[0]+abs(x[len(x)-1]-k))

for i in range(len(x)-1):
    arr.append(x[i+1]-x[i])


print(sum(arr) - max(arr))


Measured memory_bytes: 26436
// https://atcoder.jp/contests/abc143/tasks/abc143_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, sum = 0;
    cin >> n;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    REP(i, n) FOR(j, i + 1, n) { sum += v[i] * v[j]; }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define re(i,n) for(i=0;i<n;i++)
#define bre(i,n) for(i=n;i>0;i--)
#define rep(i,l,r) for(i=l;i<r;i++)
#define brep(i,l,r) for(i=r;i>l;i--)
const int inf=1145141919810893;
const int mod=1000000007;
using namespace std;
template<class T>bool chmin(T &a,const T &b){
	if(a>b){
		a=b;
		return true;
	}
	return false;
}
template<class T>bool chmax(T &a,const T &b){
	if(a<b){
		a=b;
		return true;
	}
	return false;
}
template<class T>void debug(T *a,int l,int r,const char *name){
	for(int i=l;i<r;i++)
		cout<<name<<"["<<i<<"]="<<a[i]<<endl;
}
template<int H,int W>int ruisekiwa(int x1,int y1,int x2,int y2,int(&p)[H][W]){
	return p[y2][x2]-p[y2][x1]-p[y1][x2]+p[y1][x1];
}
int A,B,C,D,N,M,K,T;
int p[114514],q[114514],r[114514],bb[4001][4001],ww[4001][4001];
string s;
signed main(){
	int i,j;
	cin>>N>>K;
	K*=2;
	re(i,N){
		char c;
		cin>>p[i]>>q[i]>>c;
		r[i]=(c=='B');
	}
	re(i,N){
		p[i]%=K;
		q[i]%=K;
	}
	re(i,N){
		bb[p[i]][q[i]]+=r[i];
		bb[p[i]+K][q[i]]+=r[i];
		bb[p[i]][q[i]+K]+=r[i];
		bb[p[i]+K][q[i]+K]+=r[i];
		ww[p[i]][q[i]]+=!r[i];
		ww[p[i]+K][q[i]]+=!r[i];
		ww[p[i]][q[i]+K]+=!r[i];
		ww[p[i]+K][q[i]+K]+=!r[i];
	}
	re(i,K*2+1){
		int u=0,v=0;
		re(j,K*2+1){
			int tmp=bb[i][j];
			bb[i][j]=u;
			u+=tmp;
			tmp=ww[i][j];
			ww[i][j]=v;
			v+=tmp;
		}
	}
	re(j,K*2+1){
		int u=0,v=0;
		re(i,K*2+1){
			int tmp=bb[i][j];
			bb[i][j]=u;
			u+=tmp;
			tmp=ww[i][j];
			ww[i][j]=v;
			v+=tmp;
		}
	}
	int ans=0;
	re(i,K)
		re(j,K){
			int a=0;
			a+=ruisekiwa(j,i,j+K/2,i+K/2,bb);
			a+=ruisekiwa(j+K/2,i,j+K,i+K/2,ww);
			a+=ruisekiwa(j,i+K/2,j+K/2,i+K,ww);
			a+=ruisekiwa(j+K/2,i+K/2,j+K,i+K,bb);
			chmax(ans,a);
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 252928
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main()
{
    int lcount = 0;
    int rcount = 0;
    char s[100001];

    scanf("%s", s);

    char now;

    // 左から
    now = s[0];
    for (int n = 0; s[n] != '\0'; n++)
    {
        if (s[n] != now)
        {
            lcount++;
            now = s[n];
        }
    }
    
    // 右から
    int len = strlen(s);
    now = s[len - 1];
    for (int n = len - 1; n >= 0; n--)
    {
        if (s[n] != now)
        {
            rcount++;
            now = s[n];
        }
    }
    
//    printf("lcount=%d, rcount=%d\n", lcount, rcount);
    
    printf("%d\n", (lcount < rcount) ? lcount : rcount);
    
    return 0;
}


Measured memory_bytes: 384
a = input().strip()

da = {}
for _a in a:
  if _a in da:
    da[_a] += 1
  else:
    da[_a] = 1

zc = 0
for v in da.values():
  if v >= 2:
    zc += (v * (v-1)) // 2


print((len(a) * (len(a) - 1)) // 2 - zc + 1)

Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
 
 
int main()
{
    long long  l , r , I=1e9+9 , S=1e9+200;
    cin>>l>>r;
    for( long long  i=l ; i<l+2019 && i<r ; i++ )
    {
 
        for(long long  j=i+1 ; j<=l+2019 &&j<=r ; j++  )
        {
            S=min( S , ( ((j%2019)*( i%2019))%2019 ) );
        }
    }
    cout<<S<<endl;;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
int b[100][100];
int a[210][210];
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=9;i++)
        for(int j=0;j<=9;j++)
        cin>>b[i][j];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        cin>>a[i][j];
    for(int i=0;i<=9;i++)
    {
        for(int j=0;j<=9;j++)
        {
            for(int k=0;k<=9;k++)
            {
                b[j][k]=min(b[j][k],b[j][i]+b[i][k]);
            }
        }
    }
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(a[i][j]!=-1&&a[i][j]!=1)
                sum+=b[a[i][j]][1];
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

int main(){
	int i,j,k,l,n,counter;

	while(scanf("%d",&n)!=EOF){
	counter=0;
	for(i=0;i<=9;i++){
		for(j=0;j<=9;j++){
			for(k=0;k<=9;k++){
				for(l=0;l<=9;l++){
					if(n==i+j+k+l)counter++;
				}
			}
		}
	}

	printf("%d\n",counter);
	}

	return 0;
}

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

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

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

    int M;
    cin >> M;

    vector<string> vec_m(M);
    for (int i = 0; i < M; i++) {
        cin >> vec_m[i];
    }
    int ans = 0;
    string target;
    for (int i = 0; i < N; i++) {
        int temp = 0;
        target = vec_s[i];
        for (int j = 0; j < N; j++) {
            if (target == vec_s[j]) 
                temp += 1;
        }
        for (int k = 0; k < M; k++) {
            if (target == vec_m[k]) 
                temp -= 1;
            
        }
        ans = max(ans, temp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		
        int c=a*b;
		if(c%2==0){
        System.out.println("Even");
        }else{
        System.out.println("Odd");
        }
       
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

/*迷路
const int INF = 50;

typedef pair<int,int> P;
char field[52][52];
int d[51][51];
int r,c;
int sx,sy;
int gx,gy;

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

int bfs(){
    queue<P> que;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            d[i+1][j+1] = INF;
        }
    }
    que.push(P(sy,sx));
    d[sy][sx]=0;
while(que.size()){
    P p=que.front();
    que.pop();
    if(p.second==gx&&p.first==gy) break;
    for(int i=0;i<4;i++){
        int nx=p.second+dx[i];
        int ny=p.first+dy[i];

        if(1<=nx&&nx<=c&&1<=ny&&ny<=r&&field[ny][nx]!='#'&&d[ny][nx]==INF){
            que.push(P(ny,nx));
            d[ny][nx] = d[p.first][p.second] + 1;
        }
    }
}
return d[gy][gx];
}
*/

int main(){
  int a,b;
  cin>>a>>b;
  if((a*b)%2 == 0)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


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

using namespace std;

struct pair_hash {
  template <class T1, class T2>
  std::size_t operator()(const std::pair<T1, T2> &pair) const {
    return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
  }
};

// Graph template
using NodeId = pair<int, int>;

template <class... Args> struct Edge {
  NodeId from, to;
  tuple<Args...> values;
  Edge(NodeId from, NodeId to, Args... values)
      : from(from), to(to), values(values...) {}
};
template <class E> auto operator<(const E &e, const E &f) {
  return e.values > f.values;
}

template <class... Args> class Graph {
  using Edges = vector<Edge<Args...>>;
  unordered_map<NodeId, Edges, pair_hash> graph_;

public:
  // Graph(int n) : graph_(n) {}
  size_t size() { return graph_.size(); };
  size_t size() const { return graph_.size(); };
  auto &operator[](NodeId x) { return graph_[x]; }
  const auto &operator[](NodeId x) const { return graph_[x]; }
  void AddEdge(NodeId s, NodeId t, Args... v) {
    graph_[s].emplace_back(s, t, v...);
  }
};

int main() {
  int n, m;
  cin >> n >> m;
  Graph<bool> g;
  {
    unordered_map<NodeId, bool, pair_hash> maked;
    for (int i = 0; i < m; ++i) {
      int u, v, c;
      cin >> u >> v >> c;
      g.AddEdge({u, c}, {v, c}, 0);
      g.AddEdge({v, c}, {u, c}, 0);
      if (!maked[{u, c}]) {
        g.AddEdge({u, 0}, {u, c}, 1);
        g.AddEdge({u, c}, {u, 0}, 0);
      }
      if (!maked[{v, c}]) {
        g.AddEdge({v, 0}, {v, c}, 1);
        g.AddEdge({v, c}, {v, 0}, 0);
      }
      maked[{u, c}] = true;
      maked[{v, c}] = true;
    }
  }
  unordered_map<NodeId, int, pair_hash> used;
  deque<pair<NodeId, int>> dq;
  dq.push_front({{1, 0}, 0});
  while (!dq.empty()) {
    NodeId u;
    int cost;
    tie(u, cost) = dq.front();
    dq.pop_front();
    if (u == NodeId(n, 0)) {
      cout << cost << endl;
      return 0;
    }
    used[u] = 1;
    for (const auto &e : g[u]) {
      auto v = e.to;
      if (used[v])
        continue;
      auto weight = get<0>(e.values);
      if (weight) {
        dq.push_back({v, cost + 1});
      } else {
        dq.push_front({v, cost});
      }
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 93188
#include <iostream>

using namespace std;

int main()
{
	int N;
  	cin >> N;
  	bool ok = true;
  	while(N--)
    {
    	int x;
      	cin >> x;
      	if(x % 2 == 0)
        {
        	if(x % 3 != 0 && x % 5 != 0)
            {
            	ok = false;
            }
        }
    }
  	if(ok) cout << "APPROVED" << endl;
  	else cout << "DENIED" << endl;
}	

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	string S, T;
	cin >> S >> T;
	rep(i, S.length()) {
		string tmp = "";
		rep(j, S.length()) {
			tmp += T[(i + j) % S.length()];
		}
		if (S == tmp) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

    return 0;
}


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

typedef long long LL;
typedef unsigned long long LONG;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MAXINT = 2147483647;
const int mod = 1000000007;
const long long MAXLONG = 9223372036854775807;
using namespace std;
typedef pair<int, int> PII;
#define ft fisrt
#define sd second
#define eb emplace_back
#define END '\n'

template <class T>
inline bool Read(T &ret)
{
	char c;
	int sgn;
	if (static_cast<void>(c = getchar()), c == EOF)
		return 0;
	while (c != '-' && (c < '0' || c > '9'))
		c = getchar();
	sgn = (c == '-') ? -1 : 1;
	ret = (c == '-') ? 0 : (c - '0');
	while (static_cast<void>(c = getchar()), c >= '0' && c <= '9')
		ret = ret * 10 + (c - '0');
	ret *= sgn;
	return 1;
}

template <class T>
inline void Write(T x)
{
	if (x < 0)
		putchar('-'), Write(x);
	if (x > 9)
		Write(x / 10);
	putchar(x % 10 + '0');
}

void solve(int question_num)
{
	while(question_num--){
		int n,k;cin>>k>>n;
		int sum=0;
		for(int i=1;i<=n;++i){
			int t;cin>>t;
			sum+=t;
		}
		if(sum>k) cout<<-1;
		else cout<<k-sum;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t = 1;
	// cin >> t;
	solve(t);
	return 0;
}


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

#define loop(lp) for(int i = 0; (i) < (lp); (i) ++)
#define ascent(i, a, b) for(int i = (a); (i) < (b); (i) ++)
#define descent(i, a, b) for(int i = (a); (i) > (b); (i) --)

#define pb push_back

using namespace std;

int main() {
  int n, m, tmp;
  vector<int> taro, hanako;

  while(true) {
    cin >> n >> m;
    if(n == 0 && m == 0) { break; }

    taro.clear();
    hanako.clear();

    ascent(i, 0, n + m) {
      cin >> tmp;
      if(i < n) {
	taro.pb(tmp);
      }
      else {
	hanako.pb(tmp);
      }
    }
  
    int sum_t = 0;
    int sum_h = 0;
    ascent(i, 0, n) {
      sum_t += taro[i];
    }
    ascent(i, 0, m) {
      sum_h += hanako[i];
    }

    int dif = sum_t - sum_h;
    int ans[2] = {200, 200};
    bool flg = false;
    for(int i = 0; i < n; i ++) {
      for(int j = 0; j < m; j ++) {
	if(dif/2 <= 0) {
	  if(taro[i] - hanako[j] == dif/2) {
	    if(taro[i] + hanako[j] < ans[0] + ans[1]) {
	      ans[0] = taro[i];
	      ans[1] = hanako[j];
	      flg = true;
	    }
	  }
	}
	else if(dif/2 > 0) {
	  if(taro[i] - hanako[j] == dif/2) {
	    if(taro[i] + hanako[j] < ans[0] + ans[1]) {
	      ans[0] = taro[i];
	      ans[1] = hanako[j];
	      flg = true;
	    }
	  }
	}
      }
    }

    if(abs(dif)%2 == 1 || !flg) {
      cout << -1 << endl;
    }	
    else if(flg) {
      cout << ans[0] << " " << ans[1] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353
#define MEM_SIZE 101010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template <typename T>
void DEBUG(T e)
{
  if (DEBUG_OUT == false)
    return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T> &v)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &e : v)
  {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T>> &vv)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &v : vv)
  {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e)
{
  if (DEBUG_OUT == false)
    return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge)
{
  if (flg)
  {
    cout << hoge << endl;
    abort();
  }
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int n;
  cin >> n;
  bool flg = true;
  vector<int> data(n, 0);
  int ma = 0;
  for (int i = 0; i < n; i++)
  {
    int x;
    cin >> x;
    data[x] += 1;
    chmax(ma, x);
  }
  for (int i = ma / 2 + 1; i <= ma; i++)
  {
    data[i] -= 2;
  }
  if (ma % 2 == 0)
    data[ma / 2] -= 1;
  for (int i = 1; i <= ma; i++)
  {
    if (data[i] < 0)
      flg = 0;
  }
  for (int i = 0; i <= ((ma % 2 == 0) ? ma / 2 : ma / 2 + 1); i++)
  {
    if (data[i] > 0)
      flg = 0;
  }
  if (flg)
  {
    cout << "Possible" << endl;
  }
  else
  {
    cout << "Impossible" << endl;
  }

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3656
//#include <GOD>
#include <iostream>
using namespace std;
typedef long long ll;
#define pb push_back
#define len length
ll n,m,x,sum;
int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>x;
		sum+=x;
	}
	if(sum>n){
		cout<<-1<<endl;
	}else{
		cout<<n-sum<<endl;
	}
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <map>
#include <math.h>
#include <complex>
#include <string>

#define _GLIBCXX_DEBUG
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
/* 基本要素 */


int main()
{
	 string s;
	 int n;
    cin >> n >> s;
    int l = s.size();
    for(int i = 0; i<l; i++){
        if(s[i]+n<='Z')s[i]+=n;
        else s[i]= 'A'+n-('Z'-s[i]+1);
    }
    cout << s << endl;
    
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;

}

signed main() {
	ll n, m, l, r;
	ll ans = 0;

	cin >> n >> m;

	vector<ll> v(n + 1, 0);

	REP(i, m) {
		cin >> l >> r;
		v[l - 1]++;
		v[r]--;
	}

	FOR(i, 1, n + 1) {
		v[i] += v[i - 1];
	}

	REP(i, n) {
		if (v[i] == m) {
			ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

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

long long com(long long n,long long k){
	
}
long long getDigit(long long n){
	if(n==1)return 1;
	else return log10(n)+1;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long ans=INF;
	long long n;
	cin>>n;
	long long i=1;
	while(i*i<=n){
		if(n%i==0)ans=min(ans,max(getDigit(i),getDigit(n/i)));
		i++;
	}
	cout<<ans<<endl;
}

	


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

int main() {
int a, b;
string op;

while (cin >> a >> op >> b && op != "?") {
if (op == "+") {
cout << a+b << endl;
} else if (op == "-") {
cout << a-b << endl;
} else if (op == "*") {
cout << a*b << endl;
} else if (op == "/") {
cout << a/b << endl;
}
}
}


Measured memory_bytes: 3156