akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {

            var NM = ReadSplitLong();
            var n = NM[0];
            var m = NM[1];
            var a = ReadSplitLongLines(m);

            var dp = new long[n + 1];
            var instrusion = new bool[n + 1];

            // 1段目への移動方法数
            dp[0] = 1;

            // 侵入負荷の段数設定（trueが侵入負荷）
            for (long i = 0; i < m; i++)
            {
                instrusion[a[i][0]] = true;
            }

            for (long i = 0; i <= n; i++)
            {
                // 1段か2段先へ移動
                for (long j = 1; j <= 2; j++)
                {
                    if (i + j <= n)
                    {
                        // 侵入不可への移動はできない
                        if (instrusion[i + j] != true)
                        {
                            // i番目からi+j番目への移動
                            dp[i + j] += dp[i];
                            dp[i + j] %= 1000000007;
                        }
                    }
                }
            }
            Console.WriteLine(dp[n]);


            Console.ReadKey();
        }



        #region MyRegion

        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        /// <summary>
        /// 空白区切の数値を取得する
        /// </summary>
        /// <returns>The read split int.</returns>
        public static int[] ReadSplitInt()
        {
            return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }

        /// <summary>
        /// 空白区切の数値を取得
        /// </summary>
        /// <returns>The read split long.</returns>
        public static long[] ReadSplitLong()
        {
            return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        }


        public static int[][] ReadSplitIntLines(int n)
        {
            return Enumerable.Range(0, n).Select(x => ReadSplitInt()).ToArray();
        }

        public static long[][] ReadSplitLongLines(int n)
        {
            return Enumerable.Range(0, n).Select(x => ReadSplitLong()).ToArray();
        }

        public static long[][] ReadSplitLongLines(long n)
        {
            var ret = new List<long[]>();
            for (long i = 0; i < n; i++)
            {
                ret.Add(ReadSplitLong().ToArray());
            }

            return ret.ToArray();
        }

        #endregion

    }
}


Measured memory_bytes: 23376
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (r[0] == r[1])
            {
                Console.WriteLine(r[2]);
            }else if (r[0] == r[2])
            {
                Console.WriteLine(r[1]);
            }
            else
            {
                Console.WriteLine(r[0]);
            }
        }
        
    }
}

Measured memory_bytes: 13268
#include <stdio.h>

int stack[1024];
int head = 0;
void push(int v)
{
	stack[head] = v;
	head++;
}
int pop()
{
	int v;
	v = stack[head - 1];
	head--;
	return (v);
}

int main(void)
{
	int train;
	while (~scanf("%d", &train)){
		if (train == 0){
			printf("%d\n", pop());
		}
		else {
			push(train);
		}
	}
	return (0);
}

Measured memory_bytes: 600
#include<cstdio>
#include <algorithm>
#include <vector>
#include <iostream>
#include <map>
#define pb push_back
using namespace std;
int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
    bool t=false;
  for (int i=1;i<b;i++){
    if (a*i%b==c){
      printf ("YES");
        t=true;
        break;}
  }
  if (t==false) printf ("NO");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// ----------------------R00TDADA------------------------------
#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define int long long

