akhauriyash/Code-Regression huggingface dataset:
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: Shiritori
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef set<string> ss;

/* global variables */

ss ds;

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  string pw;
  cin >> pw;
  ds.insert(pw);

  for (int i = 1; i < n; i++) {
    string w;
    cin >> w;

    if (pw[pw.size() - 1] != w[0] || ds.find(w) != ds.end()) {
      puts("No");
      return 0;
    }

    pw = w;
    ds.insert(w);
  }

  puts("Yes");
  return 0;
}


Measured memory_bytes: 256
h,w = map(int,input().split())
a = [input() for _ in range(h)]
while "."*w in a:
	a.remove("."*w)
lena = len(a)
b = ["".join([a[i][j] for i in range(lena)]) for j in range(w)]
while "."*lena in b:
	b.remove("."*lena)
c = [[b[i][j] for i in range(len(b))] for j in range(len(a))]
for i in c:
	print("".join(i))

Measured memory_bytes: 3064
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int h = parseInt(sc.next());
		int w = parseInt(sc.next());
		char[][] s = new char[h+2][];
		for (i = 1; i <= h; i++) {
			s[i] = (" "+sc.next()+" ").toCharArray();
		}
		s[0] = new char[w+2];
		s[h+1] = new char[w+2];
		sc.close();
		boolean f=true;
LABEL:	for (i = 1; i <= h; i++) {
			for (j = 1; j <= w; j++) {
				if(s[i][j]=='#') {
					if(s[i-1][j]!='#'&&s[i+1][j]!='#'&&s[i][j-1]!='#'&&s[i][j+1]!='#') {
						f=false;
						break LABEL;
					}
				}
			}
			
		}
		out.println(f?"Yes":"No");
	}
}

Measured memory_bytes: 23636
// https://atcoder.jp/contests/abc166/tasks/abc166_f

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DEBUG 1
#if DEBUG
  #define _GLIBCXX_DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const int N_MAX = 1e5;
const int A_MAX = 1e9;
const int B_MAX = 1e9;
const int C_MAX = 1e9;
const int A = 0;
const int B = 1;
const int C = 2;
const string ABC = "ABC";

int N;
int v[3];
vector<string> s;

vector<char> ans;

char move(int x, int y, int z) {
  if (v[x] == 0 && v[y] == 0) {
    return '-';
  }
  if (v[x] <= v[y]) {
    v[x]++;
    v[y]--;
    return ABC[x];
  }
  v[x]--;
  v[y]++;
  return ABC[y];
}

int main() {
  cin >> N >> v[A] >> v[B] >> v[C];
  s = vector<string>(N + 1);
  REP(i, N) cin >> s[i];
  s[N] = "";

  char c;
  ans = vector<char>(N);

  REP(i, N) {
    if (s[i] == "AB") {
      if (s[i + 1] == "AC") {
        c = move(A, B, C);
      } else {
        c = move(B, A, C);
      }
    } else if (s[i] == "BC") {
      if (s[i + 1] == "AB") {
        c = move(B, C, A);
      } else {
        c = move(C, B, A);
      }
    } else { // "AC"
      if (s[i + 1] == "BC") {
        c = move(C, A, B);
      } else {
        c = move(A, C, B);
      }
    }
    if (c == '-') {
      cout << "No" << endl;
      return 0;
    } else {
      ans[i] = c;
    }
  }

  cout << "Yes" << endl;
  REP(i, N) cout << ans[i] << endl;
}


Measured memory_bytes: 6408
#include <iostream>

using namespace std;

int main()
{
  int A, B, soma1, soma2, soma3;

  cin >> A >> B;

  soma1 = A+B;
  soma2 = A+(A-1);
  soma3 = B+(B-1);

  if(soma1 > soma2 & soma1 > soma3){
    cout << soma1 << endl;
  }else{
  if(soma2 > soma1 & soma2 > soma3){
     cout << soma2 << endl;
  }else{
  if(soma3 > soma1 & soma3 > soma2){
     cout << soma3 << endl;
  }else{
    if(soma1 == soma2 | soma1 == soma3){
      cout << soma1 << endl;
    }
  }}}

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
void output(int H[3][10]){
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            printf(" %d",H[i][j]);
        }
        printf("\n");
    }
}
 
 
int main(){
    int H1[3][10],H2[3][10],H3[3][10],H4[3][10],n,h_num,f_num,r_num,div_num;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            H1[i][j] = H2[i][j] = H3[i][j] = H4[i][j] = 0;
        }
    }
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d %d %d %d",&h_num,&f_num,&r_num,&div_num);
        switch(h_num){
        case 1:
            H1[f_num-1][r_num-1] += div_num;
            break;
        case 2:
            H2[f_num-1][r_num-1] += div_num;
            break;
        case 3:
            H3[f_num-1][r_num-1] += div_num;
            break;
        case 4:
            H4[f_num-1][r_num-1] += div_num;
            break;
        }
    }
 
    output(H1);
    printf("####################\n");
    output(H2);
    printf("####################\n");
    output(H3);
    printf("####################\n");
    output(H4);
 
}


