akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main()
{
    int n, a[1000];
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = n-1; -1 < i; i--)
    {
        cout << a[i] << (i==0?"\n":" ");
    }
}



Measured memory_bytes: 3084
#include <cstdio>
#include <cctype>
#include <map>
const long long mod=1000000007;
std::map<long long,long long>f;
long long solve(long long x){
	return (f[x])?f[x]:f[x]=((solve(x/2)+solve((x-1)/2)+solve((x-2)/2)))%mod;
}
long long lread(){
	long long x=0;
	char ch=getchar();
	while(!isdigit(ch))	ch=getchar();
	while(isdigit(ch))	x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	ungetc(ch,stdin);
	return x;
}
int main(){
	long long n;
	f[0]=1,f[1]=2;
	printf("%lld\n",solve(lread()));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 10;
int l, n, a[N], ans, sd[N];
inline void Solve() {
    int k = 1;
    for (int i = 1; i <= n; ++i) sd[i] = sd[i - 1] + i * (a[i + 1] - a[i]);
    for (int i = 1; i <= n; ++i) {
        while (2 * (n - (k + 1) + 1) > 2 * (k + 1 - i) + 3) ++k;
        ans = max(ans, (n - i + 2) * l - a[i] - (      (3 - 2 * i) * (a[k + 1] - a[i]) + 2 * (sd[k] - sd[i - 1])         )  
         - (    2 * (n + 1) * (l - a[k + 1]) - 2 * (sd[n] - sd[k])     )       );
    }
}
signed main() {
    scanf("%lld%lld", &l, &n);
    for (int i = 1; i <= n; ++i) scanf("%lld", a + i);
    if (n == 1) return printf("%lld\n", max(a[1], l - a[1])), 0;
    a[n + 1] = l;
    Solve();
    for (int i = 1; i <= n; ++i) a[i] = l - a[i];
    reverse(a + 1, a + n + 1);
    Solve();
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <cstdio>
//using namespace std;
 //Compiler version g++ 6.3.0

using namespace std;

 int main()
 {
 	int v1,v2;
 	char op;
 	
 	while(true){
 		cin >> v1 >> op >> v2;
 		switch(op){
 			case '+':
 			cout<<v1+v2<<endl;
 			break;
 			case '-':
 			cout<<v1-v2<<endl;
 			break;
 			case '*':
 			cout<<v1*v2<<endl;
 			break;
 			case '/':
 			cout<<v1/v2<<endl;
 			break;
 			case '?':
 			return 0;
 			break;
 		}
 	}
 	return 0;
 }
    


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,c;cin >> a >> b >> c;
  if(4 * a * b < (c-a-b) * (c-a-b) && c-a-b > 0){
    cout <<"Yes" << endl;
  }else {
    cout <<"No" << endl;
  }
}

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

typedef long long ll;
typedef pair<int, int> pii; 
const int N = 2e5+10, mod = 1e9+7;

void solve() {
    ll a, b, c, d; cin >> a >> b >> c >> d;

    ll w = a * c;
    ll x = a * d;
    ll y = b * c;
    ll z = b * d;

    cout << max(max(w, x), max(y, z)) << endl;
}   

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    while (t--) solve();
    return 0;
}


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

#define MAX 100000

