akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
using namespace std;

#define MOD 1000000007
#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];

    int ans = 0;
    int max = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            ans = a[j] - a[i];
            if(ans > max) max = ans;
        }
    }
    p(max);
}


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

int gcd(int a, int b);
int lcm(int a, int b);

int main(){
	int a, b, c, d;

	while(cin >> a >> b){
		c=gcd(a, b);
		d=lcm(a, b);

		cout << c << " " << d << endl;
	}

	return 0;
}

int gcd(int a, int b){
	int d, e, f;

	if(a>=b){ d=a; e=b; }
	else { d=b; e=a; }
	f=e;
	while(1){
		if(d%f==0) return f;
		f=d % e;
		d=e;
		e=f;
	}
}

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

Measured memory_bytes: 2968
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
S = input().strip()

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

if kaibun(S) and kaibun(S[:(len(S)-1)//2]) and kaibun(S[(len(S)-1)//2+1]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<list>
#include<map>
#include<vector>
#include<iostream>
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
typedef long int li;

int main(){
  if(df) printf("*debug mode*\n");
  int n,k;cin >>n >>k;
  vector<li> a(n),s(n+1,0);
  rep(i,n){
    int b; cin >>b;
    a.at(i)=b-1;
    s.at(i+1)=(s.at(i)+a.at(i))%k;
  }
  map<int,int> cnt;
  li ans=0;
  if(k>n+1)k=n+1;
  rep(i,k){
    li a=s.at(i);
    ans+=cnt[a];
    cnt[a]++;
  }
  repa(i,k,n+1){
    cnt[s.at(i-k)]--;
    ans+=cnt[s.at(i)];
    cnt[s.at(i)]++;
  }
  cout << ans;
}

/// confirm df==0 ///


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

using namespace std;

int n, k;
int pre[5100][5100], suf[5100][5100];
int arr[5100];
bool nece[5100];

void calc(int knap[][5100], int arr[]) {
    int i, j;
    knap[0][0] = 1;
    for (i=1;i<=n;i++) {
        for (j=0;j<=k;j++) {
            if (knap[i-1][j]||(j-arr[i]>=0&&knap[i-1][j-arr[i]])) knap[i][j] = 1;
        }
    }
}

int main() {
    int i, j;
    scanf("%d%d",&n,&k);
    for (i=1;i<=n;i++) scanf("%d",&arr[i]);
    calc(pre,arr);
    reverse(arr+1,arr+n+1);
    calc(suf,arr);
    reverse(arr+1,arr+n+1);
    for (i=0;i<=n/2;i++) {
        for (j=0;j<=k;j++) swap(suf[i][j],suf[n+1-i][j]);
    }
    for (i=0;i<=n+1;i++) {
        for (j=1;j<=k;j++) {
            suf[i][j] += suf[i][j-1];
        }
    }
    int cnt = 0;
    for (i=1;i<=n;i++) {
        for (j=0;j<k;j++) {
            if (!pre[i-1][j]) continue;
            //k-arr[i]~k-1
            int s = max(k-arr[i]-j,0), e = k-1-j;
            int val = suf[i+1][e]-((s)?suf[i+1][s-1]:0);
            if (val>0) nece[i] = true;
        }
        if (!nece[i]) cnt++;
    }
    printf("%d\n",cnt);

    return 0;
}


Measured memory_bytes: 203008
n,m=map(int,input().split())
minl=1
maxr=100000
for i in range(m):
    l,r=map(int,input().split())
    if l>minl:
        minl=l
    if r<maxr:
        maxr=r
if maxr-minl+1>0:
    print(maxr-minl+1)
else:
    print(0)

Measured memory_bytes: 3060
#include <cstdlib>
#include <iostream>
#include <tuple>
#include <vector>
using namespace std;

template<class T> inline void chmax(T &a, const T &b) { if(b > a) a = b; }

tuple<int, bool, int> calc(const vector<tuple<char, int, int>> &ants, int l) {
	tuple<int, bool, int> res{0, false, -1};
	const int n = ants.size();
	if(n == 0) return res;

	for(int i = 0; i < n; ++i) {
		if(get<0>(ants[i]) == 'R')
			chmax(res, make_tuple(l - get<1>(ants[i]), false, i));
		else
			chmax(res, make_tuple(get<1>(ants[i]), true, i));
	}

	int idx = get<2>(res);
	if(get<0>(ants[idx]) == 'R') {
		for(int i = idx + 1; i < n; ++i) {
			if(get<0>(ants[i]) == 'L')
				++idx;
		}
	}
	else {
		for(int i = idx - 1; i >= 0; --i) {
			if(get<0>(ants[i]) == 'R')
				--idx;
		}
	}

	get<2>(res) = get<2>(ants[idx]);
	return res;
}

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

	for(int n, l; cin >> n >> l && n;) {
		vector<tuple<char, int, int>> even, odd;
		for(int i = 0; i < n; ++i) {
			char d;
			int p;
			cin >> d >> p;
			(p & 1 ? odd : even).emplace_back(d, p, i + 1);
		}

		const auto answer = max(calc(odd, l), calc(even, l));
		cout << get<0>(answer) << " " << get<2>(answer) << endl;
	}
	return EXIT_SUCCESS;
}

Measured memory_bytes: 1204
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main () {
    let n = read::<usize>();
    let k = read::<i64>();
    let q = read::<usize>();
    
    let mut a = vec![0; q];
    let mut b = vec![0; n];
    for i in 0..q {
        a[i] = read::<usize>();
        b[a[i]-1] += 1
    }
    for i in 0..n {
        if b[i] > q as i64 - k {
            println!("Yes")
        } else {
            println!("No")
        }
    }
}

Measured memory_bytes: 6780
#include<iostream>

using namespace std;

int main(){
    int n;
    int sum = 0, day, x, tmp;
    cin >> n >> day >> x;

    for(int i = 0; i < n; i++){
        cin >> tmp;
        for(int j = 0; j < 1000; j++){
            if(j*tmp + 1 > day) break;
            sum ++;
        }
    }
    cout << x + sum << endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	ans := make([]byte, 0, len(s)/2+1)
	for i := 0; i < len(s); i += 2 {
		ans = append(ans, s[i])
	}
	fmt.Println(string(ans))
}


Measured memory_bytes: 1408
import sys

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

A, B = LI()

concent = 1
ans = 0
while True:
    if concent >= B:
        break
    else:
        concent = concent - 1 + A
        ans += 1

print(ans)


Measured memory_bytes: 38384
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
var mod = 998244353;
function abmod(){for(var a=arguments,r=a[0],i=1;i<a.length;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i++])%mod;return r;}
var fac=[1,1];
function fSet(n){for(var i=2;i<=n;)fac[i]=abmod(fac[i-1],i++);}
function modinv(a){for(var b=mod,u=1,v=0,t;b;v=t)t=a/b|0,a-=t*b,u-=t*v,t=a,a=b,b=t,t=u,u=v;u%=mod;return u<0?u+mod:u;}
function nCrmod(n,r){return abmod(fac[n],modinv(abmod(fac[r],fac[n-r])));}

