akhauriyash/Code-Regression huggingface dataset:
<?php

$input_number = trim(fgets(STDIN));

$input_arr = str_split($input_number);

foreach ([true, false] as $op1)
{
	foreach ([true, false] as $op2)
	{
		foreach ([true, false] as $op3)
		{
			$sum = 0;
			$sum_arr = [];
			$sum_arr[0] = $input_arr[0];
			$sum_arr[1] = ($op1)? $input_arr[1] : -$input_arr[1];
			$sum_arr[2] = ($op2)? $input_arr[2] : -$input_arr[2];
			$sum_arr[3] = ($op3)? $input_arr[3] : -$input_arr[3];
			$sum = array_sum($sum_arr);

			if ($sum === 7)
			{
				break 3;
			}
		}
	}
}

echo $input_arr[0].echo_op($op1).$input_arr[1].echo_op($op2).$input_arr[2].echo_op($op3).$input_arr[3].'=7';

function echo_op($op)
{
	return ($op)? '+' : '-';
}


Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;
 
typedef long long lld;
typedef vector<lld> vlld;
typedef pair<lld,lld> pi;
typedef tuple<lld,lld,lld> tup;
const lld mod=(lld)1e9+7;
 
void solve(lld n)
{
   lld W;
   cin>>W;
   lld w[n],v[n];
   forn(i,n)
   cin>>w[i]>>v[i];
   lld dp[W+1]={0};
   for(lld i=0;i<n;i++)
   {
       for(lld j=W;j>=w[i];j--)
       {
       	    dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
       }
   }
   cout<<dp[W]<<"\n";


}
 
int main() {

	lld t;
	t=1;
	// cin>>t;
	while(t--)
	{
      lld n;
      cin>>n;
     solve(n);

	}
  
  return 0;
}

Measured memory_bytes: 4408
#include<stdio.h>
#define NIL -1
#define MAX 100000

struct Node{
  int p,l,r;
};

struct Node T[MAX];
int n;

int depth(int a){
  
  int num=0,s=T[a].p;
  
  while(s!=NIL){
    num++;
    s=T[s].p;
  }
  return num;
}

int main(){

  int i,j,x,d,c,l;

  scanf("%d",&n);
  
  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;

  for(i=0;i<n;i++){
    scanf("%d %d",&x,&d);
    for(j=0;j<d;j++){
      scanf("%d", &c);
      if(j==0) T[x].l=c;
      else T[l].r =c;
      l=c;
      T[c].p=x;
    }
  }
  for(i=0;i<n;i++){
  printf("node %d: parent = %d, depth = %d, ", i, T[i].p,depth(i));

  if(T[i].p==NIL) printf("root, ");
  else if(T[i].l!=NIL) printf("internal node, ");
  else printf("leaf, ");

  printf("["); 

  for(j=0, c=T[i].l; c!=NIL; j++, c=T[c].r){
    if(j==0) printf("%d", c);
    else printf(", %d", c);
  }
  printf("]\n");
  }
  return 0;
}
  

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

#define endl "\n"
#define x first
#define y second
#define debug(x) cerr << #x << ": " << x << endl;
#define all(x) x.begin(), x.end()

typedef long long LL;
typedef pair <LL, LL> PLL;

const LL maxn = 1000010;
const LL mod = 1000000007;
const LL inf64 = 1LL<<60;

vector <bool> is_prime(maxn, true);

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

    for (LL i = 2; i*i < maxn; i++)
        if (is_prime[i]) for (LL j = i*i; j < maxn; j += i)
            is_prime[j] = false;

    LL n, p;
    cin >> n >> p;

    map <LL, LL> cnt;
    for (LL i = 2; i < maxn; i++)
        if (is_prime[i]) {
            while (p % i == 0)
                p /= i, cnt[i]++;
    }
    if (p != 1) cnt[p]++;

    LL ans = 1;
    for (auto p : cnt) {
        for (LL i = 0; i < p.y/n; i++)
            ans *= p.x;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
    return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
    return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
    return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
    return forall_a_in_P.second > forall_b_in_P.second;
}
int main()
{
    int n;
    cin >> n;
    vector<int>a(n),b(n);
    deque<int>c;
    rep(i,n)cin>>a[i];
    rep(i,n){
        int ite=n-1-i;
        if(ite+1>n/2){
            b[ite]=a[ite];
            if(a[ite]==1){
                c.push_back(ite+1);
            }
        }else{
            int tmp=ite;
            int sum=0;
            while(tmp+ite+1<n){
                tmp+=ite+1;
                sum+=b[tmp];   
            }
            if(sum%2==a[ite]){

            }else{
                b[ite]++;
                c.push_back(ite+1);
            }
        }
    }
    cout<<c.size()<<endl;
    if(c.size()>0){
        rep(i,c.size()){
            cout<<c[i];
            if(i!=c.size()-1){
                cout<<" ";
            }else{
                cout<<endl;
            }
        }
    }
}


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