int main() {
	string S;

	cin >> S;

	int y = atoi( S.substr( 0, 4 ).c_str() );
	int m = atoi( S.substr( 5, 2 ).c_str() );
	int d = atoi( S.substr( 8, 2 ).c_str() );
	
	if( y * 365 + m * 31 + d  <= 2019 * 365 + 4 * 31 + 30 ) {
		cout << "Heisei" << endl;
	}
	else {
		cout << "TBD" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
char a[maxn];
int main()
{

      int n;
      scanf("%d",&n);
      scanf("%s",a);
      int t1=0,t2=0;
      for(int i=0;i<n;i++)
      {
          if(a[i]=='B')
            t1++;
            else
                t2++;
      }
      if(t2>t1)
        cout<<"Yes"<<endl;
      else
        cout<<"No"<<endl;
    return 0;
}



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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A;
    int B;
    cin>>A>>B;
    int ans;
    ans=max(A+B,A-B);
    ans =max(ans,A*B);
    print(ans);
    return 0;
}


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

int main()
{
    int n, m;

    while( cin >> n >> m )
    {
        if( n + m == 0 )
            break;

        string s[n];
        int y1[n], y2[n], y3;

        for( int i = 0; i < n; i++ )
            cin >> s[i] >> y1[i] >> y2[i];

        for( int i = 0; i < m; i++ )
        {
            cin >> y3;
            bool judge = false;
            for( int j = 0; j < n; j++ )
            {
                if( y2[j] - y3 >= 0 && y1[j] - ( y2[j] - y3 ) > 0 )
                {
                    cout << s[j] << " " << y1[j] - ( y2[j] - y3 ) << endl;
                    judge = true;
                }
            }
            if( !judge )
                cout << "Unknown" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3268
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		String sB = sc.next();
		long B = Integer.parseInt(sB.substring(0, 1)) * 100 +
				 Integer.parseInt(sB.substring(2, 3)) * 10 +
				 Integer.parseInt(sB.substring(3, 4));
		System.out.println((A * B / 100));

		sc.close();
	}
}


Measured memory_bytes: 35812
#include<stdio.h>
#include<math.h>
int main(void){
  int x;
  scanf("%d",&x);
  for(int a=-188;a<=119;a++){
    for(int b=-199;b<=118;b++){
      if((pow(a,5))-(pow(b,5))==x){
        printf("%d %d",a,b);
        return 0;
      }
    }
  }
}

Measured memory_bytes: 2596
#include <bits/stdc++.h>
using namespace std;
#define M 1e9+7
#define ll long long int 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    string s;
    cin >> s;
    int n=s.length();
    int a[n]={0};
    for(int i=0;i<n;i++)
    {
        if(s[i]=='L')
        {
            int k=i-1;
            int r=0;
            int l=0;
            int li,ri;li=i;ri=i-1;
            while(s[k]=='R')
            {
                if((i-k)%2==0)
                l++;
                else
                r++;
                k--;
                if(k<0)break;
            }
            k=i;
            i++;
            l++;
            while(s[i]=='L')
            {
                if((i-k)%2==0)l++;
                else r++;
                i++;
                if(i==n)break;
            }
            a[ri]=r;
            a[li]=l;
        }
    }
    for(int i=0;i<n;i++)cout<<a[i]<<" ";
    return 0;
}

Measured memory_bytes: 1104
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
//#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
//#define EXIST(s, e) ((s).find(e)!=(s).end())
//#define SORT(c) sort(begin(c),end(c))
//#define pb emplace_back
//#define MP make_pair
//#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    int N;
    cin >> N;
    cout << "AB" << char('C' + N / 1000) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
class x{public:long f,s;};x P[1<<17];long c[1<<17],n,i,w=1e9;main(){for(std::cin>>n;i<n;P[i].s=i++)std::cin>>P[i].f;std::sort(P,P+n,[](x p,x q){return p.f-q.f?p.f<q.f:p.s>q.s;});for(;i--;)c[w=w>P[i].s?P[i].s:w]+=(n-i)*(P[i].f-P[i-1].f);for(;++i<n;)printf("%ld\n",c[i]);}

Measured memory_bytes: 3456
#include<stdio.h>
int main(){
  int i,j,n,m,a[101],st;
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<=m;i++){
    for(j=0;j<n-1;j++){
      if(a[j]%i > a[j+1]%i){
	st=a[j];
	a[j]=a[j+1];
	a[j+1]=st;
      }
    }
  }
    for(i=0;i<n;i++){
      printf("%d\n",a[i]);
    }
    return 0;
  
}

Measured memory_bytes: 1024
using System;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime.InteropServices;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            double A, B;
            A = double.Parse(str[0]);
            B = double.Parse(str[1]);
            Console.WriteLine(A * B/2);

        }

    }
}


Measured memory_bytes: 27572
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
 string s,t;
 cin>>s>>t;
 int n=s.size();
 vector<int>left(26,-1),right(26,-1);
 for(int i=0;i<n;i++){
   int a=s[i]-'a';
   int b=t[i]-'a';
   if(left[a]!=-1||right[b]!=-1){
     if(left[a]!=b||right[b]!=a){
       cout<<"No"<<endl;return 0;
     }
   }
   left[a]=b;
   right[b]=a;
 }
 cout<<"Yes"<<endl;
 return 0;
}

Measured memory_bytes: 3888
import sys

n = int(sys.stdin.readline())
before_t, before_x, before_y = 0, 0, 0
for i in range(n):
	txy_strs = sys.stdin.readline().split()
	t, x, y = tuple(map(int, txy_strs))

	movable = t - before_t
	min_move = abs(x - before_x) + abs(y - before_y)

	remaining = movable - min_move
	if 0 <= remaining and remaining % 2 == 0:
		before_t, before_x, before_y = t, x, y
	else:
		print("No")
		sys.exit()
