akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll h, w;
    cin >> h >> w;
    deque<string> s(h); REP(i, h) cin >> s[i];
    REP(i, h) s[i] = "." + s[i] + ".";
    s.emplace_front(string(w+2, '.'));
    s.emplace_back (string(w+2, '.'));
    vector<string> ans(h, string(w, ' '));
    RANGE(i, 1, h) {
        RANGE(j, 1, w) {
            char &term = ans[i-1][j-1];
            if (s[i][j] == '#') {
                term = '#';
            } else {
                term = '0' + (s[i-1][j-1] == '#')
                           + (s[i  ][j-1] == '#')
                           + (s[i+1][j-1] == '#')
                           + (s[i-1][j  ] == '#')
                           + (s[i+1][j  ] == '#')
                           + (s[i-1][j+1] == '#')
                           + (s[i  ][j+1] == '#')
                           + (s[i+1][j+1] == '#');
            }
        }
    }

    REP(i, h) cout << ans[i] << endl;
    
}

Measured memory_bytes: 256
from collections import deque

n=int(input())
G=[[]for _ in range(n)]
L=[]
ans=[0]*n
for i in range(n-1):
   a,b=map(int,input().split())
   G[a-1].append(b-1)
   L.append(b-1)

que=deque([0])
while que:
   s=que.pop()
   color=1
   for ni in G[s]:
      if ans[s]==color:
         color+=1
      ans[ni]=color
      color+=1
      que.append(ni)
print(max(ans))
for i in L:
   print(ans[i])
   