Measured memory_bytes: 2608
package main

import (
	"fmt"
)

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

	nums := []int{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}

	fmt.Println(nums[K-1])
}


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

int main() {
  std::string s;
  std::cin>>s;
  
  bool isWhite=s[0]=='W'?true:false;
  
  int ans = 0;
  for(size_t i = 1;i<s.size();++i)
    if(s[i] == 'W'&&!isWhite || s[i] == 'B'&&isWhite){
      ++ans;
      isWhite=isWhite?false:true;
    }
  
  std::cout<<ans<<'\n';
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int n;
  cin>>n;
  int minword[26];
  rep(i,26){
    minword[i]=INF;
  }
  rep(i,n){
    int word[26]={};
    string ss;
    cin>>ss;
    rep(j,ss.length()){
      char c=ss[j];
      word[c-'a']++;
    }
    rep(j,26){
      minword[j]=min(minword[j],word[j]);
    }
  }

  string ans="";

  rep(i,26){
    rep(j,minword[i]){
      ans+=(char)('a'+i);
    }
  }

  cout<< ans<<"\n";

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


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

using namespace std;
long long x[10000010], y[10000010];
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i < (n)i++)
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define int long long
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

signed main()
{

   cin.tie(0);
   ios::sync_with_stdio(false);

   int a, b;
   cin >> a >> b;

   if ((a + b) == 15)
      cout << '+' << '\n';
   else if ((a * b) == 15)
      cout << '*' << '\n';
   else
      cout << 'x' << '\n';
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0].split("");
    const T = arg[1].split("");
    
    let answer = 0;
    
    if(S[0] === T[0]) {
        answer++;
    }
    
    if(S[1] === T[1]) {
        answer++;
    }
    
    if(S[2] === T[2]) {
        answer++;
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 22084
// Sports Festival
// * frank_c1
// * 2017 / 11 / 08

#include <bits/stdc++.h>
using namespace std;

const int maxn = 305;
int a[maxn][maxn], ban[maxn], cnt[maxn];

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) scanf("%d", &a[i][j]);
	int T = m, res = n;
	while (T--) {
		int now = 0;
		memset(cnt, 0, sizeof(cnt));
		for (int i = 1; i <= n; ++i) {
			int p = 1; while (ban[a[i][p]]) ++p;
			int v = a[i][p]; ++cnt[v]; while (cnt[v] > cnt[now]) now = v;
		} res = min(res, cnt[now]); ban[now] = 1;
	}
	return printf("%d\n", res), 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