using namespace std;

int H, W;
string field[100];
int numberField[100][100];

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

void dfs(int x, int y, char t, int number) {
    if (numberField[y][x] == -1) {
        numberField[y][x] = number;
        for (int i = 0; i < 4; ++i) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            if (0 <= nx && nx < W && 0 <= ny && ny < H && field[ny][nx] == t) {
                dfs(nx, ny, t, number);
            }
        }
    }
}

int main() {
    while (true) {
        cin >> H >> W;
        if (H == 0 && W == 0) {
            return 0;
        }

        for (int i = 0; i < H; ++i) {
            cin >> field[i];
        }
        for (int i = 0; i < 100; ++i) {
            for (int j = 0; j < 100; ++j) {
                numberField[i][j] = -1;
            }
        }

        int count = 0;
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                if (numberField[i][j] == -1) {
                    dfs(j, i, field[i][j], count++);
                }
            }
        }

        cout << count << endl;
    }
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *print;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;
void insert(int);
void inorder(Node);
void preorder(Node);
Node find(Node, int);

int main(){
  int s, a, i;
  char c[20];

  scanf("%d", &s);
 
  for ( i=0 ; i<s ; i++ ){
    scanf("%s",c);

    if ( c[0]=='f' ){
      scanf("%d", &a);
      
      Node t = find( root, a);
      if( t!=NIL ) printf("yes\n");
      if( t==NIL ) printf("no\n");

    }

    if ( c[0]=='i' ){
      scanf("%d", &a);
      insert( a );
    }

    if ( c[0]=='p' ){
      inorder( root );
      printf("\n");
      preorder( root );
      printf("\n");
    }

  }
  return 0;
}
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc( sizeof( struct node ) );
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while( x!=NIL ){
    y=x;
    if( z->key<x->key ) x = x->left;
    else x = x->right;
  }
  z->print = y;
  if( y==NIL )root = z;
  else if( z->key<y->key ) y->left = z;
  else y->right = z;
}

void inorder( Node u ){
  if( u!=NIL ){
    inorder( u->left );
    printf(" %d", u->key);
    inorder( u->right );
  }
}
void preorder( Node u ){
  if(u != NIL){
    printf(" %d", u->key);
    preorder( u->left );
    preorder( u->right );
  }
}

Node find( Node u, int k ){
  while( u!=NIL && k!=u->key ){
    if( k<u->key ) u = u->left;
    else u = u->right;
  }
  return u;
}

Measured memory_bytes: 19364
#include<iostream>
#include<string>
using namespace std;
int main() {
  int a = 0;
  string S;
  cin >> S;
  for(int i = 1; i < S.size(); i++){
    if(S[i-1] == 'A' && S[i] == 'C'){
      cout << "Yes";
      a++;
      break;
    } 
  }
  if(a == 0) cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> V(H);
    for (int i = 0; i < H; i++) {
        cin >> V.at(i);
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (V.at(i).at(j) == '#') continue;
            int count = 0;
            for (int k = i - 1; k < i + 2; k++) {
                for (int l = j - 1; l < j + 2; l++) {
                    if (k < 0 || l < 0 || k > H - 1 || l > W - 1 || (k == i && l == j)) continue;
                    if (V.at(k).at(l) == '#') count++;
                }
            }
            V.at(i).at(j) = count + '0';
        }
    }
    
    for (int i = 0; i < H; i++) {
        cout << V.at(i) << endl;
    }

    return 0;
}

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