Measured memory_bytes: 68384
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  int n,m;
  cin >> n >> m;
  int l[m],r[m];

  for(int i = 0; i < m; i++) {
    cin >> l[i] >> r[i];
  }

  int ans = *max_element(l,l+m) - *min_element(r,r+m);
  if(ans > 0) {
    cout << 0 << endl;
  }else {
    cout << abs(ans)+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 4344
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    vector<int> a(n);

    int res = 0;

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (i % 2 == 0 && a[i] % 2 == 1)
            ++res;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>
int main(void){
    int H,W;
    int i,j;
    while(1){
        scanf("%d %d",&H,&W);
        if((H==0)&&(W==0))
            break;
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                if((i+j)%2==0)
                    printf("#");
                else
                    printf(".");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

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

int main() {
  long long int N, A, B;
  cin >> N >> A >> B;
  if ((B - A) % 2 == 0) cout << (B - A) / 2 << endl;
  else {
    cout << min(A - 1, N - B) + 1 + (B - A - 1) / 2 << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	ll x;
	cin >> x;
	ll ans = 1;
	for (ll i = 0;i <= x;++i) {
		ll res = i * (i + 1) / 2;
		if (res >= x) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"

const int W = 1e5 + 5;

int n, w;
int wt[105], val[105];
int dp[105][W];

int findAns(int idx, int tw){
    if(tw > w){
        return -1e15;
    }
    if(idx == n + 1){
        return 0;
    }

    int &ans = dp[idx][tw];

    if(ans != -1){
        return ans;
    }

    ans = max(val[idx] + findAns(idx + 1, tw + wt[idx]), findAns(idx + 1, tw));
    return ans;

}

int32_t main(){

    memset(dp, -1, sizeof(dp));

    cin >> n >> w;

    for(int i = 1;i <= n; ++i){
        cin >> wt[i] >> val[i];
    }
    int ans = findAns(1, 0);
    cout << ans << endl;

}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
typedef long long ll;

template<class T> T gcd(T a,T b) {return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b) {return a/gcd(a,b)*b; }
template<class T> bool isPrime(T num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (T i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

using namespace std;

int a,b,c;
int n,cnt,M=INT_MAX;
ll ans;

main()
{
        cin>>n;

        rep(i,n)
        {
                int it;
                cin>>it;
                if(it<0)cnt++;
                M=min(M,abs(it));
                ans+=abs(it);
        }

        if(cnt%2==0)
        {
                cout<<ans<<endl;
        }else{
                cout<<ans-M*2<<endl;
        }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  ll x, y;
  cin >> x >> y;
  ll cnt = 0;
  if(x == -y){
    cout << 1 << endl;
  }else if(x == 0){
    if(y >= 0){
      cout << y << endl;
    }else{
      cout << -y + 1 << endl;
    }
  }else if(x <= y){
    if(x < 0 && y > 0){
      cout << abs(x + y) + 1 << endl;
    }else{
      cout << y - x << endl;
    }
  }else{
    if(y > 0 && x > 0){
      cout << 2 + abs(y - x) << endl;
    } else if(y <= 0 && x > 0){
      if(x < -y){
        cout << 1 - y - x << endl;
      }else{
        cout << 1 + (y + x) << endl;
      }
    }else{
      cout << 2 - (y - x) << endl;  
    }
  }
  return 0;
}

Measured memory_bytes: 256
X,Y=map(str,input().split())
a=['A','B','C','D','E','F']
b=['10','11','12','13','14','15']

for i in range(6):
  if X==a[i]:
    X=b[i]
  if Y==a[i]:
    Y=b[i]
    
if X<Y:
  print('<')
elif X==Y:
  print('=')
else:
  print('>')

Measured memory_bytes: 3064
program ABC103B
    implicit none
    integer(8)::i
    integer(8)::flg=0
    character(100)::S,T

    read(5,*)S
    read(5,*)T

    do i=1,len_trim(S)
        if(S(i:len_trim(S))//S(1:i-1)==T)then
            flg=1
            exit
        end if
    end do

    if(flg==0)then
        print'(A)',"No"
    else
        print'(A)',"Yes"
    end if
    
end program ABC103B

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

int main() {
  int N;
  int d[110];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> d[i];
  
  set<int> values;
  for (int i =0; i < N; i++) {
    values.insert(d[i]);
  }
  
  cout << values.size() << endl;
}

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

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

bool judgment(int A, int B, int C) {
    if (A < B && B < C) {
        // cout << A << " " << B << " " << C << " " << endl;
        cout << "Yes" << endl;
        return true;
    } else {
        // cout << A << " " << B << " " << C << " " << endl;
        return false;
    }
}


int main() {
    int A, B, C, K, cnt = 0;
    cin >> A >> B >> C;
    cin >> K;

    rep (i, K) {
        if (B <= A) {
            B *= 2;
            ++cnt;
        } else if (C <= B) {
            C *= 2;
            ++cnt;
        } 

        if (judgment(A,B,C)) {
            return 0;
        } else {
            continue;
        }
        
    }
    
    if (A < B && B < C) {
        cout << "Yes" << endl;
        return 0;
    } else {
        cout << "No" << endl;
        return 0;
    }

    return 0;
}


Measured memory_bytes: 3672
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
long long s[200005],total,ans;
int n,a[200005];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);
		total+=a[i];
		s[i]=s[i-1]+a[i];
	}
	ans=abs(total-s[1]-s[1]);
	for(int i=2;i<n;++i)
	{
		ans=min(ans,abs(total-s[i]-s[i]));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2560
# https://atcoder.jp/contests/dp/submissions/12482219
require 'pp'

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

N, W = gets_i_list
wv_list = []
N.times do
  wv_list.push gets_i_list
end

wv_list.sort!{|x,y| x[0]<=>y[0]}
dp = Array.new(W + 1, 0)

wv_list.each do |w, v|
  W.downto(w) do |i|
    dp[i] = dp[i - w] + v if dp[i] < dp[i - w] + v
  end
end

puts dp.max

Measured memory_bytes: 15268
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

int main() {
	string s;
	cin >> s;
	string t = s;
	rep(i, s.size()) {
		if (i % 2 == 0) {
			t[i] = '0';
		}
		else {
			t[i] = '1';
		}
	}
	int ans = 0;
	rep(i, s.size()) {
		if (t[i] != s[i])ans++;
	}
	int cnt = 0;
	rep(i, s.size()) {
		if (i % 2 == 1) {
			t[i] = '0';
		}
		else {
			t[i] = '1';
		}
	}
	rep(i, s.size()) {
		if (t[i] != s[i])cnt++;
	}
	cout << min(cnt, ans) << endl;
	return 0;
}

Measured memory_bytes: 512
def cnt(h,w):
  q=[]
  arr=[[True]*(w+2)]
  arr.extend([[True]+[s!='.' for s in input()]+[True] for _ in range(h)])
  arr.append([True]*(w+2))
  for i in range(1,h+1):
    for j in range(1,w+1):
      if arr[i][j]:
        q.append([i,j])
  ans=0
  while 1:
    nq=[]
    for y,x in q:
      if not arr[y-1][x]:
        nq.append((y-1,x))
        arr[y-1][x]=True
      if not arr[y][x-1]:
        nq.append((y,x-1))
        arr[y][x-1]=True
      if not arr[y+1][x]:
        nq.append((y+1,x))
        arr[y+1][x]=True
      if not arr[y][x+1]:
        nq.append((y,x+1))
        arr[y][x+1]=True
    if len(nq)==0:
      break
    else:
      q=nq
      ans+=1
  return ans
    
h,w=map(int,input().split())
print(cnt(h,w))


Measured memory_bytes: 137076
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	ll s; cin >> s;
	ll x1 = 1e9, x2 = 1;
	ll y1 = (s + x1 - 1) / x1, y2 = x1 * y1 - s;
	cout << 0 << " " << 0 << " " << x1 << " " << y2 << " " << 1 << " " << y1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
//cout << fixed << setprecision(8) << a << endl;
//cout << "Case " << ca << ": " << ans << endl;
#define Fast_Input ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
int main()
{
    vector < string > v;
    char a,b,i;
    string x="",y="";
    cin >> a >> b;

    for(i=1; i<=(a-'0'); i++)
    {
        x+=b;
    }

    for(i=1; i<=(b-'0'); i++)
    {
        y+=a;
    }
    if(x<=y)
        cout << x << endl;
    else
        cout << y << endl;
    return 0;
}


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

int main(void){
	int n;
	int a[200];
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}

	for(int i=n-1; i>0; i--){
		printf("%d ", a[i]);
	}
	printf("%d\n", a[0]);

	return 0;
}

Measured memory_bytes: 1144
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    cnt += min(x, K - x);
  }
  printf("%d\n", 2 * cnt);
}

Measured memory_bytes: 3244
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int n;
	while(cin>>n,n){
		int sum = 0;
		rep(i,n/4){
			int x;
			cin>>x;
			sum +=x;
		}
		cout <<sum<<endl;
	}
	return 0;
}

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

int main() {
  int N, K, X, Y, sum=0;

  cin>>N;
  cin>>K;
  cin>>X;
  cin>>Y;

  if (N>K) {
    sum = K*X + (N-K)*Y;
  } else {
    sum = N*X;
  }

  cout << sum << endl;

  return 0;
}

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

int main(){
  ll n, k;
  cin >> n >> k;

  ll ans = n%k;
  ans = min(ans, abs(ans-k));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin >> s;
  FOR(i,0,s.length()) {
    cout << s[i];
    if(i == 3) cout << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

dp = [0, abs(h[1]-h[0])]
if n >2:
    for i in range(2,n):
        dp.append(min(abs(h[i]-h[i-2])+dp[-2], abs(h[i]-h[i-1])+dp[-1]))

print(dp[-1])

Measured memory_bytes: 13928
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

int main(){
    int x; cin >> x;
    vector<int> d;

    int cnt=1;
    d.push_back(1);
    for(int i=2; i<=x; i++){
        if(i*i>x) continue;

        cnt=i*i;

        for(int j=1; j<=9;j++){
            if(cnt*i<=x){
                cnt*=i;
            }
        }
        d.push_back(cnt);
    }
    sort(d.rbegin(), d.rend());
    out(d[0]);

}

Measured memory_bytes: 3560
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define ROOP(i,n) for(i=0;i<n;i++)

//prototype declaration
int getint();
long long getllint();
double getdint();
char getch();
void setstring(char *s);
void showint(int i);
void showllint(long long i);
void showdint(double i);
void showchar(char c);
void showstring(char *s);

int myPower(int a, int n) { // aのn乗の計算
	int x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main(void) {
	int n, k;
	n = getint();
	k = getint();
	if (n % k == 0) {
		showint(0);
	} else {
		showint(1);
	}
	return 0;
}

int getint() {
	int i;
	scanf("%d", &i);
	return i;
}

long long getllint() {
	long long i;
	scanf("%lld", &i);
	return i;
}

double getdint() {
	double i;
	scanf("%lf", &i);
	return i;
}

char getch() {
	char c;
	scanf("%c", &c);
	return c;
}

void setstring(char *s) {
	scanf("%s", s);
}

void showint(int i) {
	printf("%d\n", i);
}

void showllint(long long i) {
	printf("%lld\n", i);
}

void showdint(double i) {
	printf("%lf\n", i);
}

void showchar(char c) {
	printf("%c\n", c);
}

void showstring(char *s) {
	printf("%s\n", s);
}


Measured memory_bytes: 128
#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 FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

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



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    if(n<=k) cout<<n*x<<endl;
    else cout<<k*x + (n-k)*y << endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
	int a[5][5];
	int aa[5];
	int b[5];
	for(int i = 1; i <= 3; i++){
		for(int j = 1; j <= 3; j++){
			scanf("%d",&a[i][j]);
		}
	}
	int flag;
	for(int k = 0; k <= 100; k++){
	    flag = 0;
		aa[1] = k;
		b[1] = a[1][1] - aa[1];
		b[2] = a[1][2] - aa[1];
		b[3] = a[1][3] - aa[1];
		aa[2] = a[2][1] - b[1];
		aa[3] = a[3][1] - b[1];
		for(int i = 1; i <= 3; i++){
			for(int j = 1; j <= 3; j++){
				if(a[i][j] != aa[i] + b[j])
					flag = 1;
			}
		}
		if(!flag){ printf("Yes\n"); return 0;}
    }       
	printf("No\n");
	return 0;
}


Measured memory_bytes: 128
from numpy import*
M=10**9+7
m=lambda:map(int,input().split())
n,k=m()
a=matrix([list(m())for i in[0]*n],'O')
b=eye(n,n,0,'O')
while k:b=[b,b*a][k&1];a=a*a%M;k>>=1
print(sum(b)%M)

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

int main(){
  int N, M;
  cin >> N >> M;

  int G[10][100];
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 100; j++) {
      G[i][j] = 0;
    }
  }

  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    G[a][b] = 1;
    G[b][a] = 1;
  }
  vector<int> r_comb;
  for (int i = 1; i <= N; i++) {
    r_comb.push_back(i);
  }

  set<string> ans_set;
  do {
    int start = 1;
    int chk[M+1];
    for (int i = 1; i <= M; i++) {
      chk[i] = 0;
    }
    chk[start] = 1;

    string comb = to_string(start);
    for (auto itr = r_comb.begin() + 1; itr != r_comb.end(); itr++){
      if (G[start][*itr] == 1 && G[*itr][start] == 1 && chk[*itr] != 1) {
        chk[*itr] = 1;
        comb = comb + to_string(*itr);
        start = *itr;
      } else {
        start = 1;
        itr = r_comb.end();
        break;
      }
    }
    if ((int)comb.length() == N) {
      ans_set.insert(comb);
    }
  } while (next_permutation(r_comb.begin() + 1, r_comb.end()));
  cout << ans_set.size() << endl;
}



Measured memory_bytes: 768
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll NCR[2010][2010];
    for(ll i=0;i<2010;i++)
    {
        for(ll j=0;j<2010;j++)
        {
            NCR[i][j]=0;
        }
    }
    NCR[0][0]=1;
    for(ll i=1;i<2010;i++)
    {
        NCR[i][0]=1;
        for(ll j=1;j<=i;j++)
        {
            NCR[i][j]=NCR[i-1][j]+NCR[i-1][j-1];
            if(NCR[i][j]>MOD)
            {
                NCR[i][j]=NCR[i][j]%MOD;
            }
        }
    }
    ll n,k;
    cin>>n>>k;
    if(n==k)
    {
        cout<<"1"<<endl;
        for(ll i=1;i<n;i++)
        {
            cout<<"0"<<endl;
        }
        exit(0);
    }
    ll ans,store;
    for(ll i=1;i<=k;i++)
    {
        store=NCR[n-k-1][i];
        ans=store;
        store=(2*NCR[n-k-1][i-1])%MOD;
        ans=(ans+store)%MOD;
        if(i>=2)
        {
            store=NCR[n-k-1][i-2];
            ans=(ans+store)%MOD;
        }
        store=NCR[k-1][i-1];
        ans=(ans*store)%MOD;
        cout<<ans<<endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int a, b;
  fscanf(stdin, "%d %d", &a, &b);
  int d = a / b, r = a % b;
  double f = a * 1.0 / b;
  fprintf(stdout, "%d %d %f", d, r, f);
  fprintf(stdout, "\n");
  return 0;
}

Measured memory_bytes: 1232
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<set<int>>;

typedef long long ll;
typedef tuple<ll, ll, ll> mytuple;
const ll INF = 1e9;
const ll MOD = 1000000007;
const double pi = 3.141592653589793238;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) { if (b == 0) {return a;} else {return GCD(b, a % b);} }
// a と b の最小公倍数を返す関数
long long LCM(long long a, long long b) { return a/GCD(a,b)*b; }

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


int cnt = 0;

// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v, vector<int> &h) {
    // seen[v] = true;
    int value = h.at(v);
    bool flag = false;

    int count = 0;
    for (auto next_v : G[v]) {
        // if (seen[next_v]) continue;
        if(value <= h[next_v]) {
          flag = true;
          break;
        }
        ++count;
    }
    if(!flag) {
      cnt++;
    }
}

int main() {
    // 頂点数と辺数
    int N, M; cin >> N >> M;

    vector<int> h(N+1);
    for (int i = 1; i <= N; ++i) {
      cin >> h.at(i);
    }

    // グラフ入力受取
    Graph G(N+1);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].insert(b);
        G[b].insert(a);
    }

    // 全頂点が訪問済みになるまで探索

    seen.assign(N+1, false);
    for (int v = 1; v <= N; ++v) {
        // if (seen[v]) continue; // v が探索済みだったらスルー
        dfs(G, v, h); // v が未探索なら v を始点とした DFS を行う
    }

    cout << cnt << endl;
}