signed main()
{
    rootdada;

// fac[0] = 1;
// inv[0] = 1;
// for (int i = 1; i < N; i++)
// {
//     fac[i] = fac[i - 1] * i;
//     fac[i] %= M;
//     inv[i] = power(fac[i], M - 2);
// }

    int a, b, x, y, u;
    cin >> a >> b;
    int flg = 0;
    rep(i, 1, 1201)
    {
        x = (i * 8 / 100);
        if (x == a)
        {
            y = i;
            int t = y / 10;
            if (t == b)
            {
                u = i;
                flg = 1;
                break;
            }
        }
    }
    if (flg)
        cout << u << endl;
    else
    {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 256
from collections import deque

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

buf = deque()  # 計算用配列
tmp = 0        # 計算用配列の全要素のxor値
ans = 0

for i in A_list:
    while tmp & i:
        #print(tmp, i, bin(tmp & i))
        remove_0_pos = buf.popleft()
        tmp ^= remove_0_pos #引き算
    buf.append(i)
    tmp ^= i # XORする
    ans += len(buf)
print(ans)

Measured memory_bytes: 33600
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,c=0;
  cin>>n;
  for(int i=n;i<100000000;i++){
    for(int j=2;j<sqrt(i);j++){
      if(i%j==0)
        c=1;
    }
    if(c!=1){
      cout<<i<<endl;
      return(0);
    }
    c=0;
  }    
  return(0);
}
  

Measured memory_bytes: 256
fun main(args:Array<String>) {
    val (n,k,q) = readLine()!!.split(" ").map { it.toInt() }
    val log = (1..q).map { readLine()!!.toInt() - 1 }
    val count = IntArray(n)
    for(i in log) {
        count[i] ++
    }
    (1..n).map {
        if(k-q+count[it-1]>0) {
            println("Yes")
        } else {
            println("No")
        }
    }
}

Measured memory_bytes: 45916
/* ***********************************************
Author        :ACagain
Created Time  :2018/4/21 11:50:24
File Name     :dong.cpp
************************************************ */

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define lson o<<1,l,m
#define rson o<<1|1,m+1,r
#define pii pair<int,int>
#define mp make_pair
#define ll long long
#define INF 0x3f3f3f3f
const int maxn=1e4+5;
int c[maxn];
int ans[105][105];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
   	int h,w,n;
	cin>>h>>w>>n;
	for(int i=1;i<=n;i++)
	  cin>>c[i];
	bool t=0;
	int cnt=0,cn=1;
	for(int i=0;i<h;i++)
	{
		if(t==0)
		{
			for(int j=0;j<w;j++)
			{
				ans[i][j]=cn;
				cnt++;
				if(cnt==c[cn])
				{
					cnt=0;
					cn++;
				}
			}
		}
		else
		{
			for(int j=w-1;j>=0;j--)
			{
				ans[i][j]=cn;
				cnt++;
				if(cnt==c[cn])
				{
					cnt=0;
					cn++;
				}
			}
		}
		t=!t;
	}
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		  cout<<ans[i][j]<<' ';
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
s = input()
mods = [0]*2019
mods[0] += 1
# for i in range(len(s)):
#     value = int(s[i:])
#     mods[value % 2019] += 1
base = 1
value = 0
for c in map(int, reversed(s)):
    value += (c*base) % 2019
    base = (base * 10) % 2019
    # value = int(s[i:])
    mods[value % 2019] += 1
print(sum([mod*(mod-1)//2 for mod in mods]))


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

int main(){
  int n,k;
  cin >>n >>k;
  int H = (n+k-1)/k;
  int h = n/k;
  cout << H-h << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int cv(char t){
  if(t=='I')
    return 1;
  if(t=='V')
    return 5;
  if(t=='X')
    return 10;
  if(t=='L')
    return 50;
  if(t=='C')
    return 100;
  if(t=='D')
    return 500;
  if(t=='M')
    return 1000;
  return 0;
}

int main(){
  char rom[101];
  int i,num,len;

  while(scanf("%s",rom)!=EOF){
    num=0;
    len=strlen(rom);
    for(i=0;i<len;i++){
      if(i>0&&cv(rom[i-1])<cv(rom[i]))
	// No 1st & i-1 < i ... No Operation
	continue;
      else if(i==len-1)
	// Last i & i-1 >= i ... num+=i
	num+=cv(rom[i]);  
      else if(cv(rom[i])>=cv(rom[i+1]))
	// i >= i+1 ... sum+=i
	num+=cv(rom[i]);
      else if(cv(rom[i])<cv(rom[i+1]))
	// i < i+1 ... sub
	num+=(cv(rom[i+1])-cv(rom[i]));
    }
    printf("%d\n",num);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	ll D, T, S;
	cin >> D >> T >> S;
	string ans = (D <= T * S) ? "Yes" : "No";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+2;
const int mod=998244353;
int ar[N];
int mul(int x,int y){
	return (1ll*x*y)%mod;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int ans=1,n,i,j,k,l;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>ar[i];
	}
	sort(ar,ar+n);
	for(i=0;i<n;i++){
		ans=mul(ans,__gcd(ar[i],i));
	}
	cout<<ans;
}

Measured memory_bytes: 3952
x,y = map(int, input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
if (x==2)or(y==2):
    print('No')
elif x in a:
    if y in a:
        print('Yes')
    else:
        print('No')
else:
    if y in b:
        print('Yes')
    else:
        print('No')
        


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  int N, K;
  cin >> N >> K;

  vector<pll> sushi(N);
  rep(i, N) cin >> sushi[i].first >> sushi[i].second;

  sort(sushi.begin(), sushi.end(), [](pll l, pll r){return l.second > r.second;});

  vector<ll> max_sushi, else_sushi;
  vector<bool> used(N+10, 0);
  int max_cnt = 0, else_cnt = 0;
  rep(i, N) {
    if (used[sushi[i].first]) {
      else_sushi.push_back(sushi[i].second);
      ++else_cnt;
    } else {
      used[sushi[i].first] = 1;
      max_sushi.push_back(sushi[i].second);
      ++max_cnt;
    }
  }

  sort(max_sushi.rbegin(), max_sushi.rend());
  sort(else_sushi.rbegin(), else_sushi.rend());

//  for (auto&& i : max_sushi) {
//    cerr << i.first << " " << i.second << endl;
//  }
//  cerr << endl;
//  for (auto&& i : else_sushi) {
//    cerr << i.first << " " << i.second<< endl;
//  }

  // 累積和 1-indexed
  vector<ll> max_sum(N+1), else_sum(N+1);
  rep(i, max_cnt) max_sum[i+1] = max_sum[i] + max_sushi[i];
  rep(i, else_cnt) else_sum[i+1] = else_sum[i] + else_sushi[i];

//  for (auto&& i : max_sum) {
//    cerr << i << endl;
//  }
//  cerr << endl;
//  for (auto&& i : else_sum) {
//    cerr << i << endl;
//  }

  ll ans = 0;
  // i種類で
  rep(i, K+1) {
    if (i > max_cnt || K-i > else_cnt) continue;
    cmax(ans, max_sum[i]+else_sum[K-i]+i*i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4344
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;


int main(int argc, char const *argv[])
{
  ll A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;

  cout << min(min(A*X + B*Y, X > Y ? (X-Y)*A + Y*C*2 : (Y-X)*B + X*C*2), max(X,Y)*2*C) << endl;
  return 0;
}


Measured memory_bytes: 3632
// contest.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include "bits/stdc++.h"
using namespace std;
int main()
{
	long N, M, V, P;
	cin >> N >> M >> V >> P;
	vector<long> A(N);
	for (auto& x : A)
	{
		cin >> x;
	}
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());

	long h = 1;
	while (h < N) {
		h *= 2;
	}
	long t = h / 2;
	long step = h / 2;
	while (step > 0)
	{
		if (t >= N) {
			step = step / 2;
			if (step == 0) {
				t--;
				break;
			}
			t -= step;
			continue;
		}
		long voted = N - t + P - 1;
		long box = 0;
		long flg = 1;
		for (int i = t - 1; i >= P - 1; i--)
		{
			box += A[t] + M - A[i];
			if (A[t] + M - A[i] < 0)
			{
				flg = -1;
				break;
			}
		}
		voted = N - t + P - 1 + box / M;
		step = step / 2;
		if (voted >= V && flg==1)
		{
			t += step;
		}
		else
		{
			if (step == 0) {
				t--;
				break;
			}
			t -= step;
		}
	}
	cout << t + 1;
	return 0;
}


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

int main() {
  string s, t; cin >> s;
  t = "ACGT";
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    int now = 0;
    for (int j = i; j < s.size(); j++) {
      bool isACGT = false;
      for (int k = 0; k < t.size(); k++) {
        if (s.at(j) == t.at(k)) isACGT = true;
      }
      if (isACGT) {
        now++;
        ans = max(ans, now);
      }
      else {
        now = 0;
        break;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: u8,
        s: String
    }
    let a = 'A' as u8;
    let ans = s
        .as_bytes()
        .iter()
        .map(|&b| ((b - a + n) % 26 + a) as char)
        .collect::<String>();
    println!("{}", ans);
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  ll a[n];
  rep(i,n) R a[i];
  priority_queue<ll> que;
  rep(i,n) que.push(a[i]);
  rep(i,m) {
    ll x=que.top();que.pop();
    que.push(x/2);
  }
  ll ans=0;
  while(!que.empty()) {
    ll x=que.top();que.pop();
    ans+=x;
  }
  pr(ans);
}

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


Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, ac=0, wa=0, tle=0, re=0;

    cin >> n;


    while(n--)
    {
        char tc[5];

        cin >> tc;


        if(strcmp(tc, "AC")==0)
        {
            ac++;
        }

        else if(strcmp(tc, "WA")==0)
        {
            wa++;
        }

        else if(strcmp(tc, "TLE")==0)
        {
            tle++;
        }

        else if(strcmp(tc, "RE")==0)
        {
            re++;
        }
    }

    cout << "AC x " << ac << endl;
    cout << "WA x "  << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;


}





















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

typedef short sh;
typedef unsigned short ush;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef unordered_set<int> usi;
typedef string str;
#define INF 1000000000
#define mv 1000000007
#define ln '\n'
#define max(a,b) ((a>=b)?a:b)
#define min(a,b) ((a<=b)?a:b)
#define itrip(s1,n) for(int i=s1;i<n;i++)
#define jtrip(s2,m) for(int j=s2;j<m;j++)
#define irip(s1,n) for(int i=s1;i>n;i--)
#define jrip(s2,m) for(int j=s2;j>m;j--)
#define pb push_back

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//cout<<fixed;
	//cout<<setprecision(6);

	sh a,b;
	cin>>a>>b;
	if(b%a==0)
		cout<<a+b<<ln;
	else
		cout<<b-a<<ln;
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
p = [int(x) for x in input().split()]
p = [(x + 1) / 2 for x in p]

S = [0 for _ in range(N + 1)]

for i in range(N):
    S[i + 1] += S[i] + p[i]

ans = 0
for i in range(N - K + 1):
    ans = max(ans, S[i + K] - S[i])

print(ans)

Measured memory_bytes: 24548
#include <stdio.h>

#define MAX(X,Y) ((X)>(Y)?(X):(Y))
#define MIN(X,Y) ((X)<(Y)?(X):(Y))

#define MOD 1000000007

int main(void){
    long n, p=1;
    
    scanf("%d", &n);
    for (int i=1; i<=n; i++){
        p *= i;
        p %= MOD;
    }
    printf("%d\n", p);
    return 0;
}

Measured memory_bytes: 128
n = int(input())
li = list(map(int,input().split()))
lis = []
lis.append(0)
for hoge in li:
    lis.append(hoge)
lis.append(0)
sumpo = 0
sumpo += abs(li[0])
for i in range(1,n+1):
    sumpo += abs(lis[i]-lis[i+1])
for i in range(1,n+1):
    print(sumpo + abs(lis[i+1]-lis[i-1]) - (abs(lis[i]-lis[i-1])+abs(lis[i+1]-lis[i])))


Measured memory_bytes: 14176
#include <stdio.h>
#include <string.h>

int main(void)
{
    int aa,bb;
    char a[11],b[11],c[11];
    scanf("%s %s %s",a,b,c);
    aa=strlen(a);bb=strlen(b);
    if(a[aa-1]==b[0]&&b[bb-1]==c[0]) printf("YES");
    else printf("NO");
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int ans = (n+1)/2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
csf = [list(map(int,input().split())) for _ in range(n-1)]

def cul(s,start,add):
  if s <= start:
    return start
  else:
    if s%add==0:
      return s
    else:  
      A = s+(add-s%add)
      return A 
  
for i in range(n-1):
  ans = csf[i][0]+csf[i][1]
  for j in range(i+1,n-1):
    ans = cul(ans,csf[j][1],csf[j][2])+csf[j][0]
  print(ans)  
print(0)

    
    
    

Measured memory_bytes: 3188
// 2019/03/28 Tazoe

#include <iostream>
#include <string>
using namespace std;

int main()
{
	string t;
	cin >> t;

	string b;
	cin >> b;

	int DP[1000][1000];
	if(t[0]==b[0]){
		DP[0][0] = 1;
	}
	else{
		DP[0][0] = 0;
	}

	for(int j=1; j<t.size(); j++){
		if(t[j]==b[0]){
			DP[0][j] = DP[0][j-1]+1;
		}
		else{
			DP[0][j] = DP[0][j-1];
		}
	}

	for(int i=1; i<b.size(); i++){
		DP[i][0] = 0;
	}

	for(int i=1; i<b.size(); i++){
		for(int j=1; j<t.size(); j++){
			if(t[j]==b[i]){
				DP[i][j] = (DP[i][j-1]+DP[i-1][j-1])%1000000007;
			}
			else{
				DP[i][j] = DP[i][j-1];
			}
		}
	}

	cout << DP[b.size()-1][t.size()-1] << endl;

	return 0;
}



Measured memory_bytes: 7068
#include <stdio.h>
typedef char str64k[256 * 256];

str64k ans;
int sx, sy, tx, ty;

void Solve()
{
  int dx = tx - sx;
  int dy = ty - sy;

  int ptr = 0;
  // 4点を結ぶ長方形：最短経路
  for (int y = 0; y < dy; ++y) ans[ptr++] = 'U';
  for (int x = 0; x < dx; ++x) ans[ptr++] = 'R';
  for (int y = 0; y < dy; ++y) ans[ptr++] = 'D';
  for (int x = 0; x < dx; ++x) ans[ptr++] = 'L';

  // 上記の１まわり外側
  ans[ptr++] = 'L';
  for (int y = 0; y <= dy; ++y) ans[ptr++] = 'U';
  for (int x = 0; x <= dx; ++x) ans[ptr++] = 'R';
  ans[ptr++] = 'D';
  ans[ptr++] = 'R';
  for (int y = 0; y <= dy; ++y) ans[ptr++] = 'D';
  for (int x = 0; x <= dx; ++x) ans[ptr++] = 'L';
  ans[ptr++] = 'U';

  ans[ptr] = '\0';
  printf("%s\n", ans);
}

void Init()
{
  scanf("%d %d %d %d", &sx, &sy, &tx, &ty);
}

void Clean(){}

int main(){ Init(); Solve(); Clean(); return 0; }


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

using namespace std;

#define FOR(i, a, b) for (int i=(a);i<(b);++i)
#define ROF(i, a, b) for (int i=(b)-1;i>=(a);--i)
#define REP(i, n) for (int i=0;i<(n);++i)
#define PRE(i, n) for (int i=(n)-1;i>=0;--i)
#define FOREACH(a, v) for(auto a : v)

#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cerr<<#x<<": "<<x<<endl
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)

#define INF INT_MAX/3
#define eps 1e-14

#define ll long long
using vint = vector<int>;

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

int main() {
    string str[3];
    REP(i, 3) cin >> str[i];

    REP(i, 3) cout << str[i][i];
    cout << 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);

		//2次元配列の生成
		String[][] c = new String[3][3];
		for(int i = 0; i < 3; i++) {
			String tmp = sc.next();
			for(int j = 0; j < 3; j++) {
				c[i][j] = tmp.substring(j, j + 1);
			}
		}
		sc.close();

		//3文字を出力
		System.out.println(c[0][0] + c[1][1] + c[2][2]);

	}
}

Measured memory_bytes: 21840
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <vector>
using namespace std;

int N;
long long dp[404][404];
long long a[404];

long long solve(int s, int t){
    if(dp[s][t] != -1) return dp[s][t];
    if(t==s+1) return 0;
    long long sm = 0;
    for(int i=s; i<t; i++)
        sm += a[i];
    long long mn = 1LL<<60;
    for(int k=s+1; k<t; k++){
        mn = min(mn, solve(s, k) + solve(k, t));
    }
    dp[s][t] = mn + sm;
    return dp[s][t];
}

int main(){
    cin >> N;
    for(int i=0; i<N; i++) cin >> a[i];
    for(int i=0; i<404; i++)
        for(int j=0; j<404; j++)
            dp[i][j] = -1;

    cout << solve(0, N) << endl;
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;

int score(int a) {
  int r = a % 10;
  return r ? r : 10;
}

int main() {
  vector<int> A(5);
  for (int& a : A) cin >> a;
  sort(A.begin(), A.end(), [](int a1, int a2){return score(a1) < score(a2);});
  int ret = A[0];
  for (int i = 1; i < 5; i++) {
    ret += A[i] + (10 - score(A[i]));
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
  int n,k;
  cin >> n >> k;
  vi a(n);
  rep(i,n) cin >> a[i];
  vvl dp(n+1,vl(k+1,0));
  dp[0][0] = 1;
  vvl sum(n+1,vl(k+1,0));
  rep(i,k+1){
    sum[0][i] = 1;
  }
  rep(i,n){
    rep(j,k+1){
      if(j - a[i] > 0){
        dp[i+1][j] = (sum[i][j] - sum[i][j-a[i]-1] + MOD) % MOD;
      }else{
        dp[i+1][j] = sum[i][j];
      }
    }
    sum[i+1][0] = dp[i+1][0];
    REP(j,1,k+1){
      sum[i+1][j] = (sum[i+1][j-1] + dp[i+1][j]) % MOD;
    }
  }
  cout << dp[n][k] << endl;
}

Measured memory_bytes: 161796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
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;
}

signed main()
{
    string S;
    int K;
    cin >> S >> K;
    int tmp;
    REP(i, K)
    {
        tmp = stoi(S.substr(i, 1));
        if (tmp == 1)
            continue;
        else
            break;
    }
    cout << tmp << endl;
    // system("pause");
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        // 入力
        string s = Console.ReadLine();


        StringBuilder p1 = new StringBuilder("");
        StringBuilder p2 = new StringBuilder("");
        for (int i = 0; i < s.Length; i++)
        {
            if (i % 2 == 0)
            {
                p1.Append(1);
                p2.Append(0);
            }
            else
            {
                p1.Append(0);
                p2.Append(1);
            }

        }

        int c1 = 0;
        int c2 = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (p1[i] == s[i])
            {
                c1++;
            }

            if (p2[i] == s[i])
            {
                c2++;
            }

        }

        Console.WriteLine(Math.Min(c1, c2));

    }
}


Measured memory_bytes: 15268
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

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

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

//動的計画法で役に立つ関数
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; }

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    long long  N;cin>> N;
    int rootN = sqrt(N);
    for(int i=rootN; i>0; i--)
    {
        int ans=0;
        if (N%i==0)
        {
            int num = N/i;
            while(num>=1)
            {
                num/=10;
                ans++;
            }
            cout << ans <<endl; 
        break;
        }
    }

  
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
typedef long long llong;

int main() {
    string S, T;
    int A, B;
    string U;

    cin >> S >> T;
    cin >> A >> B;
    cin >> U;

    if(U==S) --A;
    else --B;

    cout << A << " " << B << endl;

}

Measured memory_bytes: 256
n = gets.chomp.to_i

dp = Array.new(10**5 + 4, 10**5)
dp[0] = 0

1.upto(n) do |i|
  dp[i] = [dp[i], dp[i-1] + 1].min
  1.upto(7) do |j|
    break if i - (6 ** j) < 0
    dp[i] = [dp[i], dp[i - 6**j] + 1].min
  end
  1.upto(8) do |j|
    break if i - (9 ** j) < 0
    dp[i] = [dp[i], dp[i - 9**j] + 1].min
  end
end
p dp[n]


Measured memory_bytes: 2556
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll n,a[100005];
ll dp[100005][3];
//<<-----Implement Functions Here---->>//
ll solve(ll pos,ll j)
{
	if(pos>n)return 1e+18;ll ans = 1e+18;
	if(pos==n)return dp[pos][j] = abs(a[pos]-a[pos-j]);
	if(dp[pos][j]!=-1)return dp[pos][j];
	for(ll i=1;i<=2;i++)ans = min(solve(pos+i,i),ans);
	ans += abs(a[pos]-a[pos-j]);
	return dp[pos][j] = ans;
}

//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n;mset(dp,-1);
		for(ll i=1;i<=n;i++)cin>>a[i];
		cout<<solve(1,0);

}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    
}

Measured memory_bytes: 10368
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    	
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int r = sc.nextInt();
		int  ans = r * r;


		System.out.println(ans);

   		sc.close();
        return ;

    }
    
}



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

