akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int mod = 1000000007;

int powmod(int x, int y){
  ll res=1;
  rep(i, y){
    res *= x;
    res %= mod;
  }
  return res;
}

int main() {
  int N;
  cin >> N;
 
  ll ans = powmod(10,N) - powmod(9,N) - powmod(9,N) + powmod(8,N);
  ans %= mod;
  ans = (ans+mod) % mod;
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{	
int s[10]={0},a=0;
for(int i=0;i<10;i++)
{
scanf("%d",&s[i]);
a=a+s[i];
}
printf("%d\n",a);
    return 0;
}	


Measured memory_bytes: 3172
from fractions import gcd
#from math import gcd
 
def lcm(m, n): return m * n // gcd(m, n)
 
n = int(input())
a = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
mulab = 1
for i in range(n):
    mulab = lcm(mulab, a[i])
 
mulab %= MOD
ans = 0
for i in range(n):
    #フェルマーの小定理
    ans = ans + mulab * pow(a[i], MOD-2, MOD)
    ans %= MOD
 
print(ans)

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int dp[50][500][500];
int a[50], b[50], c[50];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, Ma, Mb; cin >> N >> Ma >> Mb;
    rep(i, N) cin >> a[i] >> b[i] >> c[i];

    Fill(dp, inf/2);
    dp[0][0][0] = 0;
    rep(i, N) rep(j, 500) rep(k, 500) {
        chmin(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i]);
        chmin(dp[i+1][j][k], dp[i][j][k]);
    }
    int res = inf/2;
    REP(j, 1, 500) REP(k, 1, 500) if(k * Ma == j * Mb) chmin(res, dp[N][j][k]);
    if (res == inf/2) res = -1;
    cout << res << endl;
}

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