Measured memory_bytes: 20168
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<math.h>
using namespace std;

#define LEN 100005
#define rep(i,n) for(int i = 0; i < n; i++)

struct process {
    char name[100];
    int time;
};

process Q[LEN];
int head, tail;

void initialze(int n) {
    head = 0;
    tail = n;
}

bool isEmpty() {
    return head == tail;
}

bool isFull() {
    return head == (tail + 1) % LEN;
}

void enqueue(process x) {
    if (isFull()) {
        fprintf(stderr, "Fullなのでenqueueできない\n");
        exit(1);
    }
    Q[tail] = x;

    if(tail == LEN -1) {
        tail = 0;
    }
    else {
        tail++;
    }
}

process dequeue() {
    if(isEmpty()) {
        fprintf(stderr, "Emptyなのでdequeueできない\n");
        exit(1);
    }
    if(head == LEN -1) {
        head = 0;
        return Q[LEN-1];
    }
    else {
        head++;
        return Q[head-1];
    }
}

int min(int a, int b) {
    return a > b ? b : a ; 
}


int main() {
    int  q;
    int elaps = 0; // 経過時間を計測するための変数
    int c,n;
    process x;

    scanf("%d %d", &n,&q);
    
    // 全てのプロセスをキューに順番に追加
    rep(i,n) {
        scanf("%s%d", Q[i].name, &Q[i].time);
    }
    initialze(n);
    
    while(!isEmpty()) {
        
        x = dequeue();
        c = min(q,x.time);
        x.time -= c;
        elaps += c;
        // 処理が完了していなければ、キューに再び追加する
        if(x.time > 0) {
            enqueue(x);
        }
        else {
            printf("%s %d\n",x.name ,elaps);
        }
    }
    return 0;
}




