akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

//! pascal's triangle
int pt[4005][4005];

void init()
{
    pt[0][0] = 1;
    for (int i = 0; i <= 4000; ++i) {
        for (int j = 0; j <= i; ++j) {
            pt[i+1][j] = (pt[i+1][j] + pt[i][j]) % MOD;
            pt[i+1][j+1] = (pt[i+1][j+1] + pt[i][j]) % MOD;
        }
    }
}

//! calculate xCy
int comb(int x, int y) 
{
    return pt[x][y];
}

//! combinations of split x balls into y groups allowing to have empty groups
int splitAux(int x, int y) 
{
    return comb(x+y-1, y-1);
}

//! combinations of split x balls into y groups under the condition that none of the group is empty
int split(int x, int y) 
{
    if (x == 0 && y == 0) {
        return 1;
    } else if (x < y || y < 1) {
        return 0;
    } else if (y == 1) {
        return 1;
    }

    return splitAux(x-y, y);
}


int main()
{
    init();
    int N, K;
    cin >> N >> K;
    int R = N-K;

    for (int i = 1; i <=K; ++i) {
        LL b = split(K, i);
        LL r = (split(R, i-1) + 2LL * split(R, i) + split(R, i+1))% MOD;
        cout << (b * r % MOD) << endl;
    }

    return 0;
}


Measured memory_bytes: 61440
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
using namespace std;
typedef long long ll;


int main(int argc, char *args[]) {
	ll N, i, ans = 0, tmp1 = 0, tmp2 = 0;
	cin >> N;
	int A[200000];
	for (i = 0; i < N; i++) {
		cin >> A[i];
		A[i] -= (i + 1);
	}
	sort(A, A + N);
	if (N % 2 == 1) {
		for (i = 0; i < N; i++)ans += abs(A[i] - A[(N - 1) / 2]);
	}else {
		for (i = 0; i < N; i++) {
			tmp1 += abs(A[i] - A[N / 2]);
			tmp2 += abs(A[i] - A[N / 2 - 1]);
		}
		ans = min(tmp1, tmp2);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
int A,B,C;
long long K;
int main()
{
	scanf("%d%d%d%lld",&A,&B,&C,&K);
	if (K%2==0) printf("%d\n",A-B);
	else printf("%d\n",B-A);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <map>
#include <bitset>

using namespace std;


int main() {
  int N, M;
  cin >> N >> M;
  
  int k[M];
  vector<vector<int>> s;
  for (int i = 0; i < M; i++) {
    cin >> k[i];
    vector<int> v;
    for (int j = 0; j < k[i]; j++) {
      int tmp;
      cin >> tmp;
      v.push_back(tmp);
    }
    s.push_back(v);
  }
  int p[M];
  for (int i = 0; i < M; i++) {
    cin >> p[i];
  }
  
  long successCases = 0;
  for (int bit = 0; bit < (1<<N) ; bit++) {
    bool success = true;
    for (int i = 0; i < M; i++) {

      // スイッチオンをカウント
      int onSwitch = 0;
      for (auto sw : s[i]) {
        //スイッチオンをチェック
        if (bit & (1<<sw-1)) {
          onSwitch++;
        }
      }
            
      if (onSwitch%2 != p[i]){
        success = false;
        break;
      }
    }
    if (success) successCases++;
  }

  cout << successCases << endl;
  return 0;
}


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


int main() {
    int N;
    cin >> N;
    vector<int> v;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        auto low = lower_bound(v.rbegin(), v.rend(), A);
        if (low == v.rbegin()) {
            v.push_back(A);
        } else {
            low --;
            *low = A;
        }
    }
    cout << v.size() << endl;
    return 0;
}

Measured memory_bytes: 892
#include <stdio.h>
//sekolah budi dimana tahun dibagi menjadi N semester
//n semester,k yang ingin dibanding dari smester k sampai n
// 
int main(){
int n,k;
scanf("%d %d",&n,&k);
int nilai[n];//input skor uas sesuai semester yg diminta
for(int i = 0;i<n;i++){
	scanf("%d",&nilai[i]);
}
	for(int j=0;j<n-k;j++){
		if(nilai[j]<nilai[j+k]){
			puts("Yes");
		}
		else{
			puts("No");
		}
	}
	return 0;
}

Measured memory_bytes: 2436
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(int i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

int main() {
    ll x; cin >> x;
    ll min = x/100;
    ll max = x/105 + 2;
    rep(i, 1000) {
        if(100*i <= x && x <= 105*i) {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}

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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	for(int i=0; i+1<s.size(); i++)
	{
		if(s[i]==s[i+1])
		{
			cout<<i+1<<" "<<i+2<< endl;
			return 0;
		}
	}
	for(int i=0 ; i+2<s.size(); i++)
	{
		if(s[i]==s[i+2])
		{
			cout<<i+1<<" "<<i+3<< endl;
			return 0;
		}
	}
	
	cout<<"-1"<<' '<<"-1"<< endl;
	return 0;
}


Measured memory_bytes: 512
// Copyright 2019 yaito3014
#include "bits/stdc++.h"
using namespace std;

int main() {
  cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);
  int H, N;
  cin >> H >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; ++i)cin >> A[i] >> B[i];
  constexpr int INF = 100000000;
  vector<vector<int>> dp(N + 1, vector<int>(H + 1, INF));
  for (int i = 0; i < N; ++i)dp[i][0] = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= H; ++j) {
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      dp[i + 1][j] = min(dp[i + 1][j], dp[i + 1][max(0,j - A[i])] + B[i]);
    }
  }
  cout << dp[N][H] << endl;
}