#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
#define m            make_pair
typedef long long     ll;
map<char,int>mp;
int main()
{
/*int a,b,c;cin>>a>>b>>c;

int f[3];f[0]=a,f[1]=b,f[2]=c;
sort(f,f+3);*/
string y;cin>>y;

ll x;cin>>x;
for(int i=0;i<x;i++){
  
    if(y[i]!='1'){
        cout<<y[i];return 0;
    }
}
cout<<1;

    }


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a,b,c,tot;
int main()
{
    cin>>a>>b>>c;
    if(c>a+b)
    {
        tot=a+2*b+1;
    }
    else
    {
        tot=b+c;
    }
    cout<<tot;
    return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

N,Z,W = map(int,readline().split())
A = list(map(int,readline().split()))

dp = [0] * N
ep = [0] * N
# ある地点まで来た時その人は一個前の数を持っている
#print(A)
#print(W - A[-1])
for i in range(N-1,-1,-1):
    # 最後のマスまで行く
    dp[i] = abs( (W if i == 0 else A[i-1]) - A[-1])
    ep[i] = abs( (Z if i == 0 else A[i-1]) - A[-1])
    # それ以外
    for j in range(i + 1, N):
        dp[i] = max(dp[i] , ep[j])
        ep[i] = min(ep[i] , dp[j])
#print(dp)
#print(ep)
print(dp[0])


Measured memory_bytes: 42348
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    while(scanf("%d",&t)==1){
        vector<int> v(t);
        int sum=0;
        for(int i=0;i<t;i++){
            scanf("%d",&v[i]);
        }
        sort(v.begin(),v.end());
        for(int i=0;i<t-1;i++){
            sum=sum+v[i];
        }
        printf("%d\n",sum+v[t-1]/2);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;
typedef pair<llint, vector<int> > T;

llint D;
llint c[30], csum;
llint s[400][30];
vector<int> ans;
vector<T> vec;

inline llint score(vector<int> ans, int n)
{
	int last[26];
	for(int i = 0; i < 26; i++) last[i] = 0;
	
	llint ret = 0, sub = 0;
	for(int i = 0; i < n; i++){
		llint x = ans[i];
		ret += s[i][x];
		sub -= (i-last[x]) * c[x];
		sub += csum;
		ret -= sub;
		last[x] = i;
	}
	return ret;
}

inline void search(vector<int> &ret)
{
	llint cur = score(ret, D);
	for(int t = 0; t < 1; t++){
		llint x = rand() % D, y = rand() % D;
		swap(ret[x], ret[y]);
		llint nxt = score(ret, D);
		if(nxt < cur) swap(ret[x], ret[y]);
		else cur = nxt;
		
		x = rand() % D, y = rand() % 26;
		llint tmp = ret[x];
		ret[x] = y;
		nxt = score(ret, D);
		if(nxt < cur) ret[x] = tmp;
		else cur = nxt;
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	srand(time(NULL));
	
	cin >> D;
	for(int i = 0; i < 26; i++) cin >> c[i];
	for(int i = 0; i < D; i++){
		for(int j = 0; j < 26; j++){
			cin >> s[i][j];
		}
	}
	for(int i = 0; i < 26; i++) csum += c[i];
	
	ans.resize(D);
	for(int i = 0; i < D; i++){
		llint max_val = -inf, max_j;
		for(int j = 0; j < 26; j++){
			ans[i] = j;
			llint res = score(ans, i+1);
			if(res > max_val){
				max_j = j;
				max_val = res;
			}
		}
		ans[i] = max_j;
	}
	search(ans);
	
	const int M = 70;
	llint res = score(ans, D);
	for(int i = 0; i < M; i++) vec.push_back(T(res, ans));
	
	for(int t = 0; t < 5000; t++){
		vector<T> nvec;
		for(int i = 0; i < vec.size(); i++){
			vector<int> tmp = vec[i].second;
			search(tmp);
			nvec.push_back(vec[i]);
			nvec.push_back(T(score(tmp, D), tmp));
		}
		/*for(int i = 0; i < vec.size(); i++){
			llint x = rand() % (int)vec.size(), y = rand() % (int)vec.size();
			vector<int> tmp = vec[x].second;
			tmp.resize(D/2);
			tmp.insert(tmp.end(), vec[y].second.begin()+D/2, vec[y].second.end());
			nvec.push_back(T(score(tmp, D), tmp));
		}*/
		sort(nvec.rbegin(), nvec.rend());
		nvec.resize(M);
		vec = nvec;
	}
	ans = vec.front().second;
	
	for(int i = 0; i < D; i++) cout << ans[i]+1 << endl;
	
	return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N,A,B;
  cin >> N >> A >> B;
  if(A>B)
  {
    cout << 0 << endl;
    return 0;
  }
  else if(A==B)
  {
    cout << 1 << endl;
    return 0;
  }
  else if(N==1)
  {
    cout << 0 << endl;
    return 0;
  }
  else
  {
    ll summin = A+B;
    ll summax = A+B;
    rep(i,N-2)
    {
      summin += A;
      summax += B;
    }
    cout << summax - summin + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}



int main()
{
    fastio();
    int n;cin>>n; int ans = 0;
    rep(i,1,n){
        int x;cin>>x;
        if((i&1) && (x&1)) ans++;
    }cout<<ans<<endl;
    return 0;
}


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

using namespace std;

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

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int a, b;
	cin >> a >> b;
	int cnt = 1;
	rep (i, 10000) {
	  if (cnt >= b) {
		cout << i << endl;
		return 0;
	  }
	  cnt = cnt - 1 + a;
	}
    
    return 0;
}



Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

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

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

int main() {
    int n, q, t;
    string name;
    queue<pair<string, int> > Q; //標準ライブラリからキューを使用
    
    cin >> n >> q;

    //すべてのプロセスをキューに順番に追加する
    for (int i = 0; i < n; i++) {
        cin >> name >> t;
        Q.push(make_pair(name, t));
    }

    pair<string, int> u;
    int elaps = 0, a;

    while (!Q.empty()) {//キューが空にならない限り
        u = Q.front();
        Q.pop();
        a = min(u.second, q); //qまたは必要な時間分だけ処理を行う
        u.second -= a; //残りの必要時間を更新
        elaps += a; //経過時間を更新
        if (u.second > 0) {//処理が完了していなければ
            Q.push(u); //キューに追加
        }else {
            cout << u.first << " " << elaps << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 6332
#include <iostream>
#define N 104730
using namespace std;

int main(){
  int n;
  int m=0;
  bool ip[N];
  int p[10000];
  for(int i=0;i<N;i++) ip[i]=true;
  ip[0]=ip[1]=false;
  for(int i=2;i<N;i++){
    if(ip[i]){
      p[m++]=i;
      for(int j=2*i;j<N;j+=i) ip[j]=false;
    }
  }
  while(1){
    int a=0;
    cin>>n;
    if(n==0) break;
    for(int i=0;i<n;i++) a+=p[i];
    cout<<a<<endl;
  }
  return 0;
}

Measured memory_bytes: 1300
import sys
input = sys.stdin.readline

n = int(input())
nums = [None] * n

for i in range(n):
    nums[i] = int(input())
sorted_nums = sorted(nums)

for i in range(n):
    max_val = sorted_nums[n - 1]
    if nums[i] == max_val:
        max_val = sorted_nums[n - 2]
    print(max_val)


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

const int MAXN = 200005;

int n, p1[MAXN], p2[MAXN];
char x[MAXN];

int f(int r){
	if(r == 0)return 0;
	return 1 + f(r % __builtin_popcount(r));
}

int main(){
	scanf("%d %s", &n, x);
	
	int b = 0;
	for(int i = 0; i < n; i++){
		if(x[i] == '1')b++;
	}
	
	p1[0] = 1;
	for(int i = 1; i < n; i++)
		p1[i] = p1[i - 1] * 2 % (b + 1);
	
	if(b - 1 > 0){
		p2[0] = 1;
		for(int i = 1; i < n; i++)
			p2[i] = p2[i - 1] * 2 % (b - 1);
	}
	
	int p = 0, q = 0;
	for(int i = 0; i < n; i++){
		if(x[i] == '1'){
			p = (p + p1[n - i - 1]) % (b + 1);
			if(b - 1 > 0)q = (q + p2[n - i - 1]) % (b - 1);
		}
	}
	
	for(int i = 0; i < n; i++){
		if(x[i] == '1'){
			if(b - 1 > 0)printf("%d\n", 1 + f((q - p2[n - i - 1] + (b - 1)) % (b - 1)));
			else printf("0\n");
		}else{
			printf("%d\n", 1 + f((p + p1[n - i - 1]) % (b + 1)));
		}
	}
	
	return 0;
}


Measured memory_bytes: 5504
package main

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

var (
	n, k          int
	fact, invfact [254321]int
	MOD           int = 1000000007
)

func init() {
	fact[0] = 1
	invfact[0] = 1
	for i := 1; i < 254321; i++ {
		fact[i] = fact[i-1] * i
		fact[i] %= MOD
		invfact[i] = ModPow(fact[i], MOD-2, MOD)
	}
}

func comb(x, y int) int {
	result := fact[x] * invfact[y]
	result %= MOD
	result *= invfact[x-y]
	result %= MOD
	return result
}

func readVariables() {
	n, k = nextInt(), nextInt()
}

func main() {
	readVariables()
	answer := 0
	bound := MinInt(k, n-1)
	for i := 0; i <= bound; i++ {
		p := comb(n, i) * comb(n-1, i)
		p %= MOD
		// fmt.Println(i, comb(n, k), comb(n-1, k), p)
		answer += p
		answer %= MOD
	}
	fmt.Println(answer)
}

/* 以下、テンプレート*/

var scanner *bufio.Scanner

func init() {
	Max := 1001001
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, Max), Max)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt は、2つの整数を受け取り、最小値を返します。
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt は、2つの整数を受け取り、最大値を返します。
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt は、整数の絶対値を返します。
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow は整数の累乗関数で、剰余もサポートします。
//base^exponentの値をmoduleで割った余りを返します。
//moduloが1以下の場合には、剰余演算をしません。
//baseが負の値である場合には、返す値が負になることがあります。
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd は、引数の整数全ての最大公約数を返します。
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm は、与えられた整数の最小公倍数を返します。
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


Measured memory_bytes: 4608
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	N := readInt()
	W := make([]int, N)
	var ans int
	for i := range W {
		W[i] = readInt()
		ans += W[i]
	}

	for i := 0; i < N-1; i++ {
		var s1, s2, j int
		for ; j <= i; j++ {
			s1 += W[j]
		}
		for ; j < N; j++ {
			s2 += W[j]
		}
		ans = min(ans, abs(s1-s2))
	}
	println(ans)
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long N;
    cin >> N;
    //N--;
    vector<char> ans;
    //cout << 702/26 << endl;
    long long mul = 26;
    while(N>0){
        //cout << 26*26+26 << endl;
        char c = 'a' + N%26 - 1;
        if(N%26 == 0){
             ans.push_back('z');
            // N /= 26;
//             continue;
            N--;
         }else{
            ans.push_back(c);
         }
        N /= mul;
        //mul/=26;
        //cout << c;
        
    }
    
    for(int i = ans.size()-1; i >= 0 ; i-- )cout << ans[i];
    cout << endl;
}

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

const long long MOD = 1000000007;

typedef long long LL;
LL n,k;
const LL mof=1e9+7;
const LL maxn=2e6+5;
inline LL pow_mod(LL a,LL k,LL mo)
{
    LL ans=1;
    while(k)
    {
        if(k%2) ans=ans*a%mo;
        a=a*a%mo;
        k>>=1;
    }
    return ans%mo;
}
LL jc[maxn+7];
inline LL inv(LL x)
{
    return pow_mod(x,mof-2,mof);
}
LL Inv[maxn+7];
LL C(LL N,LL k)
{
    if(k>N||k<0)return 0;
    if(k==0||k==N)return 1;
    LL ans=1;
    ans=ans*jc[N]*Inv[k]%mof*Inv[N-k]%mof;
    return ans;
}
void init()
{
    jc[1]=jc[0]=1;
    for(LL i=2; i<=maxn; ++i) jc[i]=jc[i-1]*i%mof;
    for(int i=0; i<=maxn; ++i) Inv[i]=inv(jc[i]);
}
void solve(int r1,int r2,int c1,int c2){
    auto ret = C(c2+r2+2,c2+1) - C(c2+r1+1,c2+1) - C(c1+r2+1,c1) + C(c1+r1,c1);
    ret = (ret % MOD + MOD ) % MOD;
    cout<<ret<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    init();
    int r1,c1,r2,c2;
    cin>>r1>>c1>>r2>>c2;
    solve(r1,r2,c1,c2);
    return 0;
}


Measured memory_bytes: 31488
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

string s;
int K;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>s>>K;
    
    rep(i,s.size()){
        char c=s[i];
        if(c=='a') continue;
        int x='z'-c+1;
        if(x<=K){
            K-=x;
            s[i]='a';
        }
    }
    if(K){
        K%=26;
        char c=s.back()+K;
        s.back()=c;
    }
    cout1(s)
}

Measured memory_bytes: 592
from collections import defaultdict
N = int(input())
restaurant = []
for i in range(N):
    s, p = input().split()
    restaurant += [(i + 1, s, - int(p))]
sorted_restaurant = sorted(restaurant, key=lambda x: (x[1], x[2]))
print('\n'.join([str(s[0]) for s in sorted_restaurant]))

Measured memory_bytes: 3316
N=int(input())

A= [(-2)**i for i in range(40)]
#print(A)
ans=""

for i,num in enumerate(A):
    if N%((-2)**(i+1))==0:
        ans += "0"
    else:
        ans += "1"
        N -= num
    if N==0:
        break
print(ans[::-1])

Measured memory_bytes: 3060
import std.stdio;
import std.math;
import std.algorithm;

void main() {
	double a, b, x;
	scanf("%lf %lf %lf", &a, &b, &x);
	auto s = b - x / a / a;
	if (s < b/2) {
		writef("%.20f", 90.0 - 180.0 / PI * atan(a/2/s));
	}
	else {
		writef("%.20f", 90.0 - 180.0 / PI * atan(x / b / a * 2 / b));
	}
}


Measured memory_bytes: 256
import java.util.Scanner;


	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int k = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			int n = a/k;
			if(k*n>=a&&k*n<=b) {
				System.out.println("OK");
				return;
			}
			
			if(k*(n+1)>=a&&k*(n+1)<=b) {
				System.out.println("OK");
				return;
			}
			
			System.out.println("NG");
			
		}
		
		
		
	}


Measured memory_bytes: 35728
def f(a,l):
    return  ((a+l)*(l+1-a))//2


N,K=map(int,input().split())
M=1000000007

S=0

P=f(0,K-2)
Q=f(N-K+2,N)
for x in range(K,N+2):
    P+=x-1
    Q+=N+1-x

    S=(S+(Q-P+1))%M
    
print(S)


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

using namespace std;

int main()
{
   char str[5];cin>>str;
   sort(str,str+(strlen(str)));
      if(str[0]==str[1] && str[2]==str[3] && str[1]!=str[2])cout<<"Yes\n";
      else cout<<"No\n";
 
   return 0;
}

Measured memory_bytes: 3648
/* AOJ 0056 Goldbach's Conjecture */

#include <stdio.h>

void sieve_of_eratosthenes();

#define MAX_N 50000

char is_prime[MAX_N + 1];

int
main()
{
    sieve_of_eratosthenes();

    for (;;) {
        int n, max;
        int n_combinations = 0;
        int i;

        scanf("%d", &n);
        if (n == 0) break;

        max = n / 2;
        for (i = 2; i <= max; i++) {
            if (is_prime[i] && is_prime[n - i]) n_combinations++;
        }

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

    return 0;
}

// エラトステネスの篩
void
sieve_of_eratosthenes()
{
    int i;

    is_prime[0] = is_prime[1] = 0;
    for (i = 2; i <= MAX_N; i++)
        is_prime[i] = 1;

    for (i = 2; i <= MAX_N; i++) {
        int j;

        if (!is_prime[i]) continue;

        for (j = 2 * i; j <= MAX_N; j += i)
            is_prime[j] = 0;
    }
}

Measured memory_bytes: 648
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
  int H,W;
  cin >> H >> W;

  vector<string>mass(H);

  for(int i=0;i<H;i++){
    cin >> mass[i];
  }

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(mass[i][j] == '.'){
        int bom = 0;
        for(int dx = -1;dx <= 1;dx++){
          for(int dy = -1;dy <= 1;dy++){
            int y = i + dy;
            int x = j + dx;
            if(y >= 0 && y < H && x >= 0 && x < W && mass[y][x] == '#')
              bom++;
          }
        }
        char c = '0' + bom;
        mass [i][j] = c;
      }
    }
  }
  for(int i=0;i<H;i++){
  cout << mass[i] << endl;
}
return 0;
}


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