Measured memory_bytes: 13240
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	string s, ans="";
	cin >> s;
	for(auto x : s){
		if(x!='B') ans+=x;
		else if(ans!="") ans.pop_back();
	}
	cout << ans << endl;
 	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    string ans = "No";
    if (x - r >= 0 && x + r <= w && y - r >= 0 && y + r <= h)
    {
        ans = "Yes";
    }
    cout << ans << endl;
   // system("pause");
    return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second

class DSU
{
public:
    vector<int> f;
    vector<int> cnt;
    DSU(int sz)
    {
        f = vector<int>(sz);
        cnt = vector<int>(sz, 1);
        forn(i, sz) f[i] = i;
    }
    int get(int x)
    {
        return f[x] == x ? x : (f[x] = get(f[x]));
    }
    void merge(int x, int y)
    {
        x = get(x);
        y = get(y);
        if (x != y)
            f[x] = y, cnt[y] += cnt[x];
    }
    bool same(int x, int y)
    {
        return get(x) == get(y);
    }
    int count(int x)
    {
        return cnt[get(x)];
    }
};

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll m, k;
	cin >> m >> k;
	if((1 << m) <= k) return cout << -1, 0;
	if(m == 1 && k == 1) return cout << -1, 0;
	if(k == 0)
	{
		forn(i, 1 << m) cout << i << ' ' << i << ' ';
		return 0;
	}
	cout << 0 << ' ' << k << ' ' << 0 << ' ';
	fori(i, 1, 1 << m) if(i != k) cout << i << ' ';
	cout << k << ' ';
	forr(i, (1 << m) - 1, 1) if(i != k) cout << i << ' ';
	cout << endl;
	return 0;
}

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

