akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>

using namespace std;



int main()
{
	int t, p, r;
	while(1){
		cin >> t >> p >> r;
		if(t == 0 && t == 0 && r == 0) break;
		vector<pair<int, pair<int, int> > > score(60);
		// score.first が正解数、(score.second).firstがペナルティ、(score.second).secondがチーム番号
		int wrong[60][11] = {0};
		// 誤答数[チーム番号][問題番号]
		for(int i = 0; i <= t; i++){
			score[i].first = 0;
			(score[i].second).first = 0;
			(score[i].second).second = i + 1;
		}
		int team_r, problem_r, time_r;
		string message_r;
		for(int i = 0; i < r; i++){
			cin >> team_r >> problem_r >> time_r >> message_r;
			if(message_r == "CORRECT"){
				score[team_r-1].first--;
				(score[team_r-1].second).first += 1200 * wrong[team_r-1][problem_r] + time_r;
			} else if(message_r == "WRONG"){
				wrong[team_r-1][problem_r]++;
			}
		}
		sort(score.begin(), score.begin() + t);
		for(int i = 0; i < t; i++){
			cout << (score[i].second).second << ' ' << -(score[i].first) << ' ' << (score[i].second).first << endl;
		}
	}
	return 0;
}

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

string get_comparison (int a, int b) {
  if (a < b) return "a < b";
  if (a > b) return "a > b";
  else return "a == b";
}

int main(int argc, char const *argv[])
{
  int a, b;
  cin >> a >> b;

  string judge = get_comparison(a, b);
  cout << judge << "\n";

  return 0;
}



Measured memory_bytes: 3176
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N = 0;
  int K = 0;
  int A = 1;
  std::cin >> N;
  std::cin >> K;
  
A=N-K+1;

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

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

int N,maxadd,minadd,maxmin,minmin,x,y;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	minadd = INFINITY;
	minmin = INFINITY;
	cin>>N;
	maxadd = -2e9;
	maxmin = -2e9;
	for(int i = 1;i <= N;i++){
		cin>>x>>y;
		maxadd = max(maxadd,x + y);
		maxmin = max(maxmin,x - y);
		minadd = min(minadd,x + y);
		minmin = min(minmin,x - y);
	}
	cout<<max(maxadd - minadd,maxmin - minmin)<<endl;
}


Measured memory_bytes: 3632
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")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let x = read::<i64>();
  let y = read::<i64>();

  println!("{}", 2 * y - x);
}



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

using namespace std;

/********************************MACROS********************************/

#define int long long
#define ld long double
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define vt vector
#define pb push_back
#define F first
#define S second
#define u_s unordered_set
#define u_m unordered_map
#define p_q priority_queue

/*******************************DEBUGGER*******************************/

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define deb(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

/******************************ALGORITHMS******************************/

int __pow(int x, int y, int M) {int res = 1;while(y>0){if(y&1) res = (res*x)%M; y>>=1; x = (x*x)%M;}return res%M;}
int gcd(int a, int b) {if(b==0) return a; return gcd(b, a % b);}

/******************************MAIN**CODE******************************/

const int N = 3e5+2, inf = 1e18, M = 1e9+7;

int test, n, m, k, query;

void test_case(){
    cin>>n>>k;
    vt<int> a(n);
    for(auto &x:a) cin>>x;
    vt<int> dp(n);
    for(int i=0; i<=min(k,n-1); i++){
        dp[i]=abs(a[i]-a[0]);
    }
    for(int i=1; i<n; i++){
        dp[i]=dp[i-1] + abs(a[i]-a[i-1]);
        for(int j=i-1;j>=max(0LL,i-k); j--){
            dp[i]=min(dp[j]+abs(a[i]-a[j]), dp[i]);
        }
        //debug()<<deb(dp);
    }
    cout<<dp[n-1]<<endl;   

}
int32_t main(){
    test = 1;
    //cin>>test;
    while(test--)
        test_case();
#ifndef ONLINE_JUDGE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
    return 0;
}


Measured memory_bytes: 4848
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int A;
        for(int i=0;i<5;i++){
            A=sc.nextInt();
            if(A==0){
                System.out.println(i+1);
                return;
            }
        }
        
        
	}
}