int main() {
  int N;
  cin >> N;
  if ((N-(N%10))%111 == 0 || (N%1000)%111 == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  } 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    if(n<s.size()){
        cout << s.substr(0,n) << "...";
    }else{
        cout << s;
    }
    return 0;
}

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

int main() {
  int N,K;
  cin>>N>>K;
  vector<long> a(N);
  for(int i =0;i<N;i++) cin>>a[i];
  int oidx=-1;
  for(int i =0;i<N-1;i++)
    if(a[i+1]*a[i]<0 || a[i+1]==0){
     oidx=i+1;
     break;
   }

  if(N==1){
    if(a[0]>=0) cout<<a[0]<<endl;
    else cout<<-a[0]<<endl;
    return 0;
  }
  long ans=1e18;
  if(oidx==-1){
    if(a[0]>=0){
      ans = min(ans,a[K-1]);
    }
    if(a[N-1]<0){
      ans =min(ans,-a[N-1-(K-1)]);
    }
  }
  else{
    for(int i=0;i<N-K+1;i++){
      int L=i;
      int R=L+K-1;
      if(a[R]<0){
        int r=oidx-1;
        int l=r+1-K;
        if(l>=0) ans = min(-a[l],ans);
      }
      else if(a[L]>=0){
        int l=oidx;
        int r=l+K-1;
        //if(a[l]==0) r--;
        if(r<=N-1) ans = min(a[r],ans);
      }
      else{
        ans =min(ans,min(-a[L]*2+a[R],a[R]*2-a[L]));
      }
    }
  }
cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vivi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vll = std::vector<ll>;
using vllvll = std::vector<std::vector<ll>>;


using namespace std;

#define MOD 1000000007
#define INF 1000000001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv)
{
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	int n,k; cin >> n >> k;
	vll a(n); rep(i,n) cin >> a[i];
	vllvll dp(n,vll(k+1,0));
	rep(j,k+1) if(a[0]>=j) dp[0][j]=1;
	rep(i,n) dp[i][0]=1;
	rep2(i,1,n)rep2(j,1,k+1){
		dp[i][j] = (dp[i-1][j]+dp[i][j-1])%MOD;
		if(j-a[i]-1>=0) dp[i][j] = (dp[i][j]+MOD-dp[i-1][j-a[i]-1])%MOD;
	}
	out(dp[n-1][k]);
}




Measured memory_bytes: 79488
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int k, a, b, c;
    cin >> a >> b >> c >> k;
    long long int r = 0;
    if(k > a)
    {
        k = k - a;
        r = r + a * 1;
    }
    else
    {
        r = r + k * 1;
        k = 0;
    }
    if(k > b)
    {
        k = k - b;
        r = r + b * 0;
    }
    else
    {
        r = r + k * 0;
        k = 0;
    }
    r = r + k * -1;
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <cmath>
#include <cstdio>
#include <vector>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <stdio.h>
#include <functional>
#include <chrono>
using namespace std;

#define rep(i,s,n) for(ll i=s;i<(n);++i)
using ll = long long;
using pll = pair<ll, ll>;
constexpr ll INF = (1LL << 60);
constexpr ll MAX_INF = 9223372036854775807;
constexpr ll MOD = (1e9 + 7);
//constexpr ll MOD = (998244353);

using vl = vector<ll>;
using vvl = vector<vector<ll>>;

template<class T>
vector<vector<T>> vvt(T init, ll m, ll n) {
	vector<vector<T>> ans = vector<vector<T>>(m, vector<T>(n, init));
	return move(ans);
}

template<class T>
vector<T> vt(T init, ll n) {
	vector<T> ans = vector<T>(n, init);
	return move(ans);
}

template<class T>
T maxVec(vector<T>& v) {
	T ans = -INF;
	rep(i, 0, v.size()) {
		ans = max(ans, v[i]);
	}
	return ans;
}

// 素数判定
bool judge(ll n) {
	for (ll i = 2; i * i <= n; i++) if (n %= i)return false;
	return true;
}


template <class C>
void print(const C & c, std::ostream & os = std::cout)
{
	std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, ", "));
	os << std::endl;
}
/*
ll count(ll n,ll r) {
	ll ans = 0,check = 1;
	rep(i,0, r) {
		if ((n & check) > 0) {
			ans++;
		}
		check = check << 1;
	}
	return ans;
}
*/
bool sortreverse(ll a, ll b) {
	return a > b;
}


