akhauriyash/Code-Regression huggingface dataset:
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

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

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

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

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

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

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

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...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	N := readInt()
	min := math.MaxInt32
	sum := 0
	for i := 0; i < N; i++ {
		s := readInt()
		sum += s
		if s%10 != 0 && s < min {
			min = s
		}
	}
	if sum%10 != 0 {
		println(sum)
	} else {
		if min == math.MaxInt32 {
			println(0)
		} else {
			println(sum - min)
		}
	}
}


Measured memory_bytes: 640
<?php

$input = explode(' ', trim(fgets(STDIN)));
$n = (int)$input[0];
$m = (int)$input[1];

$edges = [];
for ($i=0; $i < $m; $i++) { 
	$input = explode(' ', trim(fgets(STDIN)));
	$edges[] = [(int)$input[0], (int)$input[1]];
}

$cnt = 0;
// 全辺について、のぞいた場合のUnionFindをする
foreach ($edges as $k_not => $e_not) {
	$parents = initNodes($n);
	foreach ($edges as $k => $e) {
		if ($k == $k_not) {
			continue;
		}
		$p1 = getParent($parents, $e[0]);
		$p2 = getParent($parents, $e[1]);
		if ($p1 !== $p2) {
			$parents[max($p1, $p2)] = $parents[min($p1, $p2)];
		}
	}
	for ($i=1; $i < $n; $i++) { 
		if (getParent($parents, $i) != getParent($parents, $i+1)) {
			$cnt += 1;
			break;
		}
	}
}
echo $cnt;

//互いに素な集合
function initNodes($n){
	$g = [];
	for ($i=1; $i <= $n; $i++) { 
		$g[$i] = $i;
	}
	return $g;
}

function getParent($parents, $i){
	if ($parents[$i] != $i) {
		$parents[$i] = getParent($parents, $parents[$i]);
	}
	return $parents[$i];
}

Measured memory_bytes: 4728
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

K = Counter(A).most_common()
flag = True

for i in range(len(K)):
    if K[i][1] != 2:
        if K[i][0] == 0 and K[i][1] == 1:
            continue
        else:
            flag = False

