akhauriyash/Code-Regression huggingface dataset:
/*
 * atcoder/abc089/b.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  int n, m;
  cin >> n >> m;
  if (n <= 9 and m <= 9) cout << n*m << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define PI 3.141592653589
using namespace std;

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

  for(int i=1; i<=9; i++){
    for(int j=1; j<=9; j++){
      if(i*j == n){
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";

}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <bitset>
#include <complex>
using namespace std;
 
const double EPS = 1e-9;
const double PI = 3.14159265359;
 
typedef complex<double> P;

const int k[8] = {0, 2, 6, 4, 1, 3, 7, 5};
const int c[8] = {1, 2, 1, 2, 1, 4, 1, 4};

int rest(int *p, int i){
	int v = 0;
	for(int j = 0; j < 8; j++){
		int r = p[j] - c[(j+k[i])%8];
		if(r > 0){
			v+=r;
		}
	}

	return v;
}

int main(){
 
	int p[8];
	while(cin >> p[0]){
		for(int i = 1; i < 8; i++){
			cin >> p[i];
		}
		int m = rest(p, 0);
		int im = 0;
		for(int i = 1; i < 8; i++){
			if(m > rest(p, i)){
				m = rest(p, i);
				im = i;
			}
		}

		bool f = true;

		for(int i = 0; i < 8; i++){
			if(!f){
				cout << ' ';
			}
			f = false;
			cout << c[(i+k[im])%8];
		}
		cout << endl;

	}

    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 3005
#define mod 998244353

int n, m, k;
ll a, b, c, T;
ll s[maxn];
priority_queue<ll> pq;

int main()
{
    cin >> n >> m >> k >> a >> b >> c >> T;
    ll ans = 0;
    for (int i = 1; i <= m; i++)
    {
        scanf("%lld", &s[i]);
        s[i]--;
    }
    for (int i = 1; i <= m - 1; i++)
    {
        ll tl = s[i] * b;
        if (tl > T)
            continue;
        ll add = (T - tl) / a;
        ans += min(s[i] + add, s[i + 1] - 1) - (s[i] - 1);
        ll now = s[i] + add + 1;
        for (int j = 0; j < k - m; j++)
        {
            if (now >= s[i + 1])
                break;
            tl = s[i] * b + (now - s[i]) * c;
            if (tl > T)
                break;
            add = (T - tl) / a;
            ll r = min(s[i + 1] - 1, now + add);
            pq.push(r - now + 1);
            now = r + 1;
        }
    }
    if ((n - 1) * b <= T)
        ans++;
    int left = k - m;
    while (!pq.empty() && left--)
    {
        ans += pq.top();
        pq.pop();
    }
    printf("%lld\n", ans - 1);
    return 0;
}



Measured memory_bytes: 7048
<?php
$strs = array_count_values(str_split(trim(fgets(STDIN)))) + ['N' => 0, 'S' => 0, 'W' => 0, 'E' => 0];

if (($strs['N'] != 0 && $strs['S'] == 0)
    || ($strs['S'] != 0 && $strs['N'] == 0)
    || ($strs['E'] != 0 && $strs['W'] == 0)
    || ($strs['W'] != 0 && $strs['E'] == 0)
) {
    echo 'No';
} else {
    echo 'Yes';
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define show(x) cerr << #x << " " << x << endl

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

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

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

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = 1000000000 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  　　┓　　　┏
//  　＊┗┓　┏┛
//  　　　┫　┣　＊
//  　┏┳┻━┻┳┓
//  　┗┫　　　┣┛
//  ＊　┣　　━┃　＊        Merry Christmas!!
//  　┏┛　　〃┃
//  　┃●　　　┣━┳┓
//  　┗┻┳━━┛　┣┛
//  　＊　┃┏┓┣┓┃
//WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

string s;
ll a[30];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    FILE *stream1;
    //FILE *stream2;
    stream1 = freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt", "r", stdin);
    //stream2 = freopen("out.txt", "w", stdout);
    if (stream1 == nullptr) return 0;
    //if (stream2 == NULL) return 0;
#endif
    // 部分文字列の両端が一致すると後々反転したときに同じ文字列が出来上がってしまう
    // 従って、そういうものの個数を数えて全通りから引く(これは回分も数えてくれるので実装は難しくない)
    //
    // s[i, j] を反転するとき s[i] == s[j] ならば s[i + 1, j - 1] だけを反転しても同じ文字列になる
    // i がわかっているとき、このような現象が起こるのは s[i] == s[j] となる j のときのみ
    // s[i] == s[j] となるような組み合わせの個数を求めると良い
    // s[i] == s[j] となる部分文字列の集合に回分も必ず含まれるので回分も数え上げることになる(ここが重要)
    // 今回数えるのは回分ではなく回分と似た性質を持つ制約の弱い文字列なので組み合わせだけを用いて実装可能
    cin >> s;
    ll n = (ll)s.size();
    for (int i = 0; i < n; i++) {
        a[s[i] - 'a']++;
    }
    ll sum = n * (n + 1) / 2L - n;
    for (long long i : a) {
        if (i < 2) continue;
        sum -= i * (i - 1) / 2L;
    }
    cout << sum + 1L << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
constexpr int P = 1E9 + 7, N = 200;
int power(int base, int exp) {
    int result = 1;
    while (exp > 0) {
        if (exp & 1)
            result = 1LL * result * base % P;
        base = 1LL * base * base % P;
        exp >>= 1;
    }
    return result;
}
int main() {
    array<int, 200> factorial, inv_factorial;
    factorial[0] = 1;
    for (int i = 1; i < N; ++i)
        factorial[i] = 1LL * factorial[i - 1] * i % P;
    inv_factorial[N - 1] = power(factorial[N - 1], P - 2);
    for (int i = N - 1; i >= 1; --i)
        inv_factorial[i - 1] = 1LL * inv_factorial[i] * i % P;
    auto binom = [&](int n, int m) {return 1LL * factorial[n] * inv_factorial[m] % P * inv_factorial[n - m] % P;};
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    string s;
    cin >> n >> k >> s;
    vector<int> f;
    int ans = 0;
    auto work = [&]() {
        int len = n - (int)f.size() + 1;
        int bl = (int)f.size() + 1;
        vector<bool> book(k);
        vector<int> r(f.size());
        for (int i = 0, j = 0; i < (int)f.size(); ++i) {
            len -= max(1, 2 * f[i] - 3);
            bl += max(1, 2 * f[i] - 3);
            while (j < k && s[j] != 'r')
                ++j;
            if (j == k)
                return;
            book[j] = true;
            r[i] = j++;
        }
        for (int i = 0, j = 0; i < (int)f.size(); ++i) {
            if (f[i] == 1)
                continue;
            bl += 2;
            j = max(j, r[i]);
            while (j < k && (s[j] != 'b' || book[j]))
                ++j;
            if (j == k)
                return;
            book[j] = true;
            r[i] = j++;
        }
        for (int i = 0, j = 0; i < (int)f.size(); ++i) {
            for (int l = 0; l < f[i] - 2; ++l) {
                j = max(j, r[i]);
                while (j < k && book[j])
                    ++j;
                if (j == k)
                    return;
                r[i] = j++;
            }
        }
        int result = factorial[f.size()];
        for (int i = 0; i < (int)f.size(); ) {
            int j = i;
            while (j < (int)f.size() && f[i] == f[j])
                ++j;
            result = 1LL * result * inv_factorial[j - i] % P;
            i = j;
        }
        result = 1LL * result * binom(len + bl - 1, bl - 1) % P;
        ans = (ans + result) % P;
    };
    function<void(int, int)> dfs = [&](int sum, int last) {
        work();
        for (int i = 1; i <= last && max(2, 2 * i - 2) <= sum; ++i) {
            f.push_back(i);
            dfs(sum - max(2, 2 * i - 2), i);
            f.pop_back();
        }
    };
    dfs(n + 1, n + 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  ALDS1_7_A
//
//  Created by ptyuan on 2018/11/3.
//  Copyright © 2018 YY. All rights reserved.
//

#include <iostream>
#include <cstdio>
using namespace std;

struct Node {
    int parent = - 1;
    int left;
    int right;
};

const int kCount = 100000;
const int kNil = -1;
Node tree[kCount];
int D[kCount];
int n = 0;

void depth(int u, int p) {
    D[u] = p;
    if (tree[u].right != kNil) { depth(tree[u].right, p); }
    if (tree[u].left != kNil) { depth(tree[u].left, p + 1); }
}

void print(int u) {
    cout << "node " << u << ": ";
    cout << "parent = " << tree[u].parent << ", ";
    cout << "depth = " << D[u] << ", ";
    
    if (kNil == tree[u].parent) {
        cout << "root, ";
    } else if (kNil == tree[u].left) {
        cout << "leaf, ";
    } else {
        cout << "internal node, ";
    }
    
    cout << "[";
    int c = 0;
    for (int i = 0, c = tree[u].left; c != kNil; c = tree[c].right, i++) {
        if (i > 0) cout << ", ";
        cout << c;
    }
    
    cout << "]" << endl;
}

int main(int argc, const char * argv[]) {
    
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        Node temp;
        temp.parent = temp.left = temp.right = kNil;
        tree[i] = temp;
    }
    int ll = 0;
    for (int i = 0; i < n; ++i) {
        int nodeIndex = kNil;
        scanf("%d", &nodeIndex);
        
        int depth = 0;
        scanf("%d", &depth);
        int parentNode = nodeIndex;
        for (int j = 0; j < depth; j++) {
            int subNodeIndex = kNil;
            scanf("%d", &subNodeIndex);
            
            if (0 == j) {
                tree[parentNode].left = subNodeIndex;
            } else {
                tree[ll].right = subNodeIndex;
            }
            ll = subNodeIndex;
            tree[subNodeIndex].parent = parentNode;
        }
    }
    
    int root = kNil;
    for (int i = 0; i < n; i++) {
        if (tree[i].parent == kNil) {
            root = i;
        }
    }
    
    depth(root, 0);
    
    for (int i = 0; i < n; i++) {
        print(i);
    }
    return 0;
}



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

#define pb push_back
#define mp make_pair
typedef long long int ll;
#define mod 1000000007


void solve()
{
	ll n;
	cin >> n;
	cout << (n * (n + 1)) / 2;
}



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

#ifndef ONLINE_JUDGE
	freopen("1input.txt", "r", stdin);
	freopen("1output.txt", "w", stdout);
#endif

	int t = 1;
	// cin >> t;

	while (t--)
	{
		solve();
		cout << "\n";
	}

	return 0;
}

Measured memory_bytes: 3640
import numpy as np

N,M,C = map(int, input().split())
B = np.array(list(map(int, input().split())))
As = [np.array(list(map(int, input().split()))) for _ in range(N)]

ans = 0
for A in As:
    if np.dot(B, A) + C > 0:
        ans += 1
print(ans)

Measured memory_bytes: 27008
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

S = input()

first = S[0]
for s in S[1:]:
  if first == s:
    print('Bad')
    exit()
  first = s

print('Good')




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

public class Main 

{ 

	 static FastReader sc=new FastReader(); 
	 
	  public static void main(String[] args) 
    {
//			int t = i(); 
//	        while (t-- > 0) 
//			{ 
		  long x=Math.abs(l());
		    long k=l();
		    long d=l();
		    long div=x/d;
		    if(k<div) {
		    	x-=k*d;
		    	System.out.println(x);
		    }
		    if(k>=div) {
		    x=x-d*div;
		    k-=div;
		    if(k%2==0){
		        System.out.println(x);
		        return;
		    }
		    long a1=Math.abs(x-d);
		    long a2=Math.abs(x+d);
		    long ans=Math.min(a1,a2);
		    System.out.println(ans);
		    }
		        	
	        	
	        	
	        	
	        	
	        	
	        	
			//}
    }





static void input(int A[]) {
	   for(int i=0;i<A.length;i++) {
		   A[i]=sc.nextInt();
	   }
   }
     static int i() {
    	 return sc.nextInt();
     }
     static String s() {
    	 return sc.next();
     }
     static long l() {
    	 return sc.nextLong();
     }  
        static void shuffleArray(int[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }   
}
  
        
        
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
} 




Measured memory_bytes: 32628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String s = scan.next();
		char[] c = new char[n];
		int[] count = new int[n];
		int a = 'a';
		int max = 0;
		for (int i = 0; i < n; i++) {
				c[i] = s.charAt(i);
		}
		for (int i = 1; i < n; i++) {
			boolean[] xmemo = new boolean[26];
			boolean[] ymemo = new boolean[26];
			for (int j = 0; j < i; j++) {
				xmemo[c[j]-a] = true;
			}
			for (int k = i; k < n; k++) {
				ymemo[c[k]-a] = true; 
			}
			for (int l = 0; l < 26; l++) {
				if (xmemo[l] && ymemo[l])	 count[i]++;
			}
		}
		for (int i = 0; i < n; i++) {
			if (count[i] > max) {
				max = count[i];
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21844
#include<stdio.h>

int calculator(int number_1,char enzanshi,int number_2){
	int sonuc;
	switch(enzanshi){
	case '+':
		sonuc=number_1+number_2;
		break;
	case '-':
		sonuc=number_1-number_2;
		break;
	case '*':
		sonuc=number_1*number_2;
		break;
	case '/':
		sonuc=number_1/number_2;
		break;
	}
return sonuc;

}


int main(){
	int number_1,number_2,sonuc;
	char enzanshi;
	for( ; ; ){
	scanf("%d %c %d",&number_1,&enzanshi,&number_2);
	if(enzanshi=='?')
		break;
		else{
	sonuc=calculator(number_1,enzanshi,number_2);
	printf("%d\n",sonuc);}
	}
	return 0;

}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#include<string>
#define pii pair<int,int>
#define fr(j,n) for(int j=0;j<n;j++)
#define f(n) for(int i=0;i<n;i++)
#define rt return 0;
#define sc second
#define fi first
#define i(n) int n;cin>>n;
#define pb(i) push_back(i);
#define rt return 0;
#define sz(a) a.size()
#define all(v) v.begin(),v.end()
#define ff(i,in,fi) for(int i=in;i<fi;i++)
//#define df int n;cin>>n;int a[n];fr(n){cin>>a[i];}5 8 7 14 55 19 9 2
using namespace std;
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define invect(data,n,commands) for(int xxx = 0;xxx<n;xxx++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define ll long long int
#define p(s) cout<<#s<<":"<<s<<'\n';
#define here(n) cout<<"here"<<n<<endl;
#define ios         ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
map<int,int> ma;
std::vector<int> v;

void solve()
{
	int n;
	cin>>n;
	int b[n-1],a[n];
	f(n-1)
	{
		cin>>b[i];

	}
	a[0]=b[0];
	int sum=a[0];
	ff(i,1,n-1)
	{
		a[i]=min(b[i],b[i-1]);
		sum+=a[i];
	}
	a[n-1]=b[n-2];
	sum+=a[n-1];
	cout<<sum;


}
signed main(){
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 256
n=int(input())
c=[int(input()) for _ in range(n)]
mod=10**9+7

dp=[0]*(n+1)

dp[0]=1
last=[-1]*(2*10**5+1)
last[c[0]]=0

for i in range(1,n):
    if c[i]==c[i-1] or last[c[i]]==-1:
        dp[i]=dp[i-1]
    else:
        dp[i]=(dp[i-1]+dp[last[c[i]]])%mod
    last[c[i]]=i

print(dp[n-1])


Measured memory_bytes: 90744
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();
    if (b>c) {
      int t = c;
      c = b;
      b = t;
    }
    if (a>b) {
      int t = a;
      a = b;
      b = t;
    }
    if (b>c) {
      int t = c;
      c = b;
      b = t;
    }
    System.out.println(a+" "+b+" "+c);
  }
}


Measured memory_bytes: 26240
#include <iostream>
using namespace std;
int main()
{
  int A, B;
  cin >> A >> B;
  int taps = 0;
  int plugs = 1;
  for (;;) {
    if (B <= plugs) {
      break;
    }
    plugs = plugs-1+A;
    taps++;
  }    
  cout << taps << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-


if __name__ == '__main__':
    n, m = list(map(int, input().split()))
    ab = list()
    count = 1

    # See:
    # https://www.youtube.com/watch?v=nVSWen0oM38
    for i in range(m):
        ab.append(tuple(map(int, input().split())))

    sorted_ab = sorted(ab, key=lambda x: x[1])
    b = sorted_ab[0][1]

    for i in range(1, m):
        if sorted_ab[i][0] < b <= sorted_ab[i][1]:
            pass
        else:
            b = sorted_ab[i][1]
            count += 1

    print(count)


Measured memory_bytes: 19024
#include <bits/stdc++.h>
#define FOR(i,a,b)  for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n)    FOR(i,0,n)
#define RER(i,n)    FOR(i,0,(n+1))
#define pb          push_back
#define mp(a,b)     make_pair((a),(b))
#define mset(m,v)   memset(m,v,sizeof(m))
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pair<ll, ll> > vpll;
typedef vector<string> vs;
typedef long double ld;
const double EPS    = 1e-10;
const int INF       = 1e+9;
const double PI     = acos(-1);


auto main() -> int
{
    int a, b;
    cin >> a >> b;
    if (a > 8 || b > 8) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }
    return 0;
}



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

int main() {
	int n;
	map<char, size_t> tmp1, tmp2;
	string s;
	for (char i = 'a'; i <= 'z'; ++i) {
		tmp1.insert(make_pair(i, 50));
		tmp2.insert(make_pair(i, 0));
	}
	cin >> n;
	for (int i = 0; i < n; ++i) {
		for (char j = 'a'; j <= 'z'; ++j) tmp2.at(j) = 0;
		cin >> s;
		for (auto& x : s) ++tmp2.at(x);
		for (char j = 'a'; j <= 'z'; ++j) tmp1.at(j) = min(tmp1.at(j), tmp2.at(j));
	}
	for (char i = 'a'; i <= 'z'; ++i) {
		for (size_t j = 0; j < tmp1.at(i); ++j) cout << i;
	}
}

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

stack<char> sta;

int main(){
	string s;cin>>s;
	int ans=0;
	for(auto it:s){
		if(it=='0'){
			if(sta.size()&&sta.top()=='1') ans+=2,sta.pop();
			else sta.push(it);
		}
		else{
			if(sta.size() && sta.top()=='0') ans+=2,sta.pop();
			else sta.push(it);
		}
	}
	cout<<ans<<endl;
	return 0;
}





Measured memory_bytes: 512
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define dpr(x) cerr<<#x<<": "<<x<<endl;
#define dprc(c) do{cerr<<#c<<":";for(auto&_i:(c)){cerr<<" "<<_i;}cerr<<endl;}while(0)
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int INF = 1e9+7;
#define all(c) begin(c), end(c)
#define tr(i,c) for(auto i=begin(c);i!=end(c);i++)
#define rtr(i,c) for(auto i=(c).rbegin();i!=(c).rend();i++)
#define rep(i,b) for(auto i=0;i<(b);i++)
#define pb push_back
#define sz(c) int((c).size())

int gcd(int a, int b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}

int main(int argc, char **argv)
{
  int x, y;
  cin >> x >> y;
  cout << gcd(x, y) << endl;
  return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

#define INF 1000000

int dp[1000001];
int dp2[1000001];

int main(){
    int a[200];
    memset(dp, INF, sizeof(dp));
    memset(dp2, INF, sizeof(dp2));
    
    for(int i=1;i<200;i++){
        a[i] = i*(i+1)*(i+2)/6;
        if(a[i] > 1000000) break;
        dp[a[i]] = 1;
        if(a[i]%2) dp2[a[i]]=1;
    }

    for(int i=1;i<1000001;i++){
        for(int j=1;j<200;j++){
            if(i+a[j] > 1000000) break;
            dp[i+a[j]] = min(dp[i+a[j]], dp[i]+1);
            if(a[j]%2) dp2[i+a[j]] = min(dp2[i+a[j]], dp2[i]+1);
        }
    }
    int n;
    while(cin >> n && n){
        printf("%d %d\n", dp[n], dp2[n]);
    }
}

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

int main() {
  int N;
  cin>>N;
  
  int count=0;
  for(int i=1;i<N+1;i++){
    int a;
    cin>>a;
    if(i%2==1 && a%2==1){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3536
N, A, B = map(int, input().split())
ret = 0
for n in range(1, N+1):
  val = n
  num = n // 10000
  n -= 10000 * (n // 10000)
  num += n // 1000
  n -= 1000 * (n // 1000)
  num += n // 100
  n -= 100 * (n // 100)
  num += n // 10
  n -= 10 * (n // 10)
  num += n
  if num >= A and num <= B:
    ret += val

print(ret)


Measured memory_bytes: 3060
n = gets.to_i
ans = 0
(1..n).each do |i|
  if i % 2 == 1
    m = Math.sqrt(i).floor
    cnt = 0
    (1..m).each do |j|
      if i % j == 0
        cnt += 1
      end
    end
    if cnt == 4
      ans += 1
    end
  end
end
puts ans


Measured memory_bytes: 1788
n,q = [int(x) for x in input().split()]
G = [[] for _ in range(n)]
for _ in range(n-1):
    a,b = [int(x)-1 for x in input().split()]
    G[a].append(b)
    G[b].append(a)
count = [0]*n
for _ in range(q):
    a,b = [int(x) for x in input().split()]
    a -= 1
    count[a] += b

from collections import deque
ans = [0]*n
q = deque()
used = [0]*n
q.append(0)
used[0]=1
ans[0] += count[0]

while q:
    p = q.popleft()
    for i in G[p]:
        if used[i]!=1:
            used[i]=1
            ans[i]+=ans[p]+count[i]
            q.append(i)

for i in ans:
    print(i,end=" ")

Measured memory_bytes: 60928
n = int(input())
a = []
for i in range(n):
    x, y = input().split()
    y = int(y)
    if x == "S":
        a.append(y + 0)
    if x == "H":
        a.append(y + 13)
    if x == "C":
        a.append(y + 26)
    if x == "D":
        a.append(y + 39)
for i in range(1,53):
    if not (i in a):
        if i <= 13:
            print(f"S {i-0}")
        elif i <= 26:
            print(f"H {i-13}")   
        elif i <= 39:
            print(f"C {i-26}")
        else:
            print(f"D {i-39}") 
   


Measured memory_bytes: 5608
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
 
        while(true){
 
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
 
            if(op.equals("?"))break;
 
            int ans = 0;
 
            switch(op){
            case "+":
                ans = a+b;
                break;
            case "-":
                ans = a-b;
                break;
            case "*":
                ans = a*b;
                break;
            case "/":
                ans = a/b;
                break;
            }
 
            System.out.printf("%d\n", ans);
        }
    }
}


Measured memory_bytes: 26428
#include <stdio.h>
int main()
{
int n,arr[100],i,count=0;
scanf("%d",&n);
for(i=0;i<n;i++)
        {
scanf("%d",&arr[i]);
if(arr[i]!=i+1)
count++;
}
if (count<=2)
    {
            printf("YES");
    }
else
    printf("NO");
    return 0;
    }

Measured memory_bytes: 128
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;


int main() {
 int n,k;
  cin >> n>> k;
 long long int ans=1;
  if(k==100){
    ans=pow(100, n)*101;
  }
  else{
  ans=pow(100, n)*k;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
from itertools import accumulate

def solve():
    N, K = map(int, input().split())
    As = list(map(int, input().split()))

    As.sort()
    i = bisect_left(As, K)
    Bs = As[:i]
    M = len(Bs)

    bitsets = [1<<(K-1)]
    bitset = 1<<(K-1)
    for B in Bs:
        bitset |= bitset>>B
        bitsets.append(bitset)
    bitsetRevs = [1<<(K-1)]
    bitset = 1<<(K-1)
    for B in reversed(Bs):
        bitset |= bitset>>B
        bitsetRevs.append(bitset)
    bitsetRevs.reverse()

    def isOK(x):
        B = Bs[x]
        numRevs = [0] * K
        bitset = bitsetRevs[x+1]
        for s in range(K):
            if bitset & (1<<(K-1-s)):
                numRevs[s] = 1
        accNumRevs = list(accumulate([0]+numRevs))
        bitset = bitsets[x]
        for s in range(K):
            if bitset & (1<<(K-1-s)):
                if accNumRevs[K-s] - accNumRevs[max(0, K-s-B)] > 0:
                    return True
        return False

    ng, ok = -1, M
    while abs(ok-ng) > 1:
        mid = (ng+ok) // 2
        if isOK(mid):
            ok = mid
        else:
            ng = mid

    print(ok)


solve()


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

int main(){
  string N;
  cin >> N;
  
  int ans = 0;
  if(N[0] == '1'){
    ans++;
  }
  if(N[1] == '1'){
    ans++;
  }
  if(N[2] == '1'){
    ans++;
  }
  
  cout << ans << endl;
}



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

using namespace std;

#define boost                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for (auto &z : v)
#define sp << ' ' <<
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353
#define PI_2 1.57079632679489661923

int main()
{
    boost;
    time_t tic, toc;

    ll tt = 1, n, m, k = 0, i, j, p, q;
    ll a, b, c, d, h, w, u, v, x, y;
    ll l = 0, r = 0;
    ll ans = 0;

    bool poss = true;

    string s;

    // cin >> tt;
    tic = clock();
    for(int _ = 1; _ <= tt; _++){
        // cout << "Case #" << _ << ": ";
        char c;
        cin >> c;

        if(isupper(c)) cout << 'A' << nl;
        else cout << 'a' << nl;
    } 
    // cerr << (clock() - tic*1.0) / CLOCKS_PER_SEC << nl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> P(N), Q(N), idx(N);
    REP(i,N) cin >> P[i];
    REP(i,N) cin >> Q[i];
    iota(idx.begin(), idx.end(), 1);
    cout << endl;
    int a = -1, b = -1;
    int cnt = 1;
    do{
        bool okp = true;
        bool okq = true;
        REP(i,N){
            if(P[i] != idx[i]){
                okp = false;
                break;
            }
        }
        REP(i,N){
            if(Q[i] != idx[i]){
                okq = false;
                break;
            }
        }
        if(okp){
            a = cnt;
        }
        if(okq){
            b = cnt;
        }
        cnt++;
    }while(next_permutation(idx.begin(), idx.end()));
    cout << abs(a-b) << endl;
}

Measured memory_bytes: 256
module Main where
--import Debug.Trace
import Data.List
import Data.Char
import Data.Array
import Data.Maybe
import Data.Ord
import Control.Monad

solve :: [Int] -> Int
solve [a, b] | a > b = iter b a
             | otherwise = iter a b where
    iter x 0 = x
    iter x y = iter y (mod x y)

readLine:: IO [Int]
readLine = fmap (map read . words) getLine

main :: IO() 
main = do
    l <- readLine
    print (solve l)



Measured memory_bytes: 3652
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
import numpy as np

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()
N = 50

ans = np.array(list(range(50)))
ans += K//N
K = K%N
for i in range(K):
	ans[i] += 51
	ans -= 1
print(N)
print(*list(ans))


Measured memory_bytes: 13628
import java.util.*
import kotlin.math.absoluteValue
fun main(args: Array<String>) {
    val reader = Scanner(System.`in`)
    var X = reader.nextLong()
    val K = reader.nextLong()
    val D = reader.nextLong()

    X = X.absoluteValue

    val divD = X.div(D)
    var result = 0L
    if(divD >= K) {
        result = X - K*D
    }
    else {
        var reaminD =  X - divD*D
        var reaminCount = K - divD
        if(reaminCount % 2 == 0L){
            result = reaminD
        }
        else {
            result = D - reaminD
        }
    }
    println(result)
}

Measured memory_bytes: 36400
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
// template <class T>
// void print(T& x){printf("%d\n", x);}
void printvec(vector<int> a){
    rep(i, a.size()-1){
        printf("%d ", a[i]);
    }
    printf("%d\n", a[a.size()-1]);
}

void print(const list<int> l)
{
    if(l.empty()){
        printf("\n");
        return;
    }
    list<int> ls=l;
    printf("%d", ls.front());
    ls.pop_front();
    for(auto x: ls){
        printf(" %d", x);
    }
    printf("\n");
}
 
int main()
{
    int n, q;
    cin >> n >> q;

    list<int> l[n];
    
    int c, s, t;
    rep(i, q){
        cin >> c >> s;
        if(c==0){
            cin >> t;
            l[s].push_back(t);
        }else if(c==1){
            print(l[s]);
        }else if(c==2){
            cin >> t;
            l[t].splice(l[t].end(), std::move(l[s]));
        }
    }

    return 0;
}


Measured memory_bytes: 50088
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

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

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };
int main() {
	int h, w;
	long long n;
	while (cin >> h >> w >> n, h){
		vector<string> vs;
		vector<vector<vector<int>>> vvvi(h,vector<vector<int>>(w,vector<int>(4,-1)));
		int x, y, d;
		REP(i, h){
			string s;
			cin >> s;
			vs.push_back(s);
			REP(j, w){
				if (s[j] == 'N' || s[j] == 'E' || s[j] == 'W' || s[j] == 'S'){
					x = j;
					y = i;
					if (s[j] == 'W')d=0;
					if (s[j] == 'S')d = 1;
					if (s[j] == 'E')d = 2;
					if (s[j] == 'N')d = 3;
				}
			}
		}
		vvvi[y][x][d]=0;

		for(long long i=0;i<n;i++){
			while (x + dx[d] < 0 || x + dx[d] >= w || y + dy[d] < 0 || y + dy[d] >= h || vs[y + dy[d]][x + dx[d]] == '#'){
			d+=3;
			d%=4;
			}
			x += dx[d];
			y += dy[d];
			if (vvvi[y][x][d]==-1)
			vvvi[y][x][d] = i + 1;
			else
				n=i+1+((n - i - 1) % (i+1-vvvi[y][x][d]));
		}
		char c;
		if (d == 0)c = 'W';
		if (d == 1)c = 'S';
		if (d == 2)c = 'E';
		if (d == 3)c = 'N';
		cout << (y + 1) << " " << (x + 1) << " "<<c<<endl;
	}
}

Measured memory_bytes: 3492
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化
class UnionFind():
    def __init__(self, n):
        #初期化[-1]*nのリストを作る
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
        return self.parents[x]

    def union(self, x, y):
        #要素x,yのグループを統合する
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        #要素xが所属するグループの人数を返す
        return -self.parents[self.find(x)]

    def same(self, x, y):
        #要素xとyが同じグループかどうか(同じならTrue)
        return self.find(x) == self.find(y)

    def members(self, x):
        #要素xと同じグループのメンバー全員を返す
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        #Find-Treeの頂点
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        #グループ数を返す
        return len(self.roots())

    def all_group_members(self):
        #頂点:[グループリスト]を返す
        return {r: self.members(r) for r in self.roots()}

    def max_members_group(self):
        return max([self.size(r) for r in self.roots()])

    def __str__(self):
        return ''.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

    #遷移を確認したいときはこちらに書き換えて実行する(for以降の経路圧縮が行われていない)
    #def __str__(self):
    #  return ''.join('{}: {}'.format(r, self.members(r)))

def main():
    n, m = list(map(int,input().split()))
    data = [input().split() for _ in range(m)]
 
    UF = UnionFind(n)
    for i in range(m):
        UF.union(int(data[i][0]) - 1, int(data[i][1]) - 1)
    print(UF.max_members_group())
    
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 89676
import java.util.Scanner;

public class Main {
    public static void main(String ar[]){
        Scanner cin=new Scanner(System.in);
        int n=cin.nextInt();
        int ans1=n/30;
        n%=30;
        int ans2=n*2;
        System.out.println(ans1+" "+ans2);
    }
}

Measured memory_bytes: 26316
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
    static void Main(string[] args){
    var N = int.Parse(Console.ReadLine());
    var vals = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
    int sum=vals.Sum();
    int S1=0;
    int diff=0;
    int min=99999;
    for(int i=0;i<N;i++){
        S1+=vals[i];
        sum-=vals[i];
        diff=Math.Abs(sum-S1);
        if(diff<min){
            min=diff;
        }
    }
    Console.WriteLine(min);
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#include<tr1/unordered_map>
using namespace std;
tr1::unordered_map<int,int>mp;
vector<int>v[200000],res;
int n,m,p[200000];
bool vis[200000];
inline void read(int &x)
{
    char c=getchar();x=0;
    while(c>'9'||c<'0')c=getchar();
    while(c<='9'&&c>='0') x=(x<<1)+(x<<3)+c-'0',c=getchar();
}
int x,y;
inline void dfs(int x,int f)
{
    vis[x]=1;
    res.push_back(x);
    for(int i=0;i<v[x].size();i++)
    {
        int y=v[x][i];
        if(y==f) continue;
        if(vis[y]) continue;
        dfs(y,x);
    }
}
int ans=0;
int main()
{
    read(n);read(m);
    for(int i=1;i<=n;i++) read(p[i]);
    for(int i=1;i<=m;i++)
    {
        read(x),read(y);
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            res.clear();
            mp.clear();
            dfs(i,0);
            for(int j=0;j<res.size();j++)
                mp[res[j]]=1;
            
            for(int j=0;j<res.size();j++)
            {
                if(mp[p[res[j]]])  ans++;
            }
        }
    }
    printf("%d",ans);
    //system("pause");
}

Measured memory_bytes: 14352
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    ans, n = selectionSort(a, N)
    print(*ans, sep=' ')
    print(n)

def selectionSort(a, n):
    k = 0
    for i in range(n - 1):
        minj = i
        for j in range(i + 1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            k += 1
    return a, k

main()

Measured memory_bytes: 7740
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define itrep(itr, base) for (auto itr = base.begin(); itr != base.end(); itr++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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;}

int main() {
  int n;
  cin >> n;
  double ans =  (n - 2) * 180;
  P(ans);
  return 0;
}



Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

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

    int t, a;
    cin >> t >> a;

    vector<int> h(n);
    for (int i = 0; i < n; i++)
        cin >> h[i];

    int parece = 0;
    int min_diff = 10000000;
    a *= 1000;
    t *= 1000;
    for (int i = 0; i < n; i++) {
        int temp = t - h[i] * 6;
        int diff = abs(a - temp);
        if (min_diff > diff) {
            min_diff = diff;
            parece = i;
        }
    }

    cout << parece + 1 << '\n';
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())
if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
    print(0)
    exit()

if a == b and b == c and a % 2 == 0:
    print(-1)
else:
    ans = 0
    while (1):
        aa = 0
        bb = 0
        cc = 0
        aa += (b // 2 + c // 2)
        bb += (a // 2 + c // 2)
        cc += (a // 2 + b // 2)
        ans += 1
        if aa % 2 == 1 or bb % 2 == 1 or cc % 2 == 1:
            print(ans)
            exit()
        a = aa
        b = bb
        c = cc


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n,_n;
pii a[200005];
ll tree[200005<<2];
void update(int ind,int val){
    ind+=_n-1;
    tree[ind]+=(ll)val;
    while(ind>1){
        ind/=2;
        tree[ind]=tree[ind*2]+tree[ind*2+1];
    }
}
ll query(int l,int r,int nl,int nr,int ind){
    if(l<=nl && nr<=r) return tree[ind];
    if(l>nr || r<nl) return 0;
    int mid=(nl+nr)>>1;
    return query(l,r,nl,mid,ind*2)+query(l,r,mid+1,nr,ind*2+1);
}
int main(){
    scanf("%d",&n);
    _n=512;
    for(int i=1;i<=n;i++){
        long double now=0;
        scanf("%Lf",&now);
        now*=(long double)1e9;
        a[i].fi+=9,a[i].se+=9;
        ll ha=round(now);
        while(ha%2==0) ha/=2,a[i].fi--;
        while(ha%5==0) ha/=5,a[i].se--;
    }
    sort(a+1,a+n+1);
    int now=1;
    ll ans=0;
    for(int i=n;i>=1;i--){
        while(now<=n && a[now].fi<=-a[i].fi)
            update(a[now].se+200,1),now++;
        ans+=query(1,-a[i].se+200,1,_n,1);
    }
    for(int i=1;i<=n;i++)
        if(a[i].fi<=0 && a[i].se<=0)
            ans--;
    printf("%lld\n",ans/2);
    return 0;
}

Measured memory_bytes: 5328
#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 mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;

const int N=5e5+5;
ll fac[N];

long long power(long long x, long long y, long long p)
{
long long res = 1;


x = x % p;


while (y > 0)
{
if (y & 1)
res = (res*x) % p;


y = y>>1;
x = (x*x) % p;
}
return res;
}

long long modInverse(long long n, long long p)
{
return power(n, p-2, p);
}


void compute()
{
  fac[0]=1;
  fac[1]=1;
  ll i;
  for(i=2;i<N;i++)
  {
      fac[i]=(fac[i-1]*i)%mod;
  }
  
}


long long ncrp(long long n, long long r, long long p)
{


if (r==0)
return 1;




 return (fac[n]* modInverse(fac[r], p) % p *modInverse(fac[n-r], p) % p) % p;
}

void solve()
{
    ll n,m;
    cin>>n>>m;
    ll i,j;
    ll res=0;
    // cout<<modInverse(2,mod)<<"--\n";

    ll rans = ncrp(m,n,mod);
    rans*=(fac[n])%mod;
    rans%=mod;
    ll cur=1;

    for(i=0;i<=n;i++)
    {
        ll tans = cur*(ncrp(n,i,mod));
        tans%=mod;
        tans+=mod;
        tans%=mod;
        tans*=ncrp(m-i,n-i,mod);
        tans%=mod;
        tans*=(fac[n-i]);
        tans%=mod;
        res+=tans;
        res%=mod;
        res+=mod;
        res%=mod;
       
       
       cur=-cur;
    }
    if(res<0)
    {
        res+=mod;
        res%=mod;
    }
    res*=rans;
    res%=mod;
    cout<<res<<"\n";
    
    
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;

compute();


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 7548
#include <iostream>
#include <vector>
const int MOD = 1e9 + 7;
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>>a(n, vector<int>(n, 0));
  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
    cin >> a[i][j];
  }
  auto count_bits = [&](long long x) -> int {
    int ans = 0;
    while (x) {
      ans += x & 1;
      x >>= 1;
    }
    return ans;
  };
  // vector<vector<long long>>dp(n + 1, vector<long long>(1 << n, 0));
  // dp[0][0] = 1;
  // for (int i = 1; i <= n; i++) {
  //    for (int j = 0; j < (1 << n); j++) {
  //     for (int k = 0; k < n; k++) {
  //       //cout << m << endl;
  //       if (a[i-1][k] && (j & (1 << k))) {
  //         dp[i][j] = (dp[i][j] + dp[i-1][j-(1<<k)]) % MOD;
  //       }
  //     }
  //   }
  // }

  // cout << dp[n][(1<<n)-1] << "\n";
  vector<long long>dp(1<<n, 0);
  dp[0]=1;
  for (int i = 0; i < (1<<n) - 1; i++) {
    int j = count_bits(i);
    for (int k = 0; k < n; k++) {
      if (a[j][k] && !(i & (1 << k))) {
        dp[i ^ (1<<k)] = (dp[i ^ (1<<k)] + dp[i]) % MOD;
      }
    }
  }
  cout << dp[(1<<n) - 1] << endl;
  return 0;
}

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

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

  for (int i=1; i<n-1; i++) {
    if ((p[i] - p[i-1]) * (p[i] - p[i+1]) < 0) {
      cnt += 1;
    }
  }

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256