akhauriyash/Code-Regression huggingface dataset:
#pragma region macro
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace std {
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string &s) {
    return '"' + s + '"';
}

string to_string(const char *s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for(int i = 0; i < static_cast<int>(v.size()); i++) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for(size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
};  // namespace std
#pragma endregion

void solve() {
    i64 x;
    std::cin >> x;
    i64 ans = 0;
    ans += x / 500 * 1000;
    x %= 500;
    ans += x / 5 * 5;
    std::cout << ans << std::endl;
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

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

using namespace std;

int main() {

	int n, tmp;
	set<int> s;

	cin >> n;

	for (int i = 0;i<n;i++) {
		cin >> tmp;
		s.insert(tmp);
	}

	if(s.size()==n) cout << "YES" << endl;
	else cout << "NO" << endl;

}

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

int main(){
    int n,m;
    cin>>n>>m;
    long long x[n],y[n],z[n];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>z[i];
    }
    long long ans=0;
    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = 0; bit < (1LL<<3); ++bit)
    {
        long long v[n]={};
        for(int i=0;i<n;i++){
            if((bit>>0&1)) v[i]+=x[i];
            else v[i]-=x[i];
            if((bit>>1&1)) v[i]+=y[i];
            else v[i]-=y[i];
            if(bit>>2&1) v[i]+=z[i];
            else v[i]-=z[i];
        }
        long long ret=0;
        sort(v,v+n,greater<long long>());
        for(int i=0;i<m;i++) ret+=v[i];
        ans=max(ans,ret);
    }

    cout<<ans<<endl;

    
    

}

Measured memory_bytes: 256
main(n,m,i,I,j,J,a,A,c){
for(;scanf("%d %d",&n,&m),n;printf("%d\n",c<2?I:n))for(J=1e9,i=0;i<n;i++)
	if(scanf("%d",&a),j=m-m%a,j<J||(j==J&&a<=A))c=j==J&&a==A?c+1:1,J=j,A=a,I=i+1;
exit(0);}

Measured memory_bytes: 596
import sys
input=sys.stdin.buffer.readline
N,mod=int(input()),998244353
def data():
    edge=[[] for i in range(N)]
    for i in range(int(input())):
        a,b=map(int,input().split())
        if a>b:
            a,b=b,a
        edge[a-1].append(b-1)
    mex=[0]*N
    for i in range(N-1,-1,-1):
        used=[False]*(len(edge[i])+1)
        for pv in edge[i]:
            if mex[pv]<=len(edge[i]):
                used[mex[pv]]=True
        for j in range(len(used)):
            if not used[j]:
                mex[i]=j
                break
    res=[0]*(max(mex)+1)
    for i in range(N):
        res[mex[i]]+=pow(10,18*(i+1),mod)
        res[mex[i]]%=mod
    return res
Data,ans=[data() for i in range(3)],0
for i in range(len(Data[0])):
    for j in range(len(Data[1])):
        if i^j<len(Data[2]):
            ans+=Data[0][i]*Data[1][j]*Data[2][i^j]
            ans%=mod
print(ans)


Measured memory_bytes: 100696
#include <iostream>
#include <string>

using namespace std;

void upper(string &s){
    for (int i=0;i<s.length();i++){
        if ('a'<=s[i] && s[i]<='z'){
            s[i]+='A'-'a';
        }
    }    
}