int main() {
	int N;
	scanf("%d", &N);
	int sol = 0, cnt = 0, last = 0;
	for (int i = 0; i < N; i++) {
		int x;
		scanf("%d", &x);
		if (i && x != last) {
			sol += cnt / 2;
			cnt = 0;
		}
		cnt++;
		last = x;
	}
	
	printf("%d\n", sol + cnt / 2);
	
	return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class CHonestOrUnkind2 {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n, a, x, y;
        vector<pair<int, int>> xy[20];
        int res = 0;
        int lie[20];

        in >> n;
        rep(i, n){
            in >> a;
            rep(j, a){
                in >> x >> y;
                xy[i].push_back(make_pair(x-1, y));
            }
        }

        for(int bit=0; bit<(1 << n); bit++){
            Fill(lie, 1);
            for(int i=0; i<n; i++){
                if(bit & (1 << i)) lie[i] = 0;
            }

            bool flg = true;
            int cnt = 0;
            rep(i, n){
                for(auto const& e : xy[i]){
                    if(lie[e.first] != e.second && lie[i] == 1){
                        flg = false;
                        break;
                    }
                }
                if(lie[i]) cnt++;
                if(!flg) break;
            }
            if(flg) chmax(res, cnt);
            //adeb(lie, n-1);
        }

        out << res << endl;
	}
};