console.log(main());
function main(){
  var n = o.a();
  var m = o.a();
  var m3 = 3*m;
  fSet(m3+n);
  var ans = 0;
  var mx = Math.min(n,m);
  for(var i = m&1; i <= mx; i += 2){
    var j = m3-i >> 1;
    var t = nCrmod(j+n-1,j);
    t = abmod(t, nCrmod(n, i))
    ans += t;
  }
  for(var i = 0; i < m; i++){
    var t = abmod(n, nCrmod(i+n-2,i));
    ans -= t;
  }
  ans %= mod;
  ans += mod;
  return ans % mod;
}

Measured memory_bytes: 69612
#include<bits/stdc++.h>
using namespace std;
int main(){
	char s[101];
	int n=0;
	cin>>s;
	for(int i=0;i<strlen(s);i++)
	{
		if(s[i]=='C')
		{
			for(int j=i+1;j<strlen(s);j++)
			{
				if(s[j]=='F')
				{
					n++;
					break;
				}
			}
		}
	}
	if(n>0)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

#define rep(i,n) for(i=0;i<(n);i++)
#define For(i,a,b) for(i=(a);i<(b);i++)

int main(){
  int i,j,k;
  cin >> i >> j;
  cout << (j-i)+j << endl;
  return 0;
}


Measured memory_bytes: 256
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys

a = int(stdin.readline().rstrip())
print(a**3+a**2+a)


Measured memory_bytes: 77232
#include<stdio.h>
#define N 100
 
int main(){
 
	int m;
	int Ans=0;
 
	char S[N];
	scanf("%s",S);
	for(m=0; S[m]!='\0'; ++m);
 
 int i = 0;
  while(i < m-1-i){
  	if(S[i] != S[m - 1 - i]){
		S[m - i] = S[i];
		Ans++;
  	}	
 	i++;
 }
  	printf("%d",Ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 
#ifdef HOME
#include "/home/prateek2112/print.cpp"
#else
#define debug(...) 21
#endif

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int k;
   string s;
   cin >> k >> s;
   if(s.length()<=k){
      cout << s;
   }else{
      cout << s.substr(0,k) << "...";
   }
   return 0;
} 

Measured memory_bytes: 3648
N, L = map(int, input().split())
A = [int(i) for i in input().split()]

for i in range(1, N):
    if A[i-1]+A[i] >= L:
        print('Possible')
        ans = []
        for j in range(1, i):
            ans.append(j)
        for k in range(N-1, i, -1):
            ans.append(k)
        ans.append(i)
        print(*ans, sep='\n')
        exit()
print('Impossible')


Measured memory_bytes: 14052
#include <stdio.h>

int main(void) {
  int n, a, b, c;
  int i;

  scanf("%d", &n);

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

    if (a * a == b * b + c * c || b * b == c * c + a * a || c * c == a * a + b * b)
      printf("YES\n");
    else
      printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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








int main(){
    long long X, K, D; std::cin >> X >> K >> D;
    if(X < 0) X = -X;
    long long ans;
    if(X/D > K) ans = X - K * D;
    else{
        if(!((K - X/D) % 2)) ans = X - (X/D) * D;
        else ans = D - (X - (X/D) * D);
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<algorithm>

#define MAX 10000

using namespace std;

int p[MAX];
int ranks[MAX];

void makeset(int x){
	p[x]=x;
	ranks[x]=0;
}

void link(int x, int y){
	if(ranks[x]>ranks[y])
	p[y]=x;
	else{
		p[x]=y;
		if(ranks[x]==ranks[y])
		ranks[y]++;
	}
}

int findSet(int x){
	if(x!=p[x])
	p[x]=findSet(p[x]);
	return p[x];
}

void unite(int x, int y){
	link(findSet(x),findSet(y));
}

bool same(int x, int y){
	return findSet(x)==findSet(y);
}

int main(){
	int n,q;
	int com,x,y;
	bool ans;
	scanf("%d %d",&n,&q);
	for(int i=0;i<n;i++){
		makeset(i);
	}
	for(int i=0;i<q;i++){
		scanf("%d %d %d",&com,&x,&y);
		if(com==0)
		unite(x,y);
		else{
			ans = same(x,y);
			printf(ans==true ? "1\n" : "0\n");
		}
	}
}

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

int func(string s1, string s2)
{
    int ans = 0;
    for (char c = 'a'; c <='z'; c++) 
    {
        bool found_s1 = false, found_s2 = false;
        for (int i = 0; i < s1.length(); i++) 
        {
            if (s1[i] == c) found_s1 = true;
        }
        for (int i = 0; i < s2.length(); i++) 
        {
            if (s2[i] == c) found_s2 = true;
        }
        if (found_s1 && found_s2) ans++; 
    }
    return ans;
}

int main() 
{
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    for (int i = 0; i <= N; i++) 
    {
        int tmp = func(S.substr(0, i), S.substr(i));
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

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

const int N = 505;

int main() {
    int n;
    cin >> n;
    string x;
    cin >> x;
    int res = 0;
    for (int i = 0; i < n - 1; ++i) {
        string a = x.substr(0, i + 1);
        string b = x.substr(i + 1);
        vector< int> A(26, 0), B(26, 0);
        for (char c : a) A[c - 'a'] = 1;
        for (char c : b) B[c - 'a'] = 1;
        int cnt = 0;
        for (int j = 0; j < 26; ++j) if (A[j] + B[j] == 2) cnt++;
        res = max(cnt, res);
    }
    printf("%d\n", res);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
 
public class Hello{
 
    public static void Main(){
        // Your code here!
        int X = int.Parse(Console.ReadLine());
        int N = int.Parse(Console.ReadLine());
        
        int a = X%500;
        
        if(a <= N){
            System.Console.WriteLine("Yes");
        }else{
            System.Console.WriteLine("No");
        }
        
 
        
    }
}

Measured memory_bytes: 27332
#include <iostream>
#include <cstring>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <limits>
#include <map>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>

typedef long long li;
using namespace std;

li max(li a, li b) {
    return a > b ? a : b;
}

li max(li a, li b, li c) {
    return max(a, max(b, c));
}

li max(li a, li b, li c, li d) {
    return max(a, max(b, max(c, d)));
}

li max(li a, li b, li c, li d, li e) {
    return max(a, max(b, max(c, max(d, e))));
}


li pow_mod(li n, li e, li mod)
{
    li r = 1;
    
    while(e > 0)
    {
        if(e & 1)
            r *= n;
            r %= mod;
        
        n *= n;
        n %= mod;
        e >>= 1;
    }
    
    return r;
}

double solve(int n, unordered_map<int, double> & m) {
    double maxV = 0.0;
    
    if (m.count(n)) return m[n];
    if (n == 0) return 0.0;
    
    for (int i = 1; i <= n; i++) {
        maxV = max(maxV, solve(n - i, m)+ (double)i / (double)n);
    }
    
    return m[n] = maxV;
}

int solve(vector<int> & v, int n) {
    if (n < 0) return 0;
    vector<int> a, b;
    int minV = 0;
    
    for (int num: v) {
        if (num & (1 << n)) a.push_back(num);
        else b.push_back(num);
    }
    
    
    if (a.size() && b.size()) minV += (1 << n);
    
    if (a.size() && b.size()) minV += min(solve(a, n - 1), solve(b, n - 1));
    else if (a.size()) minV += solve(a, n - 1);
    else if (b.size()) minV += solve(b, n - 1);
    
    return minV;
    
}

int main() {
	int h, a;
	cin >> h >> a;
  
  	int n = h / a;
  
  	if (h % a) n++;
  
  	cout << n << endl;
    
    return 0;
}

 

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

std::vector<std::pair<long long, long long>> prime_factorize(long long N) {
	std::vector<std::pair<long long, long long>> result;

	for (long long i = 2; i * i <= N; i++) {
		if (N % i != 0) continue;

		long long power = 0;
		while (N % i == 0) {
			N /= i;
			power++;
		}

		result.push_back({ i,power });
	}

	if (N != 1) result .push_back({ N,1 });

	return result;
}

int main() {
	long long N;
	std::cin >> N;
	
	if (N == 1) {
		std::cout << 0 << std::endl;
		return 0;
	}
	if (N == 2 || N == 3) {
		std::cout << 1 << std::endl;
		return 0;
	}

	auto factor_list = prime_factorize(N);
	long long answer = 0;
	for (auto factor : factor_list) {
		long long count = 1;
		while (factor.second-count >= 0) {
			factor.second -= count;
			count++;
		}
		count--;
		answer += count;
	}

	std::cout << answer << std::endl;
	return 0;
}

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

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SORTVG(v) sort(v.begin(),v.end(),greater<>())
#define SORTV(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2
#define int long long

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}
template<class T> void AorB(T& a, string A,string B) {if(a){cout << A << ENT;}else{cout << B << ENT;}}

int atcoder(){
    string s;
    cin>>s;
    if(s.length()==3){
    	reverse(ALL(s));
    }
    cout<<s<<ENT;
    return 0;
}

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


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	//input
	string s;
	int K;
	cin >> s >> K;

	set<string> s_s;

	int s_len = s.size();
	for (int i = 0; i < s_len; i++) {
		for (int j = 1; j <= K; j++) {
			s_s.insert(s.substr(i, j));
		}
	}
	auto s_p = s_s.begin();
	for (int i = 0; i < K - 1; i++) {
		s_p++;
	}
	cout << *s_p;

	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a) 0<=a&&a<n
using namespace std;
int n,f[8][8],dy[]={-1,0,1,0},dx[]={0,-1,0,1};
bool dfs(int sy,int sx,int fy,int fx,int r){
	bool a=0;
	if(r>0)return 0;
	if(r==0){
		for(;sy<n&&(sx>=n||f[sy][sx]>=0);sx++)if(sx>=n)sx=-1,sy++;
		if(sy<n){
			r=f[sy][sx];f[sy][sx]=0;
			a=dfs(sy,sx,sy,sx,r);
			f[sy][sx]=r;
			return a;
		}
		a=1;rep(i,n)rep(j,n)if(f[i][j])a=0;
		return a;
	}
	rep(d,4){
		int ny=fy+dy[d],nx=fx+dx[d],t;
		if(ck(ny)&&ck(nx)&&f[ny][nx]>0&&f[ny][nx]+r<=0){
			t=f[ny][nx];f[ny][nx]=0;
			a=a||dfs(sy,sx,ny,nx,r+t);
			f[ny][nx]=t;
			if(a)return a;
		}
	}
	return a;
}
int main(){
	while(cin>>n,n){
		rep(i,n)rep(j,n)cin>>f[i][j];
		cout<<(dfs(0,0,0,0,0)?"YES":"NO")<<endl;
	}
	return 0;
}

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

int t[40000],u[40000],v[40000];
#define B 200

int par[40000];
int find(int x){
	if(par[x]==x)return x;
	return par[x]=find(par[x]);
}
void unite(int x,int y){
	x=find(x);y=find(y);
	par[x]=y;
}

multiset<int>E[40000];
int d[40000];

int main(){
	int n,k;scanf("%d%d",&n,&k);
	rep(i,k){
		scanf("%d%d%d",&t[i],&u[i],&v[i]);
	}
	set<P>se;
	for(int i=0;i<k;i+=B){
		set<P>s2,s3;
		for(int j=i;j<k&&j-i<B;j++){
			if(t[j]==2){
				if(se.count(P(u[j],v[j]))){
					se.erase(P(u[j],v[j]));
					s3.insert(P(u[j],v[j]));
				}
			}
		}
		rep(i,n)par[i]=i;
		for(auto p:se)unite(p.first,p.second);
		rep(j,n)E[j].clear();
		for(auto p:s3){
			E[find(p.first)].insert(find(p.second));
			E[find(p.second)].insert(find(p.first));
		}
		for(int j=i;j<k&&j-i<B;j++){
			if(t[j]==1){
				s2.insert(P(u[j],v[j]));
				u[j]=find(u[j]);v[j]=find(v[j]);
				E[u[j]].insert(v[j]);
				E[v[j]].insert(u[j]);
			}
			else if(t[j]==2){
				s2.erase(P(u[j],v[j]));
				u[j]=find(u[j]);v[j]=find(v[j]);
				E[u[j]].erase(E[u[j]].find(v[j]));
				E[v[j]].erase(E[v[j]].find(u[j]));
			}
			else{
				memset(d,0,sizeof(d));
				queue<int>que;
				d[find(u[j])]=1;
				que.push(find(u[j]));
				while(!que.empty()){
					int p=que.front();que.pop();
					for(int v:E[p]){
						if(d[v]==0){
							d[v]=1;que.push(v);
						}
					}
				}
				if(d[find(v[j])]==1)puts("YES");
				else puts("NO");
			}
		}
		for(auto p:s2)se.insert(p);
	}
}

Measured memory_bytes: 7208
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def get_sumd(n):
    return 0 if n == 0 else n%10 + get_sumd(n//10)

def solve():
    n  = f()[0]
    sumd = get_sumd(n)

    if n%sumd == 0:
        print('Yes')
    else:
        print('No')

solve()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int k,n;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int ans=k+a[0]-a[n-1];
    for(int i=0;i<n-1;i++){
        if(a[i+1]-a[i]>ans)ans=a[i+1]-a[i];
    }
    cout<<k-ans<<endl;
}

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

int main(){
	int n, a[3], max;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[0] >> a[1] >> a[2];
		if (a[0] >= a[1]){
			if (a[0] >= a[2]){
				max = 0;
			}
			else max = 2;
		}
		else {
			if (a[1] >= a[2]){
				max = 1;
			}
			else max = 2;
		}
		switch (max){
		case 0:
			if (((double)a[max] * a[max] / (a[1] * a[1] + a[2] * a[2])) == 1) max = 1;
			else max = 0;
			break;
		case 1:
			if (((double)a[max] * a[max] / (a[0] * a[0] + a[2] * a[2])) == 1) max = 1;
			else max = 0;
			break;
		case 2:
			if (((double)a[max] * a[max] / (a[1] * a[1] + a[0] * a[0])) == 1) max = 1;
			else max = 0;
			break;
		}
		if (max == 1){
			cout << "YES" << '\n';
		}
		else cout << "NO" << '\n';
	}
	return 0;
}

Measured memory_bytes: 1120
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define FORR(i, m, n) for(ll i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n)
#define MAX 100000
#define inf 1000000007
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
using graph = vector<vector<int>>;

int main() {
    //cin高速化
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll V = 0, E = 0;
    FOR(i, 1, n) V += i * (n-i+1);
    REP(i,n-1) {
        ll a, b;
        cin >> a >> b;
        if (a > b) swap(a,b);
        E += a * (n-b+1);
    }
    ll ans = V-E;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>

int N;
int a[200000];

#define MAGIC 4

int main(void) {
	int i, j;
	int kazu[MAGIC] = {0};
	int count[MAGIC] = {0};
	int slot = 0;
	int yes;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &a[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		int found = 0;
		for (j = 0; j < MAGIC && j < slot; j++) {
			if (kazu[j] == a[i]) {
				found = 1;
				count[j]++;
			}
		}
		if (!found && slot < MAGIC) {
			kazu[slot] = a[i];
			count[slot] = 1;
			slot++;
		}
	}
	yes = 0;
	switch (slot) {
		case 1:
			/* 1種類→全部0ならおｋ、それ以外はNG */
			yes = 0;
			if (kazu[0] == 0) yes = 1;
			break;
		case 2:
			/* 2種類→3種類のx 0 x相当ならおｋ，それ以外はNG */
			yes = 0;
			if (kazu[0] == 0 && count[0] * 2 == count[1]) yes = 1;
			if (kazu[1] == 0 && count[1] * 2 == count[0]) yes = 1;
			break;
		case 3:
			yes = 1;
			if (count[0] != count[1] || count[1] != count[2]) yes = 0; /* 数が同じでないとダメ */
			if ((kazu[0] ^ kazu[1]) != kazu[2]) yes = 0; /* xor関係になってないとダメ */
			break;
		default:
			yes = 0;
	}
	puts(yes ? "Yes" : "No");
	return 0;
}

/*

x1 + x3 = x2
x2 + x1 = x3
x3 + x2 = x1

x1 + x3 = x2
x2 + x4 = x3
...
xi-2 + xi = xi-1
xi-1 + xi+1 = xi
xi + xi+2 = xi+1
...
xj-2 + xj = xj-1
xj-1 + xj+1 = xj
xj + xj+2 = xj+1
...
xn-1 + x1 = xn
xn + x2 = x1

×全部xorして0ならYes
4
2 2 2 2

------
1 2 3 (1 2)
1 3 2 (1 3)
2 1 3 (2 1)
2 3 1 (2 3)
3 1 2 (3 1)
3 2 1 (3 2)

------

00010
00101
00111
00010
00101
00111

最初に決めた2個+そこから決まる1個でループになる

スタート
↓
Nが3の倍数でない→No
分布が3通りの数を同じ数ずつでない→No
3通りの数がxor関係にない→No
↓
Yes

a + b = c のとき、両辺にbをxorして a = c + b
両辺にaをxorして b = c + a
よって、xor関係は1個チェックすればおｋ

*/


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long int
#define F first
#define S second
#define pb push_back
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y);
#define sdl(x) scanf("%lld",&x)
#define sd2l(x,y) scanf("%lld%lld",&x,&y);
#define sz(x) (int)(x.size())
#define nax 101010
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define mp make_pair
#define pi pair<int ,int>
#define pii pair <int,pi>
using namespace std;
int arr[nax];
ll fact[nax];
ll ifact[nax];
vector< int > pos[nax];
ll modexp(ll a ,ll b)
{
  if(b == 0)
    return 1ll;
  else if(b == 1)
    return a%MOD;
  else if(b%2==1)
      return (a * modexp(a,b-1))%MOD;
  else
    return modexp((a*a)%MOD,b/2);
}
ll ncr(ll a, ll b)
{
  if(b > a)
    return 0;
  else
  {
    ll ret = fact[a];
    ret = (ret*ifact[b])%MOD;
    ret = (ret*ifact[a-b])%MOD;
    return ret;
  }
}
int main(int argc, char const *argv[])
{
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  int n;
  sd(n);
  int idx = -1;
  fact[0] = 1;
  ifact[0] = 1;
  for(int i = 1;i<=n+1; i++)
  {
    fact[i] = (fact[i-1] * i) % MOD;
    ifact[i] = modexp(fact[i],MOD-2);
    sd(arr[i]);
    pos[arr[i]].pb(i);
    if(sz(pos[arr[i]]) == 2)
    {
      idx = arr[i];
    }
  }
  int p1 = pos[idx][0];
  int p2 = pos[idx][1];
  int val = p1-1+n+1-p2;
  for(int i =1 ;i <= n+1;i++)
  {
     ll cans = (ncr(n+1,i)-ncr(val,i-1) + MOD)%MOD;
     printf("%lld\n",cans%MOD);
  }
  return 0;
}
 

Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x, n, y, z, i, t;
	scanf("%d", &n);
	if(n>=1 && n<=100){
			z=800*n;
		if(n>15){
			i=n/15;
			t=z-(i*200);
			printf("%d", t);
		}
		else{
			printf("%d", z);
		}
	}
	else{
		printf("Error");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;
int main() {
	int N, M, C;
	cin >> N >> M >>C;
	int Barr[20];
	int count = 0;
	for (int i = 0; i < M; i++) {
		cin >> Barr[i];
	}
	int Aarr[20][20];
	for (int i = 0; i < N; i++) {
		int tmp = C;
		for (int j = 0; j < M; j++) {
			cin >> Aarr[i][j];
			tmp += Aarr[i][j]* Barr[j];
	    }
		if (tmp > 0) {
			count += 1;
		}
	}

	cout << count << endl;
	return 0;
}

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

int main(){
    int W, H, x, y, r, xmin, xmax, ymin, ymax;
    cin >> W >> H >> x >> y >> r;

    xmin = x - r;
    xmax = x + r;
    ymin = y - r;
    ymax = y + r;

    if (0 <= xmin && xmax <= W && 0 <= ymin && ymax <= H) cout << "Yes" << endl;
    else cout << "No" << endl;

}


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

int main() {
  long long n;
  cin>>n;
  vector<long long>a(n+1);
  for(long long i=0;i<n+1;i++) cin>>a[i];
  vector<long long>parent(n+1);
  parent[0]=1-a[0];
  for(long long i=1;i<n+1;i++) {
    if(parent[i-1]*2-a[i]<100000000000000000) parent[i]=parent[i-1]*2-a[i];
    else parent[i]=100000000000000000;
  }
  long long ans=a[n];
  long long x=a[n];
  for(int i=n-1;i>=0;i--){
    if(x%2==0 && x/2>parent[i]){
      ans=-1;
      break;
    }
    else if(x%2==1 && x/2+1>parent[i]){
      ans=-1;
      break;
    }
    else{
      ans+=min(parent[i],x)+a[i];
      x=min(parent[i],x)+a[i];
    }
  }
  if(n!=0) cout<<ans<<endl;    
  else{
    if(a[0]==1) cout<<1<<endl;
    else cout<<-1<<endl;
  }
}


Measured memory_bytes: 4840
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), T = sc.nextInt(), t[] = new int[N], ans = 0;
		for (int i = 0; i < N; ++i) t[i] = sc.nextInt();
		sc.close();
		for (int i = 1; i < N; ++i) {
			if (t[i] - t[i - 1] > T) ans += T;
			else ans += t[i] - t[i - 1];
		}
		System.out.print(ans + T);
	}
}

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

// THINK: INT vs LONG LONG?

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

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i){
    	cin >> a[i];
    }
    ll cnt = 0;
    for (int i = 1; i < n; ++i){
    	if (a[i] < a[i - 1]){
    		cnt += (a[i - 1] - a[i]);
    		a[i] = a[i - 1];
    		// cnt++;
    	}
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3996
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		String str = "";
		while (sc.hasNextLine() == true) {
			str = sc.nextLine();
			double maxv = Double.parseDouble(str);
			double t = maxv / 9.8;
			
			double d = 4.9 * t * t;
			
			int f = (int)Math.ceil(d / 5) + 1;
			System.out.println(f);
		}
	}
}

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  int N;
  cin >> N;
  int h[N];
  for (int i = 0; i < N; i++) cin >> h[i];

  bool flag = false;
  for (int i = 0; i < N - 1; i++) {
    if (!flag && h[i] > h[i+1] && h[i] - h[i+1] == 1) {
      h[i]--;
      flag = true;
    }

    if (h[i] < h[i+1]) flag = false;

    if (h[i] > h[i+1]) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

W, H, x, y = MAP()

print((W*H)/2, '1' if (x==W/2 and y==H/2) else '0')

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll A, B;

int main() {
    cin >> A >> B;
    ll dif = B - A;
    if(A % 2) {
        if(B % 2) {
            ll ans = A ^ ((dif / 2) % 2);
            cout << ans << "\n";
        } else {
            ll ans = A ^ (B ^ (((dif - 1) / 2) % 2));
            cout << ans << "\n";
        }
    } else {
        if(B % 2)
            cout << ((dif + 1) / 2 % 2) << "\n";
        else {
            ll ans = B ^ ((dif / 2) % 2);
            cout << ans << "\n";
        }
    }
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;

const int N = 2 * 1e5 + 5;
int n, q, a, b;
vector<int> r[N], ans(N);

void dfs(int v, int p = -1) {
  for (int u : r[v]) {
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u, v);
  }
  return;
}

int main() {
  cin >> n >> q;
  int p, x;
  rep(i, n - 1) cin >> a >> b, a--, b--, r[a].push_back(b), r[b].push_back(a);
  rep(i, q) {
    cin >> p >> x, p--;
    ans[p] += x;
  }
  dfs(0);

  rep(i, n) cout << ans[i] << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 23424
import math
a,b = map(int,(input().split()))
MOD = 10**9 +7
if abs(a-b) > 1:
    print(0)
elif abs(a-b) == 1:
    print(math.factorial(a)*math.factorial(b) %MOD)
else:
    print(((math.factorial(a)**2)*2 %MOD))

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

int main() {
  int n;
  cin >> n;
  cout << (n*n*n) << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int N,K; cin >> N >> K;
  vector<ll> A(N);
 for(int i = 0; i < N; i++){ cin >> A[i];}
  vector<ll> B(N); vector<ll> C(N);
  B[0] = max(0LL,A[0]); C[0] = A[0];
  for(int i = 1; i < N; i++){
    B[i] = B[i-1] + max(0LL,A[i]);
    C[i] = C[i-1] + A[i];}
  
  ll ans = 0LL;
  
  for(int i = 0; i <= N-K; i++){
    ll res1 = 0; ll res2 = 0;
    
    if(i){ res1 += B[i-1]-C[i-1];} if( i+K <= N){ res1 +=C[i+K-1]-B[i+K-1];}
    res1 += B[N-1];
    
    if(i){ res2 += B[i-1];} if(i+K <= N){ res2 -= B[i+K-1];}
    res2 += B[N-1];
    
    ans = max(ans,max(res1,res2));}
  
  cout << ans << endl; return 0;}
    
    

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];

int32_t main(){_
         
      string s;
   cin >> s;

   bool a = false, b = false;

   for(auto it: s){
      a |= it == 'A';
   }
   
   for(auto it: s){
      b |= it == 'B';
   }

   if (a and b){
      cout<<"Yes\n";
   }
   else{
      cout<<"No\n";
   }

   return 0;
}


Measured memory_bytes: 3588
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

int n;
int a[N][3];
int mem[N][3];

int go(int idx , int lst){
    if(idx == n + 1)
        return 0;
    if(~mem[idx][lst])
        return mem[idx][lst];
    int best = 0;
    for(int i = 0; i < 3; i++){
        if(idx == 1 || lst != i){
            best = max(best , go(idx + 1 , i) + a[idx][i]);
        }
    }
    return mem[idx][lst] = best;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 3; j++){
            scanf("%d" , &a[i][j]);
        }
    }
    memset(mem , -1 , sizeof mem);
    printf("%d\n" , go(1 , 0));
}