ll kiriage(ll a, ll b) {
	if (a % b == 0)return a / b;
	return a / b + 1;
}

ll n, m, x, y, t, q, s,k,h,w;

void warshall_floyd(ll v_num,vector<vector<long long>> &d) {
	for (long long k = 0; k < v_num; k++) {       // 経由する頂点
		for (long long i = 0; i < v_num; i++) {    // 始点
			for (long long j = 0; j < v_num; j++) {  // 終点
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

int main() {
	ll r;
	cin >> n >> m >> r;
	vl rls(r);
	rep(i, 0, r) {
		cin >> rls[i];
		rls[i]--;
	}
	vvl graph(n, vl(n, INF));
	rep(i, 0, n) {
		graph[i][i] = 0;
	}
	rep(i, 0, m) {
		cin >> x >> y >> w;
		graph[x - 1][y - 1] = w;
		graph[y - 1][x - 1] = w;
	}
	warshall_floyd(n, graph);
	sort(rls.begin(), rls.end());
	ll ans = INF;
	do {
		ll tmp = 0;
		rep(i, 0, r - 1) {
			tmp += graph[rls[i]][rls[i + 1]];
		}
		ans = min(ans, tmp);
	} while (next_permutation(rls.begin(), rls.end()));
	printf("%lld\n", ans);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
#define mod 1000000007
ll n,m,i,j,k,l,t,a,b,arr[10];
string cc[123];
int main()
{
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        string c;
        cin >> c;
        cc[i]=c;
    }
    sort(cc,cc+n);
    for(i=0;i<n;i++)
    {
        cout << cc[i];
    }
}


Measured memory_bytes: 256
def main():
    N = int(input())
    t, x, y = [], [], []

    for _ in range(N):
        T, X, Y = map(int, input().split())
        t.append(T)
        x.append(X)
        y.append(Y)

    px = 0
    py = 0
    pt = 0
    for T, X, Y in zip(t, x, y):
        if (T-pt) % 2 == 0:
            if T-pt < X-px + Y-py or (X-px + Y-py) % 2 != 0:
                print('No')
                return
        else:
            if T-pt < X-px + Y-py or (X-px + Y-py) % 2 == 0:
                print('No')
                return
        pt = T
        px = X
        py = Y
    print('Yes')
    
main()

Measured memory_bytes: 11828
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const ll inf = 1LL << 50;

int main(void){
	int n;
	cin >> n;
	vector<ll> a(n + 1, 0LL);
	rep(i, n + 1) cin >> a[i];

	bool ok = true;
	ll ans = 0LL;
	using pll = pair<ll, ll>;

	vector<ll> limit(n + 1);
	vector<pll> cur(n + 1);
	cur[n] = pll(a[n], a[n]);

	if (n == 0) {
		if(a[0] == 1) {
			cout << 1 << endl;
		} else {
			cout << -1 << endl;
		}
		return 0;
	}


	ll tmp = 1LL;
	rep(i, n + 1) {
		limit[i] = tmp;
		tmp -= a[i];
		tmp = min(inf, 2LL * tmp);
	}

	rrep(i, n + 1) {
		ans += cur[i].second;

		if (i - 1 >= 0) {
			const ll amin = a[i - 1] + (cur[i].first + 1LL) / 2LL;
			const ll amax = a[i - 1] + cur[i].second; 	
			const ll border = limit[i - 1];

			if(border < amin) {
				ok = false;
			}

			cur[i - 1] = pll(min(border, amin), min(border, amax));
		}
	}

	if (ok) {
		cout << ans << endl;
	} else {
		cout << -1 << endl;
	}

	return 0;
}

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

int main() {
  ll d, n;
  cin >> d >> n;

  ll cnt = 0;
  for (ll i = 1; i <= 10000 * 100 + 10000; i++) {
    if (d == 0) {
      if (i % 100 != 0) { cnt++; }
    } else if (d == 1) {
      if (i % 100 == 0 && i % 10000 != 0) { cnt++; }
    } else {
      if (i % 10000 == 0 && i % 1000000 != 0) { cnt++; }
    }
    if (cnt == n) {
      cout << i << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int len = s.length;
        char prev = s[0];
        int cnt = 1;
        ArrayList<Integer> li = new ArrayList<Integer>();
        long n = sc.nextLong();
        for(int i = 1; i < len; i++){
            if(prev == s[i]){
                cnt++;
            } else {
                li.add(cnt);
                cnt = 1;
                prev = s[i];
            }
        }
        li.add(cnt);
        long ans = 0;
        if(li.size() == 1){
            ans = (li.get(0)*n)/2;
        }else if(s[0] == s[len-1]){
            int cf = li.get(0);
            int cl = li.get(li.size()-1);
            for(int i = 1; i < li.size()-1; i++){
                ans += li.get(i)/2 * n;
            }
            ans += cf/2 + cl/2 + (cf+cl)/2*(n-1); 
        }else{
            for(int i : li){
                ans += i/2 * n;
            }
        }
        System.out.println(ans);
    }
}


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

int main() {
  int N,K,Q;
  cin>>N>>K>>Q;
  vector<int> A(Q);
  vector<int> player(N);
  rep(i,Q){
    cin>>A.at(i);
  }
  rep(i,N){
    player.at(i)=K-Q;
  }
  rep(i,Q){
    player.at(A.at(i)-1)++;
  }
  rep(i,N){
    if(player.at(i)<=0){
      cout<<"No"<<endl;
    }else{
      cout<<"Yes"<<endl;
    }
  }
  return 0;
}

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

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  bool ans = false;
  for(int i = 0; i <= N; i++){
    for(int j = 0; j <= M; j++){
      if(i * M + N * j - 2 * i * j == K){
	ans = true;
      }
    }
  }
  cout << (ans? "Yes": "No") << endl;
}

      


Measured memory_bytes: 256
from sys import stdin
N,M,X,Y=[int(x) for x in stdin.readline().rstrip().split()]
datax=[int(x) for x in stdin.readline().rstrip().split()]
datay=[int(x) for x in stdin.readline().rstrip().split()]
if sorted(datax)[-1]+1 <= sorted(datay)[0] and  X < sorted(datax)[-1]  and sorted(datay)[0] <=Y: 
    print("No War")
else:
    print("War")

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

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

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

ll solve(vector<char> x, vector<char> y) {
    int n = x.size();
    vector<vector<ll>> same(n, vector<ll>(n, 0));
    forn(i, 0, n) same[0][i] = (x[0] == y[i]);
    forn(i, 0, n) same[i][0] = (x[i] == y[0]);
    forn(i, 1, n) forn(j, 1, n) same[i][j] = same[i - 1][j - 1] + (x[i] == y[j]);

    vector<vector<ll>> dp(n, vector<ll>(n, 0));
    forn(i, 0, n) forn(j, 0, n) {
        dp[i][j] = same[i][j];
        if (i && j) dp[i][j] += min(dp[i - 1][j], dp[i][j - 1]);
    }
    return dp[n - 1][n - 1];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w;
    cin >> h >> w;
    vector<vector<char>> c(w, vector<char>(h));
    forn(i, 0, h) forn(j, 0, w) cin >> c[j][i];
    ll ans = 0;
    forn(i, 0, w - 1) ans += solve(c[i], c[i + 1]);
    cout << ans << '\n';
}


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

int main(){
  int H,W;
  cin >> H >> W;
  int a[H]={};
  int b[W]={};
  string S[H];
  for (int i=0;i<H;i++){
    cin >> S[i];
    for(int j=0;j<W;j++){
      b[j]+=S[i][j]=='.'?1:0;
      a[i]+=S[i][j]=='.'?1:0;
    }
  }
  for (int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if (a[i]<W and b[j]<H){
        cout << S[i][j];
      }
    }
    cout << endl;
  }
}


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

namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string s=Console.ReadLine();
    int N=s.Length;
     var rev=new string(s.Reverse().ToArray());
    int flg=0;
      string s2=s.Substring(0,(N-1)/2);
      var revs2=new string(s2.Reverse().ToArray());
 	 string s3=s.Substring((N+3)/2-1);
      var revs3=new string(s3.Reverse().ToArray());     
     if(s!=rev){
       flg=1;
     }
      else if(s2!=revs2){
        flg=1;
      }else if(s3!=revs3){
        flg=1;
      }
 
             if(flg==1){
               Console.WriteLine("No");
             }else
             {Console.WriteLine("Yes");
             }
    }
    
  }

}