int main(void){
  string s;
  cin >> s;
  
  if (s.size() == 2){
    if (s[0] == s[1])
      cout << 1 << " " << 2 << endl;
    else
      cout << -1 << " " << -1 << endl;
  }
  else {
    ll n = s.size();
    for (int i = 0; i < n-2; i++){
      if (s[i] == s[i+1] || s[i+1] == s[i+2] || s[i] == s[i+2]){
        cout << i+1 << " " << i + 3 << endl;
        return 0;
      }
    }

    cout << -1 << " " << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 3768
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

vector<bool> deck[4];

int main(){
	FIO
	
	for(int i = 0; i < 4; i++)deck[i].resize(14);

	int n;cin >> n;
	for(int i = 0; i < n; i++){
		char c;cin >> c;int num; cin >> num;
		if(c == 'S')deck[0][num] = true;
		if(c == 'H')deck[1][num] = true;
		if(c == 'C')deck[2][num] = true;
		if(c == 'D')deck[3][num] = true;
	}
	for(int i = 0; i < 4; i++){
		for(int j = 1; j <= 13; j++){
			if(!deck[i][j]){
				if(i == 0)cout << 'S' << " " << j << "\n";
				if(i == 1)cout << 'H' << " " << j << "\n";
				if(i == 2)cout << 'C' << " " << j << "\n";
				if(i == 3)cout << 'D' << " " << j << "\n";
			}
		}
	}
	return 0;
}



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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int a, b;
    cin >> a >> b;
    cout << a*b << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;
const long long INF = 1LL << 60;    // 1.15x10^18
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int r;
    while (cin >> r, r) {
        vector<int> w(2), h(2), x(2), y(2);
        using ll = long long;
        using Field = vector<vector<ll>>;
        vector<Field> a(2);
        for (int k: {0, 1}) {
            cin >> w[k] >> h[k] >> x[k] >> y[k]; x[k]--, y[k]--;
            a[k].resize(h[k], vector<ll>(w[k]));
            for (auto &ai: a[k]) for (auto &aij: ai) cin >> aij;
        }
        auto dijkstra = [&](const Field &a, int si, int sj) {
            int h = a.size(), w = a[0].size();
            vector<vector<ll>> dp(h, vector<ll>(w, INF));
            using pii = pair<int, int>;
            using Pi = pair<long long, pii>;
            priority_queue<Pi, vector<Pi>, greater<Pi>> que;
            dp[si][sj] = a[si][sj]; que.emplace(dp[si][sj], pii(si, sj));
            int dij[] = {0, 1, 0, -1, 0};
            while (!que.empty()) {
                long long cost; pii p; tie(cost, p) = que.top(); que.pop();
                int i, j; tie(i, j) = p;
                if (dp[i][j] < cost) continue;
                for (int k = 0; k < 4; k++) {
                    int ni = i + dij[k], nj = j + dij[k + 1];
                    if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
                    if (chmin(dp[ni][nj], max(dp[i][j], a[ni][nj]))) {
                        que.emplace(dp[ni][nj], pii(ni, nj));
                    }
                }
            }
            vector<ll> dist(h * w);
            for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) {
                dist[i * w + j] = dp[i][j];
            }
            dist.emplace_back(0);
            sort(dist.begin(), dist.end());
            return dist;
        };
        auto v = dijkstra(a[0], y[0], x[0]);
        auto u = dijkstra(a[1], y[1], x[1]);
        int n = h[0] * w[0], m = h[1] * w[1];
        ll ans = INF;
        for (int i = 0; i <= r; i++) {
            if (i <= n && r - i <= m) chmin(ans, v[i] + u[r - i]);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 15500
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			int n = sc.nextInt();
			if (n == 0) {
				break;
			}
			int[][] a = new int[n][n];
			for (int i = 0; i < n; i++) {
				int m = sc.nextInt();
				for (int j = 0; j < m; j++) {
					a[i][sc.nextInt() - 1] = 1;
				}
			}

			int[] l = new int[n];
			int k = sc.nextInt();
			for (int i = 0; i < k; i++) {
				l[sc.nextInt() - 1] = 1;
			}

			int ans = -1;
			L: for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (a[i][j] < l[j]) {
						continue L;
					}
				}

				if (ans == -1) {
					ans = i + 1;
				} else {
					ans = -1;
					break;
				}
			}

			System.out.println(ans);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int EK_MAX = 210;
const int EK_EDGE_MAX = 10010;

template <class T> class EK{
	vector<int> V[EK_MAX];
	pair<int , int> edge[EK_EDGE_MAX];
	T f[EK_EDGE_MAX * 2];
	int d[EK_MAX];
	int n;
	
	int rev(int a){
		return a / 2 * 2 + (a + 1) % 2;
	}
	
	void bfs(int s){
		fill(d , d + EK_MAX , -1);
		d[s] = 0;
		queue<int> Q;
		Q.push(s);
		while(!Q.empty()){
			int x = Q.front(); Q.pop();
			for(vector<int>::iterator it = V[x].begin() ; it != V[x].end() ; ++it){
				if(f[*it] == 0) continue;
				int y = (*it) % 2 == 1 ? edge[(*it)/2].first : edge[(*it)/2].second;
				if(d[y] >= 0) continue;
				d[y] = d[x] + 1;
				Q.push(y);
			}
		}
	}
	
public:
	
	EK(){
		n = 0;
		fill(f , f + EK_EDGE_MAX * 2 , 0);
	}
	
	int put(int a , int b , T c){
		edge[n] = make_pair(a , b);
		V[a].push_back(2*n);
		V[b].push_back(2*n+1);
		f[2*n] = c;
		f[2*n+1] = 0;
		return n++;
	}
	
	T ans(int s , int t){
		while(1){
			bfs(s);
			if(d[t] < 0){
				T x = 0;
				for(vector<int>::iterator it = V[s].begin() ; it != V[s].end() ; ++it){
					x += f[(*it)/2*2+1] * ((*it) % 2 == 0 ? 1 : -1);
				}
				return x;
			}
			queue<int> Q;
			T y = 123456789;
			for(int i = t ; i != s ;){
				for(vector<int>::iterator it = V[i].begin() ; it != V[i].end() ; ++it){
					if(f[rev(*it)] == 0) continue;
					int z = (*it) % 2 == 1 ? edge[(*it)/2].first : edge[(*it)/2].second;
					if(d[z] == d[i] - 1){
						i = z;
						y = min(y , f[rev(*it)]);
						Q.push(*it);
						break;
					}
				}
			}
			while(!Q.empty()){
				int x = Q.front(); Q.pop();
				f[rev(x)] -= y;
				f[x] += y;
			}
		}
	}
};

const int MC = 10234567;
int N;
int x[111];
bool p[MC];
vector<int> V[2];
EK<int> solve;

int main(){
	scanf("%d%d" , &N , x);
	repp(i,1,N){
		scanf("%d" , x + i);
		if(x[i-1]+1 != x[i]){
			V[x[i-1]%2].PB(x[i-1]);
			V[(x[i]-1)%2].PB(x[i]-1);
		}
	}
	V[(x[0]-1)%2].PB(x[0]-1);
	V[x[N-1]%2].PB(x[N-1]);
	fill(p+3,p+MC,1);
	for(int i = 4 ; i < MC ; i += 2) p[i] = 0;
	for(int i = 3 ; i * i <= MC ; ++i) if(p[i]) for(int j = i*i ; j < MC ; j += i) p[j] = 0;
	repp(i,0,V[0].size()){
		repp(j,0,V[1].size()){
			if(p[abs(V[0][i]-V[1][j])]) solve.put(i,N+j,1);
		}
		solve.put(N*2,i,1);
	}
	repp(j,0,V[1].size()) solve.put(N+j,N*2+1,1);
	int z = solve.ans(N*2,N*2+1);
	printf("%d\n" , z + (V[0].size()-z)/2*2 + (V[1].size()-z)/2*2 + (V[0].size()-z)%2*3);
	return 0;
}


Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll
#define INF 1e16
#define mod 1000000007
int main(){
    ll n;
    cin>>n;
    for(double i=1;i<50001;i++){
        if(int(i*1.08)==n) {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
	long long ans = 0;
	vector<int> s(n);
	map<int, int> mapp;
	for(int i = 0; i < n; i++)
	{
		int a; cin >> a;
		s[i] = i + a + 1;
		mapp[i - a + 1]++;
	}
	for(int i = 0; i < n; i++) ans += mapp[s[i]];
	cout << ans;
 
	return 0;
}

Measured memory_bytes: 21128
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    int q;
    cin>>q;
    multiset<int> st;
    rep(i, q) {
        int m, x;
        cin>>m>>x;
        if (m == 0) {
            st.insert(x);
            cout<<st.size()<<endl;
        }
        else if (m == 1) {
            cout<<st.count(x)<<endl;
        }
        else if (m == 2) {
            st.erase(x);
        }
        else {
            int r;
            cin>>r;
            auto it = st.lower_bound(x);
            auto cl = st.upper_bound(r);
            for (; it != cl; ++it) {
                cout<<*it<<endl;
            }
        }
    }
}


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

//#define int long long
typedef long long ll;

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

void solve(){
	int n; cin >> n;
	int ans = 0;
	rep1(i, 100000) {
		if (i*i <= n)ans = i * i;
		else break;
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(6);
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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


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

    int n; cin >> n;
    std::vector<ll> v(n); rep(i,n) cin >> v[i];

    ll ans = 0LL; int cnt = 0;
    rep(i,n){ans += abs(v[i]); if(v[i]<0) cnt++;}

    if(cnt%2==0){
        cout << ans << endl;
        return 0;
    }

    rep(i,n) v[i]=abs(v[i]);
    sort(v.begin(), v.end());
    cout << ans -2*v[0]<< endl;

    return 0;
}


Measured memory_bytes: 1024
def slove():
    import sys
    import heapq
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    s = sum(a)
    t = 0
    ma = 10 ** 15
    for i in range(n-1):
        t += a[i]
        ma = min(ma, abs(t - (s - t)))
    print(ma)


if __name__ == '__main__':
    slove()


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



int32_t main(){
	int n;
	cin >> n;
	vector<int> v(n);
	for(int i = 0 ;i < n; i ++) cin >> v[i];
	map<int,int> c[2];
	c[0][0] = 0;
	c[1][0] = 0;
	for(int i = 0 ; i < n; i ++){
		c[i%2][v[i]]--;
	}
	multiset<int> p;
	for(auto w : c[1]){
		p.insert(w.second);
	}
	int ans = n; 
	for(auto w : c[0]){
		int u = c[1][w.first];
		p.erase(p.find(u));
		auto v = p.begin();
		ans = min(ans ,n + w.second + *v);
		p.insert(u);
	}
	cout << ans << endl;
}

Measured memory_bytes: 9984
#include <cstdio>
 #include <cstdlib>
 #include <iostream>
 #include <fstream>
 #include <sstream>
 #include <set>
 #include <map>
 #include <vector>
 #include <list>
 #include <algorithm>
 #include <cstring>
 #include <cmath>
 #include <string>
 #include <stack>
 #include <queue>
 #include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
 #include <cassert>
 #include <iomanip>        //do setprecision
 #include <ctime>
 #include <complex>
 using namespace std;

 #define FOR(i,b,e) for(int i=(b);i<(e);++i)
 #define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
 #define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
 #define REP(x, n) for(int x = 0; x < (n); ++x)

 #define ST first
 #define ND second
 #define PB push_back
 #define PF push_front
 #define MP make_pair
 #define LL long long
 #define ULL unsigned LL
 #define LD long double
 #define pii pair<int,int>
 #define pll pair<LL,LL>

 const double pi = 3.14159265358979323846264;
 const int mod=1000000007;

int main(){
	int x,y,z,k;
	cin>>x>>y>>z>>k;
	vector<LL> a(x),b(y),c(z);
	FOR(i,0,x)cin>>a[i];
	FOR(i,0,y)cin>>b[i];
	FOR(i,0,z)cin>>c[i];
	vector<LL> s;
	vector<LL> ans;
	FOR(i,0,x){
		FOR(j,0,y){
			s.PB(a[i]+b[j]);
		}
	}
	sort(s.begin(),s.end());
	int ls=s.size(),lc=c.size();
	FOR(i,0,lc){
		int idx=max(ls-k-1,0);
		FOR(j,idx,ls){
			ans.PB(c[i]+s[j]);
		}
	}

	int lans=ans.size();
	sort(ans.begin(),ans.end());
	FORD(i,lans,lans-k){
		cout<<ans[i]<<"\n";
	}
  return 0;
}


Measured memory_bytes: 43112
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define INF 0x7FFFFFFF
#define ll long long
const double EPS = 1e-10;


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


Measured memory_bytes: 384
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>


#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define pf push_front
#define eb emplace_back 
#define all(v) (v).begin(), (v).end()
#define mod 100000
#define mi multiset<int>
#define mii multiset<pii>
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000

// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>


// using namespace __gnu_pbds;
using namespace std;

int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}

int modp(int a,int m,int n)
{
    n=n%(m-1);
    a=a%m;
    int res=1;
    while(n>0)
    {
        if(n&1) res=(res*a)%m;
        a=(a*a)%m;
        n>>=1;
    }
    return res;
}



void solve()
{
    int t,n,m,i,k,l,r,u,v,w,j,s,pos,sum=0,flag=0,count=0;
    string S,T,U;
    int h1,m1,h2,m2;
    cin>>h1>>m1>>h2>>m2>>k;
    int M1,M2;
    M1=h1*60+m1;
    M2=h2*60+m2;
    cout<<(M2-M1-k);    
}



signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        cout<<"\n";
    }
    return 0;
}


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