int main() {
	CHonestOrUnkind2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int num[100005];
bool red[100005];

int main() {
	int N, M; cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		num[i] = 1;
		red[i] = false;
	}
	red[1] = true;

	for (int i = 1; i <= M; i++) {
		int x, y; cin >> x >> y;

		if(red[x])red[y] = true;
		num[x] = num[x] - 1;
		num[y] = num[y] + 1;
		if (num[x] == 0)red[x] = false;
	}

	int ans = 0;
	for (int i = 1; i <= N; i++) {

		if (red[i])ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
using namespace std;

int main()
{
    int n;
    int ans = 0;
    cin >> n;
    vector<int> kisu;
    for (int i=0; i < n; ++i) {
        int x;
        cin >> x;
        if (x % 2) kisu.push_back(x);
        ans += x;
    }
    if (!kisu.empty() && kisu.size() % 2) {
        sort(kisu.begin(), kisu.end());
        ans -= kisu[0];
    }
    cout << ans/2 << endl;
    return 0;
}


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

const ll INF = 1LL << 62;
const double PI = acos(-1);
const double eps = 1e-10;

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

  ll total = 0;
  rep(i, s.size()) total += s[i] - '0';
  cout << (total % 9 == 0 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3732
from collections import deque

S = input()
Q = int(input())

S = deque(S)
reverse = False

for _ in range(Q):
    query = input()
    if query[0] == '1':
        reverse = not reverse
    elif query[0] == '2':
        _, F, C = query.split()
        if F == '1':
            if reverse:
                S.append(C)
            else:
                S.appendleft(C)
        elif F == '2':
            if reverse:
                S.appendleft(C)
            else:
                S.append(C)
            
result = ''.join(S)
if reverse:
    result = result[::-1]
print(result)

Measured memory_bytes: 75608
#include <climits>
#include <cmath>
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>
using namespace std;
int main(int, char**)
{
	int N, K;
	cin >> N >> K;
	long double P = 0;
	long double l2K = log2(K);
	int m = min(N, K - 1);
	for (int i = 1; i <= m; ++i)
	{
		long double l2x = log2(i);
		int n = ceil(l2K - l2x);
		long double p = 1.0 / static_cast<long double>(1 << n);
		P += p;
	}
	int M = max(N - K + 1, 0);
	P += M;
	P /= N;
	printf("%.10Lf\n", P);
	return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
f = []
for i in range(H):
    f.append(input())
for i in range(H):
    for j in range(W):
        if '#' == f[i][j]:
            print('#', end="")
        else:
            sum = 0
            if i - 1 >= 0:
                if j - 1 >= 0:
                    if f[i-1][j-1] == '#':
                        sum = sum + 1
                if j >= 0:
                    if f[i-1][j] == '#':
                        sum = sum + 1
                if j + 1 < W:
                    if f[i-1][j+1] == '#':
                        sum = sum + 1
            if j - 1 >= 0:
                if f[i][j-1] == '#':
                    sum = sum + 1
            if f[i][j] == '#':
                sum = sum + 1
            if j + 1 < W:
                if f[i][j+1] == '#':
                    sum = sum + 1
            if i  + 1 < H:
                if j - 1 >= 0:
                    if f[i+1][j-1] == '#':
                        sum = sum + 1
                if j >= 0:
                    if f[i+1][j] == '#':
                        sum = sum + 1
                if j + 1 < W:
                    if f[i+1][j+1] == '#':
                        sum = sum + 1
            print(sum, end="")
    print()

Measured memory_bytes: 3572
import java.util.PriorityQueue;
import java.util.Scanner;


public class Main {
	
	private static class Walk implements Comparable<Walk>{
		int x,y,t,rule;
		
		Walk(int x, int y, int t,int r){
			this.x = x;
			this.y = y;
			this.t = t;
			this.rule = r;
		}

		@Override
		public int compareTo(Walk arg0) {
			return this.rule < arg0.rule ? -1 : this.rule > arg0.rule ? 1 : 0; 
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		boolean[][][] map = new boolean[210][210][6]; 
		
		for(int i = 0; i < 210; i++){
			for(int j = 0; j < 210; j++){
				for(int k = 0; k < 6; k++){
					map[i][j][k] = false;
				}
			}
		}
		
		final int sx = sc.nextInt() + 102;
		final int sy = sc.nextInt() + 102;
		final int gx = sc.nextInt() + 102;
		final int gy = sc.nextInt() + 102;
		
		final int n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			final int x = sc.nextInt() + 102;
			final int y = sc.nextInt() + 102;
			
			
			for(int j = 0; j < 6; j++){
				map[x][y][j] = true;
			}
		}
		
		final int lx = sc.nextInt();
		final int ly = sc.nextInt();
		
		
		PriorityQueue<Walk> queue = new PriorityQueue<Walk>();
		queue.add(new Walk(sx,sy,0,0));
		
		while(!queue.isEmpty()){
			Walk w = queue.poll();
			
			final int dir = Math.abs(((w.x - 102) * (w.y - 102) * w.t)) % 6;
			
			if(map[w.x][w.y][w.t%6]){
				continue;
			}
			map[w.x][w.y][w.t%6] = true;
			
			
			if(w.x == gx && w.y == gy){
				System.out.println(w.rule);
				return;
			}
			
			for(int i = 0; i < 7; i++){
				int dx = 0, dy = 0;
				
				if(Math.abs(w.x) % 2 == 0){
					switch(i){
					case 0:
						dx = 0;
						dy = 1;
						break;
					case 1:
						dx = 1;
						dy = 0;
						break;
					case 2:
						dx = 1;
						dy = -1;
						break;
					case 3:
						dx = 0;
						dy = -1;
						break;
					case 4:
						dx = -1;
						dy = -1;
						break;
					case 5:
						dx = -1;
						dy = 0;
						break;
					case 6:
						dx = 0;
						dy = 0;
						break;
					}
				}else{
					switch(i){
					case 0:
						dx = 0;
						dy = 1;
						break;
					case 1:
						dx = 1;
						dy = 1;
						break;
					case 2:
						dx = 1;
						dy = 0;
						break;
					case 3:
						dx = 0;
						dy = -1;
						break;
					case 4:
						dx = -1;
						dy = 0;
						break;
					case 5:
						dx = -1;
						dy = 1;
						break;
					case 6:
						dx = 0;
						dy = 0;
						break;
					}
				}
					
				if((w.x+dx) <= (102+lx) && (w.x+dx) >= (102-lx) && (w.y+dy) <= (102+ly) && (w.y+dy) >= (102-ly)){
					queue.add(new Walk(w.x + dx, w.y + dy, (w.t+1)%6,w.rule + (dir == i ? 0 : 1)));
				}	
			}	
		}
		
		System.out.println(-1);
	}
	
}

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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int k;
  cin >> k;
  int ans = (k/2)*(k-k/2);
  cout << ans << endl;
  return 0;
}


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

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

  int ans;
  if(s == "SUN") ans = 7;
  if(s == "MON") ans = 6;
  if(s == "TUE") ans = 5;
  if(s == "WED") ans = 4;
  if(s == "THU") ans = 3;
  if(s == "FRI") ans = 2;
  if(s == "SAT") ans = 1;

  cout << ans << endl;

}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

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

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

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	a := nextInts(n)

	ok := true
	for i := 1; ok && i < n; i++ {
		ok = ok && (a[i-1] <= a[i])
	}
	if ok {
		puts(0)
		return
	}

	plus := true
	mx, mxI := 0, 0
	for i := range a {
		if mx < abs(a[i]) {
			plus = (a[i] > 0)
			mx, mxI = abs(a[i]), i+1
		}
	}

	// 各項1回ずつ符号付きmxを加算
	puts(2*n - 1)
	for i := 1; i <= n; i++ {
		puts(mxI, i)
	}
	// n-1回の操作で累積和計算
	if plus {
		for i := 1; i < n; i++ {
			puts(i, i+1)
		}
	} else {
		for i := n; i > 1; i-- {
			puts(i, i-1)
		}
	}
}


Measured memory_bytes: 640
import java.util.Scanner;
	import java.util.*;
	
	public class Main{
		
		public static void main(String[] args) {
			
			Scanner sc=new Scanner(System.in);
			
		while(true){int n=sc.nextInt();if(n==0){break;}
		int N[]=new int[n+1];
		
		for(int i=0;i<n+1;i++){N[i]=sc.nextInt();}
		
		bi:for(int i=0;i<n+1;i++){
			List<Integer>tousa=new ArrayList<Integer>();
		for(int p=0;p<n+1;p++){
			tousa.add(N[p]);}
		tousa.remove(i);
			for(int p=0;p<n-2;p++){
				if(tousa.get(p)-tousa.get(p+1)!=tousa.get(p+1)-tousa.get(p+2)){continue bi;}
			}System.out.println(N[i]);break;
		
		}}}}
		

Measured memory_bytes: 54876
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

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

  int n; cin >> n;
  cout << 3*n*n << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n=sc.nextInt();
		int[]a=new int[n],b=new int[n],tmpA=new int[n],tmpB=new int[n];
		for(int i=0;i<n;i++) 
			tmpA[i]=sc.nextInt();
			
		for(int i=0;i<n;i++)
			tmpB[i]=sc.nextInt();
		long ans=0;
		for(int k=0;k<30;k++) {
			int T=1<<k;
			for(int i=0;i<n;i++) {
				a[i]=tmpA[i]%(2*T);
				b[i]=tmpB[i]%(2*T);
			}
			

			Arrays.sort(a);
			Arrays.sort(b);
			for(int i=0;i<n/2;i++) {
				int x=b[n-i-1];
				b[n-i-1]=b[i];
				b[i]=x;
			}

			int xor=0;
			int t1=0,t2=0,t3=0,t4=0;
			for(int i=0;i<n;i++) {
				while(t1<n && a[i]+b[t1]>=T)
					t1++;
				while(t2<n && a[i]+b[t2]>=2*T)
					t2++;
				while(t3<n && a[i]+b[t3]>=3*T)
					t3++;
				while(t4<n && a[i]+b[t4]>=4*T)
					t4++;
				int one=Math.max(0, t1-t2),two=Math.max(0, t3-t4);
				xor^=one;
				xor^=two;
			}
			if((xor&1)==1)
				ans+=T;

		}
		out.println(ans);
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

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

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

}