int main(){
    string s="",w;
    int sum=0;
    cin>>w;
    upper(w);
    for (;;){
        cin>>s;
        if (s=="END_OF_TEXT"){
            break;
        }
        upper(s);
        if (w==s){
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
#define rev(s) (string((s).rbegin(), (s).rend()))
typedef pair<int,int> p;

int main() {
    int n;cin>>n;
    vector<int> v(n);
    rep(i,n) cin>>v[i];

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

    double ans=0;
    rep(i,n) {
        if (i==0) {
            ans+=v[i]/(pow(2.0,n-i-1));
        }
        else {
            ans+=v[i]/(pow(2.0,n-i));
        }
    }

    cout << fixed << setprecision(6) << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 998244353;
const int MAX = 100000;
const int N = 100000;

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {if ((x+=a.x)>=MOD) x-=MOD; return *this;}
    mint& operator-=(const mint a) {if ((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
    mint& operator*=(const mint a) {(x*=a.x)%=MOD; return *this;}
    mint operator+(const mint a) const {mint res(*this); return res+=a;}
    mint operator-(const mint a) const {mint res(*this); return res-=a;}
    mint operator*(const mint a) const {mint res(*this); return res*=a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(MOD-2);}
    mint& operator/=(const mint a) { return (*this) *= a.inv();}
    mint operator/(const mint a) const {mint res(*this); return res/=a;}
};

int main() {
	int n;cin>>n;
	int d[N],c[N];
	rep(i,n) cin>>d[i];
	rep(i,N) c[i]=0;
	rep(i,n) c[d[i]]++;
	bool valid=true;
	if(d[0]>0) valid=false;
	if(c[0]!=1) valid=false;
	bool keep=true;
	rep(i,N){
		if(keep&&c[i]==0) keep=false;
		else if(!keep&&c[i]>0) valid=false;
	}
	if(!valid) {cout<<0<<endl;return 0;}
	mint ans=1;
	for(int i=1;i<N;i++){
		if(c[i]==0) break;
		mint a(c[i-1]);
		a=a.pow(c[i]);
		ans*=a;
	}		
	cout<<ans.x<<endl;
}


Measured memory_bytes: 1024
# coding: utf-8


def main():
    a, b, c = map(int, input().split())
    K = int(input())

    while K > 0:
        if a < b:
            break
        
        b *= 2
        K -= 1
    
    while K > 0:
        if b < c:
            break

        c *= 2
        K -= 1
    
    if a < b < c:
        return "Yes"
    else:
        return "No"


print(main())


Measured memory_bytes: 9172
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 A,B;
	cin >> A >> B;

	cout << ((A-1)*(B-1)) << endl;
	return 0;
}


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

int main(){
  int N;
  cin >>N;
  
  //カードの設定
  vector<int> cards(N);
  for( int i=0; i<N; i++){
    int a;//カードの数字
    cin >> a;
    cards.at(i) = a;
  }
  
  sort(cards.begin(), cards.end());//得点が小さい順に並び替え
  reverse(cards.begin(), cards.end());//得点が大きい順に並び替え
  
  
  int A,B; //Alice, Bob
  A = 0;
  B = 0;
  
  for(int i=0; i<N; i++){
    if( i%2 ==0){
      A += cards.at(i);
    }
    else {
      B += cards.at(i);
    }
  }
  
  cout << A-B << endl;

}

Measured memory_bytes: 256
import sys
import re
sys.setrecursionlimit(10 ** 7)
 
 
def LI(): return [int(x) for x in sys.stdin.readline().split()]
 
 
def SI(): return input()
 
 
def main():
    S = SI()
    ans = 0
    S = S.replace("BC", "1")
    a = 0
    b = 0
    for s in S:
        if s == "A":
            a += 1
        elif s == "1":
            ans += a
            b = 1
        else:
            a = 0
    print(ans)
 
 
main()

Measured memory_bytes: 3628
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}

int f(int n, int m) {
    if(m == 1) return Div(Mul(n, n + 3), 2);
    return (C(m + n + 2, m + 1) - m - n - 2 + mod) % mod;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r1, c1, r2, c2;
    fact();
    cin >> r1 >> c1 >> r2 >> c2;
    cout << (f(r2, c2) -f(r2, c1 - 1) -f(r1 - 1, c2) + f(r1 - 1, c1 - 1) + mod) % mod << endl;

    return 0;
}


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

using namespace std;

const int N=5e5+5;

int n,a[N];

long long ans;

char s[N];

int main(){
    scanf("%s",s+1);
    n=(int)strlen(s+1);
    n++;
    int lst=0;char ch;
    for(int i=1;i<=n;i++){
        if(s[i]^ch){
            if(ch=='<'){
                for(int j=lst,k=0;j<=i;j++,k++){
                    a[j]=max(a[j],k);
                }
            }
            else{
                for(int j=i,k=0;j>=lst;j--,k++){
                    a[j]=max(a[j],k);
                }
            }
            ch=s[i];lst=i;
        }
    }
    for(int i=1;i<=n;i++){
        // printf("%d%c",a[i]," \n"[i==n]);
        ans+=a[i];
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  int sen = 1000;
  while(sen < n)  {
    sen+= 1000;
  }
  cout << sen - n << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include<functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <stack>
#include <deque>

#define LL long long
#define pii pair<int,int>
#define pLL pair<LL,LL>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<LL>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<LL>
#define vecpii vector<pii>
#define vecpLL vector<pLL>
#define vecbL vector<bool>
#define endl "\n"
#define REP(e,v) for(auto e:v)
#define rep(i, a, n) for(LL i = a; i < n;i++)

using namespace std;


struct edge {
    LL to;
    LL cost;
};

/*
 LL V;

 cin >> V;

 vector<edge> G[V];

 rep(i,0,V){
 	 LL e;

 	 cin >> e;

 	 rep(j,0,e){
 	 	 LL to,cost;
 	 	 cin >> to >> cost;

 	 	 G[j].insert(new edge(to,cost));
 	 }
 }

 */


int inp(){
	int x;
	scanf("%d",&x);
	return x;
}
LL linp(){
	LL x;
	scanf("%lld",&x);
	return x;
}

void outp(int i){
	printf("%d",i);
}

void loutp(LL i){
	printf("%lld",i);
}

LL mod(LL i){
	return i % 1000000007;
}


LL gcd(LL i,LL j){
	if(j != 0)
		return gcd(j, i % j);
	else
		return i;

}

LL A(){
	string s;

	cin >> s;

	if(s == "ABC")
		cout << "ARC";
	else
		cout << "ABC";


	return 0;
}

LL B(){
	LL N,K;

	cin >> N >> K;

	LL d[K] = {0};
	vector<LL> A[K];

	rep(i,0,K){
		cin >> d[i];
		rep(j,0,d[i]){
			LL x;
			cin >> x;
			A[i].push_back(x);
		}
	}

	bool donthave[N];//持っていなければtrue

	rep(i,0,N)
	 donthave[i] = true;

	rep(i,0,K){
		rep(j,0,d[i]){
			if(A[i][j]-1 >= 0)
				donthave[A[i][j]-1] = false;
		}
	}

	LL count = 0;

	rep(i,0,N){
		if(donthave[i]){
			count++;
		}
	}

	cout << count;

	return 0;
}

LL C(){
	LL N,M;
	cin >> N >> M;

	LL H[N];

	rep(i,0,N)
		cin >> H[i];

	LL ma[N] = {0};

	rep(i,0,M){
		LL A,B;
		cin >> A >> B;
		ma[A-1] = max(ma[A-1], H[B-1]);
		ma[B-1] = max(ma[B-1], H[A-1]);

	}

	LL count = 0;
	rep(i,0,N){
		count += H[i] > ma[i];
	}

	cout << count << endl;


	return 0;
}

LL D(){
	LL X;

	cin >> X;

	rep(A, -1000, 1000){
		rep(B,-1000,1000){
			if(A*A*A*A*A - B*B*B*B*B == X){
				cout << A << " " << B;
				return 0;
			}
		}
	}


	return 0;
}

LL E(){

	return 0;
}

signed main() {
	//A();
	//B();
	C();
	//D();
	//E();
	return 0;
}


Measured memory_bytes: 5180
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


k, x = LI()
ans = []
stone = k - 1
if x - stone >= -(10 ** 6):
    ans += list(range(x - stone, x))
else:
    ans += abs(-(10 ** 6) - x)

ans += [x]

if x - stone <= (10 ** 6):
    ans += list(range(x + 1,  x + stone + 1))
else:
    ans += abs((10 ** 6) - x)
print(*ans)


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

#define rep(i, n) for(int i = 2; i <= n; i ++)

using namespace std;

int main(void){
	for(int n, count = 0; cin >> n; cout << count << endl, count = 0){
		vector<bool> numberList(n + 1);

		rep(i, n) numberList[i] = true;

		for(int i = 2; i * i <= n; i ++) for(int j = i; i * j <= n; j ++) if(numberList[i * j]) numberList[i * j] = false; 
		
		rep(i, n) if(numberList[i]) count ++;
	}

	return 0;
}

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

int dp1[200005],dp2[200005],rest[200005];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k,c;
	cin >> n >> k >> c;
	string a = " ",b;
	cin >> b;
	a += b;
	for (int i = 1; i <= n; i++)
	{
		if( a[i] == 'o' )
		{
			dp1[i] = dp1[i-1] + 1;
			rest[i] = c;
			for (int j = 1; j <= c; j++)
			{
				if( i + j > n ) break;
				dp1[i+j] = dp1[i];
				rest[i+j] = c - j;
			}
			i += c;
		}else dp1[i] = dp1[i-1],rest[i] = 0;
	} 
	for (int i = n; i >= 1; i--)
	{
		if( a[i] == 'o' )
		{
			dp2[i] = max(dp2[i+1],dp2[min(n+1,i+c+1)] + 1);
		}else dp2[i] = dp2[i+1];
	}
	for (int i = 1; i <= n; i++)
	{
		if( a[i] == 'o' )
		{
			if( dp1[i-1] + dp2[min(max(i-1+rest[i-1]+1,i+1),n+1)] < k )
			{
				cout << i << '\n';
			}
		}
	}
	return 0;
}


Measured memory_bytes: 4372
#include<bits/stdc++.h>
#define eps 0.000000001
using namespace std;
typedef long double ld;
typedef pair<int,int> p;
typedef pair<ld,p> P;

int n;
ld px[200],py[200],pz[200],vx[200],vy[200],vz[200],r[200],vr[200];

ld getlen(int a,int b,ld M){
  ld ax=px[a]+vx[a]*M,ay=py[a]+vy[a]*M,az=pz[a]+vz[a]*M,ar=r[a]-vr[a]*M;
  ld bx=px[b]+vx[b]*M,by=py[b]+vy[b]*M,bz=pz[b]+vz[b]*M,br=r[b]-vr[b]*M;
  ld dx=ax-bx,dy=ay-by,dz=az-bz;
  return sqrt(dx*dx+dy*dy+dz*dz)-(ar+br);
}

ld check(int a,int b){
  ld L=0,R=100,M;
  int s=0;
  while(s++<50){
    M=(L+R)/2;
    ld len=getlen(a,b,M),len1=getlen(a,b,M+eps);
    if(len<len1||len<0)R=M;
    else L=M;
  }
  if(getlen(a,b,R)>0)return 1000;
  return R;
}

int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++)
      cin>>px[i]>>py[i]>>pz[i]>>vx[i]>>vy[i]>>vz[i]>>r[i]>>vr[i];
    priority_queue<P,vector<P>,greater<P> > q;
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++)
	q.push(P(check(i,j),p(i,j)));
      q.push(P(r[i]/vr[i],p(i,i)));
    }
    ld used[200]={};
    while(!q.empty()){
      ld t=q.top().first;
      int a=q.top().second.first,b=q.top().second.second;
      q.pop();
      if(used[a]||used[b])continue;
      used[a]=used[b]=t;
    }
    for(int i=0;i<n;i++)printf("%.10Lf\n",used[i]);
  }
  return 0;
}

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