Measured memory_bytes: 35732
function Main(input) {
  input = input.split("\n");
  tmp= input[0].split(" ");
  var a = tmp[0];
  var b = tmp[1];
  var s;
  if(a!="H"){
    if(b=="H"){
      s="D";
    }else{
      s="H";
    }
  }else{
    s=b;
  }
  console.log('%s', s);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9420
#include <cstdio>
#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <math.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
// typedef pair<ll,ll> P;

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

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

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

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
vector<int>G[10010];
vector<int>c(10010,0);
int num[10010];
bool used[10010];
int now_c=0;
int dfs(int s){
    if(used[s]){
        return 0;
    }else{
        used[s]=true;
    }

    num[s]=c[now_c];
    now_c++;

    for(int i=0; i<G[s].size(); i++){
        dfs(G[s][i]);
    }
    return 0;
}

int main() {
    int N; cin >> N;
    vector<int>a(N+1),b(N);

    rep(i,N+1){
        cin >> a[i];
    }

    rep(i,N){
        cin >> b[i];
    }

    int mochikoshi=0;
    lli ans=0LL;
    for(int i=0; i<N+1; i++){
        ans+=min(mochikoshi, a[i]);
        a[i]=max(a[i]-mochikoshi, 0);
        ans+=min(a[i], b[i]);
        mochikoshi=max(0,b[i]-a[i]);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>

using namespace std;

int main() {
	int a{}, b{}, c{}, k{};
	cin >> a >> b >> c >> k;

	int point=0;
	for (size_t i = 0;i < k;i++) {
		if (a > 0) {
			point += 1;
			--a;
		}
		else if (b > 0) {
			--b;
		}
		else {
			point -= 1;
			c--;
		}
	}
	cout << point;
}

Measured memory_bytes: 3644
N=int(input())
*A,=map(int,input().split())
S=sum(A)

count=[[]for _ in range(N-1)]
count[0]=[A[0],S-A[0]]
i=1
while i<N-1:
    count[i]=[A[i]+count[i-1][0],S-(A[i]+count[i-1][0])]
    i+=1

print(min(abs(l-r) for l,r in count))

Measured memory_bytes: 50304
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=200005;
int n,ans,fa[N],x,cnt0[N],cnt1[N],f[N];
struct cmp{
    bool operator()(const int &a,const int &b){
        if (cnt0[a]*cnt1[b]!=cnt1[a]*cnt0[b])
        	return cnt0[a]*cnt1[b]>cnt1[a]*cnt0[b];
        else return a>b;
    }
};
set<int,cmp> S;
int find(int x){
	if (x==f[x])return x;
	return f[x]=find(f[x]);
}
signed main(){
	scanf("%lld",&n);
	for (int i=2;i<=n;i++)scanf("%lld",&fa[i]);
	for (int i=1;i<=n;i++){
		scanf("%lld",&x);
		if (x==1)cnt1[i]++;
		else cnt0[i]++;
	}
	for (int i=2;i<=n;i++)S.insert(i);
	for (int i=1;i<=n;i++)f[i]=i;
	for (int i=2;i<=n;i++){
		int k=*S.begin(),y=find(fa[k]);
		ans+=cnt1[y]*cnt0[k];
		S.erase(k);if (y!=1)S.erase(y);
		cnt0[y]+=cnt0[k],cnt1[y]+=cnt1[k];
		f[k]=y;if (y!=1)S.insert(y);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 15872
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a,AC=0,WA=0,TLE=0,RE=0;cin>>a;
  rep(i,a){
    string c;cin>>c;
    if(c=="AC")AC++;
    else if(c=="WA")WA++;
    else if(c=="TLE")TLE++;
    else RE++;
  } 
  cout<<"AC"<< " x "<<AC<<endl;
  cout<<"WA"<< " x "<<WA<<endl;
  cout<<"TLE"<< " x "<<TLE<<endl;
  cout<<"RE"<< " x "<<RE<<endl;
}


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

const int millennium = 196470;

int yearToDays(int y) {
    return 590 * ((int)(y-1)/3) + 195 * ((y-1)%3);
}

int monthToDays(int y, int m) {
    if (y % 3 == 0) {
        return 20 * (m-1);
    } else {
        return 39 * ((int)(m-1)/2) + 20 * ((m-1)%2);
    }
}

int main () {
    int n;
    cin >> n;
    while (n--) {
        int y, m, d;
        cin >> y >> m >> d;
        d += yearToDays(y) + monthToDays(y, m);
        cout << millennium - d + 1 << endl;
    }
}

Measured memory_bytes: 1160
N, K, S =map(int, input().split())
if S < 10**9:
  a1 = [S]*K
  a2 = [S+1]*(N-K)
  ans = a1+a2
  print(*ans)
else:
  a1 = [S]*K
  a2 = [S-1]*(N-K)
  ans = a1+a2
  print(*ans)
  

Measured memory_bytes: 7380
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 200010
using namespace std;
ll n,m,ans=0,sz;
bool vis[N];
vector<ll> vt[N];
void dfs(ll x)
{
	sz++;
	vis[x]=true;
	ll i;
	for(i=0;i<vt[x].size();i++)
	{
		if(!vis[vt[x][i]])
		{
			dfs(vt[x][i]);
		}
	}
	return;
}
int main(){
	ll i,x,y;
	scanf("%lld%lld",&n,&m);
	for(i=0;i<m;i++)
	{
		scanf("%lld%lld",&x,&y);
		x--;
		y--;
		vt[x].push_back(y);
		vt[y].push_back(x);
	}
	for(i=0;i<n;i++)
	{
		sort(vt[i].begin(),vt[i].end());
		vt[i].erase(unique(vt[i].begin(),vt[i].end()),vt[i].end());
	}
	for(i=0;i<n;i++)
	{
		if(!vis[i])
		{
			sz=0;
			dfs(i);
			ans=max(ans,sz);
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 21184
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし



A,B = MI()
if A <= 5:
    print(0)
elif A >= 13:
    print(B)
else:
    print(B//2)


Measured memory_bytes: 62056
X = int(input())
t = 0
for i in range(1000):
    if t == 1:
        break
    for j in range(1000):
        x5 = pow(i,5)
        y5 = pow(j,5)
        mx5 = -pow(i,5)
        my5 = -pow(j,5)
        if X == x5 - y5:
            print(i,j)
            t = 1
            break
        if X == mx5 - y5:
            print(-i,j)
            t = 1
            break
        if X == x5 - my5:
            print(i,-j)
            t = 1
            break

Measured memory_bytes: 9216
C[]={4,1,4,1,2,1,2,1},P[]={3,5,1,7,4,6,2,0},p[8],d,r,i,s,m,b;main(){for(;~scanf("%d",p+d);)if(++d==8){m=0;for(r=8;r--;s<m||(m=s,b=P[r]))for(s=0,i=8;i--;s+=p[i]<d?p[i]:d)d=C[(P[r]+i)%8];for(i=0;i<8;printf("%d%c",d,i++<7?32:10))d=C[(b+i)%8];d=0;}}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;


int main()
{

    int n,k,ans=0;
    scanf("%d %d",&n,&k);
    int a[n];

    for(int i=0;i<n;i++)
    {
        a[i]=0;
    }

    for(int i=0;i<k;i++)
    {
        int d,e;
        scanf("%d",&d);
        
        for(int j=0;j<d;j++)
        {
            scanf("%d",&e);
            a[e-1]=a[e-1]+1;
        }
    }

    for(int i=0;i<n;i++)
    {
        if(a[i]==0)
        {
            ans=ans+1;
        }
    }


    printf("%d\n",ans);
    

    return 0;
}

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

int main() {
  int N;
    cin >> N;
  rep(i,N) {
    string S_i;
    cin >> S_i;
    
    if(S_i == "Y") {
      cout << "Four" << endl;
      break;
    }
    
    if(i == N-1 && S_i != "Y") {
      cout << "Three" << endl;
    }
  }
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
#include<math.h>
//#include "Ants.h"
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef pair < int, int> P;
/****Union-Ford-Tree***/
int par[int(0x7ffffff)];//Parent
int Rank[int(0x7ffffff)];//Deep_of_the_Tree

//int a[100] = { 4,2,3,1,5 }, m[100] ={3,2,2};
//int n = 0;
//const ll mod = 1000000007;


//n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
//木の根探し
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}
/************************************************************************************/
int dx[4] = { 1,0/*,-1,0*/ }, dy[4] = { 0,1/*,0,-1*/ };
/**************/

typedef long double ld;
typedef unsigned long long ull;
const int MX = 3007;

ld f[MX][MX];

ld a[MX];
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	f[0][0] = 1.0;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= n; j++) {
			f[i + 1][j + 1] += f[i][j] * a[i];
			f[i + 1][j] += f[i][j] * (1.0 - a[i]);

		}
	}
	ld ans = 0.0;
	for (int i = 0; i <= n; i++) {
		if (i >= n - i)
			ans += f[n][i];
	}
	cout.precision(20);
	cout << fixed << ans << "\n";
	
	return 0;

}


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

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = line[0];
        var b = line[1];
        if (a[0] == '-' && b[0] == '-') { minus(b.Substring(1), a.Substring(1)); }
        else if (a[0] == '-' && b[0] != '-')
        {
            Console.Write('-');
            plus(a.Substring(1), b);
        }
        else if (a[0] != '-' && b[0] == '-') plus(a, b.Substring(1));
        else minus(a, b);
    }
    static void minus(string s2, string t2)
    {
        if (s2 == t2) { Console.WriteLine(0); return; }
        var sL = s2.Length;
        var tL = t2.Length;
        if (sL < tL) { Console.Write('-'); minus(t2, s2); return; }
        if (tL == sL && s2.CompareTo(t2) == -1)
        { Console.Write('-'); minus(t2, s2); return; }
        if (sL > tL) t2 = new string('0', sL - tL) + t2;
        else s2 = new string('0', tL - sL) + s2;
        var s = s2.ToCharArray();
        var t = t2.ToCharArray();
        var ans = new int[sL];
        Array.Reverse(s);
        Array.Reverse(t);
        var p = 0;
        var c = false;
        while (p < sL)
        {
            var sub = s[p] - t[p];
            if (c) sub--;
            if (sub < 0) { sub += 10; c = true; }
            else c = false;
            ans[p] = sub;
            p++;
        }
        Console.WriteLine(string.Join("", ans.Reverse().SkipWhile(x => x == 0)));
    }
    static void plus(string s2, string t2)
    {
        var sL = s2.Length;
        var tL = t2.Length;
        if (tL > sL) { plus(t2, s2); return; }
        t2 = new string('0', sL - tL) + t2;
        var s = s2.ToCharArray();
        var t = t2.ToCharArray();
        var ans = new int[sL];
        Array.Reverse(s);
        Array.Reverse(t);
        var p = 0;
        var c = false;
        while (p < sL)
        {
            var add = s[p] - '0' + t[p] - '0';
            if (c) add++;
            if (add >= 10) { add -= 10; c = true; }
            else c = false;
            ans[p] = add;
            p++;
        }
        Array.Reverse(ans);
        if (c) Console.Write(1);
        Console.WriteLine(string.Join("", ans));
    }
}



Measured memory_bytes: 23116
a = int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

def kuriage(n):
  mod10=n%10
  if mod10==0:
    return n
  else:
    return n+10-mod10

def kuriagesum(k,l,m,n,p):
  return kuriage(k)+kuriage(l)+kuriage(m)+kuriage(n)+p

S1=kuriagesum(a,b,c,d,e)
S2=kuriagesum(a,b,c,e,d)
S3=kuriagesum(a,b,d,e,c)
S4=kuriagesum(a,c,d,e,b)
S5=kuriagesum(b,c,d,e,a)
SS=[S1,S2,S3,S4,S5]
print(min(SS))

Measured memory_bytes: 3064
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
	#print(name)
	sys.stdin = open(name)

s = input()
ansns = 0
ansew = 0

ansns = s.count("N") * s.count("S")
if s.count("N")==0 and s.count("S")==0:
	ansns = 1

ansew = s.count("E") * s.count("W")
if s.count("E")==0 and s.count("W")==0:
	ansew = 1

ans = ansns * ansew

print("Yes" if ans!=0 else "No")


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

const int N = 410;
const int moder = 998244353;

int a[N], b[N];
int dp[N][N][2];
int fac[N], inv[N], invf[N];
int prob[N];

void add(int &a, int b, int c){a = (a + 1ll * b * c) % moder;}

int powermod(int a, int exp){
    int ret = 1;
    for ( ; exp > 0; exp >>= 1){
        if (exp & 1){
            ret = 1ll * ret * a % moder;
        }
        a = 1ll * a * a % moder;
    }
    return ret;
}

int main(){
    fac[0] = invf[0] = 1;
    for (int i = 1; i < N; ++ i){
        fac[i] = 1ll * i * fac[i - 1] % moder;
        inv[i] = i == 1 ? 1 : moder - 1ll * (moder / i) * inv[moder % i] % moder;
        invf[i] = 1ll * invf[i - 1] * inv[i] % moder;
    }
    int n;
    scanf("%d", &n);
    int sum = 0;
    for (int i = 0; i < n; ++ i){
        scanf("%d%d", &a[i], &b[i]);
        sum += a[i];
    }
    for (int i = 0; i < n; ++ i){
        prob[i] = 1ll * a[i] * inv[sum] % moder;
    }
    dp[0][0][0] = 1;
    for (int i = 0; i < n; ++ i){
        for (int j = N - 1; j >= 0; -- j){
            for (int k = N - 1; k >= 0; -- k){
                if (k + a[i] >= N){
                    continue;
                }
                for (int u = 0; u < 2; ++ u){
                    int now = dp[j][k][u], coe = prob[i];
                    for (int v = 0; v < b[i] && j + v < N; ++ v){
                        add(dp[j + v][k + a[i]][u ^ 1], now, invf[v]);
                        now = 1ll * now * coe % moder;
                    }
                }
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < N; ++ i){
        for (int j = 1; j <= sum; ++ j){
            for (int k = 0; k < 2; ++ k){
                int p = 1ll * j * inv[sum] % moder;
                int x = i;
                int y = powermod(p, moder - 2);
                ans = (ans + (k == 0 ? -1ll : 1ll) * fac[x] * powermod(y, x + 1) % moder * dp[i][j][k]) % moder;
            }
        }
    }
    ans += ans < 0 ? moder : 0;
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;
typedef long long ll;

const int N=500005;
vector<vector<int>> tree(4*N);
vector<int> val(N,0);

void build(int idx,int l,int r)
{
    if(l==r) tree[idx]={val[l]};
    else
    {
        int m=(l+r)/2;
        build(2*idx,l,m);
        build(2*idx+1,m+1,r);
        merge(tree[2*idx].begin(),tree[2*idx].end(),tree[2*idx+1].begin(),tree[2*idx+1].end(),back_inserter(tree[idx]));
    }
}

int query(int idx,int l,int r,int ql,int qr,int k)
{
    if(ql>qr) return 0;
    if(l==ql&&r==qr)
    {
        int a=-1,b=r-l+1;
        while(a<b-1)
        {
            int c=(a+b)/2;
            if(tree[idx][c]>k) b=c;
            else a=c;
        }
        return (r-l+1-b);
    }
    else
    {
        int m=(l+r)/2;
        return query(2*idx,l,m,ql,min(qr,m),k)+query(2*idx+1,m+1,r,max(ql,m+1),qr,k);
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,q;
    cin >> n >> q;
    vector<int> c(n+1,0);
    for(int i=1;i<=n;i++) cin >> c[i];
    vector<int> v(n+1,n+1);
    for(int i=n;i>=0;i--)
    {
        val[i]=v[c[i]];
        v[c[i]]=i;
    }
    build(1,1,n);
    while(q--)
    {
        int l,r;
        cin >> l >> r;
        cout << query(1,1,n,l,r,r) << "\n";
    }
    return 0;
}


Measured memory_bytes: 121356
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

int main(){
    ll n; cin>>n;
    vector<ll> a(n);
    bool possible=false;
    ll minuscnt=0;
    ll ans=0;
    rep(i,0,n){
        ll x; cin>>x;
        a[i]=abs(x);
        ans+=abs(x);
        if(x==0) possible=true;
        if(x<0) minuscnt++;
    }
    if(minuscnt%2==0) possible=true;

    sort(all(a));

    if(possible){
        cout<<ans<<endl;
    }else{
        cout<<ans-2*a[0]<<endl;
    }


}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}

ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}

        
//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
vi memo(110001);
int rec(int n){
  if(n==0)return 0;
  if(memo[n]!=-1)return memo[n];
  int res =n;
  for(int p6=1; p6<=n ;p6*=6)res =min(res,rec(n-p6)+1);
  for(int p9=1; p9<=n ;p9*=9)res =min(res,rec(n-p9)+1);
  return memo[n]=res;
}
int main(){
  int N;cin>>N;
  rep(i,110001)memo[i]=-1;
  cout<<rec(N)<<endl;
}


Measured memory_bytes: 8132
#include <stdio.h>

void swap(int* nx, int* ny) {
	int temp = *nx;
	*nx = *ny;
	*ny = temp;
}

void sort3(int* n1, int* n2, int* n3) {
	if (*n1 > * n2) swap(n1, n2);
	if (*n2 > * n3) swap(n2, n3);
	if (*n1 > * n2) swap(n1, n2);
}

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

	scanf("%d %d %d",&a,&b,&c);

	sort3(&a,&b,&c);

	if (a + b == c) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int l,r,d;
	cin>>l>>r>>d;
	int ans=0;
	for(int i=l;i<=r;i++)
	{
		if(i%d==0)
		ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T>
void print(T& x){printf("%d\n", x);}
void printvec(vector<int> a){
    rep(i, a.size()-1){
        printf("%d ", a[i]);
    }
    printf("%d\n", a[a.size()-1]);
}
 
int main()
{
    int k;
    string s;
    cin >> k;
    cin >> s;

    if(s.length() <= k){
        cout << s << endl;
    }else{
        rep(i, k){
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}


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

int main(){
    int n,m,X,Y;
    cin >> n >> m >> X >> Y;
    int max_x = -100;
    int x,y;
    int min_y = 100;
    for (int i = 0; i < n; i++){
        cin >> x;
        max_x = max(max_x,x);
    }
    for (int i = 0; i < m; i++){
        cin >> y;
        min_y = min(min_y,y);
    }
    if (min_y > max_x && max_x < Y && min_y > X){
        cout << "No War" << endl;
    }else{
        cout << "War" << endl;
    }
}

Measured memory_bytes: 256
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    a,b,c=map(int,input().split())
    if a<b<c:print("Yes")
    else:print("No")

main()



Measured memory_bytes: 6000
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
//#define base 1000000000000000000
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
inline void add(ll &a,ll b,ll c){a+=b;if(a>=c)a-=c;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=ans*a%c;a=a*a%c,b>>=1;}return ans;}
inline ll mul(ll a,ll b,ll c){return (a*b-(ll)((ld)a*b/c)*c+c)%c;}
inline ll qm(ll a,ll b,ll c){ll ans=0;while(b){if(b&1)add(ans,a,c);add(a,a,c);b>>=1;}return ans;}
inline ll qpow(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=mul(ans,a,c);a=mul(a,a,c);b>>=1;}return ans;}

using namespace std;

const ull ba=233;
const db eps=1e-10;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=(1<<15)+10,maxn=100000+10,inf=0x3f3f3f3f;


int main()
{
    ll a,b,c;scanf("%lld%lld%lld",&a,&b,&c);
    ll ans=0;
    if(c)ans++,c--;
    ll te=min(b,c);
    b-=te,c-=te,ans+=te*2;
    if(b)ans+=b;
    te=min(a,c);
    ans+=te;
    printf("%lld\n",ans);
    return 0;
}
/********************

********************/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

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

void solve(istream& cin, ostream& cout) {
  string s;
  cin >> s;
  int n = s.size() + 1;
  vector<int> a(n);
  REP(i, n - 1) {
    if (s[i] == '<') {
      a[i + 1] = max(a[i + 1], a[i] + 1);
    }
  }
  RREP(i, n - 1) {
    if (s[i] == '>') {
      a[i] = max(a[i], a[i + 1] + 1);
    }
  }
  ll ans = 0;
  REP(i, n) ans += a[i];
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 2844
#include<stdio.h>
#define MAX 2000000
#define INFTY 1073000000
void maxHeapify(int);
void insert(int);
void increaseKey(int,int);
int extractMax(void);
void swap(int,int);
int parent(int);
int left(int);
int right(int);
int A[MAX+1],H=0;

int main(){
  int key;
  char c[8];
  while(1){
    scanf("%s",c);
    if(c[0] =='e' && c[1] == 'n') break;
    if(c[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }
    else{
      printf("%d\n",extractMax());
    }
  }
  return 0;
}

void maxHeapify(int i){
  int r,l,largest;
  l = left(i);
  r = right(i);

  if(l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= H && A[r] > A[largest]) largest = r;

  if(largest != i){
    swap(i,largest);
    maxHeapify(largest);
  }
}

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

void swap(int i, int largest){
  int tmp;
  tmp = A[i];
  A[i] = A[largest];
  A[largest] = tmp;
}


void insert(int key){
  H++;
  A[H] = -INFTY;
  increaseKey(H,key);
}

 void increaseKey(int i,int key){
   if(key < A[i]) return;
   A[i] = key;
   while(i > 1 && A[parent(i)] < A[i]){
     swap(parent(i),i);
     i = parent(i);
   }
 }
 int extractMax(void){
   int max;
   if(H < 1) return -INFTY;
   max = A[1];
   A[1] = A[H];
   H--;
   maxHeapify(1);
   return max;
}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()



int main() {
    int N,L;
    cin >> N >> L;
    int sum=0;
    int minapple = 10000000;
    for(int i=1;i<=N;i++){
        sum += L+i-1;
        if(abs(minapple)>=abs(L+i-1))minapple = L+i-1;
    }

    cout << sum-minapple << endl;
}



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

typedef long long int   ll;
#define int             ll
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
#define scan(n)         scanf("%lld",&n)
#define pb              push_back
#define PI              3.1415926535897932384626433832795
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]
#define showar0(ar)     for(int i=0;i<n;i++)cout<<ar[i]<<" "
#define showar1(ar)     for(int i=1;i<=n;i++)cout<<ar[i]<<" "
#define FOR(i,a,b)      for (int i = a; i < b; i++)

int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}

signed main(){
    int n,m,k;cin>>n>>m>>k;
    vector<int> arr(n),brr(m);
    for(int i=0;i<n;i++) cin>>arr[i];
    for(int i=0;i<m;i++) cin>>brr[i];
    vector<int> psa(n+1),psb(m+1);
    psa[0]=0,psb[0]=0;
    for(int i=0;i<n;i++){
        psa[i+1]=psa[i]+arr[i];
    }
    for(int i=0;i<m;i++)
        psb[i+1]=psb[i]+brr[i];
    int ans=0;
    for(int i=0;i<=n;i++){
        int sum=k-psa[i];
        if(sum<0) continue;
        int l=lower_bound(psb.begin(),psb.end(),sum)-psb.begin();
        if(l>m or psb[l]>sum) l--;
        ans=max(i+l,ans);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 9556
n=gets.to_i
a=gets.chomp.split(" ").map(&:to_i)
arr=[]
for i in 1..n
	arr[i-1]=(a[i-1]-i)
end
arr.sort!
b=0
if(n%2==0)
	b=(arr[n/2]+arr[n/2-1])/2
else
	b=arr[n/2]
end
result=0
for i in 1..n
	result+=(a[i-1]-(i+b)).abs
end
p result

Measured memory_bytes: 21576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll N; cin >> N;
    vector<ll> v(N); for (int i = 0; i < N; ++i) cin >> v[i];
    bool ok = true;
    for (int i = N - 2; i > 0; --i) {
        if (v[i] <= v[i + 1]) continue;
        else if (v[i] == v[i + 1] + 1) v[i]--;
        else {
            ok = false;
            break;
        }
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
#define DIV0 1000000007
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    int X;
    cin >> X;
    if(X <400) fin("");
    else if(X < 600) fin("8");
    else if(X < 800) fin("7");
    else if(X < 1000) fin("6");
    else if(X < 1200) fin("5");
    else if(X < 1400) fin("4");
    else if(X < 1600) fin("3");
    else if(X < 1800) fin("2");
    else if(X < 2000) fin("1");
    return 0;
}

Measured memory_bytes: 3048
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
int test[213456];
int keta(int x) {
	int res = 0;
	while(x >= 1) {
		x /= 10; res++;
	}return res;
}
signed main() {
	int n, c, k, a, cnt = 1, atai = 0, ans = 0; cin >> n >> c >> k;
	for (int h = 0; h < n; h++) {
		cin >> a; test[h] = a;
	}
	sort(test, test + n);
	for (int h = 0; h < n; h++) {
		if (cnt == 1) { atai = test[h]; }
		if(test[h] - atai > k){ cnt = 1; atai = test[h]; ans++; }
		if (cnt == c) { cnt = 0; atai = 0; ans++; }
		cnt++;
		//cout << cnt << ' ' << atai << endl;
	}
	if (atai != 0) { ans++; }
	cout << ans << endl;
	cin >> n;
	return 0;
}

Measured memory_bytes: 1024
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	N := sc.nextInt()
	S := sc.nextStr()
	if N%2 != 0 {
		fmt.Println("No")
		return
	}
	half := N / 2
	if S[0:half] == S[half:] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
import java.util.*;


public  class Main {

    static class Node implements Comparable<Node>{

        @Override
        public int compareTo(Node o) {
            return ((Integer) o.A).compareTo(A);
        }

        int A;

        int B;

        public Node(int A, int B) {

            this.A = A;
            this.B= B;
        }
    }

    static int N;

    static int T;

    static Node[] nodes;

    static int[][] dp;

    public static void main(String[] args) {

        Scanner s=  new Scanner(System.in);

        int N = s.nextInt();

        int T = s.nextInt();

        nodes = new Node[N];

        dp = new int[N][T+1];

        for (int i = 0; i < N; i++) {

            int a = s.nextInt();

            int b = s.nextInt();

            nodes[i] = new Node(a,b);
        }

        Arrays.sort(nodes);

        System.out.println(happy(N-1 , T));
    }

    static int happy(int n, int t) {

        if (t == 0 || n < 0) return 0;

        if (dp[n][t] != 0) return dp[n][t];

        int a = nodes[n].A;

        int b = nodes[n].B;

        int r1 = happy(n-1, Math.max(0, t- a)) + b;

        int r2 = happy(n-1, t);

        int m = Math.max(r1,r2);

        dp[n][t] = m;

        return m;
    }
}

Measured memory_bytes: 88644
/*
Keep clam  Believe youself
*/
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<stack>
#include<set>
#include<cmath>
#define Xiaobo main
using namespace std;
const int maxn=2e5+7;
const int mod=1e9+7;
const double eps=1e-15;
const double pi=acos(-1);
const int INF=0x3f3f3f;
typedef long long ll;
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b);}
int Xiaobo()
{
	int h,n,k;
	cin>>h>>n;
	ll sum=0;
	for(int i=1;i<=n;i++) {
		cin>>k;
		sum+=k;
	}
	if(sum>=h) printf("Yes\n");
	else printf("No\n");
}


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

int64_t mod = 998244353 ;

vector<int> getprime(int n){
    vector<int> p(0) ;
    vector<bool> table(n+1,0) ;
    for (int i = 2; i <= n; i++)
    {
        if (table.at(i) == 0)
        {
            p.push_back(i) ;
            for (size_t j = 2; j < n/i ; j++)
            {
                table.at(i*j) = 1 ;
            }
            
        }
        
    }
    return p ;
}

int d(int64_t n){
    int re = 1 ;
    while (1)
    {
        n /= 10 ;
        if (n > 0)
        {
            re ++ ;
        }else
        {
            return re ;
        }
        
        
    }
    
}

int main(){
    int a,b ;
    cin >> a >> b ;
    if (a < 1 && b > -1)
    {
        cout << "Zero" << endl ;
    }else if (a > 0)
    {
        cout << "Positive" << endl ;
    }else if ((b - a) % 2 == 1)
    {
        cout << "Positive" << endl ;
    }else
    {
        cout << "Negative" << endl ;
    }
    
    
    
    
}

Measured memory_bytes: 3576
#include <stdio.h>

int A[110], cnt = 0;

void swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

void selectionSort(int *A, int N) {
	for (int i = 0; i < N; ++i) {
		int minj = i;
		for (int j = i; j < N; ++j) {
			if (A[j] < A[minj]) minj = j;
		}
		if (i != minj) {
			cnt++;
			swap(&A[i], &A[minj]);
		}
	}
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &A[i]);
	}
	selectionSort(A, n);

	for (int i = 0; i < n; ++i) {
		if (i != n-1) printf("%d ", A[i]);
		else printf("%d\n", A[i]);
	}
	printf("%d\n", cnt);
}



Measured memory_bytes: 2052
#include<iostream>
#include<utility>
#include<algorithm>
#include<vector>
using namespace std;
typedef pair<int, int>P;

int main() {
	int n, k;
	while (cin >> n >> k, n, k) {
		vector<P>v;
		vector<int>p;
		bool zero = false;
		for (int i = 0;i < k;i++) {
			int a;
			cin >> a;
			if (a != 0) {
				p.push_back(a);
			}
			else zero = true;
		}

		sort(p.begin(), p.end());
		p.push_back(1e8);
		int snow = p[0];
		int fnow = p[0];
		for (int i = 1;i < p.size();i++) {
			if (p[i] - fnow != 1) {
				v.push_back(make_pair(snow, fnow));
				snow = p[i];
				fnow = p[i];
			}
			else {
				fnow = p[i];
			}
		}
		int ans = -1;
		if(zero){
			for (int i = 1;i < v.size();i++) {
				if (v[i].first - v[i - 1].second == 2) {
					ans = max(ans, v[i].second - v[i - 1].first + 1);
				}
			}
		}
		else {
			for (int i = 0;i < v.size();i++) {
				ans = max(ans, v[i].second - v[i].first + 1);
			}
		}
		if (ans == -1) {
			for (int i = 0;i < v.size();i++) {
				ans = max(ans, v[i].second - v[i].first + 1);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3404
from collections import deque
n, q = map(int, input().split())
Q = []
for i in range(n): Q.append(deque())
for i in range(q):
    a = input().split()
    t = int(a[1])
    if   a[0] == '0': Q[t].append(a[2])        # push
    elif a[0] == '1' and Q[t]: print(Q[t][0])  # front
    elif a[0] == '2' and Q[t]: Q[t].popleft()  # dequeue


Measured memory_bytes: 20828
# https://atcoder.jp/contests/abc147/tasks/abc147_c
# 制約が少ない→全探索可能
# 全探索によって矛盾がない場合を探す

# 問題はどうやって矛盾しているかどうかをどうやって判別するか
# katei[i]で1のあるiが成り立っているか確かめれば良い(矛盾しなければ良い)
# つまり、ある人の発言において、正直者ものの{i} in {katei[i]==1}となる
# かつ、不親切ものの{i} not in {j|katei[i]==1}となればよい。


N = int(input())
syoujiki = []
fusin = []
for _ in range(N):
    a = int(input())
    syou = set()
    fusi = set()
    for _ in range(a):
        x, y = list(map(int, input().split()))
        if y == 1:
            syou.add(x - 1)  # 0 based inexにする
        else:
            fusi.add(x - 1)
    syoujiki.append(syou)
    fusin.append(fusi)


def is_ok(n):  # katei[i]はbinaryなのでnで表現しn>>iでアクセスすることにする。
    # 過程集合の作成
    ret = 0
    katei = set()
    for i in range(N):
        if (n >> i) % 2:  # その桁が1なら
            katei.add(i)
            ret += 1

    # for syou, fusi in zip(syoujiki, fusin):
    #     for s in syou:

    for i in katei:  # 仮定でおいたi番目の人の発言を考慮する
        cond1 = syoujiki[i].issubset(katei)  # ここがおかしい。いま言及しているものしか考えられない
        cond2 = fusin[i].isdisjoint(katei)
        # cond1とcond2を最後までみたいすときにtrueにしたい
        # →満たさないときにfalseにする
        if (not cond1) or (not cond2):
            return 0
    return ret


ans = 0
for katei in range(1 << N):
    ans = max(is_ok(katei), ans)

print(ans)


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

using namespace std;

int main(void){
    int n =0;
    int k=0;
    int offset = 0;
    string s;

    scanf("%d",&n);
    scanf("%d",&k);
    cin >> s;

    offset = s[k-1] - 0x41;
    s[k-1] = 0x61 + offset;

    cout << s ;

    return 0;
}

Measured memory_bytes: 256
P=(10,50,100,500)
price=input()
while True:
    L=map(int,raw_input().split())
    sumMoney=sum(map(lambda x,y:x*y,L,P))
    extra=sumMoney-price
    A=[0]*4
    for i in range(4)[::-1]:
        c=extra/P[i]
	A[i]=c
        extra-=c*P[i]
    for i in range(4):
        if L[i]-A[i]>0:
	    print P[i],L[i]-A[i]
    price=input()
    if price==0:break
    print

Measured memory_bytes: 4256
n = list(input())

if n[-1]=='2' or n[-1]=='4' or n[-1]=='5'or n[-1]=='7' or n[-1]=='9':
    print("hon")
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
    print("pon")
else :
    print("bon")

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

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int w = arr[0];
    int a = arr[1];
    int b = arr[2];
    if (a > b) {
      int t = a;
      a = b;
      b = t;
    }
    if (a + w >= b) Console.WriteLine(0);
    else Console.WriteLine(b - a - w);
  }
}

Measured memory_bytes: 13268