akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{
	
	public static int H = 100;
	public static int W = 100;

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		boolean map[][] = new boolean[H][W];
		
		for(int m=0;m<H;m++){
			for(int n=0;n<W;n++){
				map[m][n] = false;
				if(m>=H/2) map[m][n] = true;
			}
		}

		int x=0;
		int y=0;
		for(int n=0;n<A-1;n++){
			map[y][x] = true;
			x += 2;
			if(x >=100){
				y += 2;
				x = 0;
			}
		}
		x = 0;
		y = 51;
		for(int n=0;n<B-1;n++){
			map[y][x] = false;
			x += 2;
			if(x >=100){
				y += 2;
				x = 0;
			}
		}
		answer(map);
	}

	private static void answer(boolean m[][]){
		System.out.println(H +" "+ W);
		for(int h=0;h<H;h++){
			String st="";
			for(int w=0;w<W;w++){
				if(m[h][w]) st += "."; 
				else st += "#";
			}
			System.out.println(st);
		}
	}
}

Measured memory_bytes: 30164
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) std::cerr<< #x <<": "<<x<<"\n"
#define debug2(x,y) std::cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<"\n"
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  s += s;
  int n = s.length();
  int m = t.length();
  rep (i, n-m) {
    if (s.substr(i, m) == t) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");

  return 0;
}


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