if flag:
    print((2 ** (N // 2)) % (10 ** 9 + 7))
else:
    print(0)

Measured memory_bytes: 16088
function main(input) {
  var input=input.trim().split(/\n/);
  var N = Number(input[0].split(" ")[0]);
  var M = Number(input[0].split(" ")[1]);

  var pairs = [];
  for(var i=0;i<M;i++){
    var A = input[i+1].split(" ")[0]-1;
    var B = input[i+1].split(" ")[1]-1;
    pairs.push([A,B]);
  }

  var ans = [];
  var unionFind = new UnionFind(N);
  var tmp = N*(N-1)/2;
  var v, w;
  for(var i=pairs.length-1;i>=0;i--){
    v = pairs[i];
    w = unionFind.getSize(v[0])*unionFind.getSize(v[1]);
    ans.push(tmp);
    if(unionFind.marge(v[0], v[1])==1){
      tmp-=w;
    }
  }
  for(var i=ans.length-1;i>=0;i--){
    console.log(ans[i]);
  }
}
function UnionFind(n){
  this.nodes = [];
  for(var i=0;i<n;i++){
    this.nodes[i] = {
      parent: i,
      size: 1,
      no: i,
    };
  }
};
UnionFind.prototype.getSize = function(x){
  var parentNode = this.root(x);
  return parentNode.size;
}
UnionFind.prototype.root = function(x){
  if(this.nodes[x].parent != x){
    var parentNode = this.root(this.nodes[x].parent);
    this.nodes[x].parent = parentNode.parent;
    return parentNode;
  }
  return this.nodes[x];
};
UnionFind.prototype.marge = function(ax,bx){
  var base = this.root(ax);
  var child = this.root(bx);
  if(base.parent==child.parent) return 0;
  var baseSize = this.getSize(base.no);
  var childSize = this.getSize(child.no);
  if(baseSize > childSize){
    child.parent = base.no;
    base.size += childSize;
  }else{
    base.parent = child.no;
    child.size += baseSize;
  }
  return 1;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 65764
//#include "std_lib_facilities.h"
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;

int main() try{
	string s;
	cin >> s;
	long long b = 0, ans = 0;
	for (int i = 0; i < (int) s.size(); i++) {
		if (s[i] == 'B')
			b++;
		if (s[i] == 'W')
			ans += b;
	}

	printf("%lld\n", ans);
}catch (exception &e) {
	cerr << "error: " << e.what() << '\n';
//keep_window_open();
	return 1;
}
catch (...) {
	cerr << "Oops: unknown exception!\n";
//keep_window_open();
	return 2;
}



Measured memory_bytes: 3864
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    int n,a;
    cin>>n;
    for(ll i=0;i<100000;i++) if(i*(i+1)/2>=n){a=i;break;}
    int b=a*(a+1)/2-n;
    rep(i,a) if(i+1!=b) cout<<i+1<<"\n";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{

    static void Main()
    {
        string N = Console.ReadLine();
        int I = int.Parse(N);
        int J = I % 10;

        if (J == 2 || J == 4 || J == 5 || J == 7 || J == 9)
      {
            Console.WriteLine("hon");
        }
      else if (J == 0 || J == 1 || J == 6 || J == 8)
      {
            Console.WriteLine("pon");
        }
      else if (J == 3)
        {
            Console.WriteLine("bon");
        }


    }
}

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

#define fastio 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ld long double
#define forn(low,high,i) for(i = low; i < high; i++)
#define forrev(high,low,i) for(i = high; i >= low; i--)
#define all(v) v.begin(),v.end()
#define decimal_digits cout << fixed << setprecision(15);

string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int inf = 1e9;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(long long a, long long b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(long long a, long long b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(long long a, long long b){a %= mod; b %= mod; return (int)((long long) a * b % mod);}
inline int modexpo(long long a, long long b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(long long a, long long b){return mul(a, modexpo(b, mod - 2));}
inline int inv(long long a){return modexpo(a, mod - 2);}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre(){ // Reset each global variable (esp. for graphs)
  
}

const int N = 5e5 + 5;
int bit[N][26], n;

void add(int idx, int cc, int val){
  for(; idx <= n; idx += (idx & -idx)){
    bit[idx][cc] += val;
  }
}

int sum(int idx, int cc){
  int sum = 0;
  for(; idx > 0; idx -= (idx & -idx)){
    sum += bit[idx][cc];
  }
  return sum;
}

void solve(){
  cin >> n;
  string s; cin >> s;
  s = '$' + s;
  for(int i = 1; i <= n; i++){
    add(i, s[i] - 'a', 1);
  }

  int qq; cin >> qq;
  while(qq--){
    int tt; cin >> tt;
    if(tt == 1){
      int idx; char cc; cin >> idx >> cc;
      add(idx, s[idx] - 'a', -1);
      add(idx, cc - 'a', 1);
      s[idx] = cc;
    }else{
      int l, r; cin >> l >> r;
      int ans = 0;
      for(int i = 0; i < 26; i++){
        int cnt = sum(r, i) - sum(l - 1, i);
        if(cnt > 0){
          ans++;
        }
      }
      cout << ans << '\n';
    }
  }
}

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

  pre();

  int t = 1;
  // cin >> t;
  while(t--){
    solve();
  }

  ktj();
}


Measured memory_bytes: 51760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.awt.Point;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        long N;
        // int[] A;

        // write your code
        void solve(InputReader in, PrintWriter out) {
            N = in.nextLong();
            ArrayList<Character> al = new ArrayList<>();
            while (N > 0) {
                long r = N % 26;
                char c = 'a';
                if (r == 0) {
                    c = 'z';
                } else {
                    c += (char) (r - 1);
                }
                al.add(c);
                if (r == 0) {
                    N--;
                }
                N /= 26;
            }

            Collections.reverse(al);
            for (Character c : al) {
                out.print(c);
            }
            out.println();
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	vector<pair<int, int>> robots(N);
	for (auto& it : robots) { cin >> it.first >> it.second; it.second += it.first; }

	sort(robots.begin(), robots.end());

	for (auto& it : robots) {
		it.second = int(lower_bound(robots.begin(), robots.end(), pair<int, int>(it.second, -2e9)) - robots.begin());
	}

	const int S = 1 << 18;
	vector<int> seg(2*S);

	vector<int> dp(N+1);
	dp[N] = 1;
	for (int i = N-1; i >= 0; i--) {
		assert(robots[i].second > i);
		int furthest = robots[i].second;
		for (int a = S+i+1, b = S+robots[i].second; a < b; a /= 2, b /= 2) {
			if (a & 1) furthest = max(furthest, seg[a++]);
			if (b & 1) furthest = max(furthest, seg[--b]);
		}
		seg[S+i] = furthest;
		for (int a = (S+i)/2; a; a /= 2) {
			seg[a] = max(seg[2*a], seg[2*a+1]);
		}

		dp[i] = dp[i+1] + dp[furthest];
		if (dp[i] >= 998244353) dp[i] -= 998244353;
	}
	cout << dp[0] << '\n';

	return 0;
}


Measured memory_bytes: 4608
K=int(input())+1

def dfs(n,f,l,s):
  global K
  if l==0:
    K-=1
    if K==0:
      print(n)
      exit()
  elif s==1:
    for i in range(0,10):
      if i==0:
        dfs(10*n+i,i,l-1,1)
      else:
        dfs(10*n+i,i,l-1,0)
  else:
    if f==0:
      for i in range(0,2):
        dfs(10*n+i,i,l-1,0)
    elif f==9:
      for i in range(8,10):
        dfs(10*n+i,i,l-1,0)
    else:
      for i in range(f-1,f+2):
        dfs(10*n+i,i,l-1,0)
      
dfs(0,0,10,1)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int x,y,lose=1;
	scanf("%d%d",&x,&y);
	char z;
	getchar();
	for(int i=0;i<x;i++)
	{
		scanf("%c",&z);
		if(z>='0'&&z<='9')
			;
		else
			lose=0;
	}
	scanf("%c",&z);
	if(z!='-')
		lose=0;
	for(int i=0;i<y;i++)
	{
		scanf("%c",&z);
		if(z>='0'&&z<='9')
			;
		else
			lose=0;
	}
	if(!lose)
		printf("No\n");
	else
	{
		printf("Yes\n");
	}
	
	
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
    int N;
    scanf("%i", &N);
    int n = N;
    int a = 1;
    while (N >= 10){
        N /= 10;
        a++;
    }
    if (a == 1){
        printf("%i\n", n);
    } else if (a == 2){
        printf("%i\n", 9);
    } else if (a == 3){
        printf("%i\n", n - 99 + 9);
    } else if (a == 4){
        printf("%i\n", 999 - 99 + 9);
    } else if (a == 5){
        printf("%i\n", n - 9999 + 999 - 99 + 9);
    } else if (a == 6){
        printf("%i\n", 99999 - 9999 + 999 - 99 + 9);
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const int maxn=110;
int a1[maxn],a2[maxn];
int b1[maxn];
int b2[maxn];
int c[maxn];

int main()
{   int N;
    while (scanf("%d",&N)!=EOF&&N) {
        b2[0]=b1[0]=0;
        for(int i=1;i<=N;i++){
            scanf("%d",&a1[i]);
            b1[i]=a1[i]+b1[i-1];
        }
        for(int i=1;i<=N;i++){
            scanf("%d",&a2[i]);
            b2[i]=a2[i]+b2[i-1];
        }
        for(int i=1;i<=N;i++)
            c[i]=a1[i]+a2[i];
        int IN=0;
        for(int i=1;i<=N;i++)
            IN=max(IN,b1[i-1]+c[i]+b2[N]-b2[i]);
        printf("%d\n",IN);
    }
    return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    string S; cin >> S;
    int ans = INF;
    for(int i = 0; i+2 < S.length(); i++)
    {
        int X = stoi(S.substr(i, 3));
        ans = min(ans, abs(X-753));
    }
    cout << ans << endl;
}
        
    
int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
room = [[] for _ in range(n)]
navi = [-1 for _ in range(n)]
table = set()
for i in range(m):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    room[a].append(b)
    room[b].append(a)

table.add(0)

while len(table) != 0:
    new_table = set()
    for point in table:
        for next_room in room[point]:
            if navi[next_room] != -1:
                continue
            navi[next_room] = point
            new_table.add(next_room)

    table = new_table

print("Yes")
for i in range(1, n):
    print(navi[i] + 1)

Measured memory_bytes: 37556
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
 
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
 
using namespace std;

int main(){

  while(true){

    int a;
    cin >> a;

    vector<int> list;

    if(a==0){
      break;
    }

    rep(i,a){
      int temp=0;
      cin >> temp;
      list.push_back(temp); 
    }

    sort(list.begin(),list.end());

    int ans=0;
    int count=0;
    REP(i,1,a-1){
      ans+=list[i];
      count++;
    }
    ans=(int)(ans/count);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint n, m;
    cin >> n >> m;
    lint ans = (100 * (n - m) + 1900 * m) * power(2, m);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
A = []
for i in range(3):
    array = list(map(int, input().strip().split()))
    A.append(array)

# A = [input().split() for l in range(3)] 

N = int(input())
b = []
flag = 0
for i in range(N):
    b.append(int(input()))

#print(type(int(A[0][0])))
#print(type(b[0]))

for i in range(3):
    for j in range(3):
        for k in range(N):
            #print(A[i][j], b[k])
            if A[i][j] == b[k]:
                A[i][j] = 1000

for i in range(3):
    if A[i][0] == A[i][1] and A[i][1] == A[i][2] and A[i][2] == 1000:
        flag = 1
    if A[0][i] == A[1][i] and A[1][i] == A[2][i] and A[2][i] == 1000:
        flag = 1
    if A[0][0] == A[1][1] and A[1][1] == A[2][2] and A[2][2] == 1000:
        flag = 1
    if A[0][2] == A[1][1] and A[1][1] == A[2][0] and A[2][0] == 1000:
        flag = 1

if flag == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << v.first << " " << v.second;
    return ostr;
}

int64 powmod(int64 n, int64 count, int64 mod) {
    if (count == 0) return 1;
    if (count % 2 == 0) {
        int64 t = powmod(n, count / 2, mod);
        return t * t % mod;
    }
    return n * powmod(n, count - 1, mod) % mod;
}

int64 ncr(int64 n, int64 r, int64 mod) {
    int64 a;
    if (n < r) a = min(n, r - n);
    else a = min(n - r, r);

    int64 res = 1;
    rep(i, a) {
        res = res * (n - i) % mod;
        res = res * powmod(i + 1, mod - 2, mod) % mod;
    }

    return res;
}

int main() {
    int64 N, A, B; cin >> N >> A >> B;

    int64 a = N / (A + B);
    int64 b = N % (A + B);

    cout << a * A + min(A, b) << endl;
}


Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var D = one[1];
  var output = 0;
  for(var i = 0; i < N; i++){
    var tmp = nextIntArray();
    var dis = Math.sqrt(tmp[0] * tmp[0] + tmp[1] * tmp[1]);
    if(dis <= D){
      output++;
    }
  }
  myout(output);
}


Measured memory_bytes: 79452
N, K = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)
mod = 10**9+7

# conbModに使うfactとfactinvを求める
def factorialMod(n, p):
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    for i in range(2, n + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    return fact, factinv

# 二項係数を素数で割った余り
def combMod(n, r, fact, factinv, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

ans = 0
fact, factinv = factorialMod(N, mod)
for i in range(N):
    num = combMod(i, K-1, fact, factinv, mod) % mod
    ans += num * A[i] % mod
    ans -= num * A[N-i-1] % mod
    ans %= mod

print(ans)

Measured memory_bytes: 20184
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int N = int(S.length()), sep[2][N], count = 1, result[N], N_eo[2] = {0, 0};
  sep[1][0] = -1;
  for(int i = 0; i < N; i++){
    if(S[i] == 'R' && S[i + 1] == 'L') sep[0][count] = i;
    if(S[i] == 'L' && S[i + 1] == 'R'){
      sep[1][count] = i;
      for(int i = sep[1][count - 1] + 1; i <= sep[1][count]; i++) N_eo[i % 2] += 1;
      for(int i = sep[1][count - 1] + 1; i <= sep[1][count]; i++){
        if(i == sep[0][count]) result[i] = N_eo[i % 2];
        else if(i == sep[0][count] + 1) result[i] = N_eo[i % 2];
        else result[i] = 0;
      }
      count += 1;
      N_eo[0] = 0;
      N_eo[1] = 0;
    }
  }
  
  for(int i = sep[1][count - 1] + 1; i < N; i++) N_eo[i % 2] += 1;
  for(int i = sep[1][count - 1] + 1; i < N; i++){
    if(i == sep[0][count]) result[i] = N_eo[i % 2];
    else if(i == sep[0][count] + 1) result[i] = N_eo[i % 2];
    else result[i] = 0;
  }
  
  cout << result[0];
  for(int i = 1; i < N; i++) cout << ' ' << result[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 1408
/*氏名：保坂優介, 学籍番号：200441141
  概要：*/

#include<stdio.h>
#include<math.h>

int main(void)
{
    int i, j, k, n, x[100], y[100];
    double p[4] = { 0 };

    scanf("%d", &n);

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

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

    for (i = 0; i < n; i++)
    {

        p[0] = p[0] + fabs(x[i] - y[i]);

    }

    for (i = 0; i < n; i++)
    {
        p[1] = p[1] + pow(fabs(x[i] - y[i]),2);
    }

    p[1] = sqrt(p[1]);

    for (i = 0; i < n; i++)
    {
        p[2] = p[2] + pow(fabs(x[i] - y[i]),3);
    }

    p[2] = cbrt(p[2]);

    for (i = 0; i < n; i++)
    {
        p[3] = fmax(p[3], fabs(x[i] - y[i]));
    }

    for (i = 0; i < 4; i++)
    {
        printf("%f\n", p[i]);
    }

    return 0;
}


Measured memory_bytes: 2976
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll x, y;
  cin >> x >> y;
  ll xx = x, yy = y;
  if(x % 2) x--;
  if(y % 2) y--;
  cout << ((x ^ y && abs(xx - yy) != 1) ? "Alice" : "Brown") << endl;
}

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

int stack_pointer = -1;
long _stack[101];

void push(long l)
{
    _stack[++stack_pointer] = l;
}

long pop()
{
    return _stack[stack_pointer--];
}

bool empty()
{
    return (stack_pointer < 0);
}

int main()
{
    string _s;
    getline(cin, _s);

    istringstream iss(_s);

    string s;
    while (getline(iss, s, ' ')) {
        if (s == "+") {
            long a = pop();
            long b = pop();
            push(a + b);
        } else if (s == "-") {
            long a = pop();
            long b = pop();
            push(b - a);
        } else if (s == "*") {
            long a = pop();
            long b = pop();
            push(a * b);
        } else {
            push(stoi(s));
        }
    }

    cout << pop() << endl;

    return 0;
}



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

int main()
{
	int n; cin>>n; int a[100001]; int x; cin>>x;
	for(int i=0;i<n;i++) cin>>a[i];
	int d=0,c=0; int i=0;
	while(d<=x and i<n)
	{
		c += 1;
		d += a[i];
		i += 1;
	}

	if(d<=x) c++;

	cout<<c;

}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define BUG(x) cerr << #x << " = " << (x) << endl
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define _1 first
#define _2 second
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  if ((b - a) % 2 == 0) {
    cout << (b - a) / 2;
    return 0;
  }
  ll ans = min(a - 1, n - b) + 1;
  cout << ans + (b - a) / 2;
}


Measured memory_bytes: 256
program ARC098C
    implicit none
    integer(8)::N,i
    integer(8)::e_count=0
    integer(8)::w_count=0
    integer(8)::result
    integer(8),allocatable,dimension(:)::E,W
    character(300000)::S

    read(5,*)N
    read(5,*)S
    allocate(E(N))
    allocate(W(N))
    result=N-1

    do i=1,N
        if(S(i:i)=='E')then
            e_count=e_count+1
        else
            w_count=w_count+1
        end if
        E(i)=e_count
        W(i)=w_count
    end do

    do i=1,N
        if(i==1)then
            if(E(N)-E(i)<result)then
                result=E(N)-E(i)
            end if
        else if(i<N)then
            if(W(i-1)+E(N)-E(i)<result)then
                result=W(i-1)+E(N)-E(i)
            end if
        else if(W(i-1)<result)then
            result=W(i-1)
        end if
    end do

    print'(i0)',result
end program ARC098C

Measured memory_bytes: 5772
const lines=readlines(open("/dev/fd/0"))
let
    state=0
    global input
    input()=lines[state+=1]
end
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
intLine()=map(intSub,split(input()))
function main()
    n,m,c=intLine()
    b=intLine()
    println(sum(sum(intLine().*b)+c>0 for i in 1:n))
end
main()

Measured memory_bytes: 123092
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b >= c) cout << "Yes";
    else cout << "No";
}


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

int main(){
    ll n,total=0,total2=0;
    cin >> n;
    vector<ll> a(n+2);
    vector<ll> b(n+2,0);
    for(ll i=1;i<=n;i++) cin >> a[i];
    
    for(ll i=n;i>0;i--){
        ll k=i;
        for(ll j=i;j<=n;j+=k){
            if(b[j]==1) total++;
        }
        if(a[i]!=total%2) b[i]=1;
        total=0;
    }
    
    for(ll i=1;i<=n;i++){
        if(b[i]==1) total2++;
    }
    
    cout << total2 << endl;
    
    int c=0;
    
    for(ll i=1;i<=n;i++){
        if(b[i]==1){
            if(c) cout << " ";
            cout << i;
            c++;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int N;cin>>N;
    vector<int>vec(N);
    int k=0;
    int pc=0;
    int mc=0;
    REP(i,N){
        int a;cin>>a;
        if(a==0){
            --k;
            continue;
        }
        if(a>0){
          	pc++;
          	vec[i+k]=a;
        }
        if(a<0){
          	mc++;
        	vec[i+k]=-a;
        }
    }
    vec.resize(N+k);
    sort(vec.begin(),vec.end());
    bool y=mc%2;
    int ans=0;
    if(!y||k!=0){
        REP(i,N+k){
            ans+=vec[i];
        }
    }
    else{
        REP(i,N+k){
            if(i==0)ans-=vec[i];
            else ans+=vec[i];
        }
    }
    cout<<ans<<endl;
}

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

int MP[81][81][16000];
int AS[81][81];
int BS[81][81];
int DS[81][81];

int main() {
  int i = 0, j = 0, H, W, d, k;
  scanf("%d %d", &H, &W);
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
      scanf("%d", &AS[i][j]);
    }
  }
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
      scanf("%d", &BS[i][j]);
    }
  }
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
      DS[i][j] = abs(AS[i][j]-BS[i][j]);
    }
  }

  MP[0][0][DS[0][0]] = 1;
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
      d = DS[i][j];
      for (k = 0; k < 16000-d; k++) {
        if (i > 0) {
          MP[i][j][abs(k-d)] = MP[i][j][abs(k-d)] || MP[i-1][j][k];
          MP[i][j][abs(k+d)] = MP[i][j][abs(k+d)] || MP[i-1][j][k];
        }
        if (j > 0) {
          MP[i][j][abs(k-d)] = MP[i][j][abs(k-d)] || MP[i][j-1][k];
          MP[i][j][abs(k+d)] = MP[i][j][abs(k+d)] || MP[i][j-1][k];
        }
      }
    }
  }
  for (i = 0; i < 16000; i++) {
    if (MP[H-1][W-1][i]) {
      printf("%d\n", i);
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 405632
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
using namespace std;
using ll=long long;
#define chmax(x, y) { x = max(x, y); }
#define chmin(x, y) { x = min(x, y); }

int main(){
    int d,t,s;
    cin>>d>>t>>s;

    if(d<=t*s) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;

}

Measured memory_bytes: 3628
import sys

N = int(sys.stdin.readline().rstrip())
A = map(int, sys.stdin.readline().rstrip().split())

colors = set()
free = 0
for a_i in A:
    color = a_i // 400
    if color >= 8:
        free += 1
    else:
        colors.add(color)

n = len(colors)
print(max(n, 1), n + free)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <bitset>
#include <set>
#include <queue>

#define FOR(i, a, b) for(int i = (int)a; i < (int)b; ++i)
#define REP(i, n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
template <class T, class U> void CHMAX(T & a, const U & b) { if (a < b) a = b; }
template <class T, class U> void CHMIN(T& a, const U& b) { if (a > b) a = b; }

constexpr int INF = (1 << 30) - 1;



signed main() {
	int n, m;
	while (std::cin >> n >> m, n || m) {
		std::vector<int> a(m), b(m), c(m);
		std::vector<char> s(m);
		REP(i, m) std::cin >> a[i] >> b[i] >> c[i] >> s[i], --a[i], --b[i];
		int r;
		std::cin >> r;
		std::vector<int> z(r);
		REP(i, r) std::cin >> z[i], --z[i];

		std::vector<std::vector<ll>> gl(n, std::vector<ll>(n, INF)), gs(n, std::vector<ll>(n, INF));
		REP(i, n) gl[i][i] = gs[i][i] = 0;

		REP(i, m) {
			if (s[i] == 'L') gl[a[i]][b[i]] = gl[b[i]][a[i]] = c[i];
			if (s[i] == 'S') gs[a[i]][b[i]] = gs[b[i]][a[i]] = c[i];
		}
		REP(k, n) REP(i, n) REP(j, n) CHMIN(gl[i][j], gl[i][k] + gl[k][j]);
		REP(k, n) REP(i, n) REP(j, n) CHMIN(gs[i][j], gs[i][k] + gs[k][j]);

		std::vector<ll> cur(n, INF), nex(n, INF);
		cur[z[0]] = 0;
		REP(k, r - 1) {
			REP(i, n) CHMIN(nex[i], cur[i] + gl[z[k]][z[k + 1]]);
			REP(i, n) REP(j, n) {
				CHMIN(nex[j], cur[i] + gl[z[k]][i] + gs[i][j] + gl[j][z[k + 1]]);
			}
			cur.swap(nex);
			REP(i, n) nex[i] = INF;
		}

		ll ans = INF;
		REP(i, n) CHMIN(ans, cur[i]);
		std::cout << ans << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)

int N, M;
vector<pint> c;
int main()
{
    cin >> N >> M;
    for (int i = 0; i < M; i++)
    {
        int a, b;
        cin >> a >> b;
        c.push_back(pint(b, a));
    }
    sort(c.begin(), c.end());
    
    int ans = 0, last = -1;
    for (auto v : c)
    {
        if (last <= v.second)
        {
            ans++;
            last = v.first;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1400
from collections import deque 
import math
S = list(input())

N = len(S)
flag = 0
x = 0
y = 0
X = []
Y = [-2]
for n in range(N):
    if flag==0 and S[n]=='R':
        pass
    elif flag==0 and S[n]=='L':
        flag = 1
        Y.append(n-1)
    elif flag==1 and S[n]=='L':
        pass
    else:
        flag = 0
        X.append([x,n-1])
        x = n
X.append([x,N-1])

ans = []
ans = deque(ans)
K = len(Y)-1
for k in range(K):
    ans += [0]*(Y[k+1]-Y[k]-2)
    ans.append(math.ceil((Y[k+1]-X[k][0]+1)/2) + math.floor((X[k][1]-Y[k+1])/2))
    ans.append(math.floor((Y[k+1]-X[k][0]+1)/2) + math.ceil((X[k][1]-Y[k+1])/2))
ans += [0]*(N-Y[K]-2)

print(*ans)

Measured memory_bytes: 17692
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

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

int main() {
	ll L, R;
	const ll mod = 2019;
	cin >> L >> R;


	if(R-L>2019) {
		cout << 0 << endl;
		return 0;
	}
	ll Lm = L % mod;
	ll Rm = R % mod;
	// if(Lm >= Rm) {
	// 	cout << 0 << endl;
	// 	return 0;
	// }
	if(Lm>Rm) Rm += 2019;

	ll ans = 2018;

	for(int i = Lm; i<=Rm; i++) {
		for(int j = i+1; j<=Rm; j++) {
			ll tmp = i*j % mod;
			if(tmp<0) tmp += mod;
			if(ans > tmp) ans = tmp;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long k = sc.nextLong();
    long res;
    n %= k;
    res = Math.min(n, k-n);
    System.out.println(res);
    sc.close();
  }

  // static long cal(long n, long k) {
  //   if (Math.abs(n - k) < Math.abs(Math.abs(n - k) - k)) return Math.min(n, Math.abs(n-k));
  //   else return cal(Math.abs(n-k), k);
  // }
}

Measured memory_bytes: 22228
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main(){
  int a,b,h;
  cin >> a >> b >> h;
  cout << (a+b)*h/2 << endl;
  return 0;
}

Measured memory_bytes: 764
N, M = map(int, input().split())
p = 10**9 + 7
if abs(N-M) > 1:
  print(0)
  exit()

fct = [1] * (max(N, M) + 1)
for i in range(2, max(N, M)+1):
  fct[i] = fct[i-1] * i % p

print(fct[N] * fct[M] * ((N == M) + 1) % p)

Measured memory_bytes: 6900
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
#input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)

def main():
  s1 = input()
  n = len(s1)
  s2=s1[0:int((n-1)/2)]
  n2 = len(s2)
  s3=s1[int((n+3)/2-1):n]
  n3 = len(s3)
  tf = 'True'
  for i in range(n//2):
    if s1[i]!=s1[n-1-i]:
      tf='False'
  for i in range(n2//2):
    if s2[i]!=s2[n2-1-i]:
      tf='False'
  for i in range(n3//2):
    if s3[i]!=s3[n3-1-i]:
      tf='False'
  if tf=='True':
    print('Yes')
    
  else:
    print('No')
      
  
  

if __name__ == '__main__':
  main()

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,r;
	cin>>n>>r;
	if(n>=10){
		cout<<r<<endl;
	}
	else{
		cout<<r+(100*(10-n))<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int N, K; cin >> N >> K;
    vector<int> h(N); repp(i,0,N) cin >> h[i];
    int count = 0;

    repp(i,0,N) if (h[i] >= K) ++count;
    cout << count << endl;
}


Measured memory_bytes: 640
a, b, c, d = [int(x) for x in input().strip()]
if a + b + c + d == 7:
    print(f"{a}+{b}+{c}+{d}=7")
elif a + b + c - d == 7:
    print(f"{a}+{b}+{c}-{d}=7")
elif a + b - c + d == 7:
    print(f"{a}+{b}-{c}+{d}=7")
elif a - b + c + d == 7:
    print(f"{a}-{b}+{c}+{d}=7")
elif a - b - c + d == 7:
    print(f"{a}-{b}-{c}+{d}=7")
elif a + b - c - d == 7:
    print(f"{a}+{b}-{c}-{d}=7")
elif a - b + c - d == 7:
    print(f"{a}-{b}+{c}-{d}=7")
elif a - b - c - d == 7:
    print(f"{a}-{b}-{c}-{d}=7")


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

int main(){
  int a;
  cin>>a;
  int b=sqrt(a)/1;
  int ans=1;
  for(int i=2;i<=b;i++){
	int temp=i;
    while(temp<=a){
      temp*=i;
    }
    ans=max(ans,temp/i);
  }
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] nums = new int [N];
		int count =0;
		for(int i=0;i<N;i++) 
			nums[i]=sc.nextInt();
		
		Main c = new Main();
		
		while(true)
			if( c.isGusu(nums) ==true) 
			{
				for(int k=0;k<N;k++) 	nums[k] /= 2;
				count += 1;
			}
			else break;
		System.out.println(count);
	}
	
	boolean isGusu (int[] a) 
	{
		for(int i=0;i<a.length;i++) 
			if(a[i] %2 != 0)  return false;
		return true;
	}

}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  vll v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  ll k;
  cin>>k;

  k--;
  cout<<v[k]<<endl;
}



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

int sum(int n) {
	int ret = 0;
	while (n) {
		ret += n % 10;
		n /= 10;
	}
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, ans = 1000;
	cin >> n;
	for (int i = 1; i < n; ++i) {
		int a = sum(i);
		int b = sum(n - i);
		ans = min(ans, a + b);
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a,b,c,d, sum=0;

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

    sum += (a<b) ? a:b;
    sum += (c<d) ? c:d;

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

    return 0;
}

Measured memory_bytes: 128
n, m = map(int,input().split())
arr = [list(map(int,input().split())) for _ in range(m)]
if n == 1:
    for i in range(10):
        tmp = str(i)
        flag = True
        for j in range(m):
            if tmp[arr[j][0]-1] != str(arr[j][1]):
                flag = False
        if flag:
            print(i)
            exit()
    print(-1)
else:
    for i in range(10**(n-1),10**n):
        tmp = str(i)
        flag = True
        for j in range(m):
            if tmp[arr[j][0]-1] != str(arr[j][1]):
                flag = False
        if flag:
            print(i)
            exit()
    print(-1)

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;

int main(){
  string S; cin>>S;
  int P = 2019, N = S.size();
  vector<ll> dp(N+1,0);
  ll ten = 1;
  for(int i = N-1; i >= 0; i--){
    ll tmp = ten*((int)(S.at(i)-'0')) + dp.at(i+1);
    tmp %= P;
    ten *= 10;
    ten %= P;
    dp.at(i) = tmp;
    // cout<<dp.at(i)<<endl;
  }
  sort(begin(dp),end(dp));
  map<ll,ll> m;
  for(auto i: dp){
    if(m.count(i))m[i]++;
    else m[i]=1;
  }
  //for(auto p: m)cout<<p.first<<" "<<p.second<<endl;
  ll res = 0;
  for(auto p: m){
    ll cnt = p.second;
    res += (cnt-1)*cnt/2;
  }
  cout<<res<<endl;
}


Measured memory_bytes: 5124
//Next Alphabet

#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>

using namespace std;

int main ()
{
    char C;
    cin >> C;
    C++;
    cout << C;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

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

		while(sc.hasNext()){
			char[] a = sc.next().toCharArray();
			int ca = 1;
			int cb = 1;
			int k = 0;
			boolean flagA = false;
			boolean flagB = false;
			
			for(int i=1;i<a.length;i++){
				if(a[i]==a[i-1]){
					ca++;
				}else{
					if(a[i-1]=='J' && a[i]=='O'){
						cb = ca;
						ca = 1;
						flagA = true;
					}else if(flagA==true && cb>=ca && a[i]=='I'){
						cb = ca;
						ca = 1;
						flagA = false;
						flagB = true;
					}else if(flagB==true && cb<=ca){
						k = Math.max(k, cb);
						ca = 1;
						flagA = false;
						flagB = false;
					}else{
						ca = 1;
						flagA = false;
						flagB = false;
					}
				}
			}
			if(flagB==true && cb<=ca) k = Math.max(k, cb);
			System.out.println(k);
		}
	}
}

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

int a[100000], b[100000], c[100000], dp[100000][3];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    for (int i=0; i<n; i++)
        cin >> a[i] >> b[i] >> c[i];

    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for (int i=1; i<n; i++) {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
    }

    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << "\n";

    return 0;
}


Measured memory_bytes: 2560