akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back

bool d[22][22];
ll mp[22][22];
vec dx={1,0,-1,0}, dy={0,1,0,-1};

int main(){
    ll H,W; cin>>H>>W;
    REP(i,1,H+1){
        string S; cin>>S;
        REP(j,1,W+1) if(S.at(j-1)=='.') d[i][j]=true;
    }

    ll ans=0;
    
        REP(p,1,H+1) REP(q,1,W+1){
            if(d[p][q]){
            ll Start=p*23+q;
            rep(i,22) rep(j,22) mp[i][j]=-1;
            ll MAX=0;
            mp[p][q]=0;
            queue<ll> Q;
            Q.push(Start);
            while(!Q.empty()){
                ll X=Q.front();
                Q.pop();
                ll h=X/23, w=X%23;
                rep(i,4){
                    ll hh=h+dx.at(i), ww=w+dy.at(i);
                    if(d[hh][ww]) {
                        if(mp[hh][ww]==-1) {
                            mp[hh][ww]=mp[h][w]+1;
                            Q.push(hh*23+ww);
                            MAX=mp[hh][ww];
                        }
                    }
                }
            }
            ans=max(MAX,ans);
        }}
    

    


    cout<<ans<<endl;






}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
#ABC136D
import copy
import sys
import math

s = input()
n = len(s)

ans=[]
for i in range(0,n):
	ans.append(0)

count=0
for i in range(0,n):
	if(s[i]=="R"):
		count+=1
	else:
		ans[i]+=count//2
		ans[i-1]+=(count-1)//2+1
		count=0

count=0
for i in range(0,n):
	t=n-i-1
	if(s[t]=="L"):
		count+=1
	else:
		ans[t]+=count//2
		ans[t+1]+=(count-1)//2+1
		count=0

res=str(ans[0])
for i in range(1,n):
	res+=" "
	res+=(str(ans[i]))
print(res)


Measured memory_bytes: 5108
n = int(input())
a = list(map(int,input().split()))
ans = 0
s = 1
while s < n-1:
  if a[s-1] < a[s] < a[s+1] or a[s-1] > a[s] > a[s+1]:
    ans += 1  
  s += 1
print(ans)

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**8)

def main():
    n,k = map(int,input().split())
    xy = []
    X = []
    Y = []
    for _ in range(n):
        x,y = map(int,input().split())
        xy.append((x,y))
        X.append(x)
        Y.append(y)
    ans = 10**20
    for i in range(n-1):
        for j in range(i+1,n):
            for a in range(n-1):
                for b in range(a+1,n):
                    xl,xr = X[i],X[j]
                    yd,yu = Y[a],Y[b]
                    if xl > xr:
                        xr,xl = xl,xr
                    if yd > yu:
                        yd,yu = yu,yd
                    area = (xr-xl)*(yu-yd)
                    if ans < area:
                        continue
                    cnt = 0
                    for c in range(n):
                        if xl <= xy[c][0] and xy[c][0] <= xr and yd <= xy[c][1] and xy[c][1] <= yu:
                            cnt += 1
                    if cnt >= k:
                        ans = min(ans,area)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 52828
let () =
  (* 入力 *)
  let a,b = Scanf.scanf "%d %d " (fun a b -> a,b) in

  let res = ref 0 in
  for i = a to b do
    let c_arr = Array.of_list (Batteries.String.to_list (string_of_int i)) in
    if c_arr.(0) = c_arr.(4) && c_arr.(1) = c_arr.(3) then res := !res + 1
  done;

  Printf.printf "%d\n" !res


