akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 112345;
ll A[MAX_N];

bool possible(int N, int s) {
  ll C = 0;
  for (int i = 0; i <= s; i++) C += A[i];
  for (int i = s + 1; i < N; i++) {
    if (A[i] <= 2 * C) {
      C += A[i];
    } else return false;
  }
  return true;
}

int main2() {
  int N = nextInt();
  REP(i, N) A[i] = nextInt();
  sort(A, A+N);

  ll hi = N-1;
  ll lo = -1;
  while (hi - lo > 1) {
    ll mid = (hi + lo) / 2;
    if (possible(N, mid)) hi = mid; else lo = mid;
  }
  cout << N - hi << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 1024
n,m=map(int,input().split())
arr=[0]+list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for _ in range(m):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
ans=0
for v in range(1,n+1):
  for u in g[v]:
    if arr[u]>=arr[v]:
      break
  else:
    ans+=1
print(ans)


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

#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

vector<ll>par;
vector<ll>height; 

void init(int n){
   height.resize(n,0);
   par.resize(n);
   for(int i=0;i<n;i++)par[i] = i;
}

int root(int x){
   if(par[x] == x)return x;
   else return par[x]=root(par[x]);
}

bool isSame(int x,int y){
   return (root(x) == root(y));
}

void merge(int x,int y){
   if(isSame(x,y))return;

   x = root(x);
   y = root(y);
   if(height[x] < height[y])swap(x,y);

   par[y] = x;
   if(height[x]==height[y])height[y]++;
}

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);

   int N,M;
   cin>>N>>M;
   vector<int>p(N);
   init(N+1);
   for(int i=0;i<N;i++)cin>>p[i];
   int x=0,y=0;
   for(int i=0;i<M;i++){
      cin>>x>>y;
      merge(x,y);
      merge(y,x);
   }
   ll ans = 0;
   for(int i=0;i<N;i++){
      if(isSame(p[i],i+1))ans++;
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 2176
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		ArrayList<String> param = new ArrayList<String>();

		while (sc.hasNext()) {
			if (sc.hasNextInt()) {
				num.add(sc.nextInt());
			} else {
				param.add(sc.nextLine());
			}
		}
		Method(num, param);
	}
	
	static void Method(ArrayList<Integer> num, ArrayList<String> param) {
		
		System.out.println((num.get(0) + num.get(1)) * num.get(2) / 2);
		
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>  // sort, 二分探索, etc
#include <iomanip>  // setprecision (浮動小数点の出力の誤差)
#include <map>
#include <queue>
#include <set>
#include <stack>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define cauto const auto&
#define UNIQUE(v) (v).erase( unique(all(v), (v).end() );
#define SZ(x) ((ll)(x).size()) // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define INF 1000000000000
#define MOD 1000000007
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

using namespace std;
using ll = long long;
using ull = unsigned long long;

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

const char newl = '\n';

ll qp(ll a,ull b){ll ans=1;do{if(b&1u)ans*=a;a*=a;}while(b>>=1u);return ans;}
ll qp(ll a,ull b,ll mod){ll ans=1;do{if(b&1u)ans=ans*a%mod;a=a*a%mod;}while(b>>=1u);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll comb(int n, int r) {
    vector<vector<ll> > v(n+1, vector<ll>(r+1, 0));
    for(int i=0;i<n+1;i++) {v[i][0]=1; if(i < r+1)v[i][i]=1; }
    for(int i=1;i<n+1;i++) {for(int j=1;j<min(i,r+1);j++) {v[i][j]=v[i-1][j-1]+v[i-1][j];}}
    return v[n][r];
}

// INT_MAX   = 2.1e+09 (2147483647)
// LONG_MAX  = 9.2e+18 (9223372036854775807)
// LLONG_MAX = 9.2e+18 (9223372036854775807)


int main() {
    ll n;
    cin >> n;
    map<string, ll> mp;
//    vector<string> vec;
    rep(i, n) {
        string x;
        cin >> x;
        mp[x] += 1;
//        vec.push_back(x);
    }

    vector<string> labels = {"AC", "WA", "TLE", "RE"};

    for (auto val : labels) {
        cout << val << ' ' << 'x' << ' ' << mp[val] << newl;
    }



    return 0;
}


Measured memory_bytes: 3228
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#define Rint register int
#define mem(a,b) memset(a,(b),sizeof(a))
#define Temp template<typename T>
using namespace std;
typedef long long LL;
Temp inline void read(T &x){
    x=0;T w=1,ch=getchar();
    while(!isdigit(ch)&&ch!='-')ch=getchar();
    if(ch=='-')w=-1,ch=getchar();
    while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^'0'),ch=getchar();
    x=x*w;
}

int main(){
	int n;
	read(n);
	cout<<48-n<<endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef string st;
typedef double db;
typedef vector<long long> vecll;
typedef vector<char> vechar;
typedef vector<string> vecst;

int main(){
    ll N;
    cin >> N;
    vecll a(3 * N);
    for(auto& i : a) cin >> i;

    sort(a.begin(), a.end());
    ll ans = 0;
    for(ll i = 0; i < N; i++){
        ans += a.at(2 * i + N);
    }
    cout << ans << endl;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  string s,t;
  cin>>s>>t;
  int n = s.size();
  int m = t.size();
  string wo = string(1,'z'+1);
  string ans = wo;
  REP(i,n-m+1){
    bool ok = true;
    string k = s;
    REP(j,m){
      if(k[i+j]=='?'){
        k[i+j] = t[j];
      }else if(k[i+j]!=t[j]){
        ok = false;
        break;
      }
    }
    REP(i,n)if(k[i]=='?')k[i]='a';
    if(ok){
      CHMIN(ans,k);
    }
  }
  if(ans==wo){
    ans = "UNRESTORABLE";
  }
  cout<<ans<<endl;
  return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    double mx = -1;
    int w = 0;
    int s = 0;
    rep(ia, 31) {
        rep(ib, 31) {
            int aw = ia * 100 * A;
            int bw = ib * 100 * B;
            if (aw + bw > F) continue;
            rep(ic, 3000) {
                int cs = ic * C;
                if (aw + bw + cs > F) continue;
                rep(id, 3000) {
                    int ds = id * D;
                    if (aw + bw + cs + ds > F) continue;
                    if (cs + ds > (aw + bw) / 100 * E) continue;
                    double tmp = 100 * (double) (cs + ds) / (double) (aw + bw);
                    if (tmp > mx) {
                        mx = tmp;
                        w = aw + bw + cs + ds;
                        s = cs + ds;
                    }
                }
            }
        }
    }

    cout << w << " " << s << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		long sum = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}

		long[] answer = new long[n];
		for (int i = 1; i < n; i += 2) {
			answer[0] += a[i];
		}
		answer[0] *= -2;
		answer[0] += sum;
		for (int i = 1; i < n; i++) {
			answer[i] = 2 * a[i - 1] - answer[i - 1];
		}

		for (int i = 0; i < n; i++) {
			System.out.print(answer[i]);
			System.out.print(" ");
		}
		System.out.println();
	}
}