int main(){
    int n;
    cin >> n;
    if(n < 1000){
        cout << "ABC" << endl;
    }else{
        cout << "ABD" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
  string t;
  cin>>s>>t;
  int N=s.size();
  int M=t.size();
  vector<vector<int>>dp(N+1,vector<int>(M+1,0));
  for(int i=1;i<=N;i++){
  for(int j=1;j<=M;j++){
   if(s.at(i-1)==t.at(j-1))
     dp[i][j]=1+dp[i-1][j-1];
    else
      dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
  }
  }string ans="";
  int I=N; int J=M;
  while(1<=I && 1<=J){
  if(dp[I][J]==dp[I-1][J]){
   I--;
  }else if(dp[I][J]==dp[I][J-1]){
   J--;
  }else{
  ans=s.at(I-1)+ans; I--; J--;
  }
  
  }cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 35584
#include <stdio.h>
#include <stdbool.h>

int main(void){
    int flag = false;
    int i, j, N, Y, total;
    scanf("%i %i", &N, &Y);
    for (i = 0; i <= N; i++){
        for (j = 0; j <= N - i; j++){
            total = 10000 * i + 5000 * j + 1000 * (N - i - j);
            if (total == Y){
                flag = true;
                break;
            }
        }
        if (flag){
            break;
        }
    }
    if (flag){
        printf("%i %i %i\n", i, j, N - i - j);
    } else {
        printf("%i %i %i\n", -1, -1, -1);
    }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int mod = 1e9 + 7;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n; ll k; cin >> n >> k;
	vector<ll> v(n);
	rep(i, n) cin >> v[i];
	sort(all(v)); v.erase(unique(all(v)), v.end());
	
	ll ans = 0;
	set<vector<ll>> vis;
	map<vector<ll>, vector<pair<vector<ll>, ll>>> bucket;
	
	priority_queue<pair<int, vector<ll>>> q;
	q.emplace(0, v);
	
	while(!q.empty()){
		v = q.top().second;
		int c = -q.top().first; q.pop();
		if(vis.count(v)) continue;
		vis.insert(v);
		
		//dbg(c, v);
		vector<ll> diff;
		rep(i, v.size() - 1) diff.pb(v[i + 1] - v[i]);
		bucket[diff].emplace_back(v, k - c);
		
		if(v[0] > 0 && c + 2 <= k){
			vector<ll> nv;
			for(ll i : v) nv.pb((i - 1) / 2);
			if(!vis.count(nv)) q.emplace(-c - 2, nv);
		}
		if(c + 1 <= k){
			vector<ll> nv;
			for(ll i : v) nv.pb(i / 2);
			if(!vis.count(nv)) q.emplace(-c - 1, nv);
		}
	}
	
	for(auto it : bucket){
		vector<pair<vector<ll>, ll>> &v = it.second;
		sort(all(v)); reverse(all(v));
		//dbg(v);
		ll mn = 1e18;
		rep(i, v.size()){
			ll rem = v[i].second, fst = v[i].first[0];
			mn = min(mn, fst - rem - 1);
			ll nxt = i + 1 < v.size() ? v[i + 1].first[0] : -1;
			
			ans += fst - max(nxt, mn);
			ans %= mod;
		}
	}
	
	cout << ans % mod << endl;
	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int d[100001];
	for (int i = 0; i < n; ++i)
	{
		cin >> d[i];
	}
	sort(d, d + n);
	cout << d[n/2] - d[n / 2 - 1] << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#define int long long
using namespace std;

signed  main() {
  string o, e;
  cin >> o >> e;
  string ans;
  for (int i = 0; i < e.size(); i++) {
    ans.push_back(o[i]);
    ans.push_back(e[i]);
  }
  if (o.size() > e.size()) ans.push_back(o[o.size() - 1]);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.algorithm, std.array;
auto solve(string s_) {
    immutable N = s_.to!int();
    auto a = readln.split.map!(to!int).array();
    uint n=1; while(n<N) n*=2;
    auto s = new int[n*2]; s[]=-1;
    void update(int v, int i) {
        for(uint p=v-1+n; p>0; p/=2) s[p]=max(s[p],i);
    }
    int get(int v) {
        if(v<=0 || n<v) return -1;
        uint l=0, r=n, p=1;
        int w=-1;
        while(v<r) {
            auto m = (l+r)/2;
            if(v>m) w=max(w,s[p*2]), p=p*2+1, l=m;
            else p*=2, r=m;
        }
        return max(w,s[p]);
    }
    auto dp = new long[N];
    foreach(i,v;a) {
        immutable k = get(v-1);
        if(k<0) dp[i]=v*(i+1);
        else    dp[i]=dp[k]+v*(i-k);
        update(v,i.to!int());
    }
    return dp.sum();
}
void main(){ for(string s; (s=readln.chomp()).length;) writeln(solve(s)); }

Measured memory_bytes: 10512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int n;
vector<vector<int>> g(100010);

vector<int> calcdist(int s) {
    vector<int> dist(100010, -1);
    dist[s] = 0;
    queue<int> que;
    que.push(s);
    while (!que.empty()) {
        int now = que.front();
        que.pop();
        for (int next : g[now]) {
            if (dist[next] != -1) continue;
            dist[next] = dist[now] + 1;
            que.push(next);
        }
    }
    return dist;
}

int main() {
    int n, u, v;
    cin >> n >> u >> v;
    u--;
    v--;
    rep(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> dist1 = calcdist(u);
    vector<int> dist2 = calcdist(v);

    int ans = 0;
    rep(i, 0, n) {
        if (dist1[i] < dist2[i]) ans = max(ans, dist2[i]);
    }
    cout << ans - 1 << endl;
    return 0;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;


void solve(){
    int n, ans = 0;
    cin>>n;
    int a[n+4];
    f(i,n)cin>>a[i];
    f(i,n-1){
        for(int j = i + 1; j < n; j++)ans += (a[i] * a[j]);
    }
    cout<<ans;
}


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


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
using namespace std;

int main() {
	char A[6];
	cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4] >> A[5];
	if (A[0] == A[5] && A[1] == A[4] && A[2] == A[3])
	{
		cout << "YES";
	}
	else cout << "NO";
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;


int main()
{

    string p;
    cin >> p;

    vector<int>a(p.size()+1), b(p.size()+1);
    int x = 0;
    int n = p.size();long g = 0;
    for (int i = 0; i < n; i++) {
        if (p[i] == '<')a[i + 1] += a[i] + 1;
       

    }
    for (int i = n-1; i >=0; i--) {
        if (p[i] == '>')b[i ] += b[i+1] + 1;


    }
    for (int i = 0; i <= n; i++) {
        g += max(a[i], b[i]);
        //cout << a[i]<<" "<<b[i] << endl;
    }

    cout << g << endl;
    


    
   

    return 0;

}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

bool solve() {
	int H, W, R, C;
	cin >> H >> W >> R >> C;
	if (!H && !W && !R && !C) return (false);

	vector<vector<bitset<4>>> wall(H+2, vector<bitset<4>>(W+2));	
	for (int i = 0; i < H+1; i++) {
		for (int j = 1; j <= W; j++) {
			int c; cin >> c;
			if (c == 1) wall[i][j][0] = wall[i+1][j][2] = true;
		}
		if (i == H) break;
		for (int j = 0; j < W+1; j++) {
			int c; cin >> c;
			if (c == 1) wall[i+1][j][1] = wall[i+1][j+1][3] = true;
		}
	}
	
	vector<vector<bool>> win(H+2, vector<bool>(W+2, false));	
	vector<vector<bool>> used(H+2, vector<bool>(W+2, false));	
	queue<Pi> que;
	
	auto push = [&](int i, int j) {
		win[i][j] = used[i][j] = true;
		que.emplace(i, j);
	};
	for (int i = 1; i <= H; i++) { push(i, 0); push(i, W+1); }
	for (int i = 1; i <= W; i++) { push(0, i); push(H+1, i); }

	while (!que.empty()) {
		int y, x;
		tie(y, x) = que.front(); que.pop();
		for (int k = 0; k < 4; k++) {
			int ny = y + dy[k], nx = x + dx[k];
			if (ny <= 0 || nx <= 0 || ny > H || nx > W) continue;
			if (used[ny][nx]) continue;
			bool f1, f2; f1 = f2 = false;
			for (int l = 0; l < 4; l++) {
				int nny = ny + dy[l], nnx = nx + dx[l];
				if (win[nny][nnx] && wall[ny][nx][l]) f1 = true;
				if (win[nny][nnx] && !wall[ny][nx][l]) f2 = true;
			}
			if (f1 && f2) push(ny, nx);
		}
	}
	bool f = false;
	for (int i = 0; i < 4; i++) {
		int y = R + dy[i], x = C + dx[i];
		if (wall[R][C][i]) continue;
		f |= win[y][x];
	}
	cout << (f ? "Yes" : "No") << endl;
	return (true);
}
int main() {
	while (solve());
	return (0);
}



Measured memory_bytes: 5140
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	m := make(map[int]int)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)

		m[tmp]++
	}

	ans := 0
	for _, v := range m {
		if v%2 != 0 {
			ans++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 8064
n,t = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
l = list(sorted(l,key=lambda x:x[1]))
c,m = [list(i) for i in zip(*l)]
ans = 9999
for i in range(n):
    if m[i] > t:
        break
    else:
        ans = min(ans,c[i])
if ans == 9999:
    print('TLE')
else:
    print(ans)

Measured memory_bytes: 9208
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int num, i, k = 0, ans = 0;
	string s;
	cin >> s;
	vector<vector<ll>> dp(s.size() + 1, vector<ll>(2, 0));
	dp[0][1] = 1;
	rep(i, s.size()) {
		int n = s[i] - '0';
		dp[i + 1][0] = min(dp[i][0] + n, dp[i][1] + 10 - n);
		dp[i + 1][1] = min(dp[i][0] + n + 1, dp[i][1] + 10 - n - 1);
	}
	cout << dp[s.size()][0] << "\n";
	return 0;
}

Measured memory_bytes: 58880
#include <iostream> 
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

using ll = long long;
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()
int main(){
    int A, B, T;
    cin >> A >> B >> T;
    int ans = 0;
    for(int i = A; i <= T + 0.5; i+= A){
        ans += B;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#[macro_use]
mod utils {
    macro_rules! input {
        ($($r:tt)*) => {
            let stdin = std::io::stdin();
            let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
            let mut next = move || -> String{
                bytes
                    .by_ref()
                    .map(|r|r.unwrap() as char)
                    .skip_while(|c|c.is_whitespace())
                    .take_while(|c|!c.is_whitespace())
                    .collect()
            };
            input_inner!{next, $($r)*}
        };
    }
    macro_rules! input_inner {
        ($next:expr) => {};
        ($iter:expr, ) => {};
 
        ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
        ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
            let mut $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
    }
    macro_rules! read_value {
        ($next:expr, ( $($t:tt),* )) => {
            ( $(read_value!($next, $t)),* )
        };
        ($next:expr, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        };
        ($next:expr, chars) => {
            read_value!($next, String).chars().collect::<Vec<char>>()
        };
        ($next:expr, usize1) => {
            read_value!($next, usize) - 1
        };
        ($next:expr, $t:ty) => {
            $next().parse::<$t>().expect("Parse error")
        };
    }
}


fn main(){
    let result;
    input!{
        s: String,
    }
    let s_len = s.len();
    if s == s.chars().rev().collect::<String>() && &s[0..((s_len - 1)/2)] == s[0..((s_len-1)/2)].chars().rev().collect::<String>() && &s[((s_len+3)/2-1)..s_len] == &s[((s_len+3)/2-1)..s_len].chars().rev().collect::<String>() {
        result = "Yes";
    }else{
        result = "No";
    }
    println!("{}", result);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    ll r, d, X;
    cin >> r >> d >> X;
    REP(i,10) {
        X = r*X-d;
        cout << X << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from collections import deque

n,m = map(int,input().split())
outs = [[] for i in range(n)]
ins = [0]*n
ans = []
for i in range(n+m-1):
    a,b = map(int,input().split())
    outs[a-1].append(b-1)
    ins[b-1] += 1
S = deque([])
for i in range(n):
    if ins[i] == 0:
        S.append([i,i])
while len(S) > 0:
    cur = S.popleft()
    ans.append(cur)
    for e in outs[cur[0]]:
        ins[e] -= 1
        if ins[e] == 0:
            S.append([e,cur[0]])
ans.sort()
for i in range(n):
  if ans[i][0] == ans[i][1]:
    print(0)
  else:
    print(ans[i][1]+1)

Measured memory_bytes: 30220
table = [([1989, 1, 8], "heisei"),
         ([1926,12,25], "showa"),
         ([1912, 7,30], "taisho"),
         ([1868, 9, 8], "meiji")]
         
cmp [y1,m1,d1] [y2,m2,d2] =
  if y1 > y2
  then True
  else if y1 == y2
       then if m1 > m2
            then True
            else if m1 == m2
                 then if d1 >= d2
                      then True
                      else False
                 else False
       else False

ans' :: [Int] -> [([Int],String)] -> String
ans' _ [] = "pre-meiji"
ans' [y,m,d] (([yy,mm,dd],str):ls) =
  if cmp [y,m,d] [yy,mm,dd]
  then unwords (str:(map show [y-yy+1,m,d]))
  else ans' [y,m,d] ls
  
ans date@[y,m,d] =
  ans' date table

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = map ans i
  mapM_ putStrLn o

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

int n, k;
string s;
int main() {
  cin >> n >> k >> s;
  char c = *min_element(s.begin(), s.end());
  string t = s;
  reverse(t.begin(), t.end());
  s += t;
  int l = 0;
  for (int i = 0, j = 0; i < n << 1; i++) {
    j = s[i] == c ? j + 1 : 0;
    l = max(l, j);
  }
  int l1 = l;
  for (int i = 1; i < k; i++) {
    l <<= 1;
    if (l >= n) {
      for (int i = 0; i < n; i++) putchar(c);
      return 0;
    }
  }
  string x = "{";
  for (int i = 0, j = 0; i < n << 1; i++) {
    j = s[i] == c ? j + 1 : 0;
    if (j == l1) {
      if (i - n < 0) continue;
      string t = s.substr(i - j - n + l + 1 , n - l);
      reverse(t.begin(), t.end());
      x = min(x, t);
    }
  }
  for (int i = 0; i < l; i++) putchar(c);
  cout << x;
}


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

int k, x;

void init() {
	cin >> k >> x;
	for(int i = k-1; i >= 1; i--) {
		printf("%d ", x-i);
	}
	printf("%d ", x);
	for(int i = 1; i < k; i++) {
		printf("%d ", x+i);
	}
	return ;
}

void solve() {
	return ;
}

int main() {
	init();
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n;
  scanf("%d",&n);
  int ans;
  if(n<=104){
    ans=0;
  }else if(n<=134){
    ans=1;
  }else if(n<=164){
    ans=2;
  }else if(n<=188){
    ans=3;
  }else if(n<=194){
    ans=4;
  }else{
    ans=5;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<tuple>
using namespace std;
int main() {
  int A,B;
  cin >> A >> B;
  string s;
  cin >> s;
  int N = s.size();
  bool flag = 1;
  if (s[A] != '-') flag = 0;
  int cnt = 0;
  for (int i=0; i<N; i++) {
    for (int j=0; j<=9; j++) {
      if (s[i]-'0' == j) cnt++;
    }
  }
  if (cnt == N-1 && flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const long long INF = 1LL << 60;    // 1.15x10^18

long long tot;
pair<long long, pair<int, int>> mi;

using edge = pair<int, long long>;
using Graph = vector<vector<edge>>;
struct LowLink {
    const Graph &g;
    vector<int> aps;                // articulation points
    vector<pair<int, int>> brs;     // brides
    vector<int> seen, ord, low;
    vector<long long> dp;
    LowLink(const Graph &g) : g(g) { }
    int dfs(int u, int p = -1, int time = 0) {
        seen[u] = true;
        ord[u] = low[u] = time++;
        bool exists = false;
        int cnt_ch = 0;
        for (auto &e: g[u]) {
            int v = e.first; long long w = e.second;
            mi = min(mi, {tot - w, minmax(u, v)});
            if (!seen[v]) {
                cnt_ch++;
                time = dfs(v, u, time);
                dp[u] += w + dp[v];
                low[u] = min(low[u], low[v]);   // forward edge
                if (ord[u] < low[v]) {
                    brs.emplace_back(u, v);
                    mi = min(mi, {abs(tot - w - dp[v] * 2), minmax(u, v)});
                }
                if (ord[u] <= low[v]) exists = true;
            } else if (v != p) {
                dp[u] += w;
                low[u] = min(low[u], ord[v]);   // back edge
            }
        }
        if ((p == -1 && cnt_ch > 1) || (p != -1 && exists)) aps.emplace_back(u);
        return time;
    }
    void build() {
        int n = g.size();
        seen.assign(n, 0); ord.resize(n); low.resize(n); dp.resize(n);
        aps.clear(); brs.clear();
        for (int v = 0; v < n; ++v) if (!seen[v]) dfs(v);
        for (auto &br: brs) if (br.first > br.second) swap(br.first, br.second);
        sort(brs.begin(), brs.end());
        sort(aps.begin(), aps.end());
    }
};

int main() {
    mi.first = INF;
    int n, m; cin >> n >> m;
    Graph g(n);
    while (m--) {
        int u, v, w; cin >> u >> v >> w; u--, v--;
        g[u].emplace_back(v, w);
        g[v].emplace_back(u, w);
        tot += w;
    }
    LowLink ll(g);
    ll.build();
    cout << mi.second.first + 1 << " " << mi.second.second + 1 << endl;
    return 0;
}



Measured memory_bytes: 14444
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x <<": "<<x<<"\n"
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
//using template <class T>vec = vector<T>;
template <class T> using vec = std::vector<T>;
template <class T = int> T in(){T x; cin>>x;return(x);}
template <class T > void print(T& x){cout<<x<<"\n";}
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define MAXN 200000
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N=in();
  vec<int>a(MAXN+1,0);
  vec<int>id(MAXN+1,-1);
  REP(i,N){
	  int p=in();
	//  DEBUG(p);
	  a[p]++;
	  id[p]=i;
  }
  int maxN,secondN,idN=-1;
  bool isOne=false;
  REPR(i,MAXN){
	  if (!isOne &&id[i]!=-1){
		maxN=i;
		idN=id[i];
	//	DEBUG(maxN);
	//	DEBUG(idN);
		  if (a[i]!=1){
			//  i=-1;
			  break;
		  }else{
			  isOne = true;	
			  continue;			
		  }
	  }
	  else if (isOne && id[i]!=-1){
		  secondN=i;
		  break;
	  }
  }
  REP(i,N){
	  if (isOne && idN==i){
		  print(secondN);
	  }else{
		  print(maxN);
	  }
  }

}

Measured memory_bytes: 4736
#include<cstdio>
#include<list>
#include<algorithm>
using namespace std;
int main()
{
	int n, x;
	char com[20];
	list<int> l;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%s%d", com, &x);
		if (com[0] == 'i') l.push_front(x);//insert
		else if (com[6] == 'L') l.pop_back();
		else if (com[6] == 'F') l.pop_front();
		else if (com[0] == 'd')
		{
			for (list<int>::iterator it = l.begin(); it != l.end(); it++)
			{
				if (*it == x) 
				{
					l.erase(it);
					break;
				}
			}
		}
	}
	int i = 0;
	for (list<int>::iterator it = l.begin(); it != l.end(); it++)
	{
		if (i++) printf(" ");
		printf("%d", *it);
	}
	printf("\n");
	return 0;
}


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

using namespace std;

int N, M, a[100], b[100];

int A[10][10];

int main(void) {

	cin >> N >> M;

	for (int i = 1; i <= M; i++) {
		cin >> a[i] >> b[i];
	}

	for (int i = 1; i <= M; i++) {
		A[a[i]][b[i]] = 1;
		A[b[i]][a[i]] = 1;
	}

	int ans = 0;
	vector<int> V;
	for (int i = 1; i <= N; i++) {
		V.push_back(i);
	}

	do {
		if (V[0] != 1) { continue; }

		int sign = 1;
		for (int i = 0; i < N-1; i++) {
			if (A[V[i]][V[i + 1]] == 0) { sign = -1; break; }
		}
		if (sign == 1) { ans++; }

	} while (next_permutation(V.begin(), V.end()));

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    int a,b,c;
    cin >> a >> b >> c;
    //処理
    //出力
    if(a+b>=c) cout << "Yes" << ENT;
    else cout << "No" << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int,int>
#define heap priority_queue
#define all(k) k.begin(),k.end()
#define rall(k) k.rbegin(),k.rend()
#define fa(a,c) for(auto &a:c)
#define yes "YES"
#define no "NO"




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

ll n,a,b;
cin>>n>>a>>b;
cout<<min(b,n*a)<<endl;


	return 0;
}


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

const int maxn = 200010, P = 1000000007;
int n, X, Y, col[maxn], cnt[maxn], fact[maxn], finv[maxn];
vector<int> V[maxn], G[maxn], C[maxn];
bool vis[maxn];

int qp(int x, int y) {
    int z = 1;
    for (; y; y >>= 1, x = 1LL * x * x % P) {
        if (y & 1) z = 1LL * z * x % P;
    }
    return z;
}

int main() {
    scanf("%d %d %d", &n, &X, &Y);
    for (int i = 1, x, y; i <= n; i++) {
        scanf("%d %d", &x, &y), col[i] = x;
        V[x].push_back(y), C[x].push_back(i);
    }
    for (int i = fact[0] = finv[0] = 1; i <= n; i++) {
        fact[i] = 1LL * i * fact[i - 1] % P;
        finv[i] = qp(fact[i], P - 2);
    }
    int p1 = 0, p2 = 0;
    for (int i = 1; i <= n; i++) if (!V[i].empty()) {
        sort(V[i].begin(), V[i].end());
        if (!p1) p1 = i;
        else if (!p2) p2 = i;
        if (p1 && p2) {
            int j = i;
            if (V[j][0] < V[p1][0]) swap(j, p1);
            if (V[j][0] < V[p2][0]) swap(j, p2);
        }
    }
    auto add = [&](int u, int v) {
        G[u].push_back(v), G[v].push_back(u);
    };
    for (int i = 1; i <= n; i++) if (!V[i].empty()) {
        for (int j = 1; j < V[i].size(); j++) {
            if (V[i][0] + V[i][j] <= X) add(C[i][0], C[i][j]);
        }
        if (p1 && i != p1) {
            for (int j = 0; j < V[i].size(); j++) {
                if (V[p1][0] + V[i][j] <= Y) add(C[p1][0], C[i][j]);
            }
        }
        if (p2 && i == p1) {
            for (int j = 1; j < V[i].size(); j++) {
                if (V[p2][0] + V[i][j] <= Y) add(C[p2][0], C[i][j]);
            }
        }
    }
    int ans = 1;
    for (int i = 1; i <= n; i++) if (!vis[i]) {
        vector<int> V;
        function<void(int)> dfs = [&](int v) {
            if (!cnt[col[v]]) V.push_back(col[v]);
            vis[v] = 1, cnt[col[v]]++;
            for (int u : G[v]) if (!vis[u]) dfs(u);
        };
        dfs(i);
        int all = 0;
        for (int x : V) {
            ans = 1LL * ans * finv[cnt[x]] % P;
            all += cnt[x], cnt[x] = 0;
        }
        ans = 1LL * ans * fact[all] % P;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 36084
N, M = input().split()
N, M = int(N), int(M)

c = [1] * N
p = [0] * N

p[0] = 1

for counter in range(M):
    x, y = input().split()
    x, y = int(x) - 1, int(y) - 1

    if(c[x] > 0):
        c[x] -= 1
        c[y] += 1

        if(p[x]==1):
            p[y]=1
        if(c[x]==0):
            p[x]=0

sum = 0
for i in range(N):
    if(p[i]>0):
        sum+=1

print(sum)

Measured memory_bytes: 4724
#include <iostream>
#include <algorithm>
#include <cmath>

int n, k;
const int size = 100005;
int stones[size];

int dp[size];

int Solve(int ndx)
{
	if (ndx == n - 1)
		return 0;
	if (dp[ndx] != -1)
		return dp[ndx];
	int ans = 0x7FFFFFFF;
	for (int i = 1; i <= k && i + ndx < n; ++i)
		ans = std::min(ans, std::abs(stones[ndx] - stones[ndx + i]) + Solve(ndx + i));
	return dp[ndx] = ans;
}

int main()
{
	std::cin >> n >> k;
	for (int i = 0; i < n; ++i)
	{
		dp[i] = -1;
		std::cin >> stones[i];
	}
	std::cout << Solve(0) << '\n';
	return 0;
}

Measured memory_bytes: 5760
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

// struct UnionFind {
//     vector<int> par;

//     UnionFind(int n) : par(n, -1) { }
//     void init(int n) { par.assign(n, -1); }

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

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

//     bool merge(int x, int y) {
//         x = root(x); y = root(y);
//         if (x == y) return false;
//         if (par[x] > par[y]) swap(x, y); // merge technique
//         par[x] += par[y];
//         par[y] = x;
//         return true;
//     }

//     int size(int x) {
//         return -par[root(x)];
//     }
// };
struct UnionFind {
    vector<int> par;

    UnionFind(int n) {
        par.assign(n, -1);
    }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    bool is_same(int x, int y) {
        return root(x) == root(y);
    }
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    int size(int x) {
        return -par[root(x)];
    }
};
int main() {
    LL n, m; cin >> n >> m;
    vector<int> a(m), b(m);
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    UnionFind uf(n);
    LL cur = n * (n - 1) / 2;
    vector<LL> res;
    rep(i, m) {
        res.push_back(cur);

        int x = a[m - 1 - i]; int y = b[m - 1 - i];
        if (uf.is_same(x, y)) continue;

        LL sa = uf.size(x); LL sb = uf.size(y);
        cur -= sa * sb;
        uf.merge(x, y);
    }
    reverse(res.begin(), res.end());
    for (auto x : res) {
        cout << x << endl;
    }
    return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

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

    vector<string> v(n);
    NREP() {
        string tmp;
        cin >> tmp;
        sort(ALL(tmp));
        v[i] = tmp;
    }

    string ans = "";
    for (char c = 'a'; c <= 'z'; ++c) {
        ll cnt = LONG_LONG_MAX;
        NREP() {
            ll tmp = count(ALL(v[i]), c);
            cnt = min(tmp, cnt);
        }

        REP(i, cnt) {
            ans += c;
        }
    }

    MSG(ans)
    return 0;
}


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

string c1, c2;

int main() {
    cin >> c1 >> c2;

    bool flag = true;
    for (int i = 0; i < 3; i++) {
        // cout << c2[2 - i];
        // printf("%s %s %s %s\n", c2[2 - i], c1[i], c1[2 - i], c2[i]);
        if (c2[2 - i] != c1[i] || c1[2 - i] != c2[i]) {
            flag = false;
        }
    }

    if (flag) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

ll mod = 1000000007;

ll cal(ll x) {
  ll ret = 1;
  for (ll i = 1; i <= x; i++) {
    ret *= i;
    if (ret >= mod) ret %= mod;
  }
  return ret;
}

int main() {
  ll n, m;
  cin >> n >> m;
  if (abs(n-m) > 1) dump(0);
  else {
    ll res = cal(n)*cal(m)%mod;
    if (n == m) res = (res*2)%mod;
    dump(res);
  }
  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

std::string S, T;

void solve()
{
    std::cin >> S >> T;

	bool ok = true;
	std::map<char, char> ma, ima;
	for (int64_t i = 0; i < S.size(); i++)
	{
		char s = S[i];
		char t = T[i];

		if (ma.count(s) && ma[s] != t) ok = false;
		if (ima.count(t) && ima[t] != s) ok = false;
		ma[s] = t;
		ima[t] = s;
	}

	std::string ans = ok ? "Yes" : "No";
	std::cout << ans << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	solve();
}


Measured memory_bytes: 3816
#include <iostream>
using namespace std;
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; }
const long long INF = 1LL<<60;

const int MAX_N = 110;
const int MAX_V = 100100;

/*
LCS:最長共通部分列問題
sの部分列とtの部分列で最長なものの長さ
dp[i+1][j+1]=sのi文字までとtのj文字まででのLCSの長さ

長さを求めるのと、文字列を復元する２つのパートに別れる
*/

int dp[3010][3010]={0};

int main()
{
  string s,t;cin>>s>>t;
  
  int ls = s.size();
  int lt = t.size();
  
  //dp[i][j]=s,i文字までとt,j文字までのLCSの長さ
  for (int i=0;i<ls;i++)
  {
    for (int j=0;j<lt;j++)
    {
      if (s[i]==t[j]) chmax(dp[i+1][j+1],dp[i][j]+1);
      chmax(dp[i+1][j+1],dp[i+1][j]);
      chmax(dp[i+1][j+1],dp[i][j+1]);
    }
  }
  //cout<<dp[ls][lt]<<endl;
  
  //復元
  string ret="";
  int i=ls;
  int j=lt;
  while(i>0 && j>0)
  {
    if (dp[i][j]==dp[i-1][j])
      i--; 
    else if (dp[i][j]==dp[i][j-1])
      j--;
    else {
      ret = s[i-1] + ret;
      i--;j--;
    }
  }
  
  cout<<ret<<endl;
}

Measured memory_bytes: 35584
#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

ll mod = 1e9 + 7;

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

    ll ret = 1;
    ll fin_count = 0;
    ll calc_count = 0;
    for (int i = 2 * n - 1; i >= 0; i--) {
        if ((i % 2 == 0) == (s[i] == 'W'))fin_count++;
        else {
            ret *= fin_count;
            ret %= mod;
            fin_count--;
            calc_count++;
        }
    }

    for (ll i = 1; i <= n; i++) {
        ret *= i;
        ret %= mod;
    }
    cout << (calc_count == n ? ret : 0) << endl;
    return 0;
}


Measured memory_bytes: 640
N,C = map(int,input().split())
D = [list(map(int,input().split())) for _ in range(C)]
c = [list(map(int,input().split())) for _ in range(N)]


colornum = [[0] * C for _ in range(3)]

for i in range(N):
    for j in range(N):
        idx = (i+j)%3
        colornum[idx][c[i][j]-1] += 1
        
        
colors = list(range(C))
import itertools 

ans = 10**9+7
for v in itertools.permutations(colors,3):
    val = 0

    for i in range(3):
        x = v[i]
        for j in range(C):
            if x == j:continue
            val += colornum[i][j] * D[j][x]
            
    ans = min(ans,val)
    
print(ans)

Measured memory_bytes: 5620
MOD=10**9+7
s=input()[::-1]
l=len(s)
dp=[[0 for j in range(13)] for i in range(l)]
if s[0] == "?":
    for j in range(10):dp[0][j]=1
else:
    dp[0][int(s[0])]=1
m=1
for i in range(1,l):
    m=10*m%13
    if s[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i-1][k]%=MOD
                dp[i][(k+j*m)%13]+=dp[i-1][k]
    else:
        for k in range(13):
            dp[i-1][k]%=MOD
            dp[i][(k+int(s[i])*m)%13]+=dp[i-1][k]
print(dp[-1][5]%(10**9+7))

Measured memory_bytes: 65936
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int A;
	
	cin >> A;

	cout << (A-2) * 180 << endl;

	
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
const int maxn=1110109;
long long a[maxn];
int n;
int main()
{

    while(scanf("%d",&n)!=EOF)
    {

        for(int i=0;i<n;i++)
        scanf("%lld",&a[i]);
        long long cnt=a[0]/2;
        long long s=a[0]%2;
        long long ans=0;
        long long an=0;
        for(int i=1;i<n;i++)
        {
            ans=(s+a[i])/2;
            an=(s+a[i])%2;
            cnt+=ans;
            if(a[i]==0)
            s=0;
            else
            s=an;




        }
        printf("%lld\n",cnt);
    }
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int N, D;
vector<vector<int>> G(10, vector<int>(10));

int d(int a, int b) {
    int ans = 0;
    rep(i, D) ans += (G[a][i] - G[b][i]) * (G[a][i] - G[b][i]);
    return ans;
}

int main() {
    cin >> N >> D;
    rep(i, N) rep(j, D) cin >> G[i][j];
    
    int ans = 0;
    for (int i = 0; i < N; ++i) for (int j = i + 1; j < N; ++j) {
        int x = d(i, j);
        int y = sqrt(x);
        if (x == y * y) ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b,c,n;
    n=0;
    scanf("%d %d %d",&a,&b,&c);
    while(a<=b){
	if(c%a==0)
		n++;
	a++;
    }
    printf("%d\n",n);
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define B begin()
#define E end()
using namespace std;
typedef long long ll;
typedef double D;
typedef vector<ll> VL;
typedef set<ll> SL;
ll M= 1e9+7;	

void solve()
{
	ll n, m, k;
	cin>>n>>m>>k;
	vector<ll> a, b;
	for(int i=0, t;i<n;i++){
		cin>>t;
		a.pb(t);
		if(i) a[i]+=a[i-1];
	}
	for(int i=0, t;i<m;i++){
		cin>>t;
		b.pb(t);
		if(i) b[i]+=b[i-1];
	}
	ll ans=upper_bound(b.begin(), b.end(), k)-b.begin();
	for(int i=0;i<n;i++)
	{
		if(k-a[i]<0)continue;
		ll o=upper_bound(b.begin(), b.end(), k-a[i]) - b.begin();
		ans=max(ans, i+1+o); 
	}
	cout<<ans;
}

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




Measured memory_bytes: 7948
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    int n,k;std::cin>>n>>k;
    int ans=0;
    for(;n>0;n/=k)ans++;
    std::cout<<ans<<std::endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<iostream>

using namespace std;


int main(){
    const int MAX_S = 100000;
    string s;
    cin >> s;
    int n = s.length();

    int m;
    if (n % 2 == 0) m = n / 2;
    else m = n/2 + 1;
    // cout << m;
    char ans[m];
    for(int i = 0; i < n; i++){
        if (i % 2 == 0) ans[i/2] = s[i];
    }
    for(int i = 0; i < m; i++){
        cout << ans[i];
    }
    cout << "\n";
    // printf("%s\n", ans);
}

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



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

    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    
    int n;cin>>n;
    vector<int> a(n);

    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());

    cout<<(a[n-1]-a[0])<<endl;
    
}


Measured memory_bytes: 3644
#b
n = int(input())
l = list(map(int, input().split()))
l_set = set(l)
import itertools
if len(l_set) < 3:
    print("0")
    
else:
    
    ans = 0
    for b in itertools.combinations(l, 3):
        if (b[0] != b[1]) and (b[1] != b[2]) and  (b[2] != b[0]):
            if (b[0] + b[1] > b[2]) and (b[1]+b[2] > b[0]) and (b[2] + b[0] > b[1]):
                ans += 1
    print(ans)

Measured memory_bytes: 9148
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;

int main() {
	long long n,tmp;
	vector <long long>a;
	array<int, 100010> count = {0};
	cin >> n;
	for (long long i = 0; i < n; i++) {
		cin >> tmp;
		a.push_back(tmp);
		a.push_back(tmp + 1);
		a.push_back(tmp + 2);
	}
	
	for (int i = 0; i < a.size(); i++) {
		count[a[i]] += 1;
	}

	int mode = *max_element(count.begin(), count.end());
	

	cout << mode;
	return 0;
}

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

int main() {
 int H, W;
  cin >> H >> W;
  
  for (int i = 0; i < W + 2; i++) {    
    cout << "#";
    if (i == W + 1)
      cout << endl;
  }
  
  for (int i = 0; i < H; i++) {
    string a;
    cin >> a;
    cout << "#" + a + "#" << endl;
  }
  
  for (int i = 0; i < W + 2; i++) {
    cout << "#";
    if (i == W + 1)
      cout << endl;
  }
}


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

int main() {
  int n, t, s = 0;
  cin >> n;
  t = n;
  while(t) {
    s += t % 10;
    t /= 10;
  }
  if(n % s)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int digitBinary(int n);
void dfs(int now,int i,bool san,bool go,bool nana);
vector<int> v;
int n;
int main(){
	int N;
	cin>>N;
	n=digitBinary(N);
	int sum=0;
	if(n<3){cout<<0<<endl;return 0;}
	for(int i=1;i<n;i++)sum+=i>=3?pow(3,i)-(pow(2,i)*3)+3:0;
	dfs(0,0,0,0,0);
//	for(int i=0;i<pow(3,n)-(pow(2,n)*3)+3;i++)cout<<v[i]<<endl;
	sum+=int(distance(v.begin(),upper_bound(v.begin(),v.end(),N)));
	cout<<sum<<endl;
	return 0;
}
void dfs(int now,int i,bool san,bool go,bool nana)
{
	if(i==n){if(san==true&&go==true&&nana==true)v.push_back(now);return;}
	dfs(now*10+3,i+1,1,go,nana);
	dfs(now*10+5,i+1,san,1,nana);
	dfs(now*10+7,i+1,san,go,1);
	return;
}


int digitBinary(int n)
{
    if (n < 100000) {
        if (n < 1000) {
            if (n < 10)
                return 1;
            else if (n < 100)
                return 2;
            else
                return 3;
        } else {
            if (n < 10000)
                return 4;
            else
                return 5;
        }
    } else {
        if (n < 10000000) {
            if (n < 1000000)
                return 6;
            else
                return 7;
        } else {
            if (n < 100000000)
                return 8;
            else if (n < 1000000000)
                return 9;
            else
                return 10;
        }
    }
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef double keytype;

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int main(){
    char b;

    scanf("%c", &b);

    if(b == 'A') puts("T");
    else if(b == 'T') puts("A");
    else if(b == 'C') puts("G");
    else puts("C");

    return 0;
}


Measured memory_bytes: 1532
#include <iostream>
using namespace std;
int main(void)
{
    int a,count=0;
    cin >> a;
    for(int i = 1;i <= a;i++)
    {
        if(i%2!=0)
        {
            int aaa = 0;
            for(int j = 1;j<=i;j++)
            {
                if(i %j==0){
                 aaa++;   
                }
            }
            if(aaa==8) count++;
        }
    }
    cout<<count<<"\n";
}


Measured memory_bytes: 256