print("Yes")

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

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

int main(void){
    ll dp[100010], h[100010];
    int n, k; cin >> n >> k;
    REP(i, n) cin >> h[i];
    REP(i, 100010) dp[i] = INF;

    dp[0] = 0;
    FOR(i, 1, n){
        FOR(j, 1, k + 1){
            if(i - j < 0) break;
            chmin(dp[i], dp[i - j]  + abs(h[i] - h[i - j])); //配るdpのが書き方が楽
        }
    }

    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>

using namespace std;

vector<vector<vector<int>>> mansion(4,vector<vector<int>>(3,vector<int>(10,0)));

int main(){
  int b,f,r,v,n;
  cin >> n;
  for(int i=0;i < n;i++){
    cin >> b >> f >> r >> v;
    mansion.at(b-1).at(f-1).at(r-1) += v;
  }

  for(int i=0;i < 4;i++){
    for(int j=0;j < 3;j++){
      for(int k=0;k < 10;k++){
        cout << " " << mansion.at(i).at(j).at(k);
        if(k == 9) cout << "\n";
      }
    }
    if(i != 3) cout << "####################" << endl;
  }
  return 0;
}


Measured memory_bytes: 3160
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

S,T = list(map(str, sys.stdin.readline().split()))
A,B = LI()
U = str(input())

if S == U:
    A -= 1
elif T == U:
    B -= 1
print(A, B)

Measured memory_bytes: 5580
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

const A: usize = 0;
const G: usize = 1;
const C: usize = 2;

#[fastout]
fn main() {
    input! {
    n: usize,
    }
    let p = 1_000_000_007;
    let mut dp = vec![vec![vec![vec![0; 4]; 4]; 4]; n + 1];
    for i in 0..4 {
        for j in 0..4 {
            for k in 0..4 {
                if i == A && j == G && k == C {continue}
                if i == G && j == A && k == C {continue}
                if i == A && j == C && k == G {continue}
                dp[3][i][j][k] = 1;
            }
        }
    }
    for t in 4..=n {
        for i in 0..4 {
            for j in 0..4 {
                for k in 0..4 {
                    for l in 0..4 {
                        if i == A && k == G && l == C {continue}
                        if i == A && j == G && l == C {continue}
                        if j == A && k == G && l == C {continue}
                        if j == G && k == A && l == C {continue}
                        if j == A && k == C && l == G {continue}
                        dp[t][j][k][l] += dp[t - 1][i][j][k];
                        dp[t][j][k][l] %= p;
                    }
                }
            }

        }
    }
    let mut ans = 0;
    for i in 0..4 {
        for j in 0..4 {
            for k in 0..4 {
                ans += dp[n][i][j][k];
                ans %= p;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2264
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int maxn=1e5+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while((!isdigit(c))&&(c!=EOF)){if(c=='-')f=-1;c=getchar();}
	while((isdigit(c))&&(c!=EOF)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,x[maxn],ans,s,p[maxn];
void dfs(int l,int r){
	if(l>r)return ;
	if(x[l]<s&&s<x[r]){
		if(p[l]<p[r]){
			p[r]+=p[l];
			dfs(l+1,r);
			ans=ans+abs(x[l]-s);
			s=x[l];
		}
		else{
			p[l]+=p[r];
			dfs(l,r-1);
			ans=ans+abs(x[r]-s);
			s=x[r];
		}
		return ;
	}
	if(s<=x[l]){
		ans=ans+(x[l]-s);
		s=x[l];
		dfs(l+1,r);
		return ;
	}
	else if(s>=x[r]){
		ans=ans+(s-x[r]);
		s=x[r];
		dfs(l,r-1);
		return ;
	}
}
signed main(){
	n=read();s=read();
	for(int i=1;i<=n;i++){
		x[i]=read();
		p[i]=read();
	}
	dfs(1,n);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 4352
(defun app ()
    (let* ((n (read))
        (k (read))
        (h (make-array n :initial-element 0))
        (ans 0))
        (dotimes (i n)
        (setf (aref h i) (read)))
        (sort h '>)
        (loop for i below n do
        (if (>= i k)
            (incf ans (aref h i))
        )
        )
    (princ ans)
    )
)
(app)

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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int k, t;
    cin >> k >> t;

    vector<pair<int,int>> a(t);

    rep(i, t){
        int tmp;
        cin >> tmp;

        a[i] = make_pair(tmp, i + 1);
    }

    sort(ALL(a));

    vector<int> eat(k);

    eat[0] = a[t - 1].second;
    a[t - 1].first = a[t - 1].first - 1;
    sort(ALL(a));

    for(int i = 1; i < k; i++){

        if(eat[i - 1] == a[t - 1].second){

            if(t >= 2 && a[t - 2].first > 0){
                eat[i] = a[t - 2].second;
                a[t - 2].first = a[t - 2].first - 1;
            }else{
                eat[i] = a[t - 1].second;
                a[t - 1].first = a[t - 1].first - 1;
            }
        }else{
            eat[i] = a[t - 1].second;
            a[t - 1].first = a[t - 1].first - 1;
        }
        sort(ALL(a));
    }

    /*
    rep(i, k){
        cerr << eat[i] << " ";
    }
    cerr << endl;
    */

    int ans = 0;

    rep(i, k - 1){
        if(eat[i] == eat[i + 1]) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	ll N; cin >> N;
	ll a[100];
	rep(i, 0, N) {
		cin >> a[i];
	}
	sort(a, a + N);
	reverse(a, a + N);
	ll sum = 0;
	rep(i, 0, N) {
		sum += (i % 2 == 0) ? a[i] : -a[i];
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<string>
#include<queue>
#include<map>
using namespace std;
int dir[]={-4,4,-1,1};//上下左右 
map<string,int> table;
void bfs(string st)
{
	queue<string> q;
	table[st]=1;q.push(st); //起始状? 
	while(!q.empty())
	{
		st=q.front();q.pop();
		int num=st.find('0');//找到空格位置 
		for(int i=0;i<4;++i)
		{	
			int tn=num+dir[i];//可能??的数?
			if(tn<0||tn>7||num==3&&dir[i]==1||num==4&&dir[i]==-1)
			//空格在3的?候，4不能??，因?3 4 不相?，反之同理 
			{
				continue;
			}
			string tp=st;
			//cout<<"tp = "<<tp<<endl;
			swap(tp[num],tp[num+dir[i]]);//移?物? 
			if(!table[tp])//未出??的状? 
			{
				q.push(tp);
				table[tp]=table[st]+1; 
			}
		}
	}
}
int main()
{
	int num;
	string st="01234567";//起始状? 
	bfs(st);//逆向搜索 
	//freopen("shuju.txt","r",stdin);
	while(~scanf("%d",&num))
	{
		st[0]=num+'0';
		for(int i=1;i<8;++i)
		{
			scanf("%d",&num);
			st[i]=num+'0';
		}
		printf("%d\n",table[st]-1);//从1?始?号的 
	}
	return 0;
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

#define All(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1e9;

int main(){
   string s;
   cin >> s;
   string t;
   cin >> t;
   sort(All(s));
   sort(All(t),greater<int>());
   if(s<t){
      cout << "Yes";
   }else{
      cout << "No";
   }
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
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; }


signed main()
{
    int N; cin>>N;
    vector<int> a(N),b(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    for(int i=0;i<N;i++){
        cin>>b[i];
    }

    vector<int> v;
    int sum=0,lack=0;
    int ans=0;
    for(int i=0;i<N;i++){
        sum+=a[i]-b[i];
        if(a[i]>b[i]){
            v.push_back(a[i]-b[i]);
        }
        if(a[i]<b[i]){
            ans++;
            lack+=b[i]-a[i];
        }
    }

    if(sum<0){
        cout<<-1<<endl;
        return 0;
    }

    sort(v.rbegin(),v.rend());
    for(int i=0;i<v.size();i++){
        if(lack<=0) break;
        lack-=v[i];
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2808
import java.util.Scanner;

public class Main {

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

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);
		
		String line2 = sc.nextLine();
		String[] kari2 = line2.split(" ");
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = Integer.parseInt(kari2[i]);
		}
		
		String line3 = sc.nextLine();
		int q = Integer.parseInt(line3);
		
		String line4 = sc.nextLine();
		String[] kari4 = line4.split(" ");
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = Integer.parseInt(kari4[i]);
		}
		
		int C = 0;
		
		for (int i = 0; i < q; i++) {
			for (int j = 0; j < n; j++) {
				if (T[i] == S[j]) {
					C++;
					break;
				}
			}
			
		}
		
		System.out.println(C);

	}

}

Measured memory_bytes: 56700
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll n;
    cin >> n;
    vector<ll> a(n,0);
    rep(i,n)cin >> a[i];
    sort(a.begin(),a.end(),greater<ll>());
    ll res = -1;
    ll dist = LONG_LONG_MAX;
    for(ll i = 1;i < n;i++){
        if(dist > abs(a.front()/2.0 - a[i])){
            dist = abs(a.front()/2.0 - a[i]);
            res = a[i];
        }
    }
    cout << a.front() << " " << res << endl;
    return 0;
}

Measured memory_bytes: 1024
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
    #include "lib/dump.hpp"
#else
    #define dump(...) 42
    #define dump_1d(...) 42
    #define dump_2d(...) 42
    #define cerrendl 42
#endif
//}}}

signed main() {
    int n,k;cin>>n>>k;
    vector<int> h(n);
    rep(i, n) {
        cin>>h[i];
    }
    dump(h);
    vi dp(n, INF);
    dp[0] = 0;
    rep(i, 1, n){
        rep(j, 1, k+1){
            if (i-j>=0) chmin(dp[i], dp[i-j]+abs(h[i-j]-h[i]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main() {
  string s;
  cin >> s;
  int first = 0;
  int last = s.length() - 1;
  bool palindrome = true;
  while(first <= last) {
  	if(s[first++] != s[last--]) {
      palindrome = false;
      break;
    }
  }
  first = 0;
  last = (s.length() - 3) / 2;
  while(first <= last) {
  	if(s[first++] != s[last--]) {
      palindrome = false;
      break;
    }
  }
  first = (s.length() + 1) / 2;
  last = s.length() - 1;
  while(first <= last) {
  	if(s[first++] != s[last--]) {
      palindrome = false;
      break;
    }
  }
  if(palindrome) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
//Link : https://codeforces.com/contest/1284/problem/D

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000005
#define mod 1000000007
int add(int x,int y) {
  return ((x+y)%mod + mod)%mod;
}
int mul(int x,int y) {
  return (ll)x*y%mod;
}
int dp[N];
void solve() {
  int n,h,d;scanf("%d %d %d ", &n,&h,&d);
  int fac = 1,sum = 0;
  for(int i=1;i<=n;++i) {
    fac = mul(fac,i);
    sum = add(sum,fac);
  }
  dp[0] = 1;
  dp[1] = add(dp[1],-1);
  for(int p = 0;p<h;++p) {
    int ed = min(p + d,h);
    dp[p+1] = add(dp[p+1], mul(sum,dp[p]));
    dp[ed+1] = add(dp[ed+1],-mul(sum,dp[p]));

    dp[p+1] = add(dp[p+1],dp[p]);
  }
  int ret = 0;
  for(int i=1;i<=d;++i) {
    ret = add(ret, mul(fac,dp[h-i]));
  }
  printf("%d\n", ret);
}
int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


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

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

    int cnt = 0;
    for (int i = 0; i < N-2; i++) {
        for (int j = i + 1; j < N-1; j++) {
            for (int k = j + 1; k < N; k++) {
                if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
                    if (max(L[i], L[j]) >= min(L[i], L[j]) + L[k]) continue;
                    if (L[k] >= L[i] + L[j]) continue;
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3580
S = input()
ans = 0
for i in range (1<<(len(S)-1)):
	st = S[0]
	for j in range(len(S)-1):
		if i & (1<<j):
			st = st + '+' + S[j+1]
		else:
			st = st + S[j+1]
	ans = ans + eval(st)
	
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

ll MD=1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	map< pll , ll >POS,NEG;
	map< pll , bool >DONE;
	ll ans=0,AZ=0,BZ=0;
	cin >> n;
	for(i=1;i<=n;i++)
	{
		cin >> x >> y;
		ll f=0;
		if( (y<0 && x>0) || (y>0 && x<0) )
		{

			f=1;
		}

		x=abs(x),y=abs(y);


		if(x && y)
		{
			ll g=__gcd(x,y);
			x/=g,y/=g;

			if(f)
			{
				if(NEG.find(mp(x,y))==NEG.end())
					NEG[mp(x,y)]=1;
				else
					NEG[mp(x,y)]++;
			}
			else
			{
				// cout<<x<<"rg"<<y<<" "<<i<<endl;
				if(POS.find(mp(x,y))==POS.end())
					POS[mp(x,y)]=1;
				else
					POS[mp(x,y)]++;
			}
		}
		else
		{
			if(x==0 && y==0)
				ans+=1,ans%=MD;
			else
			{
				if(!x)
					AZ++;
				else
					BZ++;
			}
		}
	}

	x=(power(2,AZ,MD)-1+MD)%MD;
	y=(power(2,BZ,MD)-1+MD)%MD;

	ll g=(x+y+1)%MD;

	for(auto it:POS)
	{
		pll P=it.ff;
		swap(P.ff,P.ss);
		ll gg;
		if(NEG.find(P)==NEG.end())
			gg=0;
		else
			gg=NEG[P],DONE[P]=true;



		x=(power(2,it.ss,MD)-1+MD)%MD;
		y=(power(2,gg,MD)-1+MD)%MD;

		ll h=(x+y+1)%MD;
		g=(g*h)%MD;
	}

	for(auto it:NEG)
	{
		if(DONE.find(it.ff)!=DONE.end())
			continue;
		pll P=it.ff;
		swap(P.ff,P.ss);
		ll gg;
		if(POS.find(P)==POS.end())
			gg=0;
		else
			gg=POS[P];

		x=(power(2,it.ss,MD)-1+MD)%MD;
		y=(power(2,gg,MD)-1+MD)%MD;

		// cout<<x<<" "<<gg<<endl;
		ll h=(x+y+1)%MD;
		g=(g*h)%MD;
	}

	g=(g-1+MD)%MD;

	g=(g+ans)%MD;
	cout<<g<<endl;	
}

Measured memory_bytes: 16164
x = []
 
5.times do |e|
  x << gets.to_i
end
 
min = 10
sum = 0
for i in x
  
  if i%10 != 0
    min = i%10 if min > i%10
    sum += i + (10-i%10)
  else
    sum += i
  end
  
end
 
sum = sum - (10 - min)
 
puts "#{sum}"

Measured memory_bytes: 1788
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    t = i_input()
    for i in range(n-1):
        k = i_input()
        t = t*k//gcd(t,k)
    print(t)



if __name__=="__main__":
    main()


Measured memory_bytes: 9328
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int ans = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int count = -1;
		while(count != 0) {
			count = 0;
			boolean s = false;
			for (int i = 0; i < n; i++) {
				if (i == n-1 && a[i] > b[i]) {
					b[i]++;
					count++;
					ans++;
				} else if (a[i] > b[i]) {
					b[i]++;
					s = true;
				} else {
					if (s) {
						count++;
						ans++;
						s = false;
					}
				}
			}
		}
		System.out.println(ans--);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 21332
#include <stdio.h>
int main(){

    int a,b;
    scanf("%d %d",&a,&b);
    
    if(a<b){
        
        printf("a < b\n");
        
    }else if(a>b){
        
        printf("a > b\n");
        
    }else{
        
        printf("a == b\n");
        
    }
    
    return 0;
}

Measured memory_bytes: 580
#include <cstdio>
#include <algorithm>

const int MAXN = 1e5 + 5;

int n;
int arr[MAXN];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &arr[i]);
    }
    std::sort(arr + 1, arr + n + 1);
    printf("%d", arr[(n >> 1) + 1] - arr[n >> 1]);
    return 0;
}

Measured memory_bytes: 512
import itertools
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
ln = [i for i in range(n)]
ans = 0
c = 0
for i in itertools.permutations(ln):
    c += 1
    for j in range(len(i)-1):
        ans += ((l[i[j]][0] -l[i[j+1]][0])**2 +(l[i[j]][1] -l[i[j+1]][1])**2)**0.5
print(ans/c)

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

int main() {
    int n; cin>>n;
    for(int i=1;i<=9;i++) {
        for(int j=1;j<=9;j++) {
            if(n==i*j) {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return  0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
const int N=2005,P=1e9+7;
int n,m,K,ans,f[N*2][N][2],s[N];
int main(){
	cin>>n>>m>>K;
	f[0][0][0]=1;
	rep(i,1,(n+m-1)/(K-1)){
		rep(j,0,n)f[i][j][0]=s[j]=(f[i-1][j][0]+f[i-1][j][1])%P;
		rep(j,1,n)(s[j]+=s[j-1])%=P;
		rep(j,1,n){
			f[i][j][1]=(s[j-1]-(j>=K?s[j-K]:0)+P)%P;
		}
		int all=i*(K-1)+1;
		rep(j,1,n){
			if(j%(K-1)==n%(K-1)&&(all-j)%(K-1)==m%(K-1)&&all-j<=m)(ans+=f[i][j][1])%=P;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

using P = pair<int,int>;

int main() {
    int n;
    cin >> n;
    vector< vector<int> > g(n, vector<int>(n, 0));
    for(int i=0; i<n; i++){
        int u, k;
        cin >> u >> k;
        u--;
        for(int j=0; j<k; j++){
            int v;
            cin >> v;
            v--;
            g[u][v] = 1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j>0) cout << " ";
            cout << g[i][j];
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3156
#include <iostream>
#include <vector>
const long long mod=1e9+7;
using namespace std;
int main(void){
    // Your code here!
    int n,m;
    cin >> n >> m;
    
    vector<int>oks(n+1,true);
    for(int i = 0;i < m;i++){
        int a;cin >> a;
        oks[a] = false;
    }
    
    vector<long long int>dp(n+1);
    dp[0] = 1;
    for(int now = 0;now<n;now++){
        for(int next =now+1;next<=min(n,now+2);next++){
            if(oks[next]){
                dp[next]+=dp[now];
                dp[next]%=mod;//割ってるだけ
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}


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

using namespace std;

const int md = int(1e9) + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mul(int a, int b) {
  return (int) ((long long) a * b % md);
}

inline int power(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline int inv(int a) {
  a %= md;
  if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

const int N = 200010;

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

  vector<int> fac(N), finv(N);
  fac[0] = finv[0] = 1;
  for (int i = 1; i < N; i++) {
    fac[i] = mul(fac[i - 1], i);
    finv[i] = inv(fac[i]);
  }

  auto comb = [&](int n, int m) {
    int res = fac[n + m];
    res = mul(res, finv[n]);
    res = mul(res, finv[m]);
    return res;
  };

  int h, w, n;
  cin >> h >> w >> n;
  vector< pair<int,int> > wall;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    wall.emplace_back(x - 1, y - 1);
  }
  wall.emplace_back(h - 1, w - 1);
  sort(wall.begin(), wall.end());

  vector<int> dp(n + 1);
  for (int i = 0; i <= n; i++) {
    dp[i] = comb(wall[i].first, wall[i].second);
    for (int j = 0; j < i; j++) {
      int dx = wall[i].first - wall[j].first;
      int dy = wall[i].second - wall[j].second;
      if (dx >= 0 && dy >= 0) {
        sub(dp[i], mul(dp[j], comb(dx, dy)));
      }
    }
  }
  cout << dp[n] << '\n';
  return 0;
}

Measured memory_bytes: 1920
#include<iostream>
#include<string>
typedef long long int ll;
using namespace std;
int main(){
	int n,a,b,c,d; cin >>n>>a>>b>>c>>d;
	string s; cin >>s;
	s= "#"+s+"#";
	auto can_reach=[&](int start,int end){
		for(int i =start;i+1<=end;i++){
			if(s[i]=='#'&&s[i+1]=='#') return false;
		}
		return true;
	};

	if(!can_reach(a,c)|| !can_reach(b,d)){
		cout << "No" << endl;
		return 0;
	}
	if(c>d){
		bool snuke_can_over =false;
		for(int i=b;i<=d;i++){
			if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'){
				snuke_can_over=true;
			}
		}
		if(!snuke_can_over){
			cout << "No" << endl;
			return 0;
		}
	}

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


Measured memory_bytes: 772
#include <bits/stdc++.h>
#define rep( i, n ) for (long long i = 0; i < ( long long )(n); i++)

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

bool is_kai(string s ,int first,int last ){
    last--;
    while(s[first]==s[last]){
        first++;
        last--;
        if(first>=last){
            return true;
        }
    }
    return false;
}

int main(){
    string s;
    cin>>s;
    int n=s.size();
    if(is_kai(s,0,s.size())&&is_kai(s,0,(n-1)/2)&&is_kai(s,(n+3)/2-1,s.size())){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
pair<int,int> pii;
vector<int> vec;
int main()
{
  int n,cnt=0;
  int x[10],y[10];
  double sum=0;
  cin>>n;

  for(int i=0; i<n; i++){
    cin>>x[i]>>y[i];
  }

  for(int i=1; i<=n; i++){
    vec.push_back(i);
  }

  do{
    for(int i=0; i<n-1; i++){
      sum+=sqrt( (x[vec[i]-1]-x[vec[i+1]-1])*(x[vec[i]-1]-x[vec[i+1]-1]) + (y[vec[i]-1]-y[vec[i+1]-1])*(y[vec[i]-1]-y[vec[i+1]-1]) );
    }
    cnt++;
  }while(next_permutation(vec.begin(),vec.end()));

  printf("%.6f\n",sum/(double)cnt);

  return 0;
}


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


int main(){
    string S,T;
    int n, count = 0;
    std::cin >> S >> T;

    n = S.size();

    for(int i = 0; i < n; i++){
        if(S.at(i) != T.at(i)){
            S.at(i) = T.at(i);
            count++;
        }
    }

    std::cout << count;

}

Measured memory_bytes: 3840
import java.util.Scanner;

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

        char[] str=scn.next().toCharArray();
        if ( str[2]==str[3] &&str[4]==str[5]){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
        
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (a + b > c + d) cout << "Left" << endl;
  else if (a + b < c + d) cout << "Right" << endl;
  else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
line1 = input()
line2 = input()

n, k = tuple([int(val) for val in line1.split()])
a_list = [int(val) for val in line2.split()]

prev_sum = sum(a_list[0:k])
for i in range(k, n):
    current_sum = prev_sum - a_list[i-k] + a_list[i]
    if current_sum > prev_sum:
        print("Yes")
    else:
        print("No")
    prev_sum = current_sum

Measured memory_bytes: 33712
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N,R = LMIIS()
    if N < 10:
        print(R+100*(10-N))
    else:
        print(R)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    H = [int(x) for x in input().split()]

    ans, cnt = 0, 0
    for i in range(1,N):
        if H[i] <= H[i-1]:
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
    print(max(ans, cnt))


# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc139","c",main)

Measured memory_bytes: 14224
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, M = map(int, rl().split())
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]
    
    def check(y, x):
        res = True
        for dy in range(M):
            for dx in range(M):
                if A[y + dy][x + dx] != B[dy][dx]:
                    res = False
                    break
            if not res:
                break
        return res
    
    for sy in range(N - M + 1):
        for sx in range(N - M + 1):
            if check(sy, sx):
                print('Yes')
                exit()
    print('No')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <deque>
#include <stack>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define DEBUG(x) cout << (#x) << ": " << (x) << endl
#define DEBUG_VEC(v)            \
    cerr << #v << ": ";         \
    REP(__i, (v).size())        \
    cerr << ((v)[__i]) << ", "; \
    cerr << endl

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

int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin >> s;

    string ans;
    if (s == "A") ans = "T";
    else if (s == "T") ans = "A";
    else if (s == "G") ans = "C";
    else if (s == "C") ans = "G";

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


Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>
#include<string>
typedef long long int ll;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define F first
#define S second
using namespace std;
const ll INF = 10000000000000;

int main() {
	string s;
	cin >> s;
	bool judge = true;
	rep(i, 0, s.size()) {
		if (i % 2 == 1) {
			if (s[i] == 'R')judge = false;
		}
		else {
			if (s[i] == 'L')judge = false;
		}
	}

	if (judge)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int X; cin >> X;
    if(X == 1){
        cout << 1 << endl;
        return 0;
    }
    int ans = 0;
    FOR(i,2,sqrt(X)){
        int b = i, p = b;
        while(b*p <= X) b *= p;
        chmax(ans, b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int h,w,h2,w2;
    cin>>h>>w>>h2>>w2;
    
    vector<vector<int>> hoge(h,vector<int>(w,0));
    
    for(int i=0;i<h;i++){
        for(int k=0;k<w;k++){
            if(i<h2) hoge.at(i).at(k)=1;
            if(k<w2) hoge.at(i).at(k)=1;
        }
    }
    
    int ans=0;
    for(int i=0;i<h;i++){
        for(int k=0;k<w;k++){
            if(hoge[i][k]==0) ans++;
        }
    }
    
    cout<<ans<<endl;
        
 return 0;   
}

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

namespace AtCoder0627
{
	class Program
	{
		static void Main(string[] args)
		{
			B();
		}

		private static void B()
		{
			var s = Console.ReadLine();
			var t = Console.ReadLine();
			var count = Enumerable.Range(0, s.Length).Count(x => s[x] != t[x]);
			Console.WriteLine(count);
		}

		private static void A()
		{
			var a = int.Parse(Console.ReadLine());
			Console.WriteLine(a + a * a + a * a * a);
		}
	}
}


Measured memory_bytes: 28108
#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 int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  ll n; cin >> n;
  cout << n*(n-1)/2 << endl;
  system("pause");
}

Measured memory_bytes: 504