Measured memory_bytes: 67284
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int a[3];
    for(int i = 0; i < 3; i++) cin >> a[i];
    sort(a, a+3);
    cout << a[2] - a[0]; 
}

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define repN_1(i, n) for(int i = 0; i < (int)(n - 1); i++)
#define repM(i, n) for(int i = (int)(n - 1); i >= 0; i--)
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 (b < a) { a = b; return 1; } return 0; }


int main()
{
	std::cout << std::fixed << std::setprecision(10);
	int a, b, x;
	double water;
	double deg;
	double y;

	cin >> a >> b >> x;

	water = (a * b * 0.5) * a;
	deg = atan((double)b / (double)a);

	if (x >= water) {
		y = ((double)b - ((double)x / ((double)a * (double)a))) / 0.5;
		deg = atan(y / (double)a);
		cout << (double)(deg * 180 / M_PI) << endl;

	}
	else
	{
		y = x / (0.5 * a * b);
		deg = atan((double)b / y);
		cout << (double)(deg * 180 / M_PI) << endl;
	}


	return 0;
}

Measured memory_bytes: 256
number = gets.to_s.split(" ")

x = number[0].to_i
y = number[1].to_i

if x > y
  z = x % y
  z = y.gcd(z)
  puts z
end

if x < y
  z = y % x
  z = x.gcd(z)
  puts z
end

if x == y
  puts x
end



Measured memory_bytes: 6876
parseInt(x) = parse(Int, x)
parseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  N,M = readline() |> split |> parseArray
  k,s=zeros(Int,M),zeros(Int,M,N)
  for i in 1:M
    a = readline() |> split |> parseArray
    k[i],s[i,1:a[1]]=a[1],a[2:end]
  end
  p=readline()|>split|>parseArray

  c=count(0:2^N-1) do x
    sw=fill(false,N)
    for i in 1:N
      y=2^(i-1)
      sw[i]=(x&y)==y
    end
    all(1:M) do i
      n=count(1:k[i]) do j
        sw[s[i,j]]
      end
      mod(n,2)==p[i]
    end
  end

  println(c)
end

main()

Measured memory_bytes: 116256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (final Scanner sc = new Scanner(System.in);) {
			final char[] s = sc.next().toCharArray();
			final char[] t = sc.next().toCharArray();

			int c=0;
			for(int i=0; i< s.length; i++) {
				if(s[i]!=t[i]) {
					c++;
				}
			}
			System.out.println(c);
		}
	}
}