using namespace std;

int main(){
    unsigned long long  S;
    cin >> S;
    if(S%1000000000 !=0){
        cout << 0 << " " << 0 << " " << (1 + S/1000000000) << " " << 1 << " " << 1000000000 - S%1000000000 << " " << 1000000000 << endl;
    }else{
        cout << 0 << " " << 0 << " " << S/1000000000 << " " << 1 << " " << 0 << " " << 1000000000 << endl;
    }
}

Measured memory_bytes: 256
//AtCoder ABC092 C - Traveling Plan
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N;
    cin>>N;
    vector<ll> an(N+2,0);
    ll ttl=0;
    for(ll i=1;i<=N;++i){
        cin>>an[i];
        ttl += abs(an[i-1]-an[i]);
    }
    ttl += abs(an[N]-0);
    vector<ll> ans(N+1,0);
    for(ll i=1;i<=N;++i){
        ans[i]=ttl-abs(an[i-1]-an[i])-abs(an[i]-an[i+1])+abs(an[i-1]-an[i+1]);
    }
    for(ll i=1;i<=N;++i){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	int N; cin >> N;
	vector<int> A(N);
	int flg = 1;
	for(int i = 0; i < N; ++i) {
		cin >> A[i];
		if(A[i]%2) continue;
		if(A[i]%3!=0 && A[i]%5!=0) flg = 0;
	}
	cout << (flg?"APPROVED":"DENIED") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define Inf 1000000000
#define nmax_def 110000
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;

int main() {
	ll H;
	cin >> H;
	ll ans = 1;
	while (1) {
		ans *= (ll)2;
		H /= (ll)2;
		if (H < 1)
			break;
	}
	ans--;
	cout << ans << endl;

	return 0;
}

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

// lnt powmod(lnt a, lnt p, lnt m){
// 	lnt res = 1, tmp = a;
// 	while(p != 0){
// 		if(p % 2) res = (res*tmp) % m;
// 		tmp = (tmp*tmp) % m;
// 		p /= 2;
// 	}
// 	return res;
// }

lnt powmod(lnt a, lnt p, lnt m){
	if(p == 0) return 1;
	return powmod(a*a%m, p/2, m)*(p%2 ? a : 1) % m;
}

int main(){
	summon_tourist;

	lnt N; cin >> N;

	lnt c00 = 0, c01 = 0, c10 = 0;
	vector<plnt> X;
	map<plnt, lnt> mp;

	REP(i, N){
		lnt a, b; cin >> a >> b;
		if(a==0 and b==0) c00++;
		else if(a==0) c01++;
		else if(b==0) c10++;
		else X.eb(a, b);
	}

	for(plnt &p: X){
		lnt a = p.first, b = p.second;
		lnt g = __gcd(abs(a), abs(b));
		a /= g; b /= g;
		if(a < 0){
			a*=-1; b*=-1;
		}
		mp[{a, b}]++;
		if(b < 0){
			lnt ta = -b, tb = a;
			a = ta; b = tb;
		}
		p = {a, b};
	}
	sort(ALL(X));
	X.erase(unique(ALL(X)), X.end());
	lnt ans = (powmod(2, c01, MOD) + powmod(2, c10, MOD) - 1 + MOD) % MOD;
	for(plnt p: X){
		lnt a = p.first, b = p.second;
		cerr << a << ' ' << b << ln;
		lnt A = b, B = -a;
		lnt c0 = mp[p], c1 = mp[{A, B}];
		ans = ans * ((powmod(2, c0, MOD) + powmod(2, c1, MOD) - 1 + MOD) % MOD) % MOD;
	}
	
	cout << (ans-1+c00+MOD) % MOD << ln;
}

Measured memory_bytes: 35904
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        string s,s1;
        cin>>s>>s1;
        int n=s.length();int m=s1.length();
        int dp[3001][3001];
        memset(dp,sizeof(dp),0);
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                if(s[i-1]==s1[j-1])
                    dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
            }
        }
        string ans="";
        int ctr=dp[n][m];
        int r=m;
        for(int i=n;i>=1;i--){
            for(int j=r;j>=1;j--){
                if(dp[i][j]==ctr&&s[i-1]==s1[j-1]){
                    ans+=s[i-1];
                    r=j-1;
                    ctr--;
                    break;
                }
            }
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 38852
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a = read::<usize>();
    let b = read::<usize>();
    let mut seq = [a, a - 1, b, b - 1];
    seq.sort();
    println!("{}", seq[3] + seq[2]);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
long long n,m,k,b,c,ans=0,cnt=0,lcm=1;
string s,t;
int main(){
	cin >> n;
	long long a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
		ans+=a[i]-1;
		
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = float('inf')
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    H,W,K = LI()
    x1,y1,x2,y2 = _LI()

    p = [SI() for _ in range(H)]

    d = [[INF] * W for _ in range(H)]
    d[x1][y1] = 0

    q = []
    q.append((0,x1,y1))
    while q:
        n,x,y =  heapq.heappop(q)
        if d[x][y] < n: continue
        for dx,dy in DD:
            for n in range(1,K+1):
                nx = x + dx * n
                ny = y + dy * n
                if not(0<=nx<H and 0<=ny<W): break
                if p[nx][ny] == '@': break
                if d[nx][ny] < d[x][y] + 1: break
                if d[nx][ny] == d[x][y] + 1: continue
                d[nx][ny] = d[x][y] + 1
                q.append((d[nx][ny],nx,ny))
    if d[x2][y2] < INF:
        print(d[x2][y2])
    else:
        print(-1)



if __name__ == '__main__':
    main()

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

int main(){
    int N;
    cin >> N;
    int M = N;
    int sum=0;

    while(M>0){
        sum += M%10;
        M /= 10;
    }
    if(N%sum ==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

ll A[3010][3010];
ll dp[3010][3010][4];

int main(){
  ll r,c,k;
  cin>>r>>c>>k;
  
  ll x,y,z;
  rep(i,k){
    cin>>x>>y>>z;
    A[x][y]=z;
  }
  
  for(int i=1;i<=r;i++){
    for(int j=1;j<=c;j++){
      for(int k=0;k<=3;k++){
        if(A[i][j]==0){
          if(k==0) dp[i][j][k]=max(max(max(dp[i-1][j][0],dp[i][j-1][k]),
                                   max(dp[i-1][j][1],dp[i-1][j][2])),dp[i-1][j][3]);
          else dp[i][j][k]=dp[i][j-1][k];
        }
        else{
          if(k==0) dp[i][j][k]=max(max(max(dp[i-1][j][0],dp[i][j-1][k]),
                                   max(dp[i-1][j][1],dp[i-1][j][2])),dp[i-1][j][3]);
          else if(k==1) dp[i][j][k]=max(max(max(dp[i][j-1][k],dp[i][j-1][k-1]+A[i][j]),
                                        max(dp[i-1][j][0],dp[i-1][j][1])+A[i][j]),
                                        max(dp[i-1][j][2],dp[i-1][j][3])+A[i][j]);
          else dp[i][j][k]=max(dp[i][j-1][k],dp[i][j-1][k-1]+A[i][j]);
        }
      }
    }
  }
  ll ans=0;
  rep(i,4){
    ans=max(ans,dp[r][c][i]);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 356260
#include<cstdio>
int main(){
    int a,b,c,A,B,C;
    scanf("%d %d %d",&a,&b,&c);
    A = a , B = b , C = c;
    if(A <= B){
        if(B <= C){
            a = A , b = B , c = C;
        }
        else if(B > C){
            if(A <= C){
                a = A , b = C , c = B;
            }
            else {
                a = C , b = A , c = B;
        }
        }
    }
    else if(A > B){
        if(A <= C){
            a = B , b = A , c = C;
        }
        else if(A > C){
            if(B <= C){
                a = B , b = C , c = A;
            }
            else{
                a = C , b = B , c = A;
            }
        }
    }
    printf("%d %d %d\n",a,b,c);
    }


Measured memory_bytes: 2612
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl

int main() {
    long long x, y;
    cin >> x >> y;
    int n = 1;
    long long p = x;
    while (true) {
        p *= 2;
        if (p <= y) {
            ++n;
        } else {
            break;
        }
    }
    cout << n << endl;
    return 0;
}


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

int main() {
  int l, r, d;
  cin >> l >> r >> d;

  int ans = 0;

  for (int i=l;i<=r;++i) {
    if (i % d == 0) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3668
#include<cstdio>
#include<iostream>
#include<vector>
using namespace std;
const int Maxn=100000+20;
struct edge{
	int v,id;
	edge(int x,int y)
	{
		v=x,id=y;
	}
};
int d[Maxn],c[Maxn];
int n,ans;
vector <edge> e[Maxn];
inline int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
void dfs(int x,int fa,int last)
{
	int cnt=0;
	for(int i=0;i<e[x].size();++i)
	{
		int y=e[x][i].v;
		if(y==fa)continue;
		++cnt;
		if(cnt==last)++cnt;
		c[e[x][i].id]=cnt;
		dfs(y,x,cnt);
	}
}
int main()
{
//	freopen("in.txt","r",stdin);
	n=read();
	for(int i=1;i<n;++i)
	{
		int x=read(),y=read();
		++d[x],++d[y];
		e[x].push_back(edge(y,i));
		e[y].push_back(edge(x,i));
	}
	for(int i=1;i<=n;++i)
	ans=max(ans,d[i]);
	
	dfs(1,0,0);
	printf("%d\n",ans);
	
	for(int i=1;i<n;++i)
	printf("%d\n",c[i]);
	
	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll a, b, c, d;cin >> a >> b >> c >> d;
	while(1){
		c -= b;
		if(c <= 0){
			cout << "Yes" << endl;
			return 0;
		}

		a -= d;
		if(a <= 0){
			cout << "No" << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define LOOP(val, times)   for(val = 0; val < (times); val++)
int main() {
  int n,m;
  cin>>n>>m;
  priority_queue<int> d;
  int i=0;
  LOOP(i,n){
    int y;
    cin>>y;
    d.push(y);
  }
  while(m>0 && d.top()>0){
    int h;
    h=d.top()/2;

    d.pop();

    d.push(h);
    m--;
  }
  int64_t ans=0;
  while (!d.empty()) {
    ans+=d.top();
    d.pop();
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 892
#include<iostream>
#include<cstdio>
#include<ctype.h>
using namespace std;
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch))f|=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return f?-x:x;
}
string s="aeiou";
int main() {
	char c=getchar();
	for(int i=0;i<5;++i)if(c==s[i]){puts("vowel");return 0;}
	puts("consonant");
	return 0;
}

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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  int maxdif = max({abs(a - b), abs(b - c), abs(c - a)});
  cout << abs(a - b) + abs(b - c) + abs(a - c) - maxdif << endl;
  return 0;
}

Measured memory_bytes: 3552
n = int(input())
info = [list(map(int,input().split())) for i in range(n)]

ans ="Yes"
kyori = abs(info[0][1])+abs(info[0][2])
zikan = info[0][0]
if not(kyori <= zikan and kyori%2 ==zikan%2):
  print("No")
  exit()
  
for i in range(1,n):
  kyori = abs(info[i][1]-info[i-1][1])+abs(info[i][2]-info[i-1][2])
  zikan = info[i][0]-info[i-1][0]
  if not(kyori <= zikan and kyori%2 ==zikan%2):
    ans ="No"
    break
    
    
print(ans)

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

int main() {
  ll N;
  cin >> N;
  vector<ll> a(N+2);
  ll sum=0;
  a[0]=0;
  for(int i=1;i<=N;i++) {
    cin >> a[i];
    sum += llabs(a[i]-a[i-1]);
  }
  a[N+1]=0;
  sum += llabs(a[N]-a[N+1]);

  for(int i=1;i<=N;i++) {
    ll ans=sum;
    ans -= (abs(a[i]-a[i-1])+abs(a[i+1]-a[i]));
    ans += abs(a[i-1]-a[i+1]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 2048
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <iomanip>
using ll = long long;
using namespace std;
//#define int long long

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = 0; i <= (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int i = n; i >= 0; i--)
int factorical(int n) {
	int sum = 1;
	for (int i = 1; i <= n; ++i)
	{
		sum *= i;
	}
	return sum;
}

vector<int> divisors(int n) {
	vector<int> res;
	for (int i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (n / i == i) continue; // 上の行で追加済み。
		res.push_back(n / i);
	}
	return res;
}
vector<ll> divisors_ll(ll n) {
	vector<ll> res;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (n / i == i) continue; // 上の行で追加済み。
		res.push_back(n / i);
	}
	return res;
}


void printVector(const vector<int>& vec) {
	for (int value : vec) {
		cout << value << " ";
	}
	cout << endl;
}



int main() {
	ll n;
	vector<ll> divisor;
	cin >> n;
	divisor = divisors_ll(n);
	vector<ll> div_sum;
	rep(i, divisor.size()) {
	
		div_sum.push_back((divisor[i]-1) + (n/divisor[i]-1));
	}
	ll max = *min_element(div_sum.begin(), div_sum.end());
	cout << max << endl;

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
main()
{
    int a,b[100],Max=0,Min=0,i;
    cin>>a;
    for(i=0;i<a;i++)
    {
        cin>>b[i];
        if(b[i]>Max)
            Max=b[i];
    }
    Min=b[0];
    for(i=0;i<a;i++)
    {
        if(Min>b[i])
            Min=b[i];
    }
    cout<<(Max-Min)<<endl;
}


Measured memory_bytes: 256
A,B=map(int,input().split())
miA=-(-A//0.08)
maA=-(-(A+1)//0.08)-1
miB=-(-B//0.1)
maB=-(-(B+1)//0.1)-1
if max(miA,miB)<=maA and max(miA,miB)<=maB:
  print(int(max(miA,miB)))
else:
  print(-1)

Measured memory_bytes: 3064
N = int(input())
ans = ""
if N == 0:
    print(0)
    exit()
while N != 0:
    # 下の桁から求めていく
    r = N % 2
    if r < 0:
        r += 2
    N = (N-r) // (-2)
    ans += str(r)
print(ans[::-1])


Measured memory_bytes: 3064
n, d = map(int, input().split())
X = []
for _ in range(n):
    X.append([int(x) for x in input().split()])
ans = 0
for i in range(n - 1):
  for j in range(i + 1, n):
    s = sum((X[i][d] - X[j][d])**2 for d in range(d))
    if (s ** .5).is_integer():
        ans += 1
print(ans)

Measured memory_bytes: 3064
s=list(input())
#print(s)
s1=s[::-1]
#print(s1)
s2=s[:(len(s)-1)//2]
s2a=s2[::-1]
#print(s2)
s3=s[((len(s)+3)//2)-1:]
s3a=s3[::-1]
#print(s3)
#print((len(s)-1)//2)
#print((len(s)+3)//2)

if s==s1 and s2==s2a and s3==s3a:
    print("Yes")
else:
    print("No")


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var n = int.Parse(str);

            var ps = new int[n];

            for (int i = 0; i < n; i++)
            {
                str = Console.ReadLine();
                ps[i] = int.Parse(str);
            }

            var output = ps.Sum() - ps.Max() / 2;
            Console.WriteLine(output);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, M, K;
    cin >> N >> M >> K;
    
    rep(i, N + 1) {
        if ((i * M) == K) {
            cout << "Yes" << endl;
            return 0;
        }
        
        int a = K - (i * M);
        int b = N - 2 * i;
        
        if ((a <= 0) || (b <= 0)) {
            continue;
        }
        
        if (((a % b) == 0) && ((a / b) <= M)) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    cout << "No" << endl;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  char last_char =0;
  string ans = "Yes";
  map<string,bool> mp;
  for(int i=0;i<n;++i){
    string s;
    cin >> s;
    if(mp[s]) ans = "No";
    else mp[s] = true;

    if(last_char==0) last_char=s[s.size()-1];
    else{
      if(last_char==s[0]) last_char=s[s.size()-1];
      else ans = "No";
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int n,a[10001],i,count;
int main(void){
    scanf("%d",&n);
    for(i = 0;i < n;i++){
        scanf("%d",&a[i]);
    }
    for(i = 0;i < n;i++){
        while(a[i]%2 == 0){
            a[i]/=2;
            count += 1;
        }
    }
    printf("%d",count);
    return 0;
        

}

Measured memory_bytes: 256
n = gets.to_i

ans = 10
1.upto(99999) do |a|
  next if n % a != 0
  b = n / a
  al = a.to_s.size
  bl = b.to_s.size
  f = al > bl ? al : bl
  ans = f if f < ans
  break if al > bl
end
puts ans


Measured memory_bytes: 1788
use std::io::*;
use std::str::FromStr;
 
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}
 
fn main(){
    let mut v: Vec<i32> = Vec::with_capacity(5);
    for _ in 0..5 {
        v.push(read());
    }
    let k: i32 = read();
    println!("{}", if can_sock(v, k) { "Yay!" } else { ":(" });
}
 
fn can_sock(v: Vec<i32>, k: i32) -> bool {
    for a in &v {
        for b in &v {
            if (a - b).abs() > k {
                return false;
            }
        }
    }
    true
}
	

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

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    n *= 2;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a.begin(), a.end());
    vector<int> dp(n + 1);
    for (int i = 1; i < n; i++) {
        dp[i + 1] = max(dp[i], dp[i - 1] + min(a[i], a[i - 1]));
    }
    printf("%d\n", dp[n]);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val s = mutableSetOf<Int>()
	repeat(n){s.add(scn.nextInt())}
	print(if (n==s.size) "YES" else "NO")
}

Measured memory_bytes: 88936
N=int(input())
A=list(map(int,input().split()))

#DP[i][j]=A[i]からA[j-1]まで残っていた時のX-Yの予測値(0<=i<=j<=N,i=jならばDP=0)
DP=[[0]*(N+1) for _ in range(N+1)]

#j-i=1から初めてi=0かつj=Nまで、すなわちj-i=Nまで考える
for len in range(1,N+1):
    for i in range(0,N): #0<=i<Nで考えれば良い、というかi<=N-lenで良い
        j=i+len #正直len=1は例外的、maxもminもないが気にしない
        if j<=N:
            if (N-len)%2==0:#先手
                DP[i][j]=max(A[i]+DP[i+1][j],A[j-1]+DP[i][j-1])
            else:#後手
                DP[i][j]=min(-A[i]+DP[i+1][j],-A[j-1]+DP[i][j-1])
        else:
            break

#for index1 in range(N+1):
    #string=''
    #for index2 in range(N+1):
        #string+=str(DP[index1][index2])+' '
    #print(string)

print(DP[0][N])






Measured memory_bytes: 113244
#include<stdio.h>
int main()
{
	int r,D,x_i;
	scanf("%d%d%d",&r,&D,&x_i);
	for(int i=1;i<=10;i++)
	{
		x_i=r*x_i-D;
		printf("%d\n",x_i);
	}
	return 0;
} 

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const int INF=1e9;


int intpow(int a,int  m){
  int ans=1;
  rep(i,m){
    ans*=a;
    
  }
  return ans;
}

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}

    
int main(){
  ll x;
  cin>>x;
  vector<ll> xi=divisor(x);
  
  for(int a=-120;a<=120;a++){
    for(ll y : xi){//約数の一つ
      int b=a-y;
      
      if(intpow(a,5)-intpow(b,5)==x){
        cout <<a<<" "<<b<<endl;
        return 0;
      }
    }
    
  }
  
  
  
  

}

Measured memory_bytes: 3588
#include<stdio.h>
int main(){
  int i,j;
  int h[10];
  int hh;
  for(i=0;i<10;i++){
    scanf(" %d",&h[i]);
  }
  for(i=0;i<3;i++){
    for(j=9;j>0+i;j--){
      if(h[j]>h[j-1]){
	hh=h[j];
	h[j]=h[j-1];
	h[j-1]=hh;
      }
    }
  }
  for(i=0;i<3;i++){
    printf("%d\n",h[i]);
  }
  return(0);
}

Measured memory_bytes: 600
#include <cstdio>
#include <iostream>

using namespace std;

int MAX_WEIGHT = 1000000000;

int W[100000];

int n, k;

bool check(int p) {

	int kCnt = 1;
	int w = p;
	for (int i = 0; i < n; ++i) {
		if (W[i] > p) {
			return false;
		}
		w -= W[i];
		if (w < 0) {
			++kCnt;
			if (kCnt > k) {
				return false;
			}
			w = p - W[i];
		}
	}
	return true;
}

int main() {

	scanf("%d", &n);
	scanf("%d", &k);

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

	int left = 0;
	int right = MAX_WEIGHT;
	int mid = (left + right) / 2;
	while (left < mid && mid < right) {
		if (check(mid)) {
			right = mid;
		} else {
			left = mid;
		}
		mid = (left + right) / 2;
//		cout << "left:" << left << ":mid:" << mid << ":right:" << right << endl;
	}

	cout << right << endl;

	return 0;
}

Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class77
    {
        static void Main()
        {
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NM[0], M = NM[1];
            var a = new int[M];
            var b = new int[M];
            for (int i = 0; i < M; i++)
            {
                var r = Console.ReadLine().Split();
                a[i] = int.Parse(r[0]);
                b[i] = int.Parse(r[1]);
            }
            Array.Sort(a, b);
            int min = int.MaxValue;
            int count = 0;
            for(int i = 0; i < M; i++)
            {
                min = Math.Min(min, b[i]);
                if (a[i] >= min)
                {
                    count++;
                    min = int.MaxValue;
                    i--;
                }
            }
            Console.WriteLine(count+1);
        }
    }
}


Measured memory_bytes: 18012
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <sstream>

using namespace std;
int main() {
	while (true) {
		int x, y;
		cin >> x >> y;
		if (x == 0 && y == 0)break;
		int ret = 0;
		for (int i = 1; i <= x; i++) {
			for (int j = i+1; j <= x; j++) {
				for (int k = j+1; k <= x; k++) {
					if (i + j + k == y)ret++;
				}
			}
		}
		cout << ret << endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int k;
	cin >> k;
	vector<ll> a(k);
	rep(i,k)cin >> a[i];
	reverse(ALL(a));
	ll l  = 2, r = 2;
	for(int i=0;i<k;i++){
		l = (l + a[i] - 1 )/a[i] * a[i];
		r = ((r/a[i]) + 1) * a[i] - 1;
		if(l>r){
			cout << -1 << endl;
			return 0;
		}
	}
	cout << l << " " << r << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();

        if (a * b > c * d) {
            System.out.println(a * b);
        } else {
            System.out.println(c * d);
        }
    }
}

Measured memory_bytes: 23124