int main() {
	int n;
	cin >> n ;
	//char arr[2*n];
	string s,t;
	cin >> s;
	cin >> t;
    for(int i=0;i<n;++i)
    {
        cout << s.at(i) << t.at(i) ;
    }
	// your code goes here
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
a = int(input())
num_list = list(map(int,input().split()))
flag = "ok"
num_o = 0
for i in range(a-1):
  if num_list[i] > num_o:
    num_list[i] = num_list[i]-1
    num_o = num_list[i]
  if num_list[i]-num_list[i+1] > 0:
    flag = "ng"
    break

num_counter = Counter(num_list)
num_most = num_counter.most_common()
#if a == num_most[0][1] and a != 0:
#  flag = "No"
if flag == "ok":
  print("Yes")
else:
  print("No")


Measured memory_bytes: 21668
#B
a,b,c,d = map(int,input().split())

while a > 0 and c > 0:
    c -= b
    if c <= 0:
        flg = True
        break
    a -= d
    if a <= 0:
        flg = False
        break
    
if not flg:
    print('No')

else:
    print('Yes')

Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define ll long long
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;
int main()
{
    ll a,b,i,j,n,m,k;
    ll arr[100000]={0};
    for(i=1;i<100;i++) for(j=1;j<100;j++) for(k=1;k<100;k++)
    {
        n=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(i*k);
        arr[n]++;
    }
    cin>>m;
    for(i=1;i<=m;i++) cout<<arr[i]<<endl;
    
}

Measured memory_bytes: 4376
var inputRaw = require('fs').readFileSync('/dev/stdin', 'utf8');

var input = inputRaw
  .trim()
  .split('\n');

var robots = input
  .slice(1)
  .map(i => i.split(' ').map(Number))
  .map(i => [i[0] - i[1], i[0] + i[1]]);
robots.sort((a, b) => a[1] - b[1]);

var selectedRobots = [robots[0]];

for (var i = 1; i < robots.length; i++) {
  var lastSelectedRobot = selectedRobots[selectedRobots.length - 1];
  var lastSelectedRobotEnd = lastSelectedRobot[1];
  var start = robots[i][0];
  if (lastSelectedRobotEnd <= start) {
    selectedRobots.push(robots[i]);
  }
}

console.log(selectedRobots.length);


Measured memory_bytes: 53788
#include <stdio.h>

int main(void)
{
	int x;
	int i = 1;
	
	while (1){
		scanf("%d", &x);
		
		if (x == 0){
			break;
		}
		
		printf("Case %d: %d\n", i, x);
		i++;
	}
	
	return (0);
}



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

int N, K, snck, snuk, fq[101], misch = 0;

int main() {
    cin>>N>>K;
    for(int i = 0; i < K; i++) {
        cin>>snck;
        for(int j = 0; j < snck; j++) {
            cin>>snuk;
            fq[snuk]++;
        }
    }
    for(int i = 1; i <= N; i++)
        if(!fq[i])
            misch++;
    cout<<misch;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <utility>
#include <stdint.h>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>

using namespace std;

class Node {
public:
  Node()
    : counter_(0), parent_(nullptr)
  {
  };

  void set_parent(Node* node) {
    this->parent_ = node;
  }

  void count_up(uint32_t x) {
    if (this->parent_ != nullptr) {
      this->counter_ = this->parent_->counter() + x;
    } else {
      this->counter_ = x;
    }
  }

  uint64_t counter() {
    return this->counter_;
  }

private:
  Node* parent_;
  uint64_t counter_;
};

int main()
{
  uint32_t N, Q;
  cin >> N >> Q;

  vector<Node*> nodes(N+1);
  for (Node*& n : nodes)
    n = new Node();
  
  for (int n=0; n<N-1; ++n) {
    int a, b;
    cin >> a >> b;
    nodes[b]->set_parent(nodes[a]);
  }

  multimap<uint32_t, uint16_t> values;

  for (int q=0; q<Q; ++q) {
    int p, qq;
    cin >> p >> qq;
    values.emplace(p,qq);
  }

  for (int n=1; n<=N; ++n) {
    auto value_n = values.equal_range(n);
    uint64_t sum = accumulate(value_n.first, value_n.second, 0, [](uint64_t a, pair<const uint32_t,uint16_t> b){return a+b.second;});
    nodes[n]->count_up(sum);
    cout << nodes[n]->counter() << ' ';
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 19584
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define pb push_back

//PBDS: policy-based data structures. 包含 associative containers 和优先队列两类。
// Associative containers are typically parameterized by various policies.
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

using order_statistic_tree = __gnu_pbds::tree<
        long long,
        __gnu_pbds::null_type,
        less_equal<long long>,
        __gnu_pbds::rb_tree_tag,
        __gnu_pbds::tree_order_statistics_node_update>;



using ll = long long;
using ull = unsigned long long;
using ul = unsigned long;


template<typename T>
void print(const T &t, const char &eol = '\n') {
    cout << t << eol;
}

template<typename T, typename ...Args>
void print(const T &t, const Args &...rest) {
    cout << t << ' ';
    print(rest...);
}


using PII=pair<int,int>;


namespace hungary {
    const int N = 105;
    bool vis[N];
    int match[N];
    int n;
    bool e[N][N];
    bool dfs(int u) {
        for (int v = 1; v <= n; v++) {
            if(!e[u][v]) continue;
            if (vis[v]) continue;
            vis[v] = true;
            if (!match[v] || dfs(match[v])) {
                match[v] = u;
                return true;
            }
        }
        return false;
    }

    int hungary(int n) {
        memset(match, 0, sizeof(match));
        int res = 0;
        for (int i = 1; i <= n; i++) {
            memset(vis, 0, sizeof(vis));
            res += dfs(i);
        }
        return res;
    }
}

const int N = 200000+5;

int a[N], b[N];
int c[N];


int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////

    auto low=[](int k, int x) {
        return x & (1<<k+1)-1;
    };
    auto check_bit=[](long long x, int i){
        return bool(x & 1 << i);
    };
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
        cin >> b[i];
    int res = 0;

    int n_carry = 0;
    for (int i = 0; i <28; i++) {
        for (int j = 0; j < n; j++)
            c[j] = low(i, a[j]);
        sort(c, c+n);
        int nzero = lower_bound(c, c+n, 1<<i) - c;
        int n_one = n - nzero;
        int cnt = n_carry;
        n_carry = 0;
        // 由于只需知道奇偶性，所以+可以用^代替
        for(int j=0; j<n; j++) {
            if (check_bit(b[j], i))
                cnt ^= nzero;
            else
                cnt ^= n_one;
            int tmp = (1 << i+1) - low(i, b[j]);
            n_carry ^= n - (lower_bound(c, c+n, tmp) - c);
        }
        if(cnt&1) res += 1<<i;
    }
    if(n_carry & 1) res += 1 << 28;
    print(res);
    return 0;
}

Measured memory_bytes: 2560
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	a := make([]int, n)
	var sum int
	for i := 0; i < n; i++ {
		a[i] = nextInt()
		sum += a[i]
	}
	sort.Ints(a)
	if a[len(a)-m]*(4*m) >= sum {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}


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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    ll n;
    cin >> n;

    if(n==1){
        cout << "0" << "\n";
        return 0;
    }

    map<ll,ll> ap;
    ll div=2;
    while(div*div<=n){
        if(n%div==0){
            ap[div]++;
            n/=div;
        }
        else div++;
    }
    ap[n]++;

//    for(auto itr = ap.begin(); itr != ap.end(); itr++) {
//        cout << itr->first << " " << itr->second << "\n";
//    }

    ll count=0;
    for(auto itr = ap.begin(); itr != ap.end(); itr++) {
        ll apval=itr->second;
        ll red=1;
        while(apval>=red) {
            apval-=red;
            red++;
            count++;
        }
    }
    cout << count << "\n";

    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include <set>
#include <numeric>
#include<math.h>
#include<queue>
#include<unordered_map>
#include<cmath>
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
#define ll long long int
#define pi (double)3.14159265359
#define vect vector <int>
#define pb push_back
using namespace std;

void solve() {
	char x;
	cin >> x;
	if (int(x)<92) {
		x = x + 32;
		cout <<'A';
	}
	else {
		x = x - 32;
		cout << 'a';
	}

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


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
double f[3000][3000],p[3000];
int main()
{
        int n,i,j;
        double s=0.0;
        scanf("%d",&n);
        for(i=1;i<=n;i++)
                scanf("%lf",&p[i]);
        f[0][1]=0;
        f[0][0]=1;
        for(i=1;i<=n;i++)
                f[i][0]=f[i-1][0]*(1-p[i]);
        for(i=1;i<=n;i++)
                for(j=1;j<=i;j++)
                        f[i][j]=f[i-1][j]*(1-p[i])+f[i-1][j-1]*p[i];
        for(i=n/2+1;i<=n;i++)
                s+=f[n][i];
        printf("%.10lf",s);
        return 0;
}

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

int main()
{
  int ncompetitor, k, nquestion;
  cin >> ncompetitor >> k >> nquestion;

  vector<int> v(ncompetitor, k);
  for (int i = 0; i < nquestion; i++) {
    int a;
    cin >> a;
    v.at(a-1)++;
  }
  for (int x : v) {
    if (x - nquestion <= 0) {
      cout << "No\n";
    } else {
      cout << "Yes\n";
    }
  }
  return 0;
}


Measured memory_bytes: 1024
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int res;
int n,t;

int dfs(const vv<int> &g,int v,int p){
  int re=0;
  for(int w:g[v]) MX(re,dfs(g,w,v));
  ++re;
  //  cout<<pii(v,re)<<endl;
  if(v&&p&&re>=t){
    //    cout<<"!"<<endl;
    ++res;
    re=0;
  }
  return re;
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  cin>>n>>t;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
    --a[i];
  }
  res=!!a[0];
  vv<int> g(n);
  rep(i,n) if(i) g[a[i]].pb(i);
  dfs(g,0,0);
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 12416
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
const int maxn=200005;
int n,a[maxn],f[maxn],ans;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",a+i);
	for(int i=1;i<=n;i++){
		f[a[i]]=f[a[i]-1]+1;
		ans=max(ans,f[a[i]]);
//		cout<<i<<' '<<a[i]<<' '<<f[a[i]]<<endl;
	}
	cout<<n-ans<<endl;
	return 0;
}

Measured memory_bytes: 2424
def main():
  N = int(input())
  b = 2
  s = set()
  s.add(1)
  while b**2 <= N:
    p = 2
    while b**p <= N:
      s.add(b**p)
      p += 1
    b += 1

  print(max(s))


if __name__ == "__main__":
  main()


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll n[90], x;
  n[0] = 2, n[1] = 1;
  cin >> x;
  for(int i = 2; i < 90; i++) n[i] = n[i - 1] + n[i-2];

  cout << n[x] << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string S, T;
    cin >> S >> T;
    
    int answer=1001; //1000以上にしておく
    
    for(int i=0; i<S.size()-T.size()+1; i++){
        int x=0;
        for(int j=0; j<T.size(); j++){
            if(S.at(i+j)!=T.at(j)){
                x++; //一致しなかった文字の数
            }
        }
        
        if(x<answer){
            answer = x;
        }
    }
    
    cout << answer << endl;
}

Measured memory_bytes: 3588
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
 
static const double EPS = 1e-8;

static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

void disp(int stage[12][12], const int stage_size){
  for(int y = 0; y < stage_size; y++){
    for(int x = 0; x < stage_size; x++){
      printf("%d ",stage[y][x]);
    }
    printf("\n");
  }
  printf("\n");
}

class Cell {
public:
  int x;
  int y;
  int energy;
  Cell(int x,int y,int energy)
    : x(x), y(y), energy(energy) {}
};

bool check_all_zero(int stage[12][12], const int stage_size){
  for(int y = 0; y < stage_size; y++){
    for(int x = 0; x < stage_size; x++){
      if(stage[y][x] != 0) return false;
    }
  }
  return true;
}

Cell find_starting_point(int stage[12][12], const int stage_size){
  for(int y = 0; y < stage_size; y++){
    for(int x = 0; x < stage_size; x++){
      if(stage[y][x] < 0){
        return Cell(x,y,-stage[y][x]);
      }
    }
  }
  return Cell(-1,-1,0);
}

bool dfs(int stage[12][12], const int stage_size,
         int sx, int sy,int life){
  bool res = false;
  if(life < 0){
    return false;
  }
  if(life == 0){
    if(check_all_zero(stage,stage_size)){
      return true;
    }
    else{
      Cell c = find_starting_point(stage,stage_size);
      if(c.x == -1 && c.y == -1) return false;
      stage[c.y][c.x] = 0;
      res |= dfs(stage,stage_size,c.x,c.y,c.energy);
      stage[c.y][c.x] = -c.energy;
    }
  }

  for(int i = 0; i < 4; i++){
    int dx = tx[i] + sx;
    int dy = ty[i] + sy;
    if(dx < 0 || dy < 0 || dx >= stage_size || dy >= stage_size){
      continue;
    }
    if(stage[dy][dx] <= 0){
      continue;
    }
    if(life - stage[dy][dx] < 0){
      continue;
    }

    int tmp = stage[dy][dx];
    stage[dy][dx] = 0;
    res |= dfs(stage,stage_size,dx,dy,life - tmp);
    stage[dy][dx] = tmp;
  }
  return res;
}

int main(){
  int stage_size;
  while(~scanf("%d",&stage_size)){
    if(stage_size == 0) break;
    int stage[12][12];
    for(int y = 0; y < stage_size; y++){
      for(int x = 0; x < stage_size; x++){
        scanf("%d",&stage[y][x]);
      }
    }

    printf("%s\n",dfs(stage,stage_size,0,0,0) ? "YES" : "NO");
  }
}

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

int main() {
  int N, A, X;
  cin >> N >> A;
  X = N % 500;

  if(N % 500 == 0 || A > N || A > X) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;


static class P
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        Console.WriteLine(Enumerable.Repeat(0, n).Select(_ => int.Parse(Console.ReadLine())).Distinct().Count());
    }
}


Measured memory_bytes: 13396
#include <stdio.h>
int main() {
	long long n, k, r, R, ans = 0;
	scanf("%lld %lld", &n, &k);
	r = n % k;
	R = k - r;
	if (r <= R) {
		printf("%lld", r);
	}
	else {
		printf("%lld", R);
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll D;
    cin >> D;
    vector<ll> c(26);
    rep(i,26){
        cin >> c[i];
    }
    vector<vector<ll>> s(D,vector<ll>(26));
    rep(i,D){
        rep(j,26){
            cin >> s[i][j];
        }
    }
    vector<ll> t(D);
    /*rep(i,D){
        cin >> t[i];
        t[i]--;
    }*/
    vector<ll> memo(26,-1);
    ll score = 0;
    rep(i,D){
        //score += s[i][t[i]];
        //memo[t[i]] = i;
        ll M = 0;
        rep(j,26){
            if(M < s[i][j]){
                t[i] = j+1;
                M = s[i][j];
            }
        }
        //cout << score << endl;
    }
    rep(i,D){
        cout << t[i] << endl;
    }
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

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

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;

vector<int> Z_algorithm(string S) {
  int c = 0, n = S.size();
  vector<int> Z(n, 0);
  FOR(i, 1, n){
    int l = i - c;
    if (i + Z[l] < c + Z[c]) {
      Z[i] = Z[l];
    } else {
      int j = max(0ll, c + Z[c] - i);
      while (i + j < n && S[j] == S[i + j])
        j++;
      Z[i] = j;
      c = i;
    }
  }

  Z[0] = n;
  return Z;
}

signed main() {
  int N;
  string s;
  cin >> N >> s;


  int ans = 0;
  vector<int> z;
  REP(i, N){
    z = Z_algorithm(s.substr(i, N));
    REP(j, z.size()){
      if(z[j] > j) z[j] = j;
      chmax(ans, z[j]);
    }
  }
   
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 512
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;
 
public class Main {
 
	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;
 
	static void solve() {
		int a=in.nextInt();
		int b=in.nextInt();
		out.println(a*b+" "+(a+a+b+b));
	}
 
	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();
 
		solve();
		out.flush();
 
		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}
 
	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 25996