Measured memory_bytes: 5120
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    final int N=sc.nextInt();
    int[] x=new int[N];
    int[] y=new int[N];
    int sum=0;
    for(int i=0;i<N;i++){
      x[i]=sc.nextInt();
    }
    for(int i=0;i<N;i++){
      y[i]=sc.nextInt();
    }
    for(int i=0;i<N;i++){
      if(x[i]>=y[i]){
        sum+=x[i]-y[i];
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 22996
n, m = list(map(int, input().split(' ')))
a = [list(map(int, input().split(' '))) for i in range(n)]
b = [int(input()) for i in range(m)]

for i in range(n):
    rst = 0
    for j in range(m):
        rst += a[i][j] * b[j]
    print(str(rst))



Measured memory_bytes: 6016
//
// Created by munaiyi on 2020/3/31.
//
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 5;
int h[maxn], mem;
struct {
    int v, next;
} e[maxn << 1];

void add(int u, int v) {
    e[mem].v = v;
    e[mem].next = h[u];
    h[u] = mem++;
}

void dfs(int u, int fa, vector<int> &d) {
    for (int i = h[u]; i + 1; i = e[i].next) {
        int v = e[i].v;
        if (v == fa) continue;
        d[v] = d[u] + 1;
        dfs(v, u, d);
    }
}
void dfs_ans(int now, vector<int>& du, vector<int>& dv, int& ans){
    if(du[now]>dv[now]) return;

}
int main() {
    int n, u, v;
    scanf("%d%d%d", &n, &u, &v);
    memset(h, -1, sizeof(h));
    mem=0;
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        add(x, y);
        add(y, x);
    }
    vector<int> du(n + 1, 0), dv(n + 1, 0);
    dfs(u, u, du);
    dfs(v, v, dv);
    int ans = 0;
    for(int i=1;i<=n;i++){
        if(du[i]>=dv[i]) continue;
        ans = max(ans, dv[i]);
    }
    printf("%d\n", ans-1);
    return 0;
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
bool ok; long long n, a[16], x[16][15], y[16][15], ans; 
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i=1; i<=n; i++){
	cin >> a[i]; ok=1;
	for (int j=0; j<a[i]; j++){
		cin >> x[i][j] >> y[i][j];
	}
} 
for (int i=0; i<(1<<n); i++){
	bool ok=1;
	for (int j=1; j<=n; j++){
		if (i&(1<<(j-1))){
			for (int k=0; k<a[j]; k++){
				if ((bool)((1<<(x[j][k]-1))&i)!=y[j][k]) ok=0;
			}
		}
	}
	//cout << i << " " << ok << endl;
	if (ok) ans=max(ans, (long long)__builtin_popcount(i));
} 
cout << ans;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    ll N;
    cin >> N;

    ll s = (N - 1) * N / 2;
    cout << s << endl;

    return 0;
}


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

