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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed main(){

  int h,w,n; cin >> h >> w >> n;
  set<pair<int,int>> st,table;
  for(int i = 0; i < n; i++){
    int a,b; cin >> a >> b;
    a--,b--;
    st.insert({a,b});
    for(int dy : {-1,0,1}){
      for(int dx : {-1,0,1}){
        int ny = a + dy;
        int nx = b + dx;
        if(ny-1 < 0 || h <= ny+1 || nx-1 < 0 || w <= nx+1) continue;
        table.insert({ny,nx});
      }
    }
  }

  vector<int> ans(10,0);
  ans[0] = (h-2) * (w-2);
  for(auto p : table){
    int cnt = 0;
    for(int dy : {-1,0,1}){
      for(int dx : {-1,0,1}){
        int ny = p.first + dy;
        int nx = p.second + dx;
        pair<int,int> res = *st.lower_bound(make_pair(ny,nx));
        if(res.first == ny && res.second == nx) cnt++;
        //cnt += st.count(make_pair(ny,nx));
      }
    }
    //cout << p << " " << cnt << endl;
    ans[cnt]++;
    ans[0]--;
  }

  for(int p : ans){
    cout << p << endl;
  }

  return 0;
}


Measured memory_bytes: 62720
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int X, N;
    cin >> X >> N;
 
    int p[N];
    for(int i = 0; i < N; i++)
        cin >> p[i];
 
    int Min = 1000;
    int ans = 1000;
    sort(p, p+N);
    for(int i = 0; i <= 101; i++){
        bool flag = true;
        for(int j = 0; j < N; j++){
            if(p[j] == i)
                flag = false;
        }
        if(!flag)
            continue;
 
        int num = abs(X-i);
            if(Min > num){
                ans = i;
                Min = num;
            }
    }
    
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
typedef long long ll;

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define MAX_INT 100000
#define MOD 1000000007



void solve()
{
    ll a,b,c;cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;
    
}
    