Measured memory_bytes: 39424
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define mp1(a,b,c) P1(a,P(b,c))
#define pque(a) priority_queue<a>
#define rpque(a) priority_queue<a,vector<a>,greater<a>>

const int INF=1000000000;
const int dre_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dre_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const int kaijou[10]={1,1,2,6,24,120,720,5040,40320,362880};

int main(){
	while(1){
		int n;
		int t=0;
		cin>>n; if(n==0)break;
		
		int d[12][12]; rep(i,12)rep(j,12){if(i==j)d[i][j]=0; else d[i][j]=INF;}
		
		rep(i,n){
			int a,b,c;
			scanf("%d%d%d",&a,&b,&c);
			d[a][b]=min(d[a][b],c);
			d[b][a]=min(d[b][a],c);
			t=max_3(t,a,b);
		}
		
		rep(k,12){
			rep(i,12){
				rep(j,12){
					d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
				}
			}
		}

		int MIN=INF;
		int k=0;
		rep(i,t+1){
			int sum=0;
			rep(j,t+1){
				sum+=d[i][j];
			}
			if(MIN>sum){
				MIN=sum;
				k=i;
			}
		}
		
		printf("%d %d\n",k,MIN);
	}
}
		

Measured memory_bytes: 1212
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;
 
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;
 