int main(){
  int N;
  double sum, ave;
  vector<double> out;
  while(cin >> N && N){
    sum = 0;
    vector<int> v(N);
    for(int i=0;i<N;i++){
      cin >> v[i];
      sum += v[i];
    }
    ave = sum / N;
    sum = 0;
    for(int i=0;i<N;i++){
      sum += pow(v[i]-ave, 2.0);
    }
    sum = sqrt(sum/N);
    out.push_back(sum);
  }
  for(int i=0;i<out.size();i++){
    cout << fixed << setprecision(10) << out[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define fi           first
#define se           second
#define ll           long long
#define pb           push_back
#define mp           make_pair
#define pll          pair<ll,ll>
#define pii          pair<int,int>
#define all(x)       (x).begin(),(x).end()
#define isWorking()  cout<<"Wroking"<<endl
#define FOR(i,x,y)   for(int i=x; i<y; i++)
#define SORT(x)      sort(x.begin(),x.end())
#define PRINT(ok)    cout<<(ok? "YES":"NO")<<endl
#define Fast_Input   ios_base :: sync_with_stdio(false), cin.tie(NULL);
typedef vector < int > VI;
const ll mod= 1e9+7,INF=1e18,mx= 5e6+5,mn=100;
int testCase=1,cas=0;

int main() {
    Fast_Input

    //cin>>testCase;
    while(testCase--){
        int sx,sy,tx,ty;
        cin>>sx>>sy>>tx>>ty;
        string ans="";

        for(int i=sy; i<ty; i++) ans+='U';
        for(int i=sx; i<tx; i++) ans+='R';

        //cout<<ans<<endl;

        for(int i=ty; i>sy; i--) ans+='D';
        for(int i=tx; i>sx; i--) ans+='L';

        ans+='L';
        for(int i=sy; i<=ty; i++) ans+='U';
        for(int i=sx; i<=tx; i++) ans+='R';
        ans+='D';

        ans+='R';
        for(int i=ty; i>=sy; i--) ans+='D';
        for(int i=tx; i>=sx; i--) ans+='L';
        ans+='U';

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<unordered_map>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;
ll intpow(int a, int b) {
	ll res = 1;
	for (int i = 0; i < b; i++)res *= a;
	return res;
}

int main() {
	cin >> D >> N;
	if (N == 100)cout << (N + 1) * intpow(100, D);
	else cout << N * intpow(100, D);
}


Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func abs(a int, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func chmin(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func chmax(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	k := nextInt()
	heights := nextInts(n)
	dp := make([]int, n)
	for i := range dp {
		dp[i] = math.MaxInt32
	}

	for i := range dp {
		if i == 0 {
			dp[i] = 0
		}

		for j := 1; j <= k && i+j < n; j++ {
			dp[i+j] = chmin(dp[i+j], dp[i]+abs(heights[i], heights[i+j]))
		}
	}

	fmt.Println(dp[n-1])
}


Measured memory_bytes: 2816
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  
  cout<<(((min(b,d))-(max(a,c))>=0)?((min(b,d))-(max(a,c))):0)<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
#define PI 3.14159265359
typedef long long ll;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
/*ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}*/

ll lcm(ll a, ll b){
  ll g = gcd(a, b);
  b /= g;
  a *= b;
  return a;
}

//素数判定 O(√n)
bool is_prime(int64_t n){
  for(int64_t i = 2; i*i<=n; i++){
    if(n%i==0) return false;
  }
  return n!=1;
}

//約数の列挙 O(√n)
vector<int64_t> dividor(int64_t n){
  vector<int64_t> res;
  for(int64_t i=1; i*i<=n; i++){
    if(n%i==0){
      res.push_back(i);
      if(i != n/i) res.push_back(i);
    }
  }
  return res;
}

//素因数分解 O(√n)
map<int64_t, int64_t> prime_factor(int64_t n){
  map<int64_t, int64_t> res;
  for(int64_t i=2; i*i<=n; i++){
    while(n%i==0){
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};




int main(){
  int64_t n, i; cin >> n;
  int64_t lb=0, ub=n;
  while(ub-lb>1){
    int64_t mid = (ub+lb)/2;
    if(mid*(mid+1)/2>=n) ub = mid;
    else lb = mid;
  }
  cout << ub << endl;
  n -= ub;
  for(i=ub-1; i>=1; i--){
    if(i<=n) {cout << i << endl; n -= i;}
    if(n==0) break;
  }
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    String t=sc.next();
    int count=0;
    for(int n=0;n<3;n++){
      if(s.charAt(n)==t.charAt(n)){
        count=count+1;
      }
    }
    System.out.println(count);
  }
}


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

int n;

int main(){
  cin >> n;
  int res = 0;
  for(int i = 1; i <= n; i += 2){
    int cnt = 0;
    for(int j = 1; j <= i; j++){
      if(i % j == 0) cnt++;
    }
    if(cnt == 8) res++;
    //if(cnt == 8) cerr << i << endl;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}

int main() {
    int n, m;
    cin >> n >> m;
    ll k;
    cin >> k;
    vector<ll> a(n + 1);
    vector<ll> b(m + 1);
    rep1(i, n) {
        cin >> a[i];
        a[i] += a[i - 1];
    }
    rep1(i, m) {
        cin >> b[i];
        b[i] += b[i - 1];
    }
    ll ans = 0;
    ll j = m;
    for(ll i = 0; i <= n; i++) {
        if(a[i] > k) break;
        while (k - a[i] < b[j]) j--;
        ans = max(ans, i + j);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6424
n=int(input())
s=input().split()
t=int(s[0])
a=int(s[1])
s=input().split()
best=100000000000000000
res=-1
for i in range(n):
    h=int(s[i])
    if best>abs(a-t+h*0.006):
        best=abs(a-t+h*0.006)
        res=i+1
print(res)


Measured memory_bytes: 38496
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    if(n%2==0) cout<<n/2<<endl;
    else cout<<n/2+1<<endl;
}



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

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

	int N,M;
	ll r,l;
	ll K;
	ll ans=0;
	ll sum=0;

	cin >> N >> M >> K;
	vector<ll> A(N+1);
	vector<ll> B(M+1);
	rep(i,N) cin >> A[i+1];
	rep(i,M) cin >> B[i+1];


	for(l=0;sum+B[l]<=K && l<M+1;l++)
		sum+=B[l];
	l--;

	for(r=0;r<N+1;r++){
		sum+=A[r];
		while(sum>K && l>0){
			sum-=B[l];
			l--;
		}

		//cout << r << " " << l << " " << sum << endl;
		if(sum>K) break;
		ans=max(ans,r+l);
	}

	cout << ans << endl;

	return 0;
}



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

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

	int n,m;

	cin >> n >> m;
	int l1 = 1;
	int r1 = m+1;
	int l2 = m+2;
	int r2 = 2*m+1;
	for(int i=0;i<m;i++)
	{
		if(l1 < r1)
		{
			cout << l1 << ' ' << r1 << '\n';
			l1++;
			r1--;
		}
		else if(l2 < r2)
		{
			cout << l2 << ' ' << r2 << '\n';
			l2++;
			r2--;
		}
	}
	return 0;
}


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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
bool chmin(T &a,T b){if(a>b){a=b;return true;}else return false;}
template<typename T>
bool chmax(T &a,T b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}  
vector<P>ret;
vector<ll>cnt(100005);
vector<ll>used(100005);
set<P>st;
void dfs(ll k,vector<vector<ll>>&g,ll par){
  used[k]=true;
  for(auto to:g[k]){
    if(to != par){
      if(st.count(minmax(k,to)))continue;
      if(used[to]){
        cnt[k]++;
        ret.EB(k,to);
        st.emplace(minmax(k,to));
      }
      else{
        dfs(to,g,k);
        if(cnt[to]&1){
          cnt[to]++;
          ret.EB(to,k);
          st.emplace(minmax(k,to));
        }
        else{
          cnt[k]++;
          ret.EB(k,to);
          st.emplace(minmax(k,to));
        }
      } 
    }
  }
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,m;cin>>n>>m;
  vector<vector<ll>>g(n);
  rep(i,0,m){
    ll u,v;cin>>u>>v;u--;v--;
    g[u].PB(v);
    g[v].PB(u);
  }
  if(m&1){
    cout<<-1<<endl;
    return 0;
  }
  dfs(0,g,-1);
  rep(i,0,m)cout<<ret[i].fi+1 spa ret[i].se+1<<endl;
  return 0;
}

Measured memory_bytes: 25584
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>


/* ----- Type Alias ----- */
using Bool = bool;
using Int = long long int;
using Real = long double;
using Char = char;
using String = std::string;
template <class T, class U>
using Pair = std::pair<T, U>;
template <class... Ts>
using Tuple = std::tuple<Ts...>;

template <class T>
using Vector = std::vector<T>;
template <size_t N>
using Bits = std::bitset<N>;
template <class T>
using Queue = std::queue<T>;
template <class T>
using Stack = std::stack<T>;
template <class T>
using Deque = std::deque<T>;

template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
using Set = std::set<T>;
template <class T, class U>
using Map = std::map<T, U>;

template <class T, class... Us>
using Func = std::function<T(Us...)>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return Vector<decltype(genv<T>(ts...))>(l, genv<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = Vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = Vector<Vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}


/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// constexpr Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

template <class T>
T iceil(T n, T d) { return (n + d - 1) / d; }

int main() {
    Int a, b;
    std::cin >> a >> b;
    std::cout << iceil(b - 1, a - 1) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;


int main() {
  int n; cin >> n;
  int a[n];
  REP(i,n) cin >> a[i];
  sort(a,a+n);

  int ans=0;
  REP(i,n) {
    if (i==n) ans++;
    else if (a[i] == a[i+1]) i++;
    else ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    ll n, m;
    cin >> n >> m;
    ll cnt[100010];
     bool visited[100010];
    rep(i, 100010)cnt[i]=1, visited[i]=false;

    visited[1]=true;
    rep(i, m){
        ll x, y;
        cin >> x >> y;
        cnt[x]--, cnt[y]++;
        if(visited[x])visited[y]=true;
        if(cnt[x]<1)visited[x]=false;
    }
    ll ans = 0;
    rep(i, n)if(visited[i+1])ans++;
    cout << ans << endl;

}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n, m;
  cin >> n >> m;
  int h[n];
  REP(i,n) { cin >> h[i]; }

  Graph g(100000);
  REP(i,m) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  ll ans = 0;
  REP(i,n) {
    int ok = true;
    for(auto x : g[i]) {
      if (h[i] <= h[x]) { ok = false; break; }
    }
    if (ok) ans++;
  }
  COUT(ans);

  return 0;
}


Measured memory_bytes: 8804
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
using pii = pair<i32, i32>;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vf80 = vector<f80>;
using vstr = vector<string>;
using vpii = vector<pii>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;
using vvf80 = vector<vf80>;

template<typename T, typename S> bool amax(T &x, S y) { if (x < y) { x = y; return 1; } return 0; }
template<typename T, typename S> bool amin(T &x, S y) { if (y < x) { x = y; return 1; } return 0; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  cerr << fixed << setprecision(16);
  string s;
  cin >> s;
  if (s[s.size() - 1] == '1' || s[0] == '0') {
    cout << -1 << endl;
    return 0;
  }
  rep(i, (s.size() - 1) / 2) {
    if (s[i] != s[s.size() - i - 2]) {
      cout << -1 << endl;
      return 0;
    }
  }
  s[s.size() - 1] = '1';
  int cnt = 1;
  reps(i, s.size()) {
    if (s[i] == '1') {
      reps(j, cnt) {
        cout << i - j + 1 << " " << i + 1 << endl;
      }
      cnt = 1;
    } else {
      cnt++;
    }
  }
  return 0;
}

Measured memory_bytes: 1616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int numA = s.nextInt();
		String str = s.next();
		
		if(numA < 3200) {
			System.out.println("red");
		}else {
			System.out.println(str);
		}

	}

}

Measured memory_bytes: 22612
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int N;
ll C;
ll x[100000], v[100000];

ll ans = 0;
ll a[100000], b[100000];

signed main(){
	cin >> N >> C;
	rep(i, N) cin >> x[i] >> v[i];

	a[0] = v[0] - x[0];
	ans = max(ans, a[0]);
	b[N-1] = v[N-1] - (C-x[N-1]);
	ans = max(ans, b[N-1]);
	rep(i, N){
		if(i == 0) continue;
		a[i] = a[i-1] + x[i-1] + v[i] - x[i];
		ans = max(ans, a[i]);
		b[N-1-i] = b[N-i] + (C-x[N-i]) + v[N-1-i] - (C-x[N-1-i]);
		ans = max(ans, b[N-1-i]);
	}

	ll tmp = 0;
	for(int i=N-2; i>=0; i--){
		tmp = max(tmp, b[i+1]);
		ans = max(ans, a[i] - x[i] + tmp);
	}

	tmp = 0;
	for(int i=1; i<N; i++){
		tmp = max(tmp, a[i-1]);
		ans = max(ans, b[i] - (C-x[i]) + tmp);
	}

	cout << ans << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,k;
	cin>>a>>b>>k;
	long long a2=a,b2=b,k2=k;
	if(a2<=k2) 
	{
		a2=0;
		k2-=a;
	}
	else 
	{
		k2=0;
		a2-=k;
	}
	a=a2;
	b=b2;
	k=k2;
	if(b2<=k2) 
	{
		b2=0;
		k2-=b;
	}
	else 
	{
		k2=0;
		b2-=k;
	}
	cout<<a2<<" "<<b2;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
inputs = [int(i) for i in input().split()]

for i in range(N-1, 1, -1):
    if inputs[i-1] > inputs[i]:
        inputs[i-1] -= 1

for i in range(1, N):
    if inputs[i-1] > inputs[i]:
        print('No')
        break
else:
    print('Yes')


Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

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(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i,j;
	string s;
	cin>>s;
	if(s[1]=='B') cout<<"ARC"<<endl;
	else cout<<"ABC"<<endl;

}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define rep(i, n) for(lint i = 0; i < n; ++i)
#define rrep(i, n) for(lint i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  lint a, b, x; cin >> x; bool c = 0;
  rep(i, 401){
    rep(j, 401){
      lint p = i-200, q = j-200;
      if(p*p*p*p*p - q*q*q*q*q == x){
        a = p; b = q; c = 1; break;
      }
    }
    if(c) break;
  }
  cout << a << " " << b << endl;
  return 0;
}

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

int main() {
    int x, y; cin >> x >> y;
    int i=1;
    if (x == y) {
        cout << "-1" << endl;
        return 0;
    }
    while (i * x<= 1e9) {
        if (i * x % y == 0) {
            i++;
            continue;
        }
        cout << i * x << endl;
        return 0;
    }
    cout << "-1" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define num(a) a-'0'
#define charr(a) (a - 'A' + 1)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<"["<<#x<<":"<<x<<"] "
#define debug2(a,b) debug(a);debug(b)
#define debug3(a,b,c) debug2(a,b);debug(c)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/(__gcd(a,b))
#define print(arr) for(auto it = arr.begin();it < arr.end();it ++){cout << *it << " ";}cout << ln;
#define all(a) (a).begin(), (a).end()
#define vi vector<long long>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long double ld;
typedef double d;
using namespace std;
int modF=1e9+7;
int INF=1e11;

void solve(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b && b!=c){
		cout<<"Yes\n";
	}
	else if(b==c && b!=a){
		cout<<"Yes\n";
	}
	else if(a==c && a!=b){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
}

signed main(){
	boost_io;
	solve();
	return 0;
}

Measured memory_bytes: 3652
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let (a, b): (usize, usize);
    input!(a, b);

    for i in 1..10000 {
        if i * 2 / 25 == a && i / 10 == b {
            println!("{}", i);
            return;
        }
    }
    println!("-1");
}


Measured memory_bytes: 4352
#include<cstdio>
#include<queue>
#include<vector>
#include<iostream>
using namespace std;
#define mp make_pair
#define fi first
#define se second
const int MAXN = 200000;
typedef pair<int, int> pii;
typedef long long ll;
priority_queue<pii, vector<pii>, greater<pii> >que;
int lst[MAXN + 5], nxt[MAXN + 5], N, L;
void link(int x, int y) {lst[y] = x, nxt[x] = y;}
bool check(int x, int y) {return nxt[x] == y;}
ll lf[MAXN + 5], rf[MAXN + 5], f1[MAXN + 5], f2[MAXN + 5];
vector<int>v1, v2;
ll solve(int x) {
	ll ret = 0, tmp = 0;
	int lt = v2.size(), lb = lst[v2[0]], rb = nxt[v2[lt-1]];
	for(int i=0;i<lt;i++) {
		if( i - L + 1 >= 0 ) tmp += lf[v2[i-L+1]];
		ret += tmp * rf[v2[i]];
	}
	for(int i=0;i<lt;i++)
		f1[v2[i]] = lf[v2[i]], f2[v2[i]] = rf[v2[i]], lf[v2[i]] = rf[v2[i]] = 0;
	int c = lt / L;
	if( c ) {
		for(int i=L-1;i<lt;i++) {
			int t = (i + 1)/L - 1;
			rf[v2[t]] += f2[v2[i]];
		}
		for(int i=lt-L;i>=0;i--) {
			int t = c - (lt - i)/L;
			lf[v2[t]] += f1[v2[i]];
		}
		for(int i=1;i<c;i++)
			link(v2[i-1], v2[i]);
		link(lb, v2[0]), link(v2[c-1], rb);
		for(int i=0;i<c;i++)
			que.push(mp(x + 1, v2[i]));
		tmp = 0;
		for(int i=0;i<c;i++) {
			if( i - L + 1 >= 0 ) tmp += lf[v2[i-L+1]];
			ret -= tmp * rf[v2[i]];
		}
	}
	else nxt[lb] = N + 1, lst[rb] = 0;
	v2.clear();
	return ret;
}
int main() {
	scanf("%d%d", &N, &L);
	for(int i=1;i<=N;i++) {
		int x; scanf("%d", &x);
		que.push(mp(x, i)), link(i, i + 1);
		lf[i] = rf[i] = 1;
	}
	ll ans = 0; link(0, 1);
	while( !que.empty() ) {
		int x = que.top().fi; v1.clear();
		while( !que.empty() && que.top().fi == x )
			v1.push_back(que.top().se), que.pop();
		v2.clear(); v2.push_back(v1[0]);
		for(int i=1;i<v1.size();i++) {
			if( !check(v1[i-1], v1[i]) )
				ans += solve(x);
			v2.push_back(v1[i]);
		}
		ans += solve(x);
	}
	printf("%lld\n", ans + N);
}

Measured memory_bytes: 10864
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(int n);            // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。
vector<pair<long long,long long>> prime_factorize(long long p); // 素因数分解

// class
// ------------------------------------------------
class Combi {
  public:
    Combi();
    long long Combination(long long n, long long k);
    long long nPk_modp(long long n, long long k, long long p);
  private:
    map<long long, map<long long, long long>> memo;
    long long n_num;
    long long k_num;
};

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(long long(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(long long(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<long> vll;
// code
// ------------------------------------------------
int main() {

string s;
cin >> s;

cout << s.substr(0,3) << endl;
    return 0;

}
// funcの実体
// ------------------------------------------------
int getDigit(int n) {
  int i = 1;
  while(1) {
    n = n / 10;
    if(n == 1)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n) {
  int s = 0;
  while(n) {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str) {
  for(auto itr = str.begin();itr != str.end() ; itr++) {
    if(97 <= *itr && *itr <= 122) {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str) {
  for(auto itr = str.begin();itr != str.end() ; itr++) {
    if(65 <= *itr && *itr <= 90) {
      *itr = *itr + 32;
    }
  }
  return str;
}


Combi::Combi() {
  n_num = -1;
  k_num = -1;
};

ll Combi::Combination(ll n, ll k) {

  ll ret;
  if(memo[n][k] != 0) {
    ret = memo[n][k];
  } else if(n == k || k == 0) {
    memo[n][k] = 1;
    ret = 1;
  } else {
    ret = Combination(n - 1, k - 1) + Combination(n - 1, k);
    memo[n][k] = ret;
  }
  return ret;
}

long long Combi::nPk_modp(long long n, long long k, long long p) {
  ll ans = 1;
  for(long long i = k; i <= n; i++) {
    ans = (ans * i) % p;
  }

  return ans;
};

vector<pair<long long,long long>> prime_factorize(long long p) {
    vector<pair<long long,long long>> ret;

    for(long long x = 2; x * x <= p; ++x) {
        if(p % x != 0) continue;
        long long num = 0;
        while(p % x == 0) {
            num++;
            p /= x;
        }
        ret.push_back(make_pair(x,num));
    }

    if(p != 1) ret.push_back(make_pair(p, 1));
    
    return ret;
}

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

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

    if (s.at(2) == s.at(3) && s.at(4) == s.at(5)) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
# 入力文字を取得
input = gets

# AとBを取得
a, b = input.split(" ")
A = a.to_i
B = b.to_i

# 出力用の変数を定義
result = 0

if (1 <= A) && (A <= 9) && (1 <= B) && (B <= 9)
    # 計算できる場合
    result = A * B
else
    # 計算できない場合
    result = -1
end

# 結果を出力
print result

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 1000000007;
const int MOD = (int)1e9+7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-1, 0, 1, 1};
int dx[4] = {0, 1, 0, 1};

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	int r;
	cin >> r;
	cout << r*r << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

vvi grid_bfs(vector<string> &g, char start, char wall) {
    const int INF = 1000000000;
    using pii = pair<int, int>;
    int h = g.size(), w = g[0].size();
    static const auto is_valid = [&](int i, int j) {
        if (i < 0 || i >= h || j < 0 || j >= w) return false;
        if (g[i][j] == wall) return false;
        return true;
    };

    static const pii dir[] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
    queue<pii> q;
    vvi d = vv(h, w, INF, int);
    re(i, h) re(j, w) {
        if (g[i][j] == start) {
            d[i][j] = 0;
            q.emplace(i, j);
        }
    }
    while (q.size()) {
        int ci, cj;
        std::tie(ci, cj) = q.front();
        q.pop();
        for (auto &v : dir) {
            int ni = ci + v.first;
            int nj = cj + v.second;
            if (is_valid(ni, nj)) {
                int nd = d[ci][cj] + 1;
                if (d[ni][nj] > nd) {
                    d[ni][nj] = nd;
                    q.emplace(ni, nj);
                }
            }
        }
    }
    return d;
}
int main(int argc, char const *argv[]) {
  ll h, w; std::cin >> h >> w;
  vector<string> s(h);
  ll ans = 0;
  re(i, h) std::cin >> s[i];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(s[i][j] == '#') continue;
      s[i][j] = '?';
      vvi d = grid_bfs(s, '?', '#');
      s[i][j] = '.';
      re(l, h){
        re(r, w){
          if(s[l][r]!='.') continue;
          ans = max(ans, (ll)d[l][r]);
        }
      }
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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 INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  char d[a][b];
  rep(i,a)rep(j,b)
    cin>>d[i][j];
  int h=0;
  int p[a][b];
  rep(i,a)rep(s,b){
  p[i][s]=d[i][s];
  }
  rep(i,(1<<a)){
  bitset<6> e(i);
  rep(j,(1<<b)){
  bitset<6> f(j);
    rep(k,a){
      if(e.test(k)){
      rep(l,b){
      d[k][l]='.';
      }
      }
    }
    rep(m,b){
      if(f.test(m)){
      rep(n,a){
      d[n][m]='.';
      }
      }
    }
    int t=0;
    rep(k,a)rep(m,b){
    if(d[k][m]=='#')
      t++;
    }
    if(t==c)
      h++;
     rep(k,a)rep(l,b)
    d[k][l]=p[k][l];
  }
  }
  out(h);
}


Measured memory_bytes: 3696
#include<stdio.h>
#include<iostream>
using namespace std;

string S;
int main (){
    cin >> S;
    int flag = 0;
    for(int i=0; i<S.length()-1; i++){
        if ( S[i] == 'A' && S[i+1] == 'C') flag = 1;
    }
    cout << ( flag ? "Yes" : "No" )  << endl;
    return 0;
}


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

const int N=1e5+5;
int n;
ll A[N],B[N],C[N];
// +-+-+-
ll solve1() {
    ll res=0;
    if ( A[0]<=0 ) {
        res+=1-A[0];
        B[0]=1;
    } else {
        B[0]=A[0];
    }
    for ( int i=1; i<n; i++ ) {
        if ( i%2 ) { // -
            if ( B[i-1]+A[i]>=0 ) {
                res+=abs(-1-(B[i-1]+A[i]));
                B[i]=-1;
            } else {
                B[i]=B[i-1]+A[i];
            }
        } else { // +
            if ( B[i-1]+A[i]<=0 ) {
                res+=abs(1-(B[i-1]+A[i]));
                B[i]=1;
            } else {
                B[i]=B[i-1]+A[i];
            }
        }
    }
    return res;
}
// -+-+-+
ll solve2() {
    ll res=0;
    if ( A[0]>=0 ) {
        res+=abs(-1-A[0]);
        B[0]=-1;
    } else {
        B[0]=A[0];
    }
    for ( int i=1; i<n; i++ ) {
        if ( i%2==0 ) { // -
            if ( B[i-1]+A[i]>=0 ) {
                res+=abs(-1-(B[i-1]+A[i]));
                B[i]=-1;
            } else {
                B[i]=B[i-1]+A[i];
            }
        } else { // +
            if ( B[i-1]+A[i]<=0 ) {
                res+=abs(1-(B[i-1]+A[i]));
                B[i]=1;
            } else {
                B[i]=B[i-1]+A[i];
            }
        }
    }
    return res;
}

int main() {
    cin >> n;
    for ( int i=0; i<n; i++ ) {
        cin >> A[i];
    }
    cout << min(solve1(),solve2()) << '\n';
    return 0;
}

Measured memory_bytes: 5180
s=input('')
r=[]
t=[]
for a in range(len(s)):
    r.append(s[a])
    t.append(s[a])

t.reverse()
ok=1
for a in range(len(r)):
    if t[a]==r[a]:
        ok=ok*1
    else:
        ok=ok*0


f=[]
g=[]
for a in range(int((len(r)-1)/2)):
    f.append(s[a])
    g.append(s[a])
g.reverse()

for a in range(len(f)):
    if f[a]==g[a]:
        ok=ok*1
    else:
        ok=ok*0

h=[]
i=[]
p=int((len(r)-1)/2)
for a in range(int((len(r)-1)/2)):
    h.append(s[a+p+1])
    i.append(s[a+p+1])
i.reverse()

for a in range(p):
    if h[a]==g[a]:
        ok=ok*1
    else:
        ok=ok*0

if ok==1:
    print('Yes')
else:
    print('No')

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    int cnt = 0;
    rep(i, n) {
        if (a[i] <= 0) ++cnt;
    }
    int m = INF;
    rep(i, n) {
        m = min(m, abs(a[i]));
    }
    ll sum = 0;
    rep(i, n) sum += abs(a[i]);
    if (cnt%2==1) sum -= 2 * m;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 640