int main()
{
    IOS;
    
    //ll t;cin>>t;while(t--)
        solve();
 
    return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs'

function main(args: string[]) {
    // 210 5
    // 31 41 59 26 53
    const line1: string = args[0];
    const line2: string = args[1];
    let h: number = parseInt(line1.split(' ')[0], 10);
    const n: number = parseInt(line1.split(' ')[1], 10);

    const tech: number[] = line2.split(' ').map(n => parseInt(n, 10));
    for (let i: number = 0; i < n; i++) {
        h -= tech[i];
    }

    if (h <= 0) {
        console.log('Yes');
    } else {
        console.log('No');
    }
}

main(fs.readFileSync('/dev/stdin', 'utf8').split('\n'));



Measured memory_bytes: 20812
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, t = na()
dp = [0] * 6005
ab = []
for i in range(n):
    ab.append(na())

ab.sort(key=lambda x: x[0])
for u in ab:
    for i in range(6004-u[0], -1, -1):
        if i < t:
            dp[i+u[0]] = max(dp[i+u[0]], dp[i] + u[1])

print(max(dp))



Measured memory_bytes: 45232
#include <cmath>
#include <queue>
#include <vector>
#include <iostream>
#define INF 1e16
using namespace std;
// ------ Class ------ //
class Graph2 {
public:
	// ------ Variables ------ //
	int V, E; vector<vector<pair<int, long double> > > G;

	// ------ Constructors ------ //
	Graph2() : V(0), E(0), G(vector<vector<pair<int, long double> > >()) {}
	Graph2(int v) : V(v), E(0), G(vector<vector<pair<int, long double> > >(v)) {}
	Graph2(vector<vector<pair<int, long double> > > g) : V(g.size()), G(g) { for (int i = 0; i < g.size(); i++) E += g[i].size(); }

	// ------ Basic Functions ------ //
	int size() { return V; }
	void add1(int v1, int v2, long double w) { G[v1].push_back(make_pair(v2, w)); E++; }
	void add2(int v1, int v2, long double w) { add1(v1, v2, w); add1(v2, v1, w); }

	// ------ Operators ------ //
	bool operator==(const Graph2& g) const { return G == g.G; }
	bool operator!=(const Graph2& g) const { return G != g.G; }
	vector<pair<int, long double> > operator[](int x) { return G[x]; }

	// ------ Algorithms ------ //
	long double minspan() {
		vector<long double> d(V, INF);
		vector<bool> used(V, false);
		priority_queue<pair<long double, int> > que;
		for (int i = 0; i < V; i++) d[i] = INF;
		d[0] = 0; que.push(make_pair(0, 0));
		while (!que.empty()) {
			pair<long double, int> pa = que.top(); que.pop();
			int u = pa.second; used[u] = true;
			for (int i = 0; i < G[u].size(); i++) {
				int v = G[u][i].first;
				if (d[v] > G[u][i].second && !used[v]) {
					d[v] = G[u][i].second; que.push(make_pair(-d[v], v));
				}
			}
		}
		long double sum = 0;
		for (int i = 0; i < V; i++) sum += d[i];
		return sum;
	}
};
// ------ Main ------ //
int n; long double x[111], y[111], z[111], r[111];
int main() {
	while(cin >> n, n) {
		for(int i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i] >> r[i];
		Graph2 G(n);
		for(int i = 0; i < n; i++) {
			for(int j = i + 1; j < n; j++) {
				long double dist = sqrtl((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) + (z[i] - z[j]) * (z[i] - z[j]));
				G.add2(i, j, (dist > r[i] + r[j]) ? (dist - r[i] - r[j]) : 0);
			}
		}
		printf("%.3Lf\n", G.minspan());
	}
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long int li;
typedef long long ll;
typedef long double ld;

int main()
{
	string s;
	cin >> s;
	s += '#';
	int k = 0, ans = 0;
	for (int i = 0; i < s.size(); i++)
		if (s[i] == 'R')
			k++;
		else
		{
			ans = max(ans, k);
			k = 0;
		}
	cout << ans << "\n";
}


Measured memory_bytes: 3592
N = int(input())
A = list(map(int,input().split()))
d = [-1, -1, -1]
ans = 1
P = 10**9+7
for n in range(N):
    ans = ans*d.count(A[n]-1)%P
    if d[0] == A[n]-1:
        d[0] += 1
    elif d[1] == A[n]-1:
        d[1] += 1
    else:
        d[2] += 1
print(ans)


Measured memory_bytes: 14396
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.size();
	string tmp;
	string prev = "";
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		tmp += s[i];
		if (tmp != prev) {
			ans++;
			prev = tmp;
			tmp = "";
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	string s;
	cin>>s;
	ll ans=0;
	for(int i=1;i<s.size();i++){
		if(s[i-1]!=s[i]){
			ans++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a<c&&c<b)    cout << "Yes";
    else if(b<c&&c<a)   cout << "Yes";
    else    cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
ll num[100005],val[100005];
signed main(){
  ll n,k;
  cin>>n>>k;
  ll ans=0;
  for(int i=0;i<n;i++) cin>>num[i]>>val[i];
  for(int d=0;d<=32;d++){
    ll b=k;
    if((d!=0)&&((b>>d)&1)==1) {
      b=(b>>d);
      b--;
    }
    else if(d!=0) continue;
    ll kans=0;
    for(int i=0;i<n;i++){
      ll kb=(num[i]>>d);
      if((b|kb)==b){
        kans+=val[i];
      }
    }
    ans=max(ans,kans);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int A,B;
    cin >> A >> B;
    if(A<=8 && B<=8)
        cout << "Yay!" << endl;
    else
        cout << ":(" << endl;

    return 0;
}


Measured memory_bytes: 256
def binary_search(key, a):
    l = 0
    r = len(a)
    ix = (r - l) // 2

    while r - l > 0:
        if key == a[ix]:
            return True

        if key < a[ix]:
            r = ix
        else:
            l = ix + 1
        ix = l + (r - l) // 2

    return False

if __name__ == '__main__':
    n = input()
    s = [int(x) for x in input().split()]
    q = input()
    t = [int(x) for x in input().split()]

    ans = 0
    for e in t:
        ans += 1 if binary_search(e, s) else 0

    print(ans)

Measured memory_bytes: 18936
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll number1, ll number2)
{
    return number1 * number2 / gcd(number1, number2);
}
template <class T>
bool contain(const std::string &s, const T &v)
{
    // contain(to_string(N), '3')
    return s.find(v) != std::string::npos;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
        return c - '0';
    return 0;
}
using namespace std;

void transpose(vector<vector<char>> &b)
{
    if (b.size() == 0)
        return;

    vector<vector<char>> trans_vec(b[0].size(), vector<char>());

    for (int i = 0; i < b.size(); i++)
    {
        for (int j = 0; j < b[i].size(); j++)
        {
            trans_vec[j].push_back(b[i][j]);
        }
    }

    b = trans_vec; // <--- reassign here
}

// C++ゆるさねえリスト
// accumulate(all(a), 0LL);
// 二分探索

int main()
{

    int n, ans = 0;
    string s;

    cin >> s;
    n = s.size();
    rep(i, n / 2)
    {
        if (s[i] != s[n - i - 1])
        {
            ans += 1;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<climits>
#include<cstdlib>
#include<map>
#include<math.h>
#include<utility>
using namespace std;
typedef long long ll;

int main(){
  int n;
  cin >> n;
  string s[100001];
  for(int i=0; i<n; i++) cin >> s[i];

  ll count[5] = {0};
  string march="MARCH";

  for(int i=0; i<n; i++){
    for(int j=0; j<5; j++){
      if(march[j] == s[i][0]) count[j]++;
    }
  }

  ll ans = 0;
  for(int i=0; i<5; i++){
    for(int j=i+1; j<5; j++){
      if(i==j) continue;
      for(int k=j+1; k<5; k++){
        if(i==k || j==k) continue;
        ans += count[i]*count[j]*count[k];
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());

		int powers2[] = new int[11];
		int powers3[] = new int[11];
		
		powers2[0] = 1;
		powers3[0] = 1;
		for(int i = 1; i <= 10; i++){
			powers2[i] = 2*powers2[i - 1];
			powers3[i] = 3*powers3[i - 1];
			
//			System.out.println(powers2[i] +" "+ powers3[i]);
		}
		
		int dp[] = new int[n + 1];
		
		dp[1] = 1;
		
		for(int i = 2; i <= n; i++){
			int tmp;
			//タイプa
			tmp = dp[i - 1] + 1;
			
			//タイプb
			for(int j = 0; powers2[j]*powers3[j] <= i ; j++){
				tmp = Math.min(tmp, dp[i - powers2[j]*powers3[j]] + 1);
			}
			
			//タイプc
			for(int j = 0; powers3[j]*powers3[j] <= i ; j++){
				tmp = Math.min(tmp, dp[i - powers3[j]*powers3[j]] + 1);
			}
			
			dp[i] = tmp;
		}
		
		System.out.println(dp[n]);
	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

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

    cout << 800*n - 200*(n/15) << endl;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;

public class Main 
{
	static class Node
	{
		HashSet<Node> e = new HashSet<>();
		int i;
		int dis1 = -1;
		int dis2 = -1;
		
		public Node(int id)
		{
			i=id;
		}
	}

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int start1 = 0;
		int start2 = n-1;
		Node[] nd = new Node[n];
		
		for(int i = 0; i < n; i++)
		{
			nd[i] = new Node(i);
		}
		
		for(int i = 0; i < n-1; i++)
		{
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			nd[a].e.add(nd[b]);
			nd[b].e.add(nd[a]);
		}
		
		Node s1 = nd[start1];
		Node s2 = nd[start2];
		LinkedList<Node> q = new LinkedList<Node>();
		q.add(s1);
		s1.dis1 = 0;
		while(!q.isEmpty())
		{
			Node pos = q.pollFirst();
			for(Node e : pos.e)
			{
				if(e.dis1 == -1)
				{
					e.dis1 = pos.dis1+1;
					q.add(e);
				}
			}
		}
		
		q = new LinkedList<Node>();
		q.add(s2);
		s2.dis2 = 0;
		while(!q.isEmpty())
		{
			Node pos = q.pollFirst();
			for(Node e : pos.e)
			{
				if(e.dis2 == -1)
				{
					e.dis2 = pos.dis2+1;
					q.add(e);
				}
			}
		}
		
		int bl = 0;
		for(Node x : nd)
		{
//			System.out.println("node " + x.i + " " + x.dis1 + " " + x.dis2);
			if(x.dis2 >= x.dis1)
				bl++;
		}
		int wh = n - bl;
		
		if(bl > wh)
			System.out.println("Fennec");
		else
			System.out.println("Snuke");
		
	}

}


Measured memory_bytes: 114468
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    long[] T = new long[N];

    for (int i = 0; i < N; i++) {
      T[i] = sc.nextLong();
    }

    sc.close();

    long result = T[0];

    for (int i = 1; i < N; i++) {
      result = lcm(result, T[i]);
    }

    System.out.println(result);

  }

  public static long gcd(long x, long y){

    if (x < y) {
      long t = x;
      x = y;
      y = t;
    }

    while (y > 0) {
      long r = x % y;
      x = y;
      y = r;
    }

    return x;
    
  }

  public static long lcm(long x, long y) {

		return x / gcd(x, y) * y;
  
  }

}

Measured memory_bytes: 24148
N, M = map(int, input().split())
mini = 0
maxi = N
for i in range(M):
  L, R = map(int, input().split())
  mini = max(mini, L)
  maxi = min(maxi, R)
print(maxi - mini + 1 if maxi - mini + 1 > 0 else 0)

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N + 1);
  for (int i = 1; i <= N; i++) {
    cin >> a.at(i);
  }
  bool flag = false;
  
  int x = 1;
  int count = 0;
  while (count < N) {
    x = a.at(x);
    count++;
    if (x == 2) {
      cout << count;
      flag = true;
      break;
    }
  }
  if (!flag)  cout << -1;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

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

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////


int main() {
	ll H, W, K;
	cin >> H >> W >> K;
	ll x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	vector<vector<char>> c(H + 2, vector<char>(W + 2, '@'));

	repn(i, H)repn(j, W) cin >> c[i][j];

	vvll dis(H + 2, vll(W + 2, -1));

	queue<pair<ll, ll>> q;
	dis[x1][y1] = 0;
	q.push({ x1,y1 });

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

	while (!q.empty()) {
		auto p = q.front();
		q.pop();
		
		rep(j, 4) {
			ll x = p.first;
			ll y = p.second;
			ll d = dis[x][y];

			repn(i, K) {
				x += dx[j];
				y += dy[j];

				if (c[x][y] == '@') { break; }
				if (dis[x][y] >= 0 && dis[x][y] <= d) { break; }

				if (dis[x][y] == -1)q.push({ x,y });
				dis[x][y] = d + 1;
				

				//cout << x << " " << y << endl;
			}
		}
	}

	cout << dis[x2][y2] << endl;
}

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

int main(void)
{
    int N,D;
    int ans;
    cin >> N >> D;

    ans = N / (D*2+1);
    if((N % (D*2+1)) != 0)
        ans++;

    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++) cin >> a[i];

	sort(a, a+n);

	cout << a[n >> 1] - a[(n >> 1)-1];

	return 0;
}




Measured memory_bytes: 640
import sys
from collections import defaultdict
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    S=list(input())
    T=list(input())
    d_S,d_T={},{}
    c=0
    for i,(s,t) in enumerate(zip(S,T)):
        if s in d_S:
            tmp_S=d_S[s]
        else:
            d_S[s]=c
            tmp_S=d_S[s]
        if t in d_T:
            tmp_T=d_T[t]
        else:
            d_T[t]=c
            tmp_T=d_T[t]
            c+=1
        if tmp_S!=tmp_T:
            print('No')
            exit()
    print('Yes')
        

if __name__ == '__main__':
    main()


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

int main() {
  vector<int> p(5);
  int k;
  cin >> p[0] >> p[1] >> p[2] >> p[3] >> p[4] >> k;
  sort(p.begin(), p.end());
  if (p[4] - p[0] > k) cout << ":(" << endl;
  else cout << "Yay!" << endl;
}


Measured memory_bytes: 3604
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>

using namespace std;

int main() {

	int a, cnt5=0, cnt7=0;
	for (int i = 0; i < 3; i++) {
		cin >> a;
		if (a == 5) cnt5++;
		if (a == 7) cnt7++;
	}
	if (cnt5==2 && cnt7==1) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    if a < b:
        a, b = b, a

    if b == 0:
        return a

    c = a % b
    return gcd(b, c)

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

b = a[0]
for i in range(n - 1):
    b = gcd(a[i + 1], b)

print(b)

Measured memory_bytes: 15020
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(3);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)2e5+5;
const ll MOD =(ll)1e9+7;
const ll INF = (ll)1e18+5;
const int nn=1e6;

int main()
{
    _SAD()
    int n;
    cin>>n;
    ll ans=0;
    for(int i=1;i<n;i++)
    {
        ans+=(n-1)/i;
    }
    cout<<ans<<nl;
    return 0;
}



Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#define NIL -1
using namespace std;

struct Node{
	int parent;
	int left;
	int right;
};

Node tree[100000];
int depth[100000];

int getDepth(int id){
	int d = 0;
	while(tree[id].parent != NIL){
		id = tree[id].parent;
		d++;
	}
	return d;
}

void setDepth(int nodeId,int d){
	depth[nodeId] = d;
	if(tree[nodeId].right != NIL){
		setDepth(tree[nodeId].right, d);
	}if(tree[nodeId].left != NIL){
		setDepth(tree[nodeId].left, d + 1);
	}
}

void printChildren(int nodeId){
	printf("[");
	int childId = tree[nodeId].left;
	while(childId!=NIL){
		if(childId != tree[nodeId].left){
			printf(", ");
		}
		printf("%d",childId);
		childId = tree[childId].right;
	}
	printf("]");
}

void printType(int nodeId){
	if(tree[nodeId].parent == NIL){
		printf("root");
	}else if(tree[nodeId].left == NIL){
		printf("leaf");		
	}else{
		printf("internal node");
	}
}

int searchRootId(int n){
	for(int i = 0; i < n ; i++){
		if(tree[i].parent==NIL)
			return i;
	}
	return -1;
}

int main()
{
	int n,siblings;
	cin >> n;
	for(int i = 0; i < n ; i++){
		tree[i].left = tree[i].parent = tree[i].right = NIL;
	}
	for(int i = 0; i < n ; i++){
		int id, childrens;
		// scanf("%d %d", &id, &childrens);
		cin >> id >> childrens;
		for (int j = 0; j < childrens; j++)
		{
			int childId;
			scanf("%d", &childId);
			if(tree[id].left == NIL){
				tree[id].left = childId;
			}else{
				tree[siblings].right = childId;
			}
			siblings = childId;
			tree[siblings].parent = id;
		}
	}
	setDepth(searchRootId(n),0);
	for (int i = 0; i < n; i++)
	{
		Node n = tree[i];
		printf("node %d: parent = %d, depth = %d, ", i, n.parent,depth[i]);
		printType(i);
		printf(", ");
		printChildren(i);
		printf("\n");
	}
}


Measured memory_bytes: 7856
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <queue>
#include <unordered_map>
#include <stack>
#include <bitset>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll pow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = pow(N, P/2);
        return t*t;
    }
    return N * pow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}

int main() {
    ll n,k;cin>>n>>k;
    ll p=1e9+7;
    ll ans=0;
    for(int i=k;i<=n+1;i++){
        ans+=(n-i+1)*i+1;
        ans%=p;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(void){
  int a,i,j,k,x,y,n;
  y=0;
  while(1){
  scanf("%d%d",&n,&x);
  if(n==0&&x==0)break;
  for(i=1;i<=n-2;i++){
    for(j=i+1;j<=n-1;j++){
      for(k=j+1;k<=n;k++){
	a=i+j+k;
	if(a==x){
	  y++;
	}
      }
    }
  }
  printf("%d\n",y);
  y=0;
    }
    return 0;
}



Measured memory_bytes: 2036
import math
A,B=map(int, input().split())

X1=math.ceil(A/0.08)
X2=math.floor((A+1)/0.08)

if (A+1)*100%8==0:
  X2=X2-1

Y1=math.ceil(B/0.1)
Y2=math.floor((B+1)/0.1)-1



if (Y1>X2)or(X1>Y2):
  print(-1)
elif X1>=Y1:
  print(X1)
else:
  print(Y1)


Measured memory_bytes: 3060
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer                                    

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N = ni()
    val A = na(N)
    val ans = gcd(A)
    out.println(ans)
  }

  def gcd(a: Int, b: Int): Int = {
    if (b == 0) a
    else gcd(b, a % b)
  }

  def gcd(as: Array[Int]): Int = {
    var res = as(0)
    REP(as.length - 1, 1) { i =>
      res = gcd(res, as(i))
    }
    res
  }


  def debug(as: Array[Boolean]): Unit = {
    System.err.println(as.map(x => if(x) "1" else "0").mkString)
  }

  def debug(as: Array[Int]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(as: Array[Long]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(s: String): Unit = {
    System.err.println(s)
  }

  def debug(num: Long): Unit = {
    System.err.println(num)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n>=5)
    {
        cout<<0<<endl<<0<<endl<<0<<endl<<0<<endl<<0<<endl;
        for(int i=6;i<=n;i++)
        {
            int lim = sqrt(i-2) - 1;
            int ans = 0;
            // cout<<lim<<endl;
            for(int x=1;x<=lim;x++)
            {
                for(int y=1;y<=lim;y++)
                {
                    for(int z=1;z<=lim;z++)
                    {
                        int calc = (x+y)*(x+y) + (z+y)*(z+y) + (x+z)*(x+z);
                        // cout<<calc<<endl;
                        if(calc == 2*i)
                        {
                            ans++;
                        }
                        if(calc > 2*i)
                            break;
                    }
                }
            }
            cout<<ans<<endl;
        }
    }
    else
    {
        for(int i=0;i<n;i++)
        {
            cout<<0<<endl;
        }
    }
    
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const long long INF = 1LL << 60;

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

int main()
{   
    string week[] = {"SUN","MON","TUE","WED","THU","FRI","SAT" };
    string s; cin >> s;
    int a;
    for(int i=0;i<7;i++){
        if(s == week[i])a=i;
    }
    if(s=="SUN") cout << 7 << endl;
    else cout << 7-a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
int dp[105][100000];
int c[105], v[105];
int n, w;

int func(int i, int presum)
{
    if(i==n) return 0;
    if(dp[i][presum]!=-1) return dp[i][presum];
    int a=0;
    if(c[i]+presum<=w) a=max(a, v[i]+func(i+1, c[i]+presum));
    a=max(a, func(i+1, presum));
    dp[i][presum]=a;
    return dp[i][presum];
}

main()
{
    fastio;
    cin>>n>>w;
    for(int i=0; i<n; i++) cin>>c[i]>>v[i];
    memset(dp, -1, sizeof(dp));
    cout<<func(0, 0);
}


Measured memory_bytes: 82304
n = int(input())
H = list(map(int, input().split()))

for i in range(n-1, 0, -1):
    if H[i-1] > H[i]:
        if H[i-1]-1 > H[i]:
            print('No')
            exit()
        else:
            H[i-1] += -1
print('Yes')

Measured memory_bytes: 14524
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  int N;
  cin >> N;
  ll A[N];
  REP(i, N) { cin >> A[i]; }
  ll res = A[0];
  FOR(i, 1, N) { res = __gcd(res, A[i]); }
  cout << res;
  return 0;
}

Measured memory_bytes: 1024
#include <assert.h>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

const ll MOD = 998244353;
// const ll MOD = 1e9+7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll x;
  std::cin>>x;
  ll ans=0;
  ans+=((x-1)/11)*2;
  x=(x-1)%11;
  if(x>5){
    ans++;
  }

  std::cout<<ans+1;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef char string[101];

int main() {
    int N, A = 0, B = 0;
    string S;
    scanf("%d", &N);
    scanf("%s", S);
    if (N % 2 != 0) {
        printf("No\n");
        exit(0);
    }
    for (int i = 0; i < N / 2; i++) {
        A += S[i];
        B += S[i + N / 2];
    }
    printf("%s\n", (A == B) ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma region atcoder
//using mint = modint998244353;
//These are for segment tree
/*int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/
#pragma endregion
#pragma region macros
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n - 1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion

const ll mod = 1000000007;
const int inf = 1001001001;
const ll INF = 1001001001001001001;
const int MAX = 2000005;

template<class T>bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
ll modpow(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}

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

/*-----------------------------------------------------------------------------------------------------*/
ll fact[MAX], finv[MAX], inv[MAX];

void pre_cal(){
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fact[i] = fact[i-1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod; 
    }
}

ll nCk(ll n, ll k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fact[n] * finv[k] % mod * finv[n - k] % mod;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	pre_cal();
	ll n, m, k; cin >> n >> m >> k;
	ll ans = 0;
	vector<ll> x_num(m), y_num(n);
	for(ll i = 1; i <= m - 1; i++){
		x_num[i] = n * n % mod * (m - i) % mod * i % mod;
	}
	for(ll i = 1; i <= n - 1; i++){
		y_num[i] = m * m % mod * (n - i) % mod * i % mod;
	}
	for(ll i = 1; i <= m - 1; i++){
		ans += x_num[i] * nCk(n * m - 2, k - 2);
		ans %= mod;
		//debug(ans);
	}
	for(ll i = 1; i <= n - 1; i++){
		ans += y_num[i] * nCk(n * m - 2, k - 2);
		ans %= mod;
		//debug(ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 51668
def main():
    n = int(input())
    flag = False
    for i in range(0, 26):
        for j in range(0, 15):
            sumv = 4 * i + 7 * j
            if ( sumv == n ):
                flag = True
                break
        if flag:
            break
    if flag:
        print('Yes')
    else:
        print('No')
        
if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
num = []
3.times do
  num << gets.strip.split.map(&:to_i)
end
l1 = num[0][1]-num[0][0]
l2 = num[1][1]-num[1][0]
l3 = num[2][1]-num[2][0]
r1 = num[0][2]-num[0][1]
r2 = num[1][2]-num[1][1]
r3 = num[2][2]-num[2][1]
if l1==l2 && l2==l3 && r1==r2 && r2==r3
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 14296
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  vi a(26, -1), b(26, -1);
  vi x(n), y(n);
  int now = 0;
  rep(i, n) {
    int k = s[i] - 'a';
    if(a[k] == -1) {
      a[k] = now;
      now++;
    }
    x[i] = a[k];
  }
  now = 0;
  rep(i, n) {
    int k = t[i] - 'a';
    if(b[k] == -1) {
      b[k] = now;
      now++;
    }
    y[i] = b[k];
  }
  cout << (x == y ? "Yes" : "No") << endl;
}

Measured memory_bytes: 2312
#include<algorithm>
#include<cstdio>

int main(){
	int sen[10000];
	int bit[1024];
	int num[1024],s;
	for(int i=0;i<1024;i++)
		for(num[i]=0,s=i;s>0;s >>= 1)num[i]+=s&1;

  int r,c,cc;
  while(true){
		scanf("%d %d",&r,&c);
		if (!r)break;
		for(int i=0;i<c;i++) sen[i] = 0;
		for(int j=0;j<r;j++){
			for(int i=0;i<c;i++){
				scanf("%d",&cc);
				sen[i] <<= 1;
				sen[i] += cc;
			}
		}
		for(int i=0;i<1024;i++) bit[i] = 0;
		for(int i=0;i<c;i++) bit[sen[i]]++;

		int n,sum = 0,smax = 0,k=1,l;
		k <<= r-1;
		for(int i=0;i<k;i++){
			sum = 0;
			for(int j=0;j<k<<1;j++){
				s = j^i;
				sum += num[s] > (r>>1) ? num[s]*bit[j] : (r-num[s])*bit[j];
			}
			if (sum>smax)smax = sum;
		}
		printf("%d\n",smax);
  }
  return 0;
}

Measured memory_bytes: 812
num = int(raw_input())

taro = 0
hanako = 0

for i in range(num):
	cards = raw_input().split()
	if cards[0] < cards[1]:
		hanako += 3
	elif cards[0] == cards[1]:
		taro += 1
		hanako += 1
	else:
		taro += 3

print("{:} {:}".format(taro, hanako))

Measured memory_bytes: 6392
#include<iostream>
using namespace std;
int main()
{
	int a[5][5],n,i,j,k;
	string ans;
	for(i=0;i<=2;i++){
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	cin >> n;
	int b,at[5][5] = {0};
	for(i=0;i<n;i++){
		cin >> b;
		for(j=0;j<3;j++){
			for(k=0;k<3;k++){
				if (a[j][k]==b) at[j][k]=1;
			}
		}
	}
	
	ans="No";
	for(i=0;i<=2;i++){
		if (at[i][0]+at[i][1]+at[i][2]==3) ans="Yes";
		if (at[0][i]+at[1][i]+at[2][i]==3) ans="Yes";
	}

	if (at[0][0]+at[1][1]+at[2][2]==3) ans="Yes";
	if (at[0][2]+at[1][1]+at[2][0]==3) ans="Yes";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist

#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

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

    ll N ; cin >> N; 
    cout << (N-2) * 180 << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
//#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;

int main(void)
{
	int N, M; cin >> N >> M;
	vector<lli> A(M); rep(i, 0, M)cin >> A[i];
	vector<lli> dp(N + 1, -1); rep(i, 0, M)dp[A[i]] = 0;
	dp[0] = 1; dp[1] *= (-1);
	rep(i, 2, N + 1) {
		if (dp[i] == -1)dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
	}
	cout << dp[N] << endl;

	return 0;
}


Measured memory_bytes: 1792
S=input()
if S=="SUN":
  print(7)
elif S=="MON":
  print(6)
elif S=="TUE":
  print(5)
elif S=="WED":
  print(4)
elif S=="THU":
  print(3)
elif S=="FRI":
  print(2)
else:
  print(1)

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

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

  int ans=0;
  rep(i, n-1) {
    if (p[i]==i+1) {
      ans++;
      swap(p[i], p[i+1]);
    }
  }
  if (p[n-1]==n) ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
a = 3.times.map{gets.split.map(&:to_i)}
n = gets.to_i
b = n.times.map{gets.to_i}
f = 3.times.map{[false]*3}

b.each{|x|
  3.times{|i|
    3.times{|j|
      if a[i][j]==x
        f[i][j] = true
      end
    }
  }
}

ans = false
2.times{
  3.times{|i|
    ans = true if f[i].all?
  }
  ans = true if 3.times.map{|i|f[i][i]}.all?
  f = f.transpose.reverse
}

puts ans ? "Yes" : "No"


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
using namespace std;

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

    if (b == "A") {
        cout << "T" << endl;
    }else if (b == "T") {
        cout << "A" << endl;
    }else if (b == "C") {
        cout << "G" << endl;
    }else if (b == "G") {
        cout << "C" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int SelectSort_Scount(int *, int);

int main(){
  int i,N,SwapCount;
  int A[100];

  scanf("%d",&N);
  for(i=0; i<N; i++){
    scanf("%d",&A[i]);
  }

  SwapCount = SelectSort_Scount(A,N);

  for(i=0; i<N; i++){
    printf("%d",A[i]);
    if(i==N-1) printf("\n");
    else printf(" ");
  }
  printf("%d\n",SwapCount);

  return 0;
}

int SelectSort_Scount(int *A, int len){
  int i,j,tmp,min,Scount=0;

  for(i=0; i<=len-1; i++){
    min = i;
    for(j=i+1; j<=len-1; j++){
      if(A[min] > A[j]){
	min = j;
      }
    }
    if(A[i] != A[min]){
      tmp = A[i];
      A[i] = A[min];
      A[min] = tmp;
      Scount++;
    }
  }

  return Scount;
}



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

#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<ll,ll>
#define vi vector<int>
#define vpi vector< pi > 
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL)
const int N=100002;

int main()
{
	ll n,r=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(i%3!=0&&i%5!=0) r+=i;
	}
	cout<<r;

	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void) {
	int H, W, i, j=0;
	while(1){
		scanf("%d %d", &H, &W);
		if((H==0)&&(W==0)){
			break;
			//scanf("%d %d", &H, &W);
		}
		//scanf("%d %d", &H, &W);
		for(i=0;i<H;i++){
			for(j=0; j<W; j++){
				if((i==0)||(i==H-1)||(j==0)||(j==W-1)){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2032
// https://atcoder.jp/contests/abc168/tasks/abc168_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int K;
    string S;
    cin >> K >> S;
    if ((int)S.length() > K) {
        cout << S.substr(0, K) << "...\n";
    } else {
        cout << S << endl;
    }

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  string s;
  cin >> s;
  bool ok = 1;
  if(s[0]!='A')ok = 0;
  if(s[1]<'a'||s[1]>'z')ok=0;
  int c=0;
  for(int i = 2;i<s.size()-1;i++){
    if(s[i]=='C')c++;
    else if (s[i]<'a'||s[i]>'z')ok=0;
  }
  if(c!=1)ok=0;
  if(s[s.size()-1]<'a'||s[s.size()-1]>'z')ok=0;
  if(ok)cout << "AC" << endl;
  else cout << "WA" << endl;
}

Measured memory_bytes: 256
package main

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

func main() {
     sc := bufio.NewScanner(os.Stdin)
     sc.Split(bufio.ScanWords)

     var input [3]int
     for i := 0; i < len(input); i++ {
         if sc.Scan() { input[i], _ = strconv.Atoi(sc.Text()) }
     }

     if input[0] > input[1] { input = swap(input, 0, 1) }
     if input[0] > input[2] { input = swap(input, 0, 2) }
     if input[1] > input[2] { input = swap(input, 1, 2) }

     fmt.Printf("%d %d %d\n", input[0], input[1], input[2])
}

func swap(n [3]int, a, b int)[3]int {
     tmp := n[a]
     n[a] = n[b]
     n[b] = tmp

     return n
}



Measured memory_bytes: 1064
#include <stdio.h>
     
int main(void){
 int S,h,m,s;
 scanf("%d",&S);
 
 m=S/60;
 s=S%60;
 
 h=m/60;
 m=m%60;
 
 printf("%d:%d:%d\n",h,m,s);
 
 return 0;
}


Measured memory_bytes: 2096
#include <iostream>
#include <math.h>
#include <algorithm>
#include <set>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
//static const ll MOD = 1;
static const ll MAX_L = (ll)1 << 62;

static const ll FACT_SIZE = 1000000;

ll a[100001] = {};
ll b[100001] = {};
int main() {
	ll n, h; cin >> n >> h;
	ll maxV = 0;
	rep(i, 0, n) {
		cin >> a[i] >> b[i];
		maxV = max(maxV, a[i]);
	}

	ll ans = 0;
	sort(b, b + n);
	reverse(b, b + n);

	rep(i, 0, n) {
		if (maxV <= b[i]) {
			h -= b[i];
			ans++;
			if (h <= 0) {
				cout << ans << endl;
				return 0;
			}
		}
		else {
			break;
		}
	}

	ans += (h / maxV);
	if (h % maxV != 0)ans++;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
n = int(input())
al = list(map(int,input().split()))

max_al = max(al)

near = ""
abs_tmp = float("inf")
for a in al:
    if abs(a - (max_al/2)) < abs_tmp:
        near = a
        abs_tmp = abs(a - (max_al/2))

if al[0] == 100 and al[1] == 0:
    print(100)
    print(0)
else:
    print(max_al)
    print(near)

Measured memory_bytes: 62704
#include <cstdio>

using namespace std;

const int mod = 1'000'000'007;

int add(int a, int b) {
  a += b;
  return a >= mod ? a - mod : a;
}

int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + mod : a;
}

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

int pw(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return res;
}

int inv(int a) {
  return pw(a, mod - 2);
}

const int N = 200'009;

int f[N];
int rf[N];

int choose(int n, int k) {
  return mul(f[n], mul(rf[k], rf[n - k]));
}

int main() {
  f[0] = 1;
  rf[0] = 1;
  for (int i = 1; i < N; ++i) {
    f[i] = mul(f[i - 1], i);
    rf[i] = inv(f[i]);
  }
  int b, w;
  scanf("%d%d", &b, &w);
  int inv2 = inv(2);
  int pw2 = 1;
  int prb = 0, prw = 0;
  for (int i = 1; i <= b + w; ++i) {
    printf("%d\n", add(prw, mul(inv2, sub(1, add(prb, prw)))));
    pw2 = mul(pw2, inv2);
    if (i >= b) {
      prb = add(prb, mul(choose(i - 1, b - 1), pw2));
    }
    if (i >= w) {
      prw = add(prw, mul(choose(i - 1, w - 1), pw2));
    }
  }
}


Measured memory_bytes: 3712