Measured memory_bytes: 26620
import java.util.Scanner;
 
class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        if(a<b && b<c){
        System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
}

Measured memory_bytes: 26144
// review
#include <iostream>

using namespace std;
const int MAXN = 100010;

int n;
int dp[MAXN];

void solve() {
  for (int i=0;i<MAXN;i++) {
    dp[i] = MAXN;
  }
  dp[0] = 0;

  for (int i=1;i<=n;i++) {
    dp[i] = min(dp[i], dp[i-1] + 1);
    for (int p6=6;p6<=i;p6*=6) {
      dp[i] = min(dp[i], dp[i-p6] + 1);
    }
    for (int p9=9;p9<=i;p9*=9) {
      dp[i] = min(dp[i], dp[i-p9] + 1);
    }
  }
  cout << dp[n] << endl;
}

int main() {
  cin >> n;
  solve();
}


Measured memory_bytes: 640
N=input()
A=input()
B=input()
C=input()

import collections
answer=0
N=int(N)
for i in range(N):
    if len(set([A[i],B[i],C[i]]))==1:
        continue
    if len(set([A[i],B[i],C[i]]))==3:
        answer+=2
        continue
    i2=0
    #print(collections.Counter([A[i],B[i],C[i]]))
    for k,v in collections.Counter([A[i],B[i],C[i]]).items():
        if v!=max(collections.Counter([A[i],B[i],C[i]]).values()):
            #print(i2)
            #print(k,v)
            answer+=v
    