Measured memory_bytes: 32940
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=10000000000000000LL;
int n,a,b,h[100001];
bool cheak(ll c){
	ll s=0;
	for(int i=0;i<n;++i){
		if(h[i]>b*c){
			s+=(h[i]-b*c)/(a-b);
			if((h[i]-b*c)%(a-b))++s;
		}
	}
	if(s<=c)return true;
	return false;
}
ll reg(int l,int r){
	if(l==r)return l;
	ll c=(l+r)/2;
	if(cheak(c)){
		if(l+1==r)return l;
		return reg(l,c);
	}else{
		return reg(c+1,r);
	}
}
int main() {
	cin>>n>>a>>b;
	for(int i=0;i<n;++i)cin>>h[i];
	cout<<reg(0,1000000000)<<endl;
	return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << double(W) * double(H) / 2 << " " << (2 * x == W && 2 * y == H)
       << '\n';
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define F first
#define S second
#define nl cout<<"\n"
//cout<<fixed<<setprecision(11);
const ll MOD=1e9+7;
const ll ARR_MAX = 1e5+1;
const ll VAL_MAX = 1e5+1;
const ll INF=1e14;

void solve(){
    char c;
    cin>>c;
    int z=1+(c-'a');
    c='a'+z;
    cout<<c,nl;
}

int main(){
    fastio();
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,k;
    cin >> n >> k;
    if(k==1){
        ANS(0);
    }else{
        ANS(n-k);
    }
    return 0;
}

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

pub 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 mut a = read::<i64>();
    let b = read::<i64>();
    
    a -= b * 2;
    if a > 0 {
        println!("{}", a);
    } else {
        println!("0");
    }
}