Measured memory_bytes: 10496
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int a=sc.nextInt();
	int b=sc.nextInt();
	int h=sc.nextInt();
	int m=sc.nextInt();
	double angle = Math.abs(h*30+m*0.5-m*6);
	double result = Math.cos(Math.toRadians(angle));
	double x =a*a+b*b-2*a*b*result;
	double ans = Math.sqrt(x);
	System.out.println(ans);
	}
}

Measured memory_bytes: 35984
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void){
	int n;
	int box[101];
	int i;
	int sum,x;
	scanf("%d",&n);
	sum=0;
	for(i=0;i<n;i++){
		scanf("%d",&box[i]);
		sum+=box[i];
	}
	sort(box,box+n);
	x=0;
	for(i=0;i<n;i++){
		if(box[i]%10!=0){
			x=box[i];
			break;
		}
	}
	if(sum%10!=0)	printf("%d\n",sum);
	else{
		if(x!=0)	printf("%d\n",sum-x);
		else		printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	int n,i;
	char a[100]={};
	char b[100]={};
	while(~scanf("%d",&n)){
		getchar();
		if(n%2){
			for(i=0;i<n;i++)
				scanf("%c",&a[i]);
			printf("No\n");
		}else{
			for(i=0;i<n/2;i++)
			scanf("%c",&a[i]);
			for(i=0;i<n/2;i++)
				scanf("%c",&b[i]);
			if(strcmp(a,b)==0)
				printf("Yes\n");
			else
				printf("No\n");
		}		
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
	}
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let c = sc.read_chars();

    let mut cum = vec![0; n + 1];
    for i in 0..n {
        cum[i + 1] = match c[i] {
            'W' => cum[i] + 1,
            'R' => cum[i],
            _ => unreachable!(),
        }
    }

    let ans = (0..=n)
        .map(|i| cmp::max(cum[i], n - i - (cum[n] - cum[i])))
        .min()
        .unwrap();
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 3388
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	ll n; cin >> n;
	vector<ll> dp(n + 1);
	dp[0] = 2;
	dp[1] = 1;
	for(int i = 2; i <= n; ++i) dp[i] = dp[i - 1] + dp[i - 2];
	cout << dp[n] << '\n';
}

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

template<typename T, T mod>
class Modint {
private:
  T x;

public:
  Modint(): x((T)0) {}
  Modint(T y): x(y >= 0? y % mod: (mod - (-y) % mod) % mod) {}

  T get() {
    return x;
  }

  Modint &operator+=(const Modint &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }

  Modint &operator-=(const Modint &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  Modint &operator*=(const Modint &p) {
    x = x * p.x % mod;
    return *this;
  }

  Modint &operator/=(const Modint &p) {
    *this *= p.inverse();
    return *this;
  }

  Modint operator-() const { return Modint(-x); }
  Modint operator+(const Modint &p) const {return Modint(*this) += p; }
  Modint operator-(const Modint &p) const {return Modint(*this) -= p; }
  Modint operator*(const Modint &p) const {return Modint(*this) *= p; }
  Modint operator/(const Modint &p) const {return Modint(*this) /= p; }

  bool operator==(const Modint &p) const { return x == p.x; }
  bool operator!=(const Modint &p) const { return x != p.x; }

  Modint inverse() const {
    T a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return Modint(u);
  }

  Modint pow(int e) const {
    T a = 1, p = x;
    while(e > 0) {
      if (e % 2 == 0) {
	p = (p * p) % mod;
	e /= 2;
      } else {
	a = (a * p) % mod;
	e--;
      }
    }
    return Modint(a);
  }
};

constexpr long long MOD = 1000000007;

using mi = Modint<long long, MOD>;

int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> a(n + 1, true);
  for (int i = 0; i < m; ++i) {
    int tmp;
    cin >> tmp;
    a[tmp] = false;
  }

  vector<mi> dp(n + 10, mi(0));
  dp[0] += 1;
  dp[1] += 1;
  for (int i = 2; i <= n; ++i) {
    if (!a[i]) continue;
    dp[i] += (dp[i - 1]* mi((int)a[i - 1])) + (dp[i - 2] * mi((int)(a[i - 2])));
  }

  cout << dp[n].get() << '\n';
  return 0;
}


Measured memory_bytes: 4000
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

import math

print(2*n*math.pi)

Measured memory_bytes: 9184
#include <cstdio>
#include <algorithm>
const int maxn = 1e5 + 5;
using namespace std;
struct QNode{
	int t, a, res, id;
	bool operator< (QNode x)const{
		return t < x.t || (t == x.t && a < x.a);
	}
}q[maxn]; int X, n, Q, r[maxn], opt = -1;
bool cmpid(QNode x, QNode y){
	return x.id < y.id;
}
int main(){
	scanf("%d%d", &X, &n); for (int i = 1; i <= n; i++) scanf("%d", r + i);
	scanf("%d", &Q); for (int i = 1; i <= Q; i++) scanf("%d%d", &q[i].t, &q[i].a), q[i].id = i;
	sort(q + 1, q + Q + 1);
	int lr = 0, lq = 1, u = X, d = 0, S = 0;
	while (lq <= Q){
		if (r[lr + 1] < q[lq].t && lr < n){
			++lr; int t = opt * (r[lr] - r[lr - 1]);
			d = max(0, min(X, d + t));
			u = max(0, min(X, u + t));
			S += t; opt *= -1;
		}
		else{
			q[lq].res = max(d, min(u, S + q[lq].a));
			q[lq].res = min(X, max(0, q[lq].res + opt * (q[lq].t - r[lr])));
			++lq;
		}
	} sort(q + 1, q + Q + 1, cmpid);
	for (int i = 1; i <= Q; i++) printf("%d\n", q[i].res);
	return 0;
}

Measured memory_bytes: 3072
# K回前と現在の問いが同じだったら0点

str1 = input().split(" ")
str2 = input().split(" ")
t = list(input())

n = int(str1[0])
k = int(str1[1])

r = int(str2[0])
s = int(str2[1])
p = int(str2[2])

result = 0
hoge = 0
for i in range(0,n):
    if i < k:
        continue

    j = i-k
    if t[i] == t[j]:
        t[i] = "_"

pres = p * t.count("r")
rres = r * t.count("s")
sres = s * t.count("p")

print(pres + rres + sres)

Measured memory_bytes: 4084