int main() {
  int x, y, s;
  while (cin >> x >> y >> s, x) {
    int ans = 0;
    for (int i = 1; i < s; i++) {
      for (int j = 1; j < s; j++) {
        int ax = i * (100 + x) / 100;
        int bx = j * (100 + x) / 100;
        if (ax + bx == s) {
          int ay = i * (100 + y) / 100;
          int by = j * (100 + y) / 100;
          ans = max(ans, ay + by);
        }
      }
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3076
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
using namespace std;
int n, k;
int arr[101];
int dp[105][100005];

int solve(int i,int j){

	//cout<<"called"<<i<<" "<<j<<endl;

	if(i==1 && j<=arr[i-1])
		dp[i][j] = 1;
	else if(i==1 && j>arr[i-1])
		dp[i][j] = 0;


	if(dp[i][j]!=-1)
		return dp[i][j];

	dp[i][j] = ( mod +  ( (j-1>=0)?solve(i,j-1):0) - ( ((j-1)>=arr[i-1])?solve(i-1,j-1-arr[i-1]):0 ) + solve(i-1,j) )%mod;

	return dp[i][j];
}


int32_t main() {
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif

	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> arr[i];

	memset(dp,-1,sizeof dp);

	cout<<solve(n,k)<<endl;
	
	


}

Measured memory_bytes: 90312
n,m = map(int, input().split())
e = [set() for _ in range(n)]
for _ in range(m):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    e[a].add(b)
    e[b].add(a)

p = [-1]*n
p[0] = 0
q = [0]
while len(q)>0:
    u = q.pop(0)
    for v in e[u]:
        if p[v]==-1:
            p[v] = u
            q.append(v)
if min(p)==-1:
    print("No")
else:
    print("Yes")
    for i in range(1,n):
        print(p[i]+1)

Measured memory_bytes: 62428
#include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
    int n,a,i;
    long long max,min,sum;
    cin>>n;
    max=-1000000;
    min=1000000;
    sum=0;
    for(i=0;i<n;i++){
        cin>>a;
        if (a>max) max=a;
        if (a<min) min=a;
        sum+=a;
    }
    printf ("%lld %lld %lld\n",min,max,sum);
    return 0;
}


Measured memory_bytes: 3220
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

const INF = int(math.MaxInt32)
const INF64 = math.MaxInt64 / 2

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func uniqIntSlice(a []int) []int {
	m := make(map[int]struct{})
	for _, v := range a {
		m[v] = struct{}{}
	}
	u := []int{}
	for k := range m {
		u = append(u, k)
	}
	return u
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

//a:old b:new a>b -> a=b (update) more small
func chmin(a *int, b int) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}

//a:old b:new a>b -> a=b (update) more small
func chmin64(a *int64, b int64) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}

//a:old b:new a<b -> a=b (update) more large
func chmax(a *int, b int) bool {
	if *a < b {
		*a = b
		return true
	}
	return false
}

//a:old b:new a<b -> a=b (update) more large
func chmax64(a *int64, b int64) bool {
	if *a < b {
		*a = b
		return true
	}
	return false
}
type DP struct{
	count int
	s string
}
func rec(a []float64)[]float64{
	sort.Float64s(a)
	if len(a)<=1{
		return a
	}
	a[1]=(a[0]+a[1])/2
	return rec(a[1:])
}

func main() {
	n := nextInt()
	a := make([]float64,n)
	for i:=0; i<n; i++ {
		a[i]= float64(nextInt())
	}
	res := rec(a)
	fmt.Println(res[0])
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<v<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll a;
    cin >> a;
    ll b;
    cin >> b;
    ll c;
    cin >> c;
    ll d;
    cin >> d;
    ll K;
    cin >> K;
    prt((60*c+d)-(60*a+b)-K)
    
    return 0;
}


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

int main()
{
	int N;
	string S;

	cin >> N >> S;

	int x = 0, m = 0;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'I')
			x++;
		else
			x--;
		if (m < x)
			m = x;
	}

	cout << m << endl;

	return 0;
}



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

template<class t> void vin(vector<t>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        char[] digits = input.readLine().toCharArray();
        if (digits[0] >= digits[1] && digits[0] >= digits[2]) {
            System.out.println(digits[0] + "" + digits[0] + "" + digits[0]);
        }else{
            digits[0]++;
            System.out.println(digits[0] + "" + digits[0] + "" + digits[0]);
        }
    }
}


Measured memory_bytes: 21076
#include <iostream>
#include <string>
using namespace std;
int main(){
	string str;
	cin >> str;
	for(int i=0;i<str.size();i++){
		if(str[i]<'D'){
			str[i]=str[i]+23;
		}else{
			str[i]=str[i]-3;
		}
	}
	cout << str << endl;
	return 0;
}