Measured memory_bytes: 4352
from math import ceil
h, w = map(int, input().split())
def solve(h, w):
    ans = float("inf")
    for i in range(1, h):
        l = [i * w, (h - i) * (w // 2), (h - i) * (w - w // 2)]
        l2 = [i * w, ((h - i) // 2) * w, (ceil((h - i) / 2)) * w]
        ans = min(ans, max(l) - min(l), max(l2) - min(l2))
    return ans
print(min(solve(h, w), solve(w, h)))

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

ll f[2000000];

int main()
{
    int n;
    cin>>n;
    vector<ll>a(n);
    ll ans=0;
    for(int i=0;i<n;++i){
        cin>>a[i];
        f[a[i]]++;
        ans+=a[i];
    }
    int q;cin>>q;
    for(int i=0;i<q;++i){
        ll b,c;cin>>b>>c;
        ans-=b*f[b];
        ans+=c*f[b];
        f[c]+=f[b];
        f[b]=0;
        cout<<ans<<endl;;
    }
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;
 
typedef pair<int, int> Pii;
 
template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);
 
void add_b(vector< vector<int> > &b, int x0, int y0, int K){
    b[x0][y0]++;
    if(x0 < K && y0 < K){
        b[x0 + K][y0]--;
        b[x0][y0 + K]--;
        b[x0 + K][y0 + K]++;
    }
    if(x0 >= K && y0 < K){
        b[x0][y0 + K]--;
        b[0][y0]++;
        b[0][y0 + K]--;
        b[x0 - K][y0]--;
        b[x0 - K][y0 + K]++;
    }
    if(x0 < K && y0 >= K){
        b[x0 + K][y0]--;
        b[x0][0]++;
        b[x0 + K][0]--;
        b[x0][y0 - K]--;
        b[x0 + K][y0 - K]++;
    }
    if(x0 >= K && y0 >= K){
        b[0][0]++;
        b[x0 - K][0]--;
        b[0][y0 - K]--;
        b[x0 - K][y0 - K]++;
        b[0][y0]++;
        b[x0 - K][y0]--;
        b[x0][0]++;
        b[x0][y0 - K]--;
    }
}
 
signed main(){
 
    int N, K;
    cin >> N >> K;
    
    vector< vector<int> > b(2 * K, vector<int>(2 * K, 0)), s(2 * K, vector<int>(2 * K, 0));
 
    int x, y, x0, y0;
    char c;
    REP(i, N){
        cin >> x >> y >> c;
        if(c == 'W') x += K;
 
        x0 = x % (2 * K);
        y0 = y % (2 * K);
        add_b(b, x0, y0, K);
        add_b(b, (x0 + K) % (2 * K), (y0 + K) % (2 * K), K);
    }
 
    s[0][0] = b[0][0];
    int ans = s[0][0];
 
    FOR(j, 1, 2 * K){
        s[0][j] = s[0][j - 1] + b[0][j];
        ans = max(ans, s[0][j]);
    }
    FOR(i, 1, 2 * K){
        int tmp = 0;
        FOR(j, 0, 2 * K){
            tmp += b[i][j];
            s[i][j] = s[i - 1][j] + tmp;
            ans = max(ans, s[i][j]);
        }
    }
 
    cout << ans;
    
 
    return 0;
}
 
 
template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

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

int main()
{
    ll x, k, d, out, kaisu, amari;
    cin >> x >> k >> d;

    if (x < 0) {
        x *= -1;
    }

    kaisu = x / d;
    amari = x % d;

    if (k <= kaisu) {
        out = x - k * d;
        cout << out << endl;
        return 0;
    }
    else {
        if ((k - kaisu) % 2 == 0) {
            out = amari;
            cout << out << endl;
            return 0;
        }
        else {
            out = abs(amari-d);
            cout << out << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3668
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

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

	string s; cin >> s;
	cout << (s.substr(0, 4) == "YAKI" ? "Yes" : "No") << endl;








	return 0;
}

Measured memory_bytes: 256
solve :: String -> String
solve = show . solve' . map read . tail . words

solve' :: [Int] -> Int 
solve' xs = 3 ^ n - f xs
    where
        n = length xs

f :: [Int] -> Int 
f [] = 1 
f (x:xs)
    | odd x = f xs
    | even x = 2 * f xs

main :: IO ()
main = interact solve

Measured memory_bytes: 508
#include<stdio.h>
#include<math.h>
struct point {
    double x, y;
};
void koch(int n, struct point a, struct point b) {
    if ( n == 0) return;
    struct point s, t, u;
    double rad = 3.1415926535897932384626 / 3;
    s.x = ( 2 * a.x + b.x ) / 3;
    s.y = ( 2 * a.y + b.y ) / 3;
    t.x = ( a.x + 2 * b.x ) / 3;
    t.y = ( a.y + 2 * b.y ) / 3;
    u.x = ( t.x - s.x ) * cos(rad) - ( t.y - s.y ) * sin(rad) + s.x;
    u.y = ( t.x - s.x ) * sin(rad) + ( t.y - s.y ) * cos(rad) + s.y;

    koch(n - 1, a, s);
    if ( s.x < 0 ) s.x *= -1;
    if ( s.y < 0 ) s.y *= -1;
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n - 1, s, u);
    if ( u.x < 0 ) u.x *= -1;
    if ( u.y < 0 ) u.y *= -1;
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    if ( t.x < 0 ) t.x *= -1;
    if ( t.y < 0 ) t.y *= -1;
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, b);
}

int main(void) {
    struct point p, q;
    int n;

    scanf("%d", &n);

    p.x = 0;
    p.y = 0;
    q.x = 100;
    q.y = 0;

    printf("%.8f %.8f\n", p.x, p.y);
    koch(n, p, q);
    printf("%.8f %.8f\n", q.x, q.y);

    return 0;
}

Measured memory_bytes: 1848
import sys
def input(): return sys.stdin.readline().strip()


def quickSelect(A, k):
    """
    長さnの配列Aの中からk番目(1-indexed)に小さい値を線形時間で求めるアルゴリズム。
    動作原理は次を参照：http://www.flint.jp/blog/?entry=109
    処理の流れは次を参照：https://naoyat.hatenablog.jp/entry/median-of-medians

    使用例：quickSelect([2,7,1,8,2], 5, 3) => 2
    """
    n = len(A)
    while True:
        B = A
        m = n

        # 1.配列からmedian of mediansにより適切なpivotを選択（25%~75%に収まる）
        while m > 5:
            medians = []
            rem = 0
            for i in range(m // 5):
                sortB = sorted(B[i * 5: (i + 1) * 5])
                medians.append(sortB[2])
            if m % 5 != 0:
                sortB = sorted(B[(m // 5) * 5:])
                medians.append(sortB[(m - (m // 5) * 5) // 2])
                rem = 1
            B = medians
            m = m // 5 + rem
        B.sort()
        pivot = B[m // 2]

        # 2.pivotを軸に大小で左右に分ける
        left = []
        right = []
        left_num = 0
        right_num = 0
        for a in A:
            if a < pivot:
                left.append(a)
                left_num += 1
            elif a > pivot:
                right.append(a)
                right_num += 1
        if left_num < k <= n - right_num:
            return pivot
        elif left_num < k:
            A = right
            k -= (n - right_num)
            n = right_num
        else:
            A = left
            n = left_num


def main():
    N, M = map(int, input().split())
    if M == 0:
        print(0)
        return
    cakes = [(0, 0, 0)]
    for _ in range(N):
        x, y, z = map(int, input().split())
        cakes.append((x, y, z))

    """
    quickSelectによりO(N)で解ける別解を実装。
    x+y+zやx-y-z等のそれぞれに対してcakesをソートして大きい値から取れば良い。
    """

    ans = 0
    for i in range(8):
        sorted_cakes = []
        for j in range(1, N + 1):
            S = 0
            for k in range(3): # iの立っているビットでx, y, zの符号を管理している！！
                if i & (1 << k):
                    S += cakes[j][k]
                else:
                    S -= cakes[j][k]
            sorted_cakes.append(S)

        # ここでsorted_cakesのM番目に大きな値（＝(N - M + 1)番目に小さな値）をquickSelectで求める
        # あとはその数以上なら評価に加算すれば良い
        val = 0
        bound = quickSelect(sorted_cakes, N - M + 1)
        cnt = 0
        for c in sorted_cakes:
            if c > bound:
                val += c
                cnt += 1
        val += bound * (M - cnt)
        ans = max(ans, val)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 74152
def main():
    mod = 10**9 + 7
    N, M = map(int, input().split())
    S = list(map(int, input().split()))
    T = list(map(int, input().split()))
    V = [1] * N
    for t in T:
        p, q = 1, 1
        for i, (s, v) in enumerate(zip(S, V)):
            V[i] = q = v + q if s == t else v + q - p
            p = v
    return V[-1] % mod

print(main())

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

int main()
{
  int H, W;
  cin >> H >> W;

  char a[H][W];
  for(int i = 0; i < H; ++i){
    for(int j = 0; j < W; ++j){
      cin >> a[i][j];
    }
  }

  bool r[H], c[W];
  fill(r, r+H, true);
  fill(c, c+W, true);

  for(int i = 0; i < H; ++i){
    r[i] = !all_of(&a[i][0], &a[i][W], [](const char c) { return c == '.';});
  }

  for(int i = 0; i < W; ++i){
    int count = 0;
    for(int j = 0; j < H; ++j){
      if(a[j][i] == '.'){
        ++count;
      }
    }
    if(count == H){
      c[i] = false;
    }
  }
  for(int i = 0; i < H; ++i){
    if(r[i]){
      for(int j = 0; j < W; ++j){
        if(c[j]){
          cout << a[i][j];
        }
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int c1;
void a(int x,int sum,int count,int limitc,int limits){
    int i;
    if(sum == limits && count == limitc){
        c1++;
        return;
    }
    if(sum > limits || count > limitc)
        return;
    for(i=x+1;i<10;i++)
            a(i,sum+i,count+1,limitc,limits);
}
int main(void){
    int n,s,i,sum;
    for(;c1=0,scanf("%d %d",&n,&s),n;){
        for(i=0;i<10;i++)
            if(s >= i){
                sum=i;
                a(i,sum,1,n,s);
            }
        printf("%d\n",c1);
    }
    return 0;
}

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

for _ in range(min(50,K)):
    lst = [0]*(N+1)
    for i in range(N):
        lst[max(i-A[i],0)] += 1
        lst[min(i+A[i]+1,N)] -= 1
    add = 0
    for i in range(N):
        add += lst[i]
        A[i] = add
print(*A)

Measured memory_bytes: 171444
#include<bits/stdc++.h>
#define PI acos(-1)
#define EPS 1e-12
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define bitCount __builtin_popcount
#define forn(i, n) for(i = 0; i < (ll)n; i++)
#define for1(i, n) for(i = 1; i <= (ll)n; i++)
#define forv(i, v) for(i = 0; i < v.size(); i++)
#define forab(i, a, b) for(i = a; i <= (ll)b; i++)
#define Sort(v) sort(v.begin(), v.end())
#define bend(v) v.begin(), v.end()
#define sz(v) v.size()
#define trace(x) cout<<"x = "<<x<<"\n"
#define trace2(x, y) cout<<"x = "<<x<<" y = "<<y<<"\n"
#define trace3(x, y, z) cout<<"x = "<<x<<" y = "<<y<<" z = "<<z<<"\n"
#define trace4(w, x, y, z) cout<<"w = "<<w<<" x = "<<x<<" y = "<<y<<" z = "<<z<<"\n"
#define ln "\n"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef set<int>::iterator sit;
typedef set<ll>::iterator sllt;
typedef set<char>::iterator sct;
typedef map<int, int>::iterator mit;
typedef vector<int>::iterator vit;
typedef multiset<int>::iterator msit;
const int maxn = 500+5;
const ll mod = 1e9+7;
const int alphabet = 26;
const int inf = INT_MAX;
const ll linf = 1e18+9;
namespace util{
	inline ll cnm(char ch){ return (ch-'0'); }
	inline ll cap(char ch){ return (ch-'a'); }
	inline void instr(string& s, ll& n){ cin>>s;    n = s.length(); }
	inline void instr(string& s){ cin>>s; }
	template<typename T> T gcd(T a, T b){ if(a==0) return b; return gcd(b%a, a); }
	template<typename T> bool min(T a, T b, T c){
		return  std::min(a, std::min(b, c));
	}
}
using namespace util;

ll h[maxn][maxn];
bool occ[maxn][maxn];
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};

void dfs(ll x, ll y){
	ll z = h[x][y] + occ[x][y];
	for(int i = 0; i < 4; i++){
		ll x1 = x+dx[i];
		ll y1 = y + dy[i];
		if(h[x1][y1] > z){
			h[x1][y1] = z;
			dfs(x1, y1);
		}
	}
}

void solve(int tc)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	ll i, j, k, m, n;
	cin>>n;
	for(i = 1; i <= n; i++){
		for(j = 1; j <= n; j++){
			h[i][j] = min( min(i, (n-i+1)), min(j, n-j+1) ) - 1;
			occ[i][j] = true;
		}
	}

	ll ans = 0;
	for(i = 0; i < n*n; i++){
		ll id; cin>>id;
		ll x = (id+n-1)/n;
		ll y = id%n;
		if(y == 0) y += n;
		ans += h[x][y];
		occ[x][y] = false;
		dfs(x, y);
	}

	cout<<ans<<ln;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int t = 1;
	int i = 1;
	// cin>>t;
	while(i <= t){
		solve(i);
		i++;
	}

	return 0;
}



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

int main(void)
{
  int a,b,c;
  cin>>a>>b;
  c=a+b;
  if(a%3==0){
      cout<<"Possible"<<endl;
  }
  else if(b%3==0){
    cout<<"Possible"<<endl;
  }
  else if((a+b)%3==0){
    cout<<"Possible"<<endl;
  }
  else
    cout<<"Impossible"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
  int main(void){
    int a=100000,b,m,n,i,j;
     scanf("%d",&n);
     for(i=0;i<n;i++){
      a=a+a*0.05;
      if(a%1000!=0)
      a=(a/1000+1)*1000;


        }

printf("%d\n",a);

 return 0;
 }

Measured memory_bytes: 592
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
using namespace std;

int main() {
	int n;
	double ans = 0;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		double gift;
		cin >> gift;
		string s; 
		cin >> s;
		if (s == "JPY") ans += gift;
		else ans += (gift * 380000.0);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
'use strict';
(function(stdin) {
  var lines  = stdin.toString().split('\n');
  var result = (function(data) {

    return data.replace(/([a-z])|([A-Z])/g,function(c,lower,upper) {
      if (lower) return c.toUpperCase();
      if (upper) return c.toLowerCase();
    });
  
  }(lines[0]
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 8700
#include<iostream>
using namespace std;
int mark[100001],a[100005];
int main()
{
	int n,x,c=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	x=1;
	c=0;
	mark[1]=1; 
	while(x!=2)
	{
		c++;
		x=a[x];
		if(mark[x])
		break;
		mark[x]=1;
	}
	if(x==2)
	cout<<c;
	else
	cout<<-1;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<limits>
#include<string>
#include<vector>
#include<stack>
#include<queue>
using namespace std;


long long e[100100];
long long a[100100], b[100100];

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

	long long x = 0,y = 0;
	for (int i = 0; i < n; i++) {
		x = x + a[i];}
	for (int i = 0; i < n; i++) {
		y = y + b[i];}
	if (x < y) { 
		cout << -1;
		return 0;
	}

	long long c = 0, d = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] < b[i]) {
			c = c + b[i] - a[i];
			d++;
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i] > b[i]) {
			e[i] = a[i] - b[i];
		}
		else e[i] = 0;
	}
	sort(e, e + n);
	reverse(e, e + n);
	if (c == 0) { 
		cout << 0;
		return 0;
	}
	for (int i = 0; i < n; i++) {
		c = c - e[i];
		d++;
		if (c <= 0)break;
	}
	cout << d << endl;

    return 0;
}


Measured memory_bytes: 2560
#include <iostream>

using namespace std;

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

  int num = n;
  for(int i = 0; i < n-1; i++){
    if(s[i] == s[i+1]){
      num--;
    }
  }

  cout << num << endl;

  return 0;
}

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

int main() {
  ll x;
  cin >> x;
  ll balance = 100, cnt = 0;
  ;
  while (balance < x) {
    balance = floor(balance * 1.01);
    // cerr << balance << endl;
    // break;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	k := make([]int, m)
	s := make([][]int, m)
	for i := range k {
		fmt.Scan(&k[i])
		s[i] = make([]int, k[i])
		for j := range s[i] {
			fmt.Scan(&s[i][j])
		}
	}
	p := make([]int, m)
	for i := range p {
		fmt.Scan(&p[i])
	}

	ans := 0
	for i := 0; i < (1 << uint(n)); i++ {
		ok := true
		for j := 0; j < m; j++ {
			sum := 0
			for _, v := range s[j] {
				sum += i >> uint(v-1) & 1
			}
			if sum%2 != p[j] {
				ok = false
				break
			}
		}
		if ok {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  if (a >= k) {
    cout << k << endl;
  } else {
    k -= a;
    if (b >= k) {
      cout << a << endl;
    } else {
      k -= b;
      cout << a - k << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int a,b,c;
    char m,n;
    cin>>a>>m>>b>>n>>c;
    if (b<05) {
        cout<<"Heisei"<<endl;
    }else{
        cout<<"TBD"<<endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s ;
    cin >> s ;
    int m = 0 ;
    REP(i,SZ(s)){
        m += s[i] - '0' ;
    }
    if(stoi(s)%m==0){
        yes() ;
    }
    else{
        no() ;
    }



    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    String ans = "No";
    if(c >= a && c <= b) ans = "Yes";
    System.out.println(ans);
  }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}

template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

int main()
{
	ios_base::sync_with_stdio(false);
	
	int n;

	cin >> n;
	
	vector<int> v(n), vals(n);
	for(int i = 0; i < n; ++i) {
		cin >> v[i];
		vals[i] = v[i];
	}

	sort(all(vals));

	for(int i = 0; i < n; ++i)
		v[i] = lower_bound(all(vals), v[i]) - vals.begin();

	int ans = 0;
	for(int i = 0; i < n; ++i)
		if(v[i] % 2 != i % 2) ++ans;

	assert(ans % 2 == 0);
	cout << ans / 2 << '\n';

	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N;
    string s, t;
    cin >> N;
    cin >> s >> t;
    string ans;
    ans = s+t;
    REP(i,2*N){
        if(i % 2 == 0){
            ans[i] = s[i/2];
        }
        else ans[i] = t[i/2];
    }
    cout << ans << endl;
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define f           first
#define s          second
#define sz(x)       (int)x.size()
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rep0(a,n)  for(int i=0;i<n;i++)cin>>a[i]
#define si(x)       cin>>x
#define sii(x,y)    cin>>x>>y
#define siii(x,y,z) cin>>x>>y>>z
#define ahell   998244353
#define hell 1000000007
#define N 1000001
#define fl 1.0000000000
//#define mod 998244353
#define cntbit(a) __builtin_popcountl(a)
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
vector<int>adj[100005];
//int indeg[100005],lpath[100005];
int dp[2][100005];

void func(int v,int parent)
{

  int flg=0,t1=1,t2=1;
  for(auto x:adj[v])
  {
    if(x!=parent)
    {
        flg++;
        func(x,v);
    }
  }

for(auto x:adj[v])
{
    if(x!=parent)
    {
        t1*=(dp[1][x]);
        t1%=hell;
        t2*=(dp[0][x]+dp[1][x]);
        t2%=hell;
    }
}
dp[0][v]=t1;
dp[1][v]=t2;
return;
}

main()
{
  ios
int n,m,i;
int j;
int u,v,q;
int test=1;
//si(test);

while(test--)
{
  cin>>n;
  int x[n],y[n];
  for(i=0;i<n-1;i++)
    {
        cin>>x[i]>>y[i];
        adj[x[i]].push_back(y[i]);
        adj[y[i]].push_back(x[i]);

    }

    func(1,0);
    cout<<(dp[0][1]+dp[1][1])%hell;
}

}


Measured memory_bytes: 16356
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

void solve() {
	int n; cin >> n;
	cout << 180 * (n - 2) << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> n)solve();
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 256
local n,k,s=io.read("*n","*n","*n")
local t={}
for i=1,n do
    if i<=k then
        t[i]=s
    else
        if s==10^9 then
            t[i]=1
        else
            t[i]=s+1
        end
    end
end
print(table.concat(t," "))

Measured memory_bytes: 4600
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            long ans = 0;
            for (var i = 1; i <= N; i++)
            {
                if (i % 3 != 0 && i % 5 != 0) ans += i;
            }
            Console.WriteLine(ans);
        }
    }
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	int t = 0;

	int lo = 1000;
	for (int i = 0; i < N; ++i) {
		int s; cin >> s;
		t += s;
		if (s % 10 != 0 && s < lo) lo = s;
	}
	if (t % 10 != 0) {
		print(t);
	} else if (lo == 1000) {
		print(0);
	} else {
		print(t - lo);
	}
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define all(v) v.begin(),v.end()
#define fio() ios::sync_with_stdio(0);cin.tie(0);
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define fornn(i,a,n) for(ll i=a;i<=n;i++)
#define pb push_back
#define MAXN 100005LL
#define INF LONG_MAX
#define MOD 1e9+7LL
inline void solve(){
	ll n,k;
	cin>>n>>k;
	ll arr[n],dp[n];
	for(ll i=0;i<n;i++){
		cin>>arr[i];
	}
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(ll i=2;i<n;i++){
		dp[i]=INF;
		for(ll j=1;j<=k;j++){
			if((i-j)<0)
				break;
			dp[i]=min(abs(arr[i]-arr[i-j])+dp[i-j],dp[i]);
		}
	}
	cout<<dp[n-1];
}
int main(){
	fio();
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 5164
# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

n,m = map(int, input().split())
# n = int(input())
# a = list(map(int,input().split()))

ans0,ans1 = 0,0
ac = [False] * n
mis = [0] * n
if m>0:
    for i in range(m):
        p,s = input().split()
        p = int(p)-1
        if not ac[p] and s == 'WA':
            mis[p] += 1
        elif ac[p] == False and s == 'AC':
            ans0 += 1
            ac[p] = True

for i in range(n):
    if not ac[i]:
        mis[i] = 0
print(ans0, sum(mis))




Measured memory_bytes: 4596
fun main(args: Array<String>) {

    val (h,n) = readLine()!!.split(" ").map{ it.toInt() }

    val magicList = mutableListOf<Magic>()

    repeat(n) {
        val (a,b) = readLine()!!.split(" ").map{ it.toInt() }
        magicList.add(Magic(a,b))
    }


    val dp = IntArray (h+1)
    dp[0] = 0
    for (i in 1..h) {
        dp[i] = (0 until n).map{
            dp.getOrElse(i-magicList[it].atk){0} + magicList[it].mp
        }.min()!!
    }

    println(dp[h])

}

class Magic(val atk: Int, val mp:Int)


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


int main() {

    ll N, M;
    vl H;

    cin >> N >> M;
    ll h;
    for (int i = 0; i < N; i++) {
        cin >> h;
        H.push_back(h);
    }

    vl G(100010, 1);
    ll a, b;
    for (int i = 0; i < M; ++i) {
        cin >> a >> b;
        a--;
        b--;
        if (H[a] <= H[b]) {
            G[a] = 0;
        }
        if (H[a] >= H[b]) {
            G[b] = 0;
        }
    }

    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        if (G[i] == 1) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4992
#include<cstdio>
#include<math.h>
#include <stdlib.h>
#define M 100000
using namespace std;
 
 
int n, m,l, p = 0 , result = 0;
int x[100010];
 
int main(){
    scanf("%d %d",&n,&m);
    x[0] = 0;
    for (int i = 1; i < n; i++){
        scanf("%d", &x[i]);
        x[i] += x[i - 1];
    }
    while (m--){
        scanf("%d", &l);
        result += abs(x[p + l] - x[p]);
    result %= M;
        p += l;
    }
    printf("%d\n", result);
}

Measured memory_bytes: 1412
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
#include <set>
#include <map>
#include <unordered_map>
#include <cassert>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    int n;
    std::cin >> n;
    std::vector<int> v(n), o(100001,0), e(100001,0);
    rep(i,n){
        std::cin >> v[i];
        if(i%2) o[v[i]]++;
        else e[v[i]]++;
    }

    auto io = std::distance(o.begin(),std::max_element(o.begin(),o.end()));
    auto ie = std::distance(e.begin(),std::max_element(e.begin(),e.end()));

    std::sort(o.begin(),o.end());
    std::sort(e.begin(),e.end());
    // 全部同じとき
    if(o.back()==n/2 && e.back()==n/2 && v[0]==v[1]){
        std::cout << n/2 << "\n";
        return 0;
    }
    int ans = 0;
    if(io==ie){ //最大の値が同じとき
        ans = std::min(n-o[o.size()-1]-e[e.size()-2],n-o[o.size()-2]-e[e.size()-1]);
    }else{ //最大の値が違うとき
        ans = n - o.back() - e.back();
    }
    std::cout << ans << "\n";
    return 0;
}


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

int main(){
	int n;
	cin>>n;
	int i;
	for ( i = 0; i < n; i++ ){
	int a;
	int b;
	int c;
	cin>>a>>b>>c;
	int aa=a*a;
	int bb=b*b;
	int cc=c*c;
	if(aa==bb+cc){
	cout<<"YES"<<endl;}else
	if(bb==aa+cc){
	cout<<"YES"<<endl;}else
    if(cc==bb+aa){
	cout<<"YES"<<endl;}else
	{cout<<"NO"<<endl;}}
    return 0;
}


Measured memory_bytes: 1156
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	int H, W, N; cin >> H >> W >> N;
	vector<int> num(H * W);
	int cnt = 0;
	for (int i = 1; i <= N; i++) {
		int a; cin >> a;
		for (int j = 0; j < a; j++) {
			num[cnt] = i;
			cnt++;
		}
	}
	
	cnt = 0;
	vector<vector<int>> grid(H, vector<int>(W));
	for (int i = 0; i < H; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < W; j++) {
				grid[i][j] = num[cnt];
				cnt++;
			}
		}

		else {
			for (int j = W-1; j >= 0; j--) {
				grid[i][j] = num[cnt];
				cnt++;
			}
		}
	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << grid[i][j] << " ";
		}
		cout << endl;
	}

}


Measured memory_bytes: 3676
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;
  cin >> a >> b;
  cout << (b-a)*(b-a+1)/2-b << endl;
}

Measured memory_bytes: 256