int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	vector <int> v;
	int sum = 0;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		v.push_back(x);
		sum += x;
	}
	if(sum % 10 == 0) {
		int sub = sum;
		for(int i = 0; i < n; i++) {
			if(v[i] % 10 != 0) {
				sub = min(sub, v[i]);
			}
		}
		sum -= sub;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

int cnt[100010];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>a(n); rep(i, n)cin >> a[i];
	sort(a.begin(), a.end());
	rep(i, n) {
		cnt[a[i]]++;
	}
	int ans = 0;
	rep(i, 100010) {
		if (cnt[i] >= 1)ans++;
	}
	if (ans % 2 == 0)cout << ans - 1 << endl;
	else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m, K;
	ll memo[1003][1003] = { {} };
	ll memox[1003] = {};
	ll memoy[1003] = {};
	ll x[1000006] = {};
	ll y[200005] = {};
	ll z[200005] = {};
	string s;
	string s1, s2;
	//IntStack yStack;
	//charStack Stack;
	//vector<pair<int, int> > pairs(a);
	cin >> a;
	 //10進数の桁数を取得
	for (ll i = 1; b < a; i++)
	{
		b += i;
		ans++;
	}
	
	cout << ans << endl;


	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
 int a;
 long long int b;

 scanf("%d",&a);
  
 if(a>1000000)
 {
   return 0;
 }
  
 b=0;
  
 for(int i=1; i<a+1; i++)
 {
   if(i%15==0 || i%3 ==0 || i%5 == 0)
   {
   }
   else
   {
     b = b + i;
   }
 }
  
  printf("%lld",b);
  
  return 0;
}