Measured memory_bytes: 1180
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;
int main(){

int a,b;
int ans;

cin >> a >> b;

ans = (b - a)*(b - a + 1) / 2 - b;

cout << ans;


return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
#include<queue>
using namespace std;

long long int mod = 1000000007;

int main(void) {

  int n, d;
  string x;
  cin >> n >> x >> d;
  string y = x;
  for(int i=0; i<n; i++){
    if( d == 0 ) break;
    if( d > 0 && x[i] == '0' ){
      x[i] = '1';
      d--;
    }
  }
  for(int i=n-1; i>=0; i--){
    if( d == 0 ) break;
    if( d > 0 && y[i] == '1' ){
      x[i] = '0';
      d--;
    }
  }
  cout << x << endl;
  return 0;
}


//

Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>

using namespace std;

int main(void){
    string S;
    int cntR=0,cntL=0,ansR,ansL;
    cin>>S;
    VI ans(S.length());
    rep(i,S.length()-1){
        //cout<<"!!"<<endl;
        //ans[i]=0;
        if(S[i]=='R'){
            cntR++;
            ansR=i;
        }
        else{
            cntL++;
        }
        if(S[i]=='L' && S[i+1]=='R'){
            //cout<<cntR<<cntL<<endl;
            ans[ansR]=cntR/2+cntL/2;
            ans[ansR+1]=cntR/2+cntL/2;
            if(cntR%2!=0)ans[ansR]++;
            if(cntL%2!=0)ans[ansR+1]++;
            cntR=0,cntL=0;
        }
    }
    cntL++;
    ans[ansR]=cntR/2+cntL/2;
    ans[ansR+1]=cntR/2+cntL/2;
    if(cntR%2!=0)ans[ansR]++;
    if(cntL%2!=0)ans[ansR+1]++;
    rep(i,S.length()){
        cout<<ans[i]<<' ';
    }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3fLL
#define endl '\n'
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    string s; cin >> s;
    s.resize(4);
    if (s == "YAKI") cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

enum week {
    SUN,
    MON,
    TUE,
    WED,
    THU,
    FRI,
    SAT
};

int main(void){
    
    char string[100];
    
   scanf("%s",string);
   
   if(strcmp(string,"SUN") == 0){
       printf("%d",7-SUN);
   }else if(strcmp(string,"MON")==0){
       printf("%d",7-MON);
   }else if(strcmp(string,"TUE")==0){
       printf("%d",7-TUE);
   }else if(strcmp(string,"WED")==0){
       printf("%d",7-WED);
   }else if(strcmp(string,"THU")==0){
       printf("%d",7-THU);
   }else if(strcmp(string,"FRI")==0){
       printf("%d",7-FRI);
   }else if(strcmp(string,"SAT")==0){
       printf("%d",7-SAT);
   }
   
    
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

class Main
{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        
        String judge;
        int countAC = 0;
        int countWA = 0;
        int countTLE = 0;
        int countRE = 0;
        for (int i = 0; i < n; i++) {
            judge = sc.next();
            
            if (judge.equals("AC")) {
                countAC++;
            } else if (judge.equals("WA")) {
                countWA++;
            } else if (judge.equals("TLE")) {
                countTLE++;
            } else if (judge.equals("RE")) {
                countRE++;
            }
        }
        
        System.out.println("AC x " + countAC);
        System.out.println("WA x " + countWA);
        System.out.println("TLE x " + countTLE);
        System.out.println("RE x " + countRE);
    }
}

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

using namespace std;

int main(void)
{
	string s;
	
	cin >> s;
	
	for (int i = 0; i < 4; i++) {
		int cnt = 0;
		
		for (int j = 0; j < 4; j++) {
			if (i == j) {
				continue;
			}
			
			if (s[j] == s[i]) {
				cnt++;
			}
		}
		
		if (cnt != 1) {
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int calc(int m,int n){

	if(n==0){
		return m;
	}
	else{
		return calc(n,m%n);
	}

}

int main(){

	int m,n;

	int kouyakusu;
	long long int koubaisu;

	while(cin>>m){
		cin>>n;

		if(m>=n){
			kouyakusu = calc(m,n);
		}
		else{
			kouyakusu = calc(n,m);
		}

		koubaisu = (m/kouyakusu)*n;

		printf("%d %lld\n",kouyakusu,koubaisu);

	}

	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n = s.length();
        for(int i = 1 ; i <= n ; i++ ){
            System.out.print("x");
        }
        sc.close();
    }
}

Measured memory_bytes: 35700
#include<iostream>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<vector>
using namespace std;
const int INF = 2000000005;
int main() {
	int a, b;
	cin >> a >> b;
	cout << max(a + b, max(a - b, a*b))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(k,i,n) for(ll i=k;i<n;++i)
const ll inf=1e6;
ll c0[20][20],c1[20][20][20][20];
ll dx[4]={0,0,1,-1},dy[4]={-1,1,0,0};
ll h,w;
ll bfs(ll sx,ll sy){
    if(c0[sx][sy]==-1)return 0;
    ll res=0;
    c1[sx][sy][sx][sy]=0;
    queue<P> que;
    que.push(P(sx,sy));
    while(!que.empty()){
        P p=que.front();que.pop();
        rep(0,i,4){
            ll nx=p.first+dx[i],ny=p.second+dy[i];
            if(0<=nx && h>nx && 0<=ny && w>ny){
                ll d=c1[sx][sy][nx][ny];
                if(d==inf){
                    que.push(P(nx,ny));
                    c1[sx][sy][nx][ny]=c1[sx][sy][p.first][p.second]+1;
                    res=max(res,c1[sx][sy][nx][ny]);
                }
            }
        }
    }
    //cout<<res<<endl;
    return res;
}
int main(void){
    cin>>h>>w;
    rep(0,i,h){
        string s0;
        cin>>s0;
        rep(0,j,w){
            string s1=s0.substr(j,1);
            if(s1=="#"){
                c0[i][j]=-1;
            }else{
                c0[i][j]=inf;
            }
        }
    }
    ll ans=0;
    rep(0,i0,h){
        rep(0,j0,w){
            rep(0,i1,h){
                rep(0,j1,w){
                    c1[i0][j0][i1][j1]=c0[i1][j1];
                }
            }//initialize
            ans=max(bfs(i0,j0),ans);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int n;
  cin >> n;
  vs s(10);
  s[0] = "pon";
  s[1] = "pon";
  s[2] = "hon";
  s[3] = "bon";
  s[4] = "hon";
  s[5] = "hon";
  s[6] = "pon";
  s[7] = "hon";
  s[8] = "pon";
  s[9] = "hon";
  cout << s[n%10] << endl;

  return 0;
}

Measured memory_bytes: 3620
N, M, C = map(int, input().split())
B_arr = list(map(int, input().split()))
A_arr = []
for i in range(N):
    A_arr.append(list(map(int, input().split())))

count = 0
for i in range(N):
    sum = 0
    for j in range(M):
        sum += A_arr[i][j]*B_arr[j]
    sum += C
    
    if sum > 0:
        count += 1
    else:
        pass

print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define ld long double
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rloop(i,a,b) for(ll i=a;i>b;i--)
const ll inf=1e9+7;
ll addself(ll x)
{
	if(x<inf)return x;
	else
	return (x+inf)%inf;
}
int main()
{
	ios::sync_with_stdio(0); 
	cin.tie(0);

ll n;
cin>>n;
ll mask[n]={0},ai,b;
	loop(i,0,n)
	{
		loop(j,0,n)
		{
			cin>>ai;
			mask[i]|=ai<<j;
		}
	
	}

	vector<ll>dp(1<<n); //2^n possible combinatons
	dp[0]=1; // 1 way to get 000...0
	loop(i,0,(1<<n)-1)
	{
		
		b=__builtin_popcount(i);// number of bit set to 1;
		loop(j,0,n)
		{
			if((mask[b]&(1<<j)) &&( !(i&(1<<j)) ))  // intersted pair && position not used
			{
				dp[i|(1<<j)]+=dp[i];
				dp[i|(1<<j)]=addself(dp[i|(1<<j)]);
			}
			
		}
	}

cout<<dp.back();	
	
}


Measured memory_bytes: 16640
# Aizu Problem 0050: Apple and Peach
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

dummy = "fadlsjkfhadslkjhfadskljghadsiuowzhgalsjdhflksjdhfasdjsadklfhasjdkhfalsdfhsadljkhfajdkshfadlfshadjkuihzuizt9285692843756239847ztsadhgsjaklg"

for line in sys.stdin:
    print(line.strip().replace("apple", dummy).replace("peach", "apple").replace(dummy, "peach"))

Measured memory_bytes: 7580
def cyokkaku(a,b,c):
    if a*a+b*b==c*c or b*b+c*c==a*a or c*c+a*a==b*b:
      print("YES")
    else:
      print("NO")
  
n=int(input())
for i in range (n):
    a,b,c=map (int,input().split())
    cyokkaku(a,b,c)



Measured memory_bytes: 5600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[LEN + 5];
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
}
inline void putll(ll x){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
}
inline char get_char(){
  char c;
  for(c = buff.get();c == ' ' || c == '\n';c = buff.get());
  return c;
}
#define maxn 505
int n,k,a[maxn],sum;
bool check(int d){
  vector <int> r;
  int sumr = 0;
  for(int i = 1;i <= n;i++){
    r.push_back(a[i] % d);
    sumr += a[i] % d;
  }
  sumr /= d;
  sort(r.begin(),r.end());
  int cnt = 0;
  for(int i = 0;i < n - sumr;i++) cnt += r[i];
  return cnt <= k;
}
int main(){
  n = getint(), k = getint();
  for(int i = 1;i <= n;i++){
    a[i] = getint();
    sum += a[i];
  }
  int ans = 0;
  for(int i = 1;i * i <= sum;i++){
    if(sum % i == 0){
      if(check(i)) ans = max(ans,i);
      if(i * i != sum && check(sum / i)) ans = max(ans,sum / i);
    }
  }
  putint(ans);
  bufo.put('\n');
  bufo.flush();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define pb push_back
#define int long long
#define str string
using namespace std;
const int M = 1e9 + 7;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    if (s == t) {
        cout << n;
        return 0;
    }
    int g = __gcd(n, m);
    int x1 = 0, x2 = 0;
    for (int _ = 0; _ < g; _++) {
        if (s[x1] != t[x2]) {
            cout << -1;
            return 0;
        }
        x1 += n / g;
        x2 += m / g;
    }
    cout << n * m / g;


}

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

// マクロ //
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vpii = vector<pii>;
using msi = map<string, int>;

// 関数 //
template<class T> lint gcd(T a, T b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T> lint lcm(T a, T b) {
    return a * b / gcd(a, b);
}

double distance(pii a, pii b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

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

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

// 定数 //
#define pi acos(-1)
#define mod 1000000007
#define MOD 998244353
#define inf ((1LL << 62) - 1 + (1LL << 62))

// キーワード //
#define elif else if

// End of Template //



int main() {

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

    int N;
    cin >> N;
    lint sum = 0;
    for(int i=1; i< N+1; i++) {
        if (i % 3 != 0 && i % 5 != 0) {
            sum += i ;
        }
    }
    cou(sum);



}

Measured memory_bytes: 3692
# ABC096C - Grid Repainting 2
h, w = list(map(int, input().rstrip().split()))
arr = [list(input().rstrip()) for _ in range(h)]
arr.insert(0, ["."] * (w + 2))
arr.append(["."] * (w + 2))
for i in arr[1:-1]:
    i.insert(0, ".")
    i.append(".")

flg = False
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if arr[i][j] == "#":
            if (
                arr[i - 1][j] != "#"
                and arr[i + 1][j] != "#"
                and arr[i][j - 1] != "#"
                and arr[i][j + 1] != "#"
            ):
                print("No")
                flg = True
                break
    if flg:
        break
if not flg:
    print("Yes")

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

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  if (a >= k) {
    cout << k << endl;
  } else if (a + b >= k) {
    cout << a << endl;
  } else {
    cout << a - (k - a - b) << endl;
  }
}


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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int r;
    cin >> r;
    cout << r*r << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

#define MAX 10000
#define NIL -1

struct Node {int p, l, r;};
struct Node T[MAX];
int n;

/* 先行順巡回 */
void preParse(int u) {
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

/* 中間順巡回 */
void inParse(int u) {
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

/* 後方順巡回 */
void postParse(int u) {
  if(u == NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(void) {
  int i, v, l, r, root;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    T[i].p = NIL;
  }
  
  for(i=0; i<n; i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  
  for(i=0;i<n;i++) if(T[i].p == NIL) root = i;
  
  printf("Preorder\n");
  preParse(root);
  printf("\n");

  printf("Inorder\n");
  inParse(root);
  printf("\n");

  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}


Measured memory_bytes: 2040
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! flush {
    () => {
        std::io::stdout().flush().unwrap();
    };
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let d: usize = sc.cin();
    let s: usize = sc.cin();
    let t: usize = sc.cin();
    put!(if d <= s * t { "Yes" } else { "No" });
}

use std::collections::VecDeque;
use std::io::{self, Write};
use std::str::FromStr;

struct Scanner {
    stdin: io::Stdin,
    buffer: VecDeque<String>,
}
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: io::stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}


Measured memory_bytes: 2132
#include<bits/stdc++.h>
using namespace std;
main()
{
	int h1,h2,m1,m2,k,t1,t2;
	cin>>h1>>m1>>h2>>m2>>k;
	if(h1>h2)
	h2+=24;
	t1=h1*60+m1;
	t2=h2*60+m2;
	cout<<t2-t1-k;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int n;cin>>n;
  vector<int> a(n,0);
  rep(i,n-1){
    int tmp;cin>>tmp;
    a[tmp-1]++;
  }
  rep(i,n)print(a[i]);
  return 0; 
}


Measured memory_bytes: 4056
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int N, D; cin >> N >> D;
  int cnt = 0;
  int x = 0;
  while (x < N) {
    ++cnt;
    x += 2 * D + 1;
  }
  cout << cnt << endl;
}


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

int main()
{
    int n, m, roads[50]{};
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        a--; b--;
        roads[a]++; roads[b]++;
    }
    for (int i = 0; i < n; i++)
        printf("%d\n", roads[i]);

    return 0;
	
}

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long s;
	cin >> s;
	long long x1, y1, x2, y2, x3, y3;
	x1 = y1 = 0;
	x2 = 1000000000;
	x3 = 1;
	y3 = (s + x2 - 1) / x2;
	y2 = x2 - (s % x2 == 0 ? x2 : s % x2);
	cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << ' ' << x3 << ' ' << y3;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

ll ans;
string S;

void solve(){
    if(S[0] != S[1] && S[1] != S[2] && S[2] != S[3])
        cout << "Good" << endl;
    else
        cout << "Bad" << endl;
}

int main(){
    cin >> S;

    solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <numeric>
#include <climits>
#include <cfloat>
#include <bitset>
long long int power(long long int base, int exp, const int mod) {
	long long int result = 1;
	while (exp > 0) {
		if (exp % 2 == 1) {
			result *= base;
			result %= mod;
		}
		base *= base;
		base %= mod;
		exp >>= 1;
	}
	return result;
}
int main() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	int p; std::cin >> p;
	std::vector<long long int> factorial(p, 1LL);
	std::vector<long long int> inv(p, 1LL);
	std::vector<long long int> inverse(p, 1LL);
	for (auto i = 2; i < p; ++i) {
		factorial[i] = factorial[i - 1] * i % p;
		inv[i] = (p - p / i) * inv[p % i] % p;
		inverse[i] = inv[i] * inverse[i - 1] % p;
	}
	std::vector<long long int> coefficients(p, 0LL);
	{int a;
	for (auto i = 0; i < p; ++i) {
		std::cin >> a;
		if (a == 1) {
			coefficients[p - 1]++;
			int c = 1;
			for (auto j = 0; j < p; ++j) {
				coefficients[j] -= ((factorial[p - 1] * inverse[j] % p * inverse[p - 1 - j]) % p * c % p) % p;
				c *= -i;
				c %= p;
			}
		}
	}
	}
	for (int i = p - 1; i >= 0; --i) {
		if (i != p - 1) std::cout << ' ';
		std::cout << (coefficients[i] % p + p) % p;
	}
}


Measured memory_bytes: 512
p = int(input())
nums = list(map(int, input().split()))

ans = 1
large = False
for i in nums:
    if i == 0:
        ans = 0
        large = False
    if not large:
        ans = ans * i
        if ans > 10 ** 18:
            large = True
    else:
        pass

if large:
    print(-1)
else:
    print(ans)


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

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> data(n+1, 0);
	vector< vector<int> > dd(k, vector<int>());
	for (int i = 0; i < k; i++) {
		int m;
		cin >> m;
		int b;
		for (int j = 0; j < m; j++) {
			cin >> b;
			dd[i].push_back(b);
		}
		sort(dd[i].begin(), dd[i].end());
	}
	int r;
	cin >> r;
	int aa, bb;
	for (int i = 0; i < r; i++) {
		cin >> aa >> bb;
		if (aa > bb) {
			swap(aa, bb);
		}
		for (int j = 0; j < k; j++) {
			int p;
			int cc = 0;
			for (p = 0; p < dd[j].size(); p++) {
				if (dd[j][p] == aa) {
					cc++;
					break;
				}
			}
			for (int q = p+1; q < dd[j].size(); q++) {
				if (dd[j][q] == bb) {
					cc++;
					break;
				}
			}
			if(cc == 2) {
				data[aa] = data[bb] = 1;
				break;
			}
		}
	}
	int s = 0;
	for (int i = 0; i <= n; i++) {
		s += data[i];
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 1220
class abc_167:
    
    def __init__(self):
        pass
    
    def A(self):
        S=input()
        T=input()
        if S==T[:len(S)]:print("Yes")
        else:print("No")
    
    def B(self):
        pass
            
    def C(self):
        pass
    
    def D(self):
        pass
    
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_167()
    obj.A()
    

Measured memory_bytes: 61752
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 1010
using namespace std;
ll rint(){
	ll ret=0,uu=1;
	char c=getchar();
	while(!isdigit(c)&&c!='-') c=getchar();
	if(c=='-') uu=-1,c=getchar();
	while(isdigit(c)) ret=ret*10+(c-'0'),c=getchar();
	return ret*uu;
}
int n,m,k,nm[11],num[11],ans=INF,tmp,tp;
char grid[11][N];
int main(){
	int i,j,l,lst;
	n=rint();
	m=rint();
	k=rint();
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			scanf(" %c",&grid[i][j]);
		}
	}
	for(i=(1<<n)-1;i>=0;i--)
	{
		memset(nm,0,sizeof(nm));
		for(j=0;j+1<n;j++)
		{
			if(i&(1<<j))
			{
				nm[j+1]=nm[j]+1;
			}
			else
			{
				nm[j+1]=nm[j];
			}
		}
		tmp=0;
		tp=__builtin_popcount(i);
		memset(num,0,sizeof(num));
		for(j=m-1;j>=0;j--)
		{
			if(tmp+tp>=ans)
			{
				break;
			}
			for(l=0;l<n;l++)
			{
				if(grid[l][j]=='1')
				{
					num[nm[l]]++;
				}
				if(num[nm[l]]>k)
				{
					l=-1;
					break;
				}
			}
			if(l==-1)
			{
				tmp++;
				j++;
				memset(num,0,sizeof(num));
			}
		}
		ans=min(ans,tmp+tp);
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int main(){
	int a , b;
	cin >> a >> b;
	int diff = b - a;
	int a_num = 0;
	for(int i = 1; i < diff; i++){
		a_num += i;
	}
	cout << a_num - a << endl;
}

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

int cmp(const void * n1, const void * n2)
{
	if (*(long *)n1 > *(long *)n2)
	{
		return 1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}

int main(void){

  long n;
  scanf("%ld", &n);
  long a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }

  qsort(a, sizeof(a) / sizeof(a[0]), sizeof(long), cmp);

  int flag = 1;
  for (long i = 1; i < n; i++) {
    if (a[i] == a[i-1]) {
      flag = 0;
      break;
    }
  }

  if (flag == 1) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 3324
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<string>
#include<vector>
//#include<string>
//#include<sstream>
using namespace std;

int main(){
	int n;
	long long sum;
	scanf("%d",&n);
	sum=800*n-200*(n/15);
	printf("%lld\n",sum);
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class EStringsOfImpurity {
public:
	void solve(std::istream& in, std::ostream& out) {
	    string s, t;
	    in >> s >> t;
	    int slen = s.length();
	    int tlen = t.length();
        map<char, vector<ll>> mp;
        rep(i, slen){
            mp[s[i]].push_back(i+1);
        }

        for(auto const& e : mp){
            vector<ll> buf = e.second;
            sort(all(buf));
            mp[e.first] = buf;
        }

        bool flg = true;
        int last = 0;
        ll cnt = 0;
        rep(i, tlen){
            if(mp[t[i]].size() == 0){
                flg = false;
                break;
            }
            auto itr = upper_bound(all(mp[t[i]]), last);
            if(itr == mp[t[i]].end()){
                cnt++;
                last = mp[t[i]][0];
            }else{
                int ind = distance(mp[t[i]].begin(), itr);
                last = mp[t[i]][ind];
            }
        }

        if(!flg) out << -1 << endl;
        else{
            ll res = cnt*slen + last;
            out << res << endl;
        }
	}
};


int main() {
	EStringsOfImpurity solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 2236