print(answer)

Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  int s[n];
  for(int i=0;i<n;i++) cin >> s[i];
  sort(s,s+n);
  for(int i=1;i<=s[0];i++){
    if(n==2&&s[0]%i==0&&s[1]%i==0) cout << i << endl;
    else if(n==3&&s[0]%i==0&&s[1]%i==0&&s[2]%i==0) cout << i << endl;
  }
  return 0;
}

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

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

int main() {
    string s;
    cin >> s;
    char ch1 = s[0], ch2 = s[s.size()-1];
    cout << ch1 << s.size()-2 << ch2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>

using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

string S, T;
vector<ll>AS,AT;

int main() {
	cin >> S >> T;
	AS.resize(S.size() + 1,0);
	AT.resize(T.size() + 1,0);
	for (ll n = 0; n < S.size(); n++) {
		if (S[n] == 'A')AS[n + 1] = AS[n] + 1;
		else AS[n + 1] = AS[n];
	}
	for (ll n = 0; n < T.size(); n++) {
		if (T[n] == 'A')AT[n + 1] = AT[n] + 1;
		else AT[n + 1] = AT[n];
	}
	ll Q;
	cin >> Q;
	for (ll q = 0; q < Q; q++) {
		ll a, b, c, d;
		cin >> a >> b >> c >> d;
		ll s = 2 * (AS[b] - AS[a - 1]) - (b - a + 1);
		ll t = 2 * (AT[d] - AT[c - 1]) - (d - c + 1);
		s = (s % 3) + 3;
		s %= 3;
		t = (t % 3) + 3;
		t %= 3;
		if(s == t)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main () {
	std::map<string, int> count;
	int r,b;
	cin >> b;
	for (int i = 0; i < b; ++i)
	{
		string tmp;
		cin >> tmp;
		count[tmp]++;
	}
	cin >> r;
	for (int i = 0; i < r; ++i)
	{
		string tmp;
		cin >> tmp;
		count[tmp]--;
	}
	int max = 0;
	    for(auto x : count) {
        max = std::max(max,x.second);
    }
    cout << max << endl;
}

Measured memory_bytes: 256
/*
h3110_fr13nd,
 
AUTHOR : @sam_jn
*/
 
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
// typedef tree<pair<int, int>, null_type, less_equal<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define NN 1000002
#define in(a, n) for(int i = 0; i < n; i++) cin >> a[i];
#define ot(a, n) for(int i = 0; i < n; i++) cout << a[i] << " ";
#define ot2(a, n) for(int i = 0; i < n; i++) cout << a[i] << "\n";
ll pwr(ll a, ll b);
ll pwr(ll a, ll b, ll m);
int baap[200002];
int prime[NN];
int find(int i);  
bool Union(int x, int y);
ll inv(ll x) {return pwr(x, MOD - 2, MOD);}
void init();
ll max(ll x, ll y, ll z) {return max(x, max(y, z));}
int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[8] = {-1, 1, 0, 0, 1, -1, 1, -1};
//----------------------------------SOLUTION-BELOW-------------------------------------------// 

void solve(){
    int l, r, d, cnt = 0;
    cin >> l >> r >> d;
    for(int i = l; i <= r; i++){
        if(i % d == 0) cnt++;
    }
    cout << cnt;
}
int main(){


                                                            // #ifndef ONLINE_JUDGE    
                                                            // freopen("/home/samyak/Desktop/CP/input.txt", "r", stdin);
                                                            // freopen("/home/samyak/Desktop/CP/output2.txt", "w", stdout);
                                                            // #else
                                                            // // online submission
                                                            // #endif
// 

    boost
    int _ = 1;
    // cout << 0 << endl;
    // cin >> _;
    while(_--){
        solve();
        cout << endl;
    }
}
 
 
//--------------------------------------DEFININTIONS---------------------------------------
ll pwr(ll a, ll b){
    if(b == 0)
        return 1 ;
    ll c = pwr(a, b/2) ;
    c = c * c;
    if(b % 2)
        return c*a;
    return c ;
}
ll pwr(ll a, ll b, ll m){
    if(b == 0)
        return 1;
    ll c = pwr(a, b/2, m) % m ;
    c = (c * c) % m;    
    if(b % 2)
        return (c * a%m) % m;
    return c ;
}
int find(int i)  
{  
    if (baap[i] != i)  
        baap[i] = find(baap[i]);  
  
    return baap[i];  
}
 
bool Union(int x, int y)
{
    x = find(x);
    y = find(y);
    if(x == y) return false;
    baap[x] = y;
    return true;
}
void init(){
  for(ll i = 2; i < NN; i++){
      if(prime[i]) continue;
      for(ll j = 2*i; j < NN; j += i)
          prime[j] = i;
  }
}

Measured memory_bytes: 3652
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

vector<ll> prime;
bool isprime[1100000];

void sieve(){
	for(ll i=0; i<1100000; i++){
		isprime[i]=1;
	}
	isprime[0]=0, isprime[1]=0;
	for(ll i=2; i<1100000; i++){
		if(isprime[i]){
			prime.push_back(i);
			for(ll j=2*i; j<1100000; j+=i){
				isprime[j]=0;
			}
		}
	}
	return;
}

int main()
{
	sieve();
	int a[1001][1001];
	int x=500, y=500, t=1;
	a[x][y]=t;
	for(int i=3; i<=1001; i+=2){
		y++; t++;
		a[x][y]=t;
		for(int j=1; j<i-1; j++){
			x--; t++;
			a[x][y]=t;
		}
		for(int j=0; j<i-1; j++){
			y--; t++;
			a[x][y]=t;
		}
		for(int j=0; j<i-1; j++){
			x++; t++;
			a[x][y]=t;
		}
		for(int j=0; j<i-1; j++){
			y++; t++;
			a[x][y]=t;
		}
	}
	P p[1100000];
	for(int i=0; i<1001; i++){
		for(int j=0; j<1001; j++){
			p[a[i][j]]=P(i, j);
		}
	}
	while(1){
		int n, m;
		cin>>m>>n;
		if(m==0 && n==0) return 0;
		int d[1000001];
		fill(d, d+m+1, -1);
		if(isprime[n]) d[n]=1;
		else d[n]=0;
		int x0=p[n].first, y0=p[n].second;
		for(int i=x0; i<=1000; i++){
			bool end=1;
			for(int j=max(0, y0-i+x0); j<=min(1000, y0+i-x0); j++){
				if(a[i][j]>m) continue;
				if(i+1<=1000 && j-1>=0 && a[i+1][j-1]<=m){
					end=0;
					if(isprime[a[i+1][j-1]]){
						d[a[i+1][j-1]]=max(d[a[i+1][j-1]], d[a[i][j]]+1);
					}else{
						d[a[i+1][j-1]]=max(d[a[i+1][j-1]], d[a[i][j]]);
					}
				}
				if(i+1<=1000 && a[i+1][j]<=m){
					end=0;
					if(isprime[a[i+1][j]]){
						d[a[i+1][j]]=max(d[a[i+1][j]], d[a[i][j]]+1);
					}else{
						d[a[i+1][j]]=max(d[a[i+1][j]], d[a[i][j]]);
					}
				}
				if(i+1<=1000 && j+1<=1000 && a[i+1][j+1]<=m){
					end=0;
					if(isprime[a[i+1][j+1]]){
						d[a[i+1][j+1]]=max(d[a[i+1][j+1]], d[a[i][j]]+1);
					}else{
						d[a[i+1][j+1]]=max(d[a[i+1][j+1]], d[a[i][j]]);
					}
				}
			}
			if(end) break;
		}
		int ans=0, ans2=0;
		for(int i=1; i<=m; i++){
			if(ans<d[i]) ans=d[i];
		}
		if(ans==0){
			cout<<0<<" "<<0<<endl;
			continue;
		}
		for(int i=1; i<=m; i++){
			if(isprime[i] && ans==d[i]) ans2=i;
		}
		cout<<ans<<" "<<ans2<<endl;
	}
	return 0;
}


Measured memory_bytes: 20980
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=1000000007;
const long long int INF=99999999999999999;


long long int n,m,a[300000],b[300000],c[300000],res=0,cou=1000;
string str;
int main() {
	cout << fixed << setprecision(10);
	cin>>n;
	for(int i=0;i<n-1;i++){
		cin>>b[i];
	}
	res+=b[0];
	res+=b[n-2];
	for(int i=0;i<n-2;i++){
		res+=min(b[i],b[i+1]);
	}
	cout<<res<<endl;
} 


Measured memory_bytes: 2304