const int N = 2e5 + 2;
int n , m , k;
string s;
int a[N];
main(){
	 int A , B , AB;
	 cin >> A >> B >> AB;
	 ll ans = 1e14;
	 int X , Y;
	 cin >> X >> Y;
	 for(int i = 0;  i <= 300000; i += 2){
		int cost = max(X - i / 2 , 0ll ) * A + max(0ll , Y - i / 2) * B + i * AB;
		ans = min(ans , cost);
	 }
	 	
	 cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = mod * mod;
#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++)

int main() {
    int N;
    vector<int> A(100005);
    map<int, int> m;

    cin >> N;
    rep(i, N) cin >> A[i];
    
    rep(i, N) m[A[i]]++;

    rep(i, 100000) {
        if (m[i] % 2 == 0 && m[i] != 0) m[i] = 2;
        if (m[i] % 2 == 1) m[i] = 1;
    }

    int ans1 = 0, ans2 = 0;
    rep(i, 100000) {
        if (m[i] == 2) ans1 += m[i] / 2;
        else ans2 += m[i];
    }
    if (ans1 % 2 == 1) ans1--;

    cout << ans1 + ans2 << endl;
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
using namespace std;
int main() {
	int n, m;
	int a;
	long long a1;
	long long ans = 0;
	priority_queue<long long> que;
	cin >> n >> m;
	for (int b = 0; b < n; b++) {
		cin >> a;
		que.push(a);
	}
	for (int i = 0; i < m; i++) {
		a1 = que.top();
		a1 = a1 / 2;
		que.pop();
		que.push(a1);
	}
	for (int j = 0; j < n; j++) {
		ans += que.top();
		que.pop();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1400
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"
#include "string"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (n); i++)

int main() {
	int l, r;
	cin >> l >> r;
	if (r - l + 1 >= 2019) {
		cout << 0 << endl;
		return 0;
	}
	int ans = 2018;
	for (int i = l; i <= r - 1; ++i) {
		for (int j = i + 1; j <= r; ++j) {
			ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main() {
    int a, b, ans = 0;
    char op;
    while (1) {
        scanf("%d %c %d", &a, &op, &b);
        if (op == '+') {
            ans = a + b;
        } else if (op == '-') {
            ans = a - b;
        } else if (op == '*') {
            ans = a * b;
        } else if (op == '/') {
            ans = a / b;
        } else if (op == '?') {
            return 0;
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string s;
	cin >> s;
	reverse(s.begin(),s.end());
	ll cnt=0;
	string sub7, sub6, sub5;
	while(cnt<s.length()){
		if(cnt+7<=s.length()){
			sub7=s.substr(cnt,7);
		}
		if(cnt+6<=s.length()){
			sub6=s.substr(cnt,6);
		}
		if(cnt+5<=s.length()){
			sub5=s.substr(cnt,5);
		}
		
		if(sub7=="remaerd"){
			cnt+=7;
		}
		else if(sub6=="resare"){
			cnt+=6;
		}
		else if(sub5=="maerd" || sub5=="esare"){
			cnt+=5;
		}
		else{
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

int a[2010];
int b[2010];
int c[2010][2010];

int main(void){
   
   long long int  N,X,Min = 0;
   cin >> N >> X;
   
   for(int i = 0; i < N; i++){
       cin >> a[i];
       if(a[Min] > a[i]) Min = i;
   }
   
   for(int i = 0; i < N; i++){
       b[i] = a[(Min+i)%N];
   }
   
   c[0][0] = b[0];
   for(int i = 0; i < N; i++) c[0][i] = b[0];
   
   for(int i = 1; i < N; i++){
       c[i][0] = b[i];
       for(int j = 1; j < N; j++){
           c[i][j] = min(c[i-1][j-1],c[i][j-1]);
       }
   }
   
   long long int res = 2010*pow(10,9);
   //mahou
   for(long long int i = 0; i < N; i++){
       
       long long int tmp = 0;
       //
       for(int j = 0; j < N; j++){
           tmp += c[j][i];
       }
       
       tmp += X*i;
       res = min(res,tmp);
   }
   
   cout << res << endl;
   
   
}


Measured memory_bytes: 16000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int b=sc.nextInt();
		
		if(n>=13){
			System.out.println(b);
		}else if(n>=6){
			System.out.println(b/2);
		}else{
			System.out.println(0);
		}
	}}

Measured memory_bytes: 21588
n = int(input())
# for i in range(n):
#     m = int(input())
#     k = k*m
op = 1
p = list(map(int,input().split()))
p.sort()
for i in p:
    op = op*i

    if op > 10**18:
        print(-1)
        exit(0)

print(op)

Measured memory_bytes: 21644
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
using namespace std;

int main(){
    ll r;
    cin >> r;

    cout << 2*r*PI << endl;    

    return 0;
}

Measured memory_bytes: 3788
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
	char suit;
	int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int left, int mid, int right) {
	int i, j, k;
	int n1 = mid - left;
	int n2 = right - mid;
	for ( i = 0; i < n1; i++ ) L[i] = A[left + i];
	for ( i = 0; i < n2; i++ ) R[i] = A[mid + i];
	L[n1].value = R[n2].value = SENTINEL;
	i = j = 0;
	for ( k = left; k < right; k++ ){
		if ( L[i].value <= R[j].value) {
			A[k] = L[i++];
		} else {
			A[k] = R[j++];
		}
	}
}

void mergeSort(struct Card A[], int left, int right) {
	if ( left + 1 < right ) {
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

int partition(struct Card A[], int p, int r) {
	int i, j;
	struct Card t, x;
	x = A[r];
	i = p - 1;
	for ( j = p; j < r; j++ ){
		if ( A[j].value <= x.value ) {
			i++;
			t = A[i]; A[i] = A[j]; A[j] = t;
		}
	}
	t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;
	return i+1;
}

void quickSort(struct Card A[], int p, int r) {
	int q;
	if ( p < r ) {
		q = partition(A, p, r);
		quickSort(A, p, q - 1);
		quickSort(A, q + 1, r);
	}
}

int main() {
	int n, i, v;
	struct Card A[MAX], B[MAX];
	char s[10];
	int stable = 1;
	scanf("%d",&n);
	
	for (int i = 0; i < n; i++ ){
		scanf("%s %d", s, &v);
		A[i].suit = B[i].suit = s[0];
		A[i].value = B[i].value = v;
	}
	
	mergeSort(A, 0, n);
	quickSort(B, 0, n-1);
	
	for ( i = 0; i < n; i++ ){
		//比较归并排序与快速排序的结果
		if ( A[i].suit != B[i].suit ) stable = 0; 
	}
	
	if ( stable == 1) printf("Stable\n");
	else printf("Not stable\n");
	for ( int i = 0; i < n; i++ ) {
		printf("%c %d\n", B[i].suit, B[i].value);
	}
	
	return 0;
}


Measured memory_bytes: 5044
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	K = int(input())
	val = 0
	for i in range(10 ** 6 + 1):
		val = (val * 10 + 7) % K
		if val % K == 0:
			print(i + 1)
			return

	print(-1)


if __name__ == '__main__':
	main()

Measured memory_bytes: 65888
from collections import deque
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
adjacent_list = [[] for i in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
ans = [-1 for i in range(n+1)]
def bfs():
    #start at 1
    que = deque([1])
    while que:
        node = que.popleft()
        for i in adjacent_list[node]:
            if ans[i] == -1:
                que.append(i)
                ans[i] = node
bfs()
print("Yes")
for i in range(2,n+1):
    print(ans[i])


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

int main()
{
  int arr[3],count=0;
  for(int i=0;i<3;i++)
    cin>>arr[i];
  map<int,int> mp;
  for(int i=0;i<3;i++)
    mp[arr[i]]++;
  for(auto it=mp.begin();it!=mp.end();it++)
  {
    if(it->first==5)
    {
      if(it->second==2)
        count=1;
      else
        count=0;
    }
   else
   {
     if(it->first==7)
     {
       if(it->second==1)
         count=1;
       else
         count=0;
     }
     else
       count=0;
   }
  }
  if(count==1)
    cout<<"YES";
  else
    cout<<"NO";
  return 0;
}
    
    
    
    
    
    
    

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

bool kaibun(string &s) {
  string comp = s;
  reverse(s.begin(), s.end());
  if(comp == s) return true;
  else return false;
}
 
int main() {
  string s;
  cin >> s;
  string S;
  S = s.substr(0, (s.size() - 1) / 2);
  if(kaibun(s) && kaibun(S)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

  

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

int main()
{

string S;

cin>>S;
   
if(S=="SUN") {
cout <<7<<endl;
 }
if(S=="MON") {
cout <<6<<endl;
 }
if(S=="TUE") {
cout <<5<<endl;
 }    
if(S=="WED") {
cout <<4<<endl;
 } 
if(S=="THU") {
cout <<3<<endl;
 }    
if(S=="FRI") {
cout <<2<<endl;
 }    
if(S=="SAT") {
cout <<1<<endl;
 }    
    
}    
    
   

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    bool ok = true;
    if(s.size()%2==1) ok = false;
    rep(i,0,s.size()){
        if(i%2==0 && s[i] != 'h') ok = false;
        if(i%2==1 && s[i] != 'i') ok = false;
        
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
typedef long long ll;
long long mod = 1000000007;
const int INF = 1001001001;

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

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

int main() {
	int h[10],max;
	for (int i = 0; i < 10; i++)
		cin >> h[i];
	
	for (int lp = 0; lp < 3; lp++) {
		max = -1;
		for (int lp2 = 0; lp2 < 10; lp2++) {
			if (max == -1)
				max = lp2;
			else if (h[max] < h[lp2])
				max = lp2;
		}
		cout << h[max]<<endl;
		h[max] = -1;
	}
	return 0;
}


Measured memory_bytes: 3076
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " << a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll n;
	cin >> n;
	ll i = 1;
	if (n == 1 || n == 2) {
		cout << 4 << endl;
		return 0;
	}
	while (n != 4)
	{
		i++;
		if (n % 2 == 0)
			n = n / 2;
		else
			n = (3 * n) + 1;
	}
	cout << i + 3 << endl;
	return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>

template <class Integer>
auto boost_irange(Integer last) { return boost::irange(static_cast<Integer>(0), last); }
template <class Integer>
auto boost_irange(Integer first, Integer last) { return boost::irange(first, last); }

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { cout << '\n'; }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy operator<<(T&& val)
    {
        cout << val;
        return {};
    }
};

int main()
{
    input in;
    output out;

    int N, M;
    in >> N, M;
    std::vector<std::pair<int, int>> arbeit;
    arbeit.reserve(N);
    for (int i = 0; i < N; ++i) {
        std::pair<int, int> x;
        in >> x.first, x.second;
        if (x.first <= M) {
            arbeit.push_back(x);
        }
    }

    auto cmp = [](auto& x, auto& y) { return x.first > y.first; };
    std::sort(arbeit.begin(), arbeit.end(), cmp);

    std::priority_queue<int> q;
    int res = 0;
    for (int i : boost_irange(1, M + 1)) {
        while (!arbeit.empty() && arbeit.back().first <= i) {
            q.push(arbeit.back().second);
            arbeit.pop_back();
        }
        if (!(q.empty())) {
            res += q.top();
            q.pop();
        }
    }

    out << res;

    return 0;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF INT_MAX/3
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

#define MAX_N 10000
int G[MAX_N][MAX_N];
int MIN_COSTS[MAX_N];

int main() {
  int n;
  cin >> n;
  REP(i, n) {
    REP(j, n) {
      G[i][j] = INT_MAX;
    }
    MIN_COSTS[i] = INT_MAX;
  }
  int u, k;
  int v, c;
  REP(i, n) {
    cin >> u >> k;
    REP(j, k) {
      cin >> v >> c;
      G[u][v] = c;
    }
  }

  priority_queue<P> q;
  int position;
  int new_cost;
  q.push(P(0, 0));
  while (q.size() != 0){
    position = q.top().first;
    MIN_COSTS[position] = q.top().second;
    q.pop();
    REP(i, n) {
      if (G[position][i] != INT_MAX) {
        new_cost = MIN_COSTS[position] + G[position][i];
        if (new_cost < MIN_COSTS[i]) {
          MIN_COSTS[i] = new_cost;
          q.push(P(i, new_cost));
        }
      }
    }
  }

  REP(i, n) {
    cout << i << ' ' << MIN_COSTS[i] << endl;
  }

  return 0;
}



Measured memory_bytes: 3496
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

pll operator+(pll a,pll b){
  return pll(a.first+b.first,a.second+b.second);
}
pll operator-(pll a,pll b){
  return pll(a.first-b.first,a.second-b.second);
}
pll operator*(ll a,pll b){
  return pll(b.first*a,b.second*a);
}
const ll INF=(1LL<<60);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
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;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


int main(){
  cout<<setprecision(1000);
  ll N;
  cin>>N;
  vector<string> A(N);
  REP(N){
    cin>>A[i];
  }
  vector<ll> B;
  for (auto &&i : A)
  {
    string::iterator itr=find(i.begin(),i.end(),'.');
    string s;
    copy(i.begin(),itr,back_inserter(s));
    ll num=0;
    if(itr!=i.end()){
      itr=next(itr);
      for (num=0;itr!=i.end();++num,++itr)
      {
        s.push_back(*itr);
      }
    }
    for(;num<9;++num){
      s.push_back('0');
    }
    B.push_back(stoll(s));
  }
  vector<vector<ll>> num(21,vector<ll>(21));
  for (auto i : B)
  {
    ll two=0,five=0;
    while(i%2==0){
      i/=2;
      ++two;
    }
    while(i%5==0){
      i/=5;
      ++five;
    }
    two=min(20LL,two);five=min(20LL,five);
    ++num[20-two][20-five];
  }
  vector<vector<ll>> anum(num);
  For(i,21){
    For(j,21-1){
      anum[i][j+1]+=anum[i][j];
    }
  }
  For(j,21){
    For(i,21-1){
      anum[i+1][j]+=anum[i][j];
    }
  }
  ll ans=0;
  For(i,21){
    For(j,21){
      ll two=20-i,five=20-j;
      ll ntwo=max(0LL,18-two),nfive=max(0LL,18-five);
      ll ii=20-ntwo,jj=20-nfive;
      ll n=num[i][j];
      ll an=anum[ii][jj];
      if(ntwo<=two&&nfive<=five){
        an-=n;
        ans+=n*(n-1);
      }
      ans+=an*n;
    }
  }
  cout<<ans/2<<endl;
  return 0;
}


Measured memory_bytes: 11604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n, k;
  cin>>n>>k;
  vector<ll>a(n), dp(n,LONG_LONG_MAX);
  for(ll i=0;i<n;i++) cin>>a[i];
  dp[0]=0;
  for(ll i=1;i<=k;i++)
    dp[i] = abs(dp[i] - dp[0]);
  //cout<<dp[0]<<" "<<dp[1]<<" ";
  for(ll i=1;i<n;i++)
  {
    for(ll j=0;j<k;j++)
    {
      if(i-j-1 < 0)
        break;
      dp[i] = min((dp[i-j-1] + abs(a[i-j-1] - a[i])), dp[i]);
    }
    //cout<<dp[i]<<" ";
  }
  cout<<dp[n-1];
  return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int less(int a,int b){
  if(a<b){
    return(a);

  }
  return(b);
}
int main(void){
  int a,b,c,na,nb,sum=0,zz;
  scanf("%d%d%d%d%d",&a,&b,&c,&na,&nb);
  if((a+b)<(c*2)){
    printf("%d",na*a+nb*b);
    return(0);
  }
  zz=less(na,nb);
  sum+=c*zz*2;
  na-=zz;nb-=zz;
  if(na){
    if(a>(2*c)){
      sum+=na*2*c;
    }else{
      sum+=na*a;
    }
  }
  if(nb){
    if(b>(2*c)){
      sum+=nb*2*c;
    }else{
      sum+=nb*b;
    }
  }
  printf("%d\n",sum);
  return(0);
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e12;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll h, n;
  cin >> h >> n;
  vector<P> p(n);
  rep(i, n) {
    cin >> p[i].first >> p[i].second;
  }

  vector<ll> dp(h+1, INF); // dp[i] .. minimum cost to decrease i.
  dp[0] = 0; // cost is 0 to decrease 0

  rep(i, h) {
    rep(j, n) {
      ll a = p[j].first;
      ll b = p[j].second;
      // Here, add (a,b) to dp[i]

      ll ni = i + a;
      if (ni > h) { ni = h; }
      dp[ni] = min(dp[ni], dp[i] + b);
    }
  }
  cout << dp[h] << endl;
}


Measured memory_bytes: 384
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int H = scn.nextInt();
        int N = scn.nextInt();
        
        int [] A = new int [N];
        int sum = 0;
        
        for(int i=0;i<N;i++){
            A[i] = scn.nextInt();
            sum += A[i];             
        }
        
        if(sum>=H){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
    }
}

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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    string s;
    cin >> n >> m >> s;
    n++;
    int _=0;
    for(int i=0; i<n; i++){
        if(s[i] == '1') _++;
        else _ = 0;
        if(_ == m) return cout << -1, 0;
    }
    int pre[n+1], dp[n+1];
    for(int i=0; i<n; i++){
        int j = i;
        while(s[j]=='1') j++;
        for(int t=i; t<=j; t++)
            pre[t] = j;
    }
    memset(dp, -1, sizeof dp);
    dp[0]=0;
    for(int i=1; i<n; i++)
        if(s[i] == '0')
            dp[i] = 1+dp[pre[max(0, i-m)]];
    vector<int> res;
    for(int i=n-1; i>0;){
        int p = max(0, i-m);
        while(dp[p]==-1) p++;
        res.push_back(i-p);
        i = p;
    }
    for(int i=dp[n-1]-1; i>=0; i--)
        cout << res[i]  << " ";
    return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;
typedef long double Double;

int n;
int a[100000], b[100000], c[100000], ord[100000], tmp[100000];

void re(int *a) {
    forn(i, n) tmp[i] = a[ord[i]];
    forn(i, n) a[i] = tmp[i];
}

inline bool cmpX(const int &lhs, const int &rhs) {
    return -a[lhs] * b[rhs] < -a[rhs] * b[lhs];
}

inline bool cmpY(const int &lhs, const int &rhs) {
    return -b[lhs] * a[rhs] < -b[rhs] * a[lhs];
}

pair<Double, int> p[100000];

int fen[100000];

void fenInc(int pos) {
    for (; pos < n; pos |= pos + 1) {
        ++fen[pos];
    }
}

int fenGet(int pos) {
    int res = 0;
    for (; pos >= 0; pos = (pos & (pos + 1)) - 1) {
        res += fen[pos];
    }
    return res;
}

int main() {
    scanf("%d", &n);
    forn(i, n) {
        scanf("%d%d%d", a + i, b + i, c + i);
        c[i] *= -1;
        if (b[i] < 0) {
            a[i] *= -1;
            b[i] *= -1;
            c[i] *= -1;
        }
    }

    forn(i, n) ord[i] = i;
    sort(ord, ord + n, cmpX);
    re(a);
    re(b);
    re(c);
    Double lo = -1e18, hi = 1e18, mid;
    forn(_, 200) {
        mid = (lo + hi) / 2;
        forn(i, n) p[i] = mp((-c[i] - a[i] * mid) / b[i], i);
        sort(p, p + n);
        LL cnt = 0;
        memset(fen, 0, sizeof fen);
        forn(i, n) {
            cnt += fenGet(p[i].second);
            fenInc(p[i].second);
        }
        if (cnt < (n * (n - 1) / 2 + 1) / 2) {
            lo = mid;
        } else {
            hi = mid;
        }
    }
    printf("%.15f ", (double) lo);

    forn(i, n) {
        if (a[i] < 0) {
            a[i] *= -1;
            b[i] *= -1;
            c[i] *= -1;
        }
    }
    forn(i, n) ord[i] = i;
    sort(ord, ord + n, cmpY);
    re(a);
    re(b);
    re(c);
    lo = -1e18, hi = 1e18;
    forn(_, 200) {
        mid = (lo + hi) / 2;
        forn(i, n) p[i] = mp((-c[i] - b[i] * mid) / a[i], i);
        sort(p, p + n);
        LL cnt = 0;
        memset(fen, 0, sizeof fen);
        forn(i, n) {
            cnt += fenGet(p[i].second);
            fenInc(p[i].second);
        }
        if (cnt < (n * (n - 1) / 2 + 1) / 2) {
            lo = mid;
        } else {
            hi = mid;
        }
    }
    printf("%.15f\n", (double) lo);
    return 0;
}


Measured memory_bytes: 4988
#include <iostream>
#include <limits.h>

using namespace std;


struct p_tag {
	int num;
	double time;
} P[3][8], tmp;

void sort()
{
	int i, j, k;
	for( i=0; i<3; i++ ){
		for( j=0; j<8; j++ ){
			for( k=j+1; k<8; k++ ){
				if( P[i][j].time > P[i][k].time ){
					tmp = P[i][j];
					P[i][j] = P[i][k];
					P[i][k] = tmp;
				}
			}
		}
	}

	return;
}


int main(void)
{
	int i, j, min;

	for( i=0; i<3; i++ )
		for( j=0; j<8; j++ )
			cin >> P[i][j].num >> P[i][j].time;

	sort();

	for( i=0; i<3; i++ )
		for( j=0; j<2; j++ )
			printf("%d %.2f\n", P[i][j].num, P[i][j].time );


	for( i=0; i<2; i++ ){
		min = 0;
		for( j=1; j<3; j++ )
			if( P[min][2].time > P[j][2].time )
				min = j;
		printf("%d %.2f\n", P[min][2].num, P[min][2].time );
		P[min][2].time = INT_MAX;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define END return 0
typedef int64_t ll;
const int mod7 = 1e9 + 7;
const int mod9 = 1e9 + 9;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a % b) : abs(a);}
template<typename T> T lcm(T a, T b) {return a / gcd(a, b) * b;}
template<typename T> bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template<typename T> bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) {fill((T*)array, (T*)(array+N), val);}

int main() {
    ll x;
    cin >> x;
    for(ll a = 1; a < 1e5; a++)
        for(ll b = -1e3; b < 1e3; b++)
            if(a*a*a*a*a - b*b*b*b*b == x) {cout << a << ' ' << b << endl; END;}
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define MM 1e9

int N;

void input() {
    cin >> N;
}

void solve(){
    int result = 180 * (N-2);
    cout << result << endl;
}

int main() {
    input();
    solve();
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll n = in(), k = in();
	cout << (k <= (n + 1) / 2 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>

using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<int> a(n);
    bool approve = true;

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

    for (int i = 0; i < n; i++)
    {
        if(a[i] % 2 ==0){
            if(a[i] % 3 != 0 && a[i] % 5 != 0){
                approve = false;
            }
        }
        
    }

    if (approve)
    {
        cout << "APPROVED" << endl;
    }
    else
    {
        cout << "DENIED" << endl;
    }

    return 0;
}


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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int n;
    cin >> n;
    int a1[n],a2[n];
    
    int num1 = 0;
    for(int i=0;i<n;i++){
        int t;
        cin >> t;
        num1 += t;
        a1[i] = num1;
    }
    
    int num2 = 0;
    for(int i=0;i<n;i++){
        int t;
        cin >> t;
        num2 += t;
        a2[i] = num2;
    }
    
    int max1 = a1[0] + a2[n-1];
    int ans = 0;
    for(int i=1;i<n;i++){
        ans = a1[i] + a2[n-1] - a2[i-1];
        if(max1<ans) max1 = ans;
    }
    COUT(max1);
    return 0;
}    

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define maxn 1000010
using namespace std;
char s[maxn];
struct node{
	int l,r;
}a[maxn];
int tot;
int cmp(node a,node b){
	return a.l-a.r>b.l-b.r;
}
int main(){
	int n,i,j,l,r,ln,rn;
	ln=rn=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		l=r=0;
		scanf("%s",s+1);
		for(j=1;s[j];j++){
			if(s[j]=='(')l++;
			else if(s[j]==')'){
				if(l)l--;
				else r++;
			}
		}
		if(l&&!r)ln+=l;
		else if(!l&&r)rn+=r;
		else if(l&&r) a[++tot]=(node){l,r};
	}
	sort(a+1,a+1+tot,cmp);
	for(i=1;i<=tot;i++)
		if(ln<a[i].r)return printf("No\n"),0;
		else ln-=a[i].r,ln+=a[i].l;
	if(ln!=rn)return printf("No\n"),0;
	printf("Yes\n");
	return 0;
}

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

using namespace std;

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

  long long ans = -1000000000;
  long long minv = r[0];

  for (int i = 1; i < n; i++) {
    ans = max(r[i] - minv, ans);
    minv = min(r[i], minv);
  }

  cout << ans << endl;
}



Measured memory_bytes: 4668
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

N, A, B, C, D = map(int, input().split())
diff = B - A
if diff < 0:
    diff *= -1

def can_reach(k, M):
    if k < 0:
        return False
    mx = M * D
    mn = M * C
    m = (M - k) // 2

    mx -= (D + C) * m
    mn -= (D + C) * m

    # print("diff, M, k, mn, mx = ", diff, M, k, mn, mx)
    return mn <= diff <= mx

flag = False
if N % 2 == 1:
    for k in range(0, N+1, 2):
        if can_reach(k, N - 1):
            flag = True
else:
    for k in range(1, N+1, 2):
        if can_reach(k, N - 1):
            flag = True
if flag:
    print("YES")
else:
    print("NO")



Measured memory_bytes: 5404
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

using namespace std;

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

int main(){
  int n;
  cin >> n;
  
  string s;
  map<string, int> d;
  rep(i, n) {
    cin >> s;
    sort(s.begin(), s.end());
    ++d[s];
  }
  
  ll ans = 0;
  for (auto p : d) {
    ans += (ll)p.second*(p.second-1)/2;
  }
  cout << ans << endl;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

long double radius[8];

int main(void){
	int n;
	cin >> n;

	set<vector<int>> visited;
	for (int i = 0; i < n; ++i) cin >> radius[i];
	sort(radius,radius+n);

	long double ans=0.0;

	do{
		long double theta[8];
		for(int last=3;last<=n;++last){
			vector<int> cur;
			for(int i=0;i<last;++i) cur.pb(radius[i]);
			if(visited.find(cur)!=visited.end()) continue;
			visited.insert(cur);reverse(cur.begin(),cur.end());visited.insert(cur);

			long double l=0.0,r=pi;
			for(int loop=0;loop<200;++loop){
				long double m=(l+r)/2.0;
				theta[0]=m;
				for(int i=1;i<last;++i){
					long double tmp=1.0*(radius[0]*radius[1])/(radius[(i)%last]*radius[(i+1)%last])*cos(theta[0]);
					if(tmp>1.0+eps) tmp=1.0;
					if(tmp+eps<-1.0) tmp=-1.0;
					theta[i]=acos(tmp);
					if(theta[i]<-eps) theta[i]+=2.0*pi;
				}

				long double sum=0.0;
				for(int i=0;i<last;++i) sum+=theta[i];
				if(sum<2.0*pi)
					l=m;
				else
					r=m;
			}

			long double res=0.0;
			long double sum=0.0;
			for(int i=0;i<last;++i){
				 res+=(radius[(i)%last]*radius[(i+1)%last])*sin(theta[i])/2.0;
				 sum+=theta[i];
			}
			if(abs(sum-2*pi) < eps) ans=max(ans,res);
		}
	}while(next_permutation(radius,radius+n));

	cout.precision(9);
	cout << fixed <<  ans << endl;
	return 0;
}

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


int main()
{
   string s;
   cin>>s;
   ll v[200010];
   v[0]=1;
   ll n =0;
   ll x =1,counter =0;
   for(ll i= s.length()-1;i>=0;i--){

    n=(n+x*(s[i]-'0')%2019)%2019;
    x=x*10%2019;
    counter+=v[n];
    v[n]++;


   }

  cout<<counter;

    return 0;
}


Measured memory_bytes: 3760
x = int(input())

a = 1
diff = 1
while True:
    res = a ** 5 - (a - diff) ** 5
    if res == x:
        print(a, a - diff)
        break
    if res < x:
        a += 1
        continue
    while True:
        diff += 1
        if x % diff == 0:
            break
    a = (diff + 1) // 2

Measured memory_bytes: 9136
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] T = sc.next().toCharArray();
    int ans = 0;
    int now = 0;
    char[] atcg = {'A', 'T', 'C', 'G'};
    for(int i = 0; i < T.length; i++){
      boolean isATCG = false;
      for(int j = 0; j < atcg.length; j++) {
        if(T[i] == atcg[j]) {
          isATCG = true;
        }
      }
      if(!isATCG) {
        now = 0;
      }else {
        now++;
        ans = Math.max(ans, now);
      }
    }
    System.out.println(ans);
  }
}
        
        


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

using namespace std;

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, x;

    string s;

    cin >> n;

    pair <pair<string,int>, int> p[n];

    for (int i = 0; i < n; i++) {

        cin >> s >> x;

        p[i] = make_pair(make_pair(s, -x), i);
    }

    sort (p, p+n);

    for (int i = 0; i < n; i++) {

        cout << p[i].second+1 << endl;
    }

    return 0;
}


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

int find(int X,vector<int> &P){
  if(P.at(X)<0){
    return X;
  }
  return P.at(X)=find(P.at(X),P);
}

void unite(int X,int Y,vector<int> &P){
  X=find(X,P);
  Y=find(Y,P);
  if(X==Y){
    return;
  }
  P.at(Y)+=P.at(X);
  P.at(X)=Y;
}
  
int main(){
  int N,M;
  cin >> N >> M;
  vector<int> P(N,-1);
  for(int i=0;i<M;i++){
    int A,B;
    cin >> A >> B;
    unite(A-1,B-1,P);
  }
  sort(P.begin(),P.end());
  cout << (-1)*P.at(0) << endl;
}
    

Measured memory_bytes: 4024