Measured memory_bytes: 1712
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define fora(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define ford(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define foraf(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define fordf(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

int iINF = 2147483647;
ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

ll k(ll n) {
	if (n <= 1) return 1;
	return n * k(n - 1);
}

int main() { int n; cin >> n; cout << k(n) << endl; return 0; }

Measured memory_bytes: 1152
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var [h,w]=arr.shift().split(" ").map(Number);
var yx=[];
for(var i=0;i<h;i++){
   yx[i]=arr.shift().split(" ").map(v=>1-(v-0));
}
for(var y=1;y<h;y++){
   for(var x=1;x<w;x++){
      if(yx[y][x]==1)yx[y][x]=Math.min(yx[y-1][x],yx[y][x-1],yx[y-1][x-1])+1;
   }
}
var max=0;
for(var y=0;y<h;y++){
   for(var x=0;x<w;x++){
      max=Math.max(max,yx[y][x]);
   }
}
console.log(max*max);


Measured memory_bytes: 65912
import sys
input = sys.stdin.readline
import bisect
import collections
from collections import deque
n,d,a= map(int, input().split())
x= [list(map(int, input().split())) for i in range(n)]

x.sort()
y=[]
for i in range(n):
    y.append(x[i][0])
    x[i][1]=-(-x[i][1]//a)

# どのモンスターまで倒したか管理しながら進める。
# 累積ダメージを管理
qq=deque([])
ans=0
atk=0
for i in range(n):
    w=x[i][1]
    # iがダメージの有効期限を超過している場合
    while len(qq)>0 and i > qq[0][0]:
        atk-=qq[0][1]
        qq.popleft()

    if w-atk>0:
        ans+=w-atk
        q=bisect.bisect_right(y,x[i][0]+2*d)-1
        # 有効期限　ダメージ
        qq.append([q,w-atk])
        atk += w - atk
print(ans)

Measured memory_bytes: 90568
a,b,h,m = gets.chomp.split(' ').map(&:to_i)
tansin = (h*60+m)*0.5
kakudo = (tansin - m*6).abs
target = a*a + b*b -Float(2*(Math.cos(kakudo*Math::PI / 180))*a*b)
puts Float(Math.sqrt(target))

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


int main()
{
    string s;
    cin >>s;
    bool h = 0;
    for(int i = 0; i< s.size(); i++)
    {
        if((s[i] == 'R' && i%2 != 0) || (s[i] == 'L' && i%2 == 0))
        {
            h = 1;
            break;
        }
    }
    if(h) cout << "No" <<endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
#include<string>
#include<deque>
typedef long long ll;
#define PB	push_back
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define pii(p)			pair<int,int> p
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define print(mes)		cout << mes << endl
const double PI	 = 3.141592;
const int	 MOD = 1e9 + 7;
using namespace std;

void solve() {
    string s;
    cin >> s;
    int n = s.length();
    for(int i = 0; i < n/2; ++i) {
        if (s[i] != s[n/2+1+i]){
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3592
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}



	public void run() {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int d=sc.nextInt();
		int e=sc.nextInt();
		int f=sc.nextInt();

		Set<Integer> ws = new HashSet<Integer>();
		for(int i=0; i<=f; i+= 100*a) {
			for(int j=0; j<=f; j+= 100*b) {
				if(i+j != 0 && i+j<=f) {
					ws.add(i+j);
				}
			}
		}
		Set<Integer> ss = new HashSet<Integer>();
		for(int i=0; i<=f; i+= c) {
			for(int j=0; j<=f; j+= d) {
				if(i+j<=f) {
					ss.add(i+j);
				}
			}
		}

		double max=0;
		int ans1=100*a;
		int ans2=0;
		for(int x : ws) {
			for(int y : ss) {
				if(x+y>f) continue;
				if(100.0*y/x<=e && max < 100.0*y/(x+y)) {
					max = 100.0*y/(x+y);
					ans1 = x+y;
					ans2 = y;
				}
			}
		}
		System.out.println(ans1 + " " + ans2);
		sc.close();
	}

}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define debug0(x) printf("! %d\n", x);
#define debug1(x, a, b) for(int (ii)=(a);(ii)<(b);(ii++)) printf("%d: %d\n", ii, x[ii]);
#define nono(x, ite) for(__typeof((x).begin()) (ite)=(x).begin();(ite)!=(x).end();(ite++))

typedef long long ll;

const int N = 1e5 + 10;
vector<int> G[N];
int sz[N];
int n;

void dfs(int u, int f) {
  if (G[u][0] == f && G[u].size() == 1) {
    return ;
  }
  sz[u] = 1;
  vector<int> v;
  for (int i = 0; i < G[u].size(); i++) {
    if (G[u][i] == f)continue;
    dfs(G[u][i], u);
    v.pb(sz[G[u][i]]);
  }
  sort(v.begin(), v.end());
  int res = 0;
  for (int i = 0; i < v.size(); i++) {
    res = max(res, v[i] + (int)v.size() - 1 - i);
  }
  sz[u] += res;
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int t;
    scanf("%d", &t);
    G[t].pb(i + 1);
    G[i + 1].pb(t);
  }
  dfs(1, -1);
  int ans = 1;
  ans = max((int)G[1].size(), ans);
  ans = max(sz[1], ans);
  printf("%d\n", ans);
  return 0;
}



Measured memory_bytes: 17024
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug (fprintf(stderr,"orzyrt\n"),fflush(stderr))
	#define debug(__a...) (fprintf(stderr,__a),fflush(stderr))
	#define setfile(__a) ('orzyrt')
	#define Compile(__a) system("g++ "__a".cpp -lm -o "__a)
#else
	#define Debug ('orzyrt')
	#define debug(__a...) ('orzyrt')
	#define setfile(__a) freopen(__a".in","r",stdin);freopen(__a".out","w",stdout)
	#define Compile(__a) ('orzyrt')
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline TT cmin(R TT &a,R TT b){(b<a)&&(a=b);}
template<class TT>inline TT cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

namespace Night{
	int n;
	int a[200010];
	LL ans;
	int main(){
		read(n);
		for(R int i=1;i<=n;++i)read(a[i]),a[n+i]=a[i];
		sort(a+1,a+1+n*2);
		if(n==2){
			ans=Abs(a[3]-a[2]);
		}else if(n&1){
			for(R int i=n*2;i>=n+4;i--)ans+=a[i];
			for(R int i=1;i<=n-3;++i)ans-=a[i];
			ans+=a[n+3]-a[n-2];
			ans+=Max(a[n+2]-a[n+1],a[n]-a[n-1]);
		}else{
			for(R int i=n*2;i>=n+3;i--)ans+=a[i];
			for(R int i=1;i<=n-2;++i)ans-=a[i];
			ans+=a[n+2]-a[n-1];
		}
		cout<<ans;
		return 0;
	}
}
int main(){
	return Night::main();
}

Measured memory_bytes: 1024
def find_min(v):
    x = v % 10
    return (x % 5, x//5, v // 10)

def find_max(v):
    return (v, 0, 0)


def conv10to5(xs):
    return (xs[0], xs[1] +2, xs[2] - 1)

def undoconv10to5(xs):
    return (xs[0], xs[1] -2, xs[2] + 1)


def conv5to1(xs):
    return (xs[0]+5, xs[1] -1, xs[2])


def next(xs):
    if xs[2] == 0:
        if xs[1] == 0:
            return None
        else:
            return conv5to1(xs)
    else:
        if xs[1] < 7:
            return conv10to5(xs)
        else:
            return conv5to1(undoconv10to5(undoconv10to5(undoconv10to5(xs))))


def find(v, n):
    xs = find_min(v)
    m = sum(xs)
    if m > n or n > v:
        return (-1, -1, -1)

    while xs:
        if sum(xs) == n:
            return xs
        xs = next(xs)
    return (-1, -1, -1)



if __name__ == "__main__":
    n, y = map(int, input().split())
    y = y // 1000
    print("{2} {1} {0}".format(*find(y, n)))
    

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func gets() string {
	sc.Scan()
	return sc.Text()
}

func toInt(value string) int {
	num, _ := strconv.Atoi(value)
	return num
}

func splitWithInt(value string) []int {
	vals := strings.Split(value, " ")
	nums := make([]int, len(vals))
	for index, elem := range vals {
		nums[index] = toInt(elem)
	}
	return nums
}

func main() {
	k := toInt(gets())
	fmt.Println((k / 2) * (k - k/2))
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define B 5005
signed main(){
  int n,k;
  cin>>n>>k;
  //if(n>400||k>400) assert(0);
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  int ans=n;
  sort(a,a+n);
  bitset<B> pre[5005],ok[5005];
  pre[0]=bitset<B>(1);
  for(int i=0;i<n;i++){
    pre[i+1]=pre[i]|(pre[i]<<a[i]);
    ok[i+1]=bitset<B>(0);
    for(int j=k-1;j>=0;j--){
      if(pre[i+1][j]){
	for(int l=k-j;l<k;l++) ok[i+1][l]=1;
	break;
      }
    }
  }
  sort(a,a+n,greater<int>());
  bitset<B> dp(1),ms(0);
  for(int i=0;i<k;i++) ms[i]=1;
  for(int i=0;i<n;i++){
    bitset<B> b(0);
    for(int j=max(0LL,k-a[i]);j<k;j++) b[j]=1;
    //cout<<dp<<" "<<b<<" "<<(ok[n-i-1]<<a[i])<<endl;
    //cout<<(dp&b)<<endl;
    //cout<<((dp<<a[i])&ok[n-i-1])<<endl;
    if((dp&b).any()||((dp<<a[i])&ok[n-i-1]).any()) ans--;
    dp=(dp|(dp<<a[i]))&ms;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6528