Measured memory_bytes: 64128
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
string s;
void print1(int n,int id = 0,int st = 0){
	if(id == n){
		cout<<s<<"\n";
		return;
	}
	for(int i = 0;i<=min(id,st+1);i++){
		s[id] = 'a'+i;
		print1(n,id+1,max(i,st));
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	cin>>n;
	rep(i,n){
		s.pb('A');
	}
	print1(n);	

	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
bool ismirror(string s)
{
	string ss;
	int len = s.size();
	for(int i = 0;i < len;i++)
	{
		ss += ' ';
	}
	int h = 0;
	for(int i = len-1;i >= 0;i--)
	{
		ss[h++] = s[i];
	}
	for(int i = 0;i < len;i++)
	{
		if(ss[i] == 'b')
		{
			ss[i] = 'd';
			continue;
		}else if(ss[i] == 'd')
		{
			ss[i] = 'b';
			continue;
		}else if(ss[i] == 'p')
		{
			ss[i] ='q';
			continue;
		}else if(ss[i] == 'q')
		{
			ss[i] = 'p';
			continue;
		}
	}
	if(ss == s)
	{
		return true;
	}else
	{
		return false;
	}
}
int main()
{
	string s;
	cin>>s;
	if(ismirror(s))
	{
		cout<<"Yes";
	}else cout<<"No";
	return 0;
	
}

Measured memory_bytes: 512
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
res_arr = [-1] * n

for i in a:
    res_arr[i] = 0

for i in range(1, n):
    if res_arr[i] == 0:
        next
    elif i == 1:
        res_arr[i] = 1
    elif i == 2:
        res_arr[i] = 1 + res_arr[i-1]
    else:
        res_arr[i] = res_arr[i-1] + res_arr[i-2]

if n == 1:
    res = 1
elif n == 2:
    res = 1 + res_arr[1]
else:
    res = res_arr[-1]+res_arr[-2]
amari = res % 1000000007
print(amari)


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

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    if((a*100+b*10+c)%4==0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}



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

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

            string inputs = Console.ReadLine();
            string[] words = inputs.Split(' ');

            List<int> iList = new List<int>();
            foreach (var word in words)
            {
                iList.Add(int.Parse(word));
            }

            var result = (iList[0] * iList[1]) % 2;

            var strOddEven = string.Empty;
            strOddEven = (result == 0) ? "Even" : "Odd";
            Console.WriteLine(strOddEven);

            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092