akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数leng
#define INF 9223372036854775807 //  巨大数INF
using namespace std;

int f(int n){
  vector<int> vec(n+3);
  vec[0] = 1;
  vec[1] = 1;
  rep(i, n) vec[i+2] = (vec[i]+vec[i+1])%1000000007;
  return vec[n];
}

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M+2);
  a[0] = -1;
  rep(i, M) cin >> a[i+1];
  a[M+1] = N+1;
  
  int ans = 1;
  
  rep(i, M+1) {
    if (a[i]+1 == a[i+1]) {
      ans = 0;
      break;
    }
    int d = a[i+1]-a[i]-2;
    ans = (ans * f(d))%1000000007;
  }
  cout << ans % 1000000007 << endl;
}


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

using namespace std;

const int inf = 0x3f3f3f3f;
const int maxv = 200010;
const int maxe = 100010;
int vertex, RailEdge, RoadEdge, cnt;
int RailHead[maxv], RoadHead[maxv], number[maxv], ans[maxv];
bool vis[maxv];
vector <int> v[maxv];
struct Edge
{
    int to, next;
}e[maxe * 4];

void addEdge(int *head, int from, int to)
{
    e[cnt].next = head[from];
    e[cnt].to = to;
    head[from] = cnt++;
}

void getNumberDFS(int cur)
{
    vis[cur] = true;
    number[cur] = cnt;
    for (int i = RoadHead[cur]; ~i; i = e[i].next)
    {
        int to = e[i].to;
        if (!vis[to])
            getNumberDFS(to);
    }
}

vector <int> valid;

void DFS(int cur)
{
    vis[cur] = true;
    int curNumber = number[cur];
    if (v[curNumber].size() == 0)
        valid.push_back(curNumber);
    v[curNumber].push_back(cur);
    for (int i = RailHead[cur]; ~i; i = e[i].next)
    {
        if (!vis[e[i].to])
            DFS(e[i].to);
    }
}

int main()
{
    memset(RailHead, -1, sizeof(RailHead));
    memset(RoadHead, -1, sizeof(RoadHead));
    for (int i = 0; i < maxv; i++)
        ans[i] = 1;


    int from, to;
    scanf("%d %d %d", &vertex, &RoadEdge, &RailEdge);
    for (int i = 0; i < RoadEdge; i++)
    {
        scanf("%d %d", &from, &to);
        addEdge(RoadHead, from, to);
        addEdge(RoadHead, to, from);
    }
    for (int i = 0; i < RailEdge; i++)
    {
        scanf("%d %d", &from, &to);
        addEdge(RailHead, from, to);
        addEdge(RailHead, to, from);
    }
    cnt = 0;
    for (int i = 1; i <= vertex; i++)
    {
        if (!vis[i])
        {
            getNumberDFS(i);
            cnt++;
        }
    }
//    printf("number:\n");
//    for (int i = 1; i <= vertex; i++)
//        printf("%d%c", number[i], i == vertex ? '\n' : ' ');
    memset(vis, false, sizeof(vis));
    for (int i = 1; i <= vertex; i++)
    {
        if (!vis[i])
        {
            DFS(i);
            for (int i = 0; i < valid.size(); i++)
            {
                int id = valid[i];
                for (int j = 0; j < v[id].size(); j++)
                    ans[v[id][j]] += v[id].size() - 1;
                v[id].clear();
            }
            valid.clear();
        }
    }
//    printf("answer:\n");
    for (int i = 1; i <= vertex; i++)
        printf("%d%c", ans[i], i == vertex ? '\n' : ' ');
    return 0;
}
/*
7 5 5
1 2
2 3
2 5
6 7
5 6
3 5
4 5
3 4
6 7
5 6
 
 1 1 4 1 4 4 4
 */




Measured memory_bytes: 17664
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

int main ()
{
  prep();
  int n;
  cin >> n;
  vector<int> graph[n+1];
  vector<int> opp[n+1];
  int childcnt[n+1];
  for (int i=2; i<=n; i++){
      int a;
      cin >>a;
      graph[a].push_back(i);
      opp[i].push_back(a);
  }
  queue<int> q;
  bool vis[n+1] = {false};
  for (int i=1; i<=n; i++){
      if (graph[i].size() == 0){
          q.emplace(i);
      }
      childcnt[i] = graph[i].size();
  }
  int maxx = 0;
  int vals[n+1] = {0};
  while (!q.empty()){
      int node = q.front();
      
      q.pop();
      childcnt[node]--;
      if (childcnt[node] > 0){
          continue;
      }
      vector<pair<int, int> > v;
      for (int i : graph[node]){
          v.emplace_back(vals[i], i);
      }
      sort(v.rbegin(), v.rend());
      int cnt = 0;
      for (pair<int, int> p : v){
          cnt++;
          vals[node] = max(vals[node], p.first+cnt);
      }
      for (int i : opp[node]){
          q.push(i);
      }
  }
  for (int i=1; i<=n; i++){
      maxx = max(vals[i], maxx);
      //cout << vals[i] << " ";
  }
  cout << maxx;
  return 0; 
}

Measured memory_bytes: 12032
sx, sy, tx, ty = map(int, input().split())
x, y = tx - sx, ty - sy
print("U"*y + "R"*x + "D"*y + "L"*x +
      "L" + "U"*(y+1) + "R"*(x+1) + "D" +
      "R" + "D"*(y+1) + "L"*(x+1) + "U")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    int64_t N;
    cin >> N;
    int64_t sum = 0;
    for (int64_t i=0; i<N; i++)  {
        sum += i;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3492
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int X = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        System.out.println(solve(X, A, B));

        sc.close();
    }

    static String solve(int X, int A, int B) {
        if (B <= A) {
            return "delicious";
        } else if (B <= A + X) {
            return "safe";
        } else {
            return "dangerous";
        }
    }
}

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

int main()
{
    int64_t N,count=0;
    cin >> N;
    int64_t chk=sqrt(N);
    for(int i=1; i<=1000000; i++)
    {
        for(int j=1; j<=1000000; j++)
        {
            if(N-i*j>0)
            {
                count++;
            }
            else
            {
                break;
            }
        }
    }
    cout << count << endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S, T;
  cin >> S >> T;
  int N = (int)S.size(), M = (int)T.size();
  vector<vector<int>> dp(N + 1, vector<int>(M + 1, 0));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (S[i] == T[j]) {
        dp[i + 1][j + 1] = dp[i][j] + 1;
      } else {
        dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
      }
    }
  }
  string res = "";
  int i = N, j = M;
  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 {
      res += S[i - 1];
      i--, j--;
    }
  }
  reverse(res.begin(), res.end());
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 35584
package main

import "fmt"

type Heap struct {
	size  int
	elems [100000]int64
}

type MyHeap interface {
	Size() int
	Push(int64)
	Pop() int64
}

func (heap *Heap) Size() int {
	return heap.size
}

func (heap *Heap) Push(x int64) {
	i := heap.size

	for i > 0 {
		p := (i - 1) / 2

		if heap.elems[p] >= x {
			break
		}

		heap.elems[i] = heap.elems[p]
		i = p
	}

	heap.elems[i] = x
	heap.size++
}

func (heap *Heap) Pop() int64 {
	ret := heap.elems[0]
	heap.size--
	x := heap.elems[heap.size]

	i := 0
	for i*2+1 < heap.size {
		a, b := i*2+1, i*2+2
		if b < heap.size && heap.elems[b] > heap.elems[a] {
			a = b
		}
		if heap.elems[a] <= x {
			break
		}

		heap.elems[i] = heap.elems[a]
		i = a
	}

	heap.elems[i] = x

	return ret
}

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

	pq := new(Heap)
	for i := 0; i < n; i++ {
		var a int64
		fmt.Scan(&a)
		pq.Push(a)
	}

	for i := 0; i < m; i++ {
		max := pq.Pop()
		pq.Push(max / 2)
	}

	fmt.Println(sum(pq.elems))
}

func sum(a [100000]int64) int64 {
	ret := int64(0)
	for _, v := range a {
		ret += v
	}
	return ret
}


Measured memory_bytes: 8320
S=gets.chomp
K=gets.to_i

if S.chars.uniq.length == 1
    puts S.length*K/2
    exit 0
end

a = S.chars.chunk_while {|c1,c2| c1 == c2 }.map(&:count)
ret = a.inject(0) {|sum,cnt| sum += cnt/2 * K }
ret += K-1 if S[0] == S[-1] && a[0].odd? && a[-1].odd?
puts ret

Measured memory_bytes: 1788
#include <iostream>

int main()
{
  long long A, B, K, R;

  std::cin >> A >> B >> K;
  R = (A + B) - K;
  
  if (R <= 0)
  {
    A = 0;
    B = 0;
  }
  else if (A <= K)
  {
    A = 0;
    B = R;
  }
  else
  {
    A -= K;
  }

  std::cout << A << " " << B << std::endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int x = sc.nextInt();

			if (x == 2) {
				System.out.println(2);
				return;
			}

			if (x % 2 == 0) {
				x++;
			}

			do {
				if (isPrime(x)) {
					System.out.println(x);
					return;
				}
				x += 2;
			} while(true);
		}
	}

	private static boolean isPrime(int n) {
		for (int i = 3; i < Math.sqrt(n); i++) {
			if (n % i == 0) {
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

pair<long long,long long> operator-(const pair<long long,long long> &A, const pair<long long,long long> &B){
  return {A.first-B.first,A.second-B.second};
}

int main(){
  int N;
  cin >> N;
  vector<pair<long long,long long>> V;
  for(int i = 0; i < N; ++i){
    long long x, y;
    cin >> x >> y;
    V.emplace_back(x,y);
  }
  int t = 0;
  for(size_t i = 0; i < V.size(); ++i){
    for(size_t j = 0; j < V.size(); ++j){
      if(i == j) continue;
      pair<long long,long long> d = V[j]-V[i];
      int t_ = 0;
      for(size_t k = 0; k < V.size(); ++k){
        for(size_t l = 0; l < V.size(); ++l){
          if(V[l]-V[k] == d){
            ++t_;
            break;
          }
        }
      }
      t = max(t,t_);
    }
  }
  cout << N - t << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		final String b = "CODEFESTIVAL2016";
		
		int dp[][] = new int[20][20];
		for(int i=0; i<=16; i++) {
			dp[0][i] = i;
			dp[i][0] = i;
		}
		
		for(int i=1; i<=16; i++) {
			for(int j=1; j<=16; j++) {
				int f = 0;
				if(a.charAt(i-1) != b.charAt(j-1))
					f = 1;
				
				
				dp[i][j] = dp[i-1][j-1] + f;
			}
		}
		
		System.out.println(dp[16][16]);

	}

}

Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, h, n, k;
  in(n);
  vector<ll> c(n);
  rep(i, n)
    in(c[i]);
  h = 0;
  rep(i, n){
    if(h < c[i]){
      h = c[i];
      a = 0;
      k = i;
    }
    else if(h == c[i])
      a++;
  }
  if(a != 0){
    rep(i, n){
      out(h);
      memi;
    }
  }
  else{
    rep(i, n){
      if(c[i] != h)
        a = max(a, c[i]);
    }
    rep(i, n){
      if(i != k)
        out(h);
      else
        out(a);
      memi;
    }
  }
}

Measured memory_bytes: 3200
H, W = map(int, input().split())
s = [list(input()) for i in range(H)]

def draw_check(s):

    for i in range(H):
        for j in range(W):
            if s[i][j] == '.':
                continue
            else:
                 if all([s[max(0, i - 1)][j] == '.', s[min(H - 1, i + 1)][j] == '.', s[i][max(0, j - 1)] == '.', s[i][min(W - 1, j + 1)] == '.']):
                    return False

    return True

if draw_check(s):
    print('Yes')
else:
    print('No')
   

Measured memory_bytes: 3064
//Never stop trying
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<str> vs;
typedef vector<ld> vd;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

#define dbg(x) cerr << " - " << #x << " : " << x << endl;
#define dbgs(x,y) cerr << " - " << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << " - " << #v << " : " << endl << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;

void IO() {
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
}

int N;
vi K,L,R;

int get(vpi a){
   multiset<int> s;
   FOR(i,0,sz(a)){
      s.insert(a[i].se);
      while(sz(s)>a[i].fi) s.erase(s.begin());
   }
   int ans=0;
   for(auto x: s) ans+=x;
   return ans;
}

int32_t main() {
   boost; IO();

   int TC; cin>>TC; 
   while(TC--){
      cin>>N;
      K.resize(N); L.resize(N); R.resize(N);
      FOR(i,0,N) cin>>K[i]>>L[i]>>R[i];
      vpi a,b;
      int sum=0;
      FOR(i,0,N){
         if(L[i]>=R[i]) a.pb({K[i],L[i]-R[i]});
         else b.pb({N-K[i],R[i]-L[i]});
         sum+=min(L[i],R[i]);
      }
      sort(all(a)); sort(all(b));

      cout << sum+get(a)+get(b) << endl;

   }


   return 0;
}

/* Careful!!!
   .Array bounds
   .Infinite loops
   .Uninitialized variables / empty containers
   .Order of input

   Some insights:
   .Binary search
   .Graph representation
   .Write brute force code
   .Change your approach
*/


Measured memory_bytes: 18952
# 2020/04/30
# AtCoder Beginner Contest 063 - B

# Input
s = input()

# Init
d = dict()

# Calc
for i in range(len(s)):
    if d.get(s[i]) == None:
        d[s[i]] = 1
    else:
        d[s[i]] = d[s[i]] + 1

ans = 'yes'
for key in d:
    if d[key] > 1:
        ans = 'no'
        break

# Output
print(ans)


Measured memory_bytes: 2940
class UnionFind():
    def __init__(self,size):
        self.table=[-1for _ in range(size)]
    def root(self,x):
        while self.table[x]>=0:
            x=self.table[x]
        return x
    def unite(self,x,y):
        s1=self.root(x)
        s2=self.root(y)
        if s1!=s2:
            if self.table[s1]!=self.table[s2]:
                if self.table[s1]<self.table[s2]:
                    self.table[s2]=s1
                else:
                    self.table[s1]=s2
            else:
                self.table[s1]+=-1
                self.table[s2]=s1
        return
    def same(self,x,y):
      return self.root(x)==self.root(y)
n,m=map(int,input().split())
UF=UnionFind(n+m)
for i in range(n):
    for t in map(int,input().split()[1:]):
        UF.unite(i,n+t-1)
print('YNEOS'[len(set(UF.root(i)for i in range(n)))>1::2])

Measured memory_bytes: 59720
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;



signed main(){

	int N;
	cin >> N;
	vector<int> b(N);
	rep(i, N){
		cin >> b[i]; b[i]--;
	}

	vector<int> ans;
	while (b.size()>0){
		// 一致するものを後ろから探す
		int idx = INF;
		for (int i = b.size()-1; i >= 0; i--){
			if (b[i] == i){ idx = i; break; }
		}
		if (idx == INF){
			cout << -1 << endl;
			return 0;
		}
		// idxを削除する
		ans.push_back(idx + 1);
		b.erase(b.begin() + idx);
	}
	for (auto i = ans.rbegin(); i != ans.rend(); i++){
		cout << *i << endl;
	}

	return 0;
}

Measured memory_bytes: 256
/*input
3
011
101
110
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
#define version 20190814
//}}}
const ll maxn=205;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}
int n;
string s[maxn];
bool adj[maxn][maxn];

int dis[maxn][maxn];
bool tg[maxn];
bool vis[maxn];

void dfs(int u){
	vis[u]=1;
	REP(v,n) if(adj[u][v]&&!vis[v]){
		tg[v]=!tg[u];
		dfs(v);
	}
}

int main(){
	IOS;
	cin>>n;
	REP(i,n) cin>>s[i];
	REP(i,n) REP(j,n) adj[i][j]=(s[i][j]=='1');

	REP(i,n) REP(j,n){
		if(i==j) dis[i][j]=0;
		else if(adj[i][j]) dis[i][j]=1;
		else dis[i][j]=INF;
	}

	dfs(0);

	REP(i,n) REP(j,n) if(adj[i][j]){
		if(tg[i]==tg[j]){
			cout<<"-1\n";
			return 0;
		}
	}
	REP(j,n) REP(i,n) REP(k,n){
		dis[i][k]=min(dis[i][k],dis[i][j]+dis[j][k]);
	}
	int mx=0;
	REP(i,n) REP(j,n) mx=max(mx,dis[i][j]);
	cout<<mx+1<<'\n';
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, m,n) for (int i = m; i < (int)(n); i++)
int main(){
int N,X,Y;cin>>N>>X>>Y;
  vector<vector<int>>d(N,vector<int>(N,0));
    X=X-1;Y=Y-1;int a;int b;
  rep(i,N){
    rep(m,i){
      a=i-Y;b=m-X;
      if(a<0){a=a*(-1);}
      if(b<0){b=b*(-1);}
      d.at(i).at(m)=min(i-m,a+b+1);}
  }
  vector<int>number(N);
  rep(i,N){rep(m,i){number.at(d.at(i).at(m))=number.at(d.at(i).at(m))+1;}}
  Rep(i,1,N){cout<<number.at(i)<<endl;}
}

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n;cin>>n;
  if(n==1){
    puts("Hello World");
  }else {
    int a,b;cin>>a>>b;
    cout<<(a+b)<<endl;
  }

  
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
typedef long long ll;
 
int main() {
  ll a,b,c,d;cin>>a>>b>>c>>d;
  cout<<(a-c)*(b-d);
  return 0;
}

Measured memory_bytes: 256
A,B,M = [int(x) for x in input().split()]
A_list = [int(x) for x in input().split()]
B_list = [int(y) for y in input().split()]
discount = []
min = 10000000
for _ in range(M):
  case = [int(x) for x in input().split()]
  discount.append(case)

min_a = sorted(A_list)[0]
min_b = sorted(B_list)[0]
 
for i in range(M):
  temp = A_list[discount[i][0]-1] + B_list[discount[i][1]-1] - discount[i][2]
  if temp < min:
    min = temp
    
if min_a + min_b > min:
  print(min)
else:
  print(min_a + min_b)

Measured memory_bytes: 33776
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

int k;
int a;
int b;

void input() {
  cin >> k >> a >> b;
}

void solve() {
  while (a <= b) {
    if (a % k == 0) {
      cout << "OK\n";

      return;
    }

    ++a;
  }

  cout << "NG\n";
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 3;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(auto i = (N) - 1; i >= 0; i -= 1)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define rand mtrand
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cout << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cout << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = 0x1FFFFFFFFFFFFFFFLL;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}

using P = pair<int,int>;
//random_device seed_gen; mt19937_64 mtrand(seed_gen());
//////////////////////////////////////////

int main(){
  ini(p); vi a(p); in(a);

  // 逆元の前計算
  vi inv(p , 1);
  for(int i = 2; i < p ; i++)
    inv[i] = p - inv[p % i] * (p / i) % p;

  vi ans(p,0);
  // k=0
  ans[0] = a[0];
  // k=1~p-2
  for(int l = 1; l <= p - 1; l++){
    int cur = 1;
    for(int k = 1; k <= p - 1; k++){
      cur = cur * inv[l] % p;
      ans[k] += a[l] * cur;
    }
  }
  for(int k = 1; k <= p - 1; k++){
    ans[k] = (ans[k] % p) * inv[p-1] % p;
  }
  // k = p-1
  ans[p-1] = (ans[p-1] + p - a[0]) % p;

  out(ans);
}

Measured memory_bytes: 256
fun main(args : Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val xx = readLine()!!.split(" ").map { it.toInt() }.sorted()

    if (n >= m) {
        println(0)
        return
    }

    val diffs = mutableListOf<Int>()
    for (i in 1 until m) {
        diffs.add(Math.abs(xx[i]-xx[i-1]))
    }

    println(diffs.sorted().dropLast(n-1).sum())
}



Measured memory_bytes: 52396
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 105;
int n, m;
int a[maxn][maxn];

bool read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
      a[i][j]--;
    }
  }
  return true;
}

int used[maxn][maxn];
vector<int> g[2][maxn];
int p[2][maxn];
int used1[2][maxn];
int curu;

bool dfs(int t, int v) {
  used1[t][v] = curu;
  for (int i = 0; i < sz(g[t][v]); i++) {
    int u = g[t][v][i];
    if (p[!t][u] == -1) {
      p[!t][u] = v;
      p[t][v] = u;
      return true;
    }
  }
  for (int i = 0; i < sz(g[t][v]); i++) {
    int u = g[t][v][i];
    int w = p[!t][u];
    if (used1[t][w] != curu && dfs(t, w)) {
      p[!t][u] = v;
      p[t][v] = u;
      return true;
    }
  }
  return false;
}

int b[maxn][maxn], c[maxn][maxn];
int bb[maxn];

void solve() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      used[i][j] = false;
    }
  }
  for (int it = 0; it < m; it++) {
    for (int i = 0; i < n; i++) {
      g[0][i].clear();
      g[1][i].clear();
      p[0][i] = -1;
      p[1][i] = -1;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (used[i][j]) {
          continue;
        }
        int cc = a[i][j] / m;
        g[0][i].push_back(cc);
        g[1][cc].push_back(i);
      }
    }
    for (int i = 0; i < n; i++) {
      if (p[0][i] == -1) {
        curu++;
        assert(dfs(0, i));
      }
    }
    for (int i = 0; i < n; i++) {
      int cc = p[0][i];
      for (int j = 0; j < m; j++) {
        if (used[i][j] || a[i][j] / m != cc) {
          continue;
        }
        used[i][j] = true;
        b[i][it] = a[i][j];
        break;
      }
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      bb[i] = b[i][j];
    }
    sort(bb, bb + n);
    for (int i = 0; i < n; i++) {
      c[i][j] = bb[i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", b[i][j] + 1);
    }
    printf("\n");
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", c[i][j] + 1);
    }
    printf("\n");
  }
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 640
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		for(double i=1;i<=n;i++) {
			if(Math.floor(i*1.08) == n) {
				int j = (int)i;
				System.out.println(j);
				System.exit(0);
			}
		}
		System.out.println(":(");
	}

}


Measured memory_bytes: 22996
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<ctime>
typedef long long ll ;
#define rep(i, a, b) for (int i = a; i <= b; ++i)
using namespace std;

template <typename tn> void read (tn & a) {
	tn x = 0, f = 1; char c = getchar();
	while (c < '0' || c > '9'){ if (c == '-') f = -1; c = getchar(); }
	while (c >= '0' && c <= '9'){ x = x * 10 + c - '0'; c = getchar(); }
	a = f == 1 ? x : -x;
}

const int MAXN = 100010;
int n, m;
int a[MAXN], fa[MAXN], p[MAXN];
int x[MAXN], y[MAXN];
ll ans;

int find (int x) { return fa[x] == x || fa[x] == 0 ? x : fa[x] = find(fa[x]); }

int main() {
	read(n);
	read(m);
	ans = 0;
	rep(i, 1, n) {
		read(a[i]);
		p[a[i]] = i;
	}
	rep(i, 1, n) fa[i] = i;
	rep(i, 1, m) {
		int x, y;
		read(x);
		read(y);
		x = find(x);
		y = find(y);
		fa[x] = y;
	}
	rep(i, 1, n) {
		if (find(p[i]) == find(i)) ++ans;
	}
	cout << ans << "\n";
	return 0;
} 


Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main(void){
    string s;
    cin>>s;
    int count=0;
    int n=s.length();
    char a='0';
    for(int i=0;i<n;i++){
        if(s[i]!=a){
            count++;
        }
        if(a=='0') a='1';
        else a='0';
    }
    if(count>n-count) cout<<n-count<<endl;
    else cout<<count<<endl;
}


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

int main(void){

  int N;
  scanf("%d\n", &N);

  int ans=0;

  while(N>=0){
    if(N%4==0){
      printf("Yes\n");
      return 0;
    }else{
      N -= 7;
    }
  }

  printf("No\n");

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<pair<int,int> , null_type,less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update> 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define fi first
#define se second
#define endl '\n'
#define int int64_t
#define double long double
#define fdt fuck donald trump
// mt19937 rnd(time(0));
// const int SMALL = LLONG_MIN >> 2;
// const int BIG = LLONG_MAX >> 2;
const int MAXN = (int)2e5 + 3;
const int MOD = 998244353;

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
	// freopen("FDT.txt","r",stdin);
	string s;
	cin >> s;
	cout << (s[2] == s[3] && s[4] == s[5] ? "Yes": "No");
}


Measured memory_bytes: 256
s=input()
q= int(input())

top=""
btm=""

iturn=0
for iq in range(1,q+1):
	t=input().split()
	if t[0]=='1':
		iturn=iturn+1   	
	else:
		iturn2=iturn%2
		if (t[1]=='1' and iturn2==0) or (t[1]=='2' and iturn2==1):
#			s=t[2]+s
#			s='{}{}'.format(t[2],s)
			top=t[2]+top
		else:
#			s=s+t[2]
#			s='{}{}'.format(s,t[2])
			btm=btm+t[2]

if iturn%2==0:
	s=top+s+btm
else:
	s=btm[::-1]+s[::-1]+top[::-1]
print (s)

Measured memory_bytes: 4424
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int main()
{
    long long n,m,i,j,k,x,y,f1=1,f2=1,f3=1;
    string s;
    cin>>s;
    n=s.length();
    x=(n-1)/2;
    y=(n+3)/2;
    for(i=0,j=n-1;i<=j;i++,j--)
    {
        if(s[i]!=s[j])
        {
            f1=0;
            break;
        }
    }
    for(i=0,j=x-1;i<=j;i++,j--)
    {
        if(s[i]!=s[j])
        {
            f2=0;
            break;
        }
    }
    for(i=y-1,j=n-1;i<=j;i++,j--)
    {
        if(s[i]!=s[j])
        {
            f3=0;
            break;
        }
    }
   if(f1==1&&f2==1&&f3==1)
   {
       cout<<"Yes"<<endl;
   }
   else
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    for(int i=0; i<s.size() - 1; i++) {
        if(s[i] == 'A' && s[i + 1] == 'C') {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 0){
				break;
			}
			for(int i = 0;i < n;i++){
				int m = scan.nextInt();
				int e = scan.nextInt();
				int j = scan.nextInt();
				if(m == 100 || e == 100 || j == 100 || m + e >= 180 || (m + e + j) >= 240){
					System.out.println("A");
				}else if((m + e + j) >= 210 || ((m + e + j) >= 150 && (m >= 80 || e >= 80))){
					System.out.println("B");
				}else{
					System.out.println("C");
				}
			}
		}
	}
}

Measured memory_bytes: 28236
H,W,M = map(int,input().split())
listh = [0] * H
listw = [0] * W
s = set()
for i in range(M):
    hm,wm = map(int,input().split())
    listh[hm-1] += 1
    listw[wm-1] += 1
    s.add((hm-1,wm-1))
mh = max(listh)
mw = max(listw)
maxh = [i for i,v in enumerate(listh) if v == mh]
maxw = [i for i,v in enumerate(listw) if v == mw]

import sys
for i in maxh:
    for j in maxw:
        if (i,j) not in s:
            print(mh + mw)
            sys.exit()
print(mh + mw - 1)

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

int main(void){
    int k = 0, s = 0; 
    int ans = 0;

    scanf("%d%d", &k, &s);
/*
    if(3 * k < s){
        printf("0\n");
        return 0;
    }
*/
    for(int i = 0; i <= k; i++){
        for(int j = 0; j <= k; j++){
            if(k >= s - (i + j) && 0 <= s - (i + j)){
                ans++;
//                fprintf(stderr, "i = %d j = %d l = %d\n", i, j, s-(i+j));
            }
        }
    }

    printf("%d\n", ans);

    return 0;

} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}



int main() {
    int a,b;
    cin >> a >> b;
    vector<int> c(a);
    rep(i,a) cin >> c[i];
    sort(c.begin(),c.end());
    int res=0;
    rep(i,b) res+=c[i];
    pt(res);

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    long long a,b,c; cin>>a>>b>>c;
    if(c<=a+b){
        cout<<b+c<<endl;
    }else{
        cout<<a+1+b*2<<endl;
    }
    return 0;
}


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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main(){
  ll N,M ;cin>>N >>M ;
   ll ans = +N*(N-1)/2+M*(M-1)/2; 
  cout<< ans<<endl;
  
  
}
  


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

int main(void) {
	char str[1001];
	char ans[1001];
	int number;
	int i, j;
	gets(str);
	number = strlen(str);
	for (i = 0; i < number+1; i++) {
		if (!strncmp(&str[i], "apple", 5)) {
			strncpy(&ans[i], "peach", 5);
			i += 4;
		}
		else if (!strncmp(&str[i], "peach", 5)) {
			strncpy(&ans[i], "apple", 5);
			i += 4;
		}
		else {
			ans[i] = str[i];
		}
	}
	printf("%s\n", ans);
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
	int n,l,k;
  cin>>n>>l;
  k=n*(l-1)+n*(n+1)/2;
  
  if(1<=1-l&&1-l<=n)
    cout<<k<<endl;
 if(l>0)
	cout<<k-l<<endl;
  if(1-l>n)
    cout<<k-l-n+1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX]; 
void COMinit() {   //MOD combの計算を行う．COMinitを宣言してから以下のCOMルーチンを実行すればよい
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
    COMinit();
    ll n,k;
    std::cin >> n>>k;
    rep(i,k){
        std::cout << (COM(k-1,i)*COM(n-k+1,i+1))%MOD << std::endl;
    }
}


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

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

  int ans = 0;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    while (a % 2 == 0) {
      a /= 2;
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353;
ll n,m,k,ans=0,tmp=1;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int main()
{
    cin>>n>>m>>k;
    for(int i=0;i<=k;i++){
        ans=(ans+(tmp*m%mod)*power(m-1,n-i-1))%mod;
        tmp=tmp*(n-i-1)%mod*power(i+1,mod-2)%mod;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3740
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;

ll fact(int n) {
	if(n == 0) return 1;
	return n * fact(n - 1);
}

int main(){
	int n; cin >> n;
	cout << fact(n) << endl;
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<functional>

using namespace std;

long long convination(int n, int r) {
	if (r == 0)
		return 1;
	else
		return convination(n, r - 1)*(n - r + 1) / r;
}

int main() {
	long long n, a, b, v[60], c = 0, d, ans = 0;
	double amax, sum = 0;
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++)cin >> v[i];
	sort(v, v + n, greater<long long>());
	for (int i = 0; i < a; i++) {
		sum += v[i];
		if (v[c] > v[i])c = i;
	}
	amax = sum / a;
	d = a - 1;
	for (int i = a; i < n; i++) {
		if (v[i] == v[c])d = i;
		else break;
	}
	if (c != 0) {
		ans = convination(d - c + 1, a - c);
	}
	else {
		for (int i = a; i <= min(d + 1, b); i++) {
			ans += convination(d + 1, i);
		}
	}
	printf("%.8lf ", amax);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
private static Scanner s = new Scanner(System.in);

public static void main(String[] args) {
	int n = s.nextInt();
	int[][] T = new int[n][n];
	int ans = 0;
	int min,mint = 0,count = 1;
	int[] times = new int[n];

	for(int i = 0;i < n;i++) {
		for(int j = 0;j < n;j++) {
			T[i][j] = s.nextInt();
		}
	}
	times[0] = 1;
	while(true) {
		min = Integer.MAX_VALUE;

		for(int i = 0;i < n;i++) {
			if(times[i] == 1) {
			for(int j = 0;j < n;j++) {
				if(times[j] == 0 && T[i][j] >= 0 && T[i][j] < min) {
					min = T[i][j];
					mint = j;
				}
			}
			}
		}
		times[mint] = 1;
		ans += min;
		count++;
		if(count == n)break;
	}
	System.out.println(ans);
}
}



Measured memory_bytes: 41136
#include<iostream>
#include<string>
using namespace std;
int main () {
	string str;
    cin >> str;
	int max = 0, cnt = 0;
	for (int i = 0; i < str.length(); ++i) {
		if (str[i] == 'A' || str[i] == 'G' || str[i] == 'C' || str[i] == 'T') {
			++cnt;
		}
		else {
			if (cnt > max)
				max = cnt;
			cnt = 0;
		}
	}
	if (cnt > max)
		max = cnt;
	cout << max << endl;
	return 0;
}


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

int main() {
  string s,t;
  bool check = 1;
  cin >> s >> t;
  if (s.size() <= 10) {
    for(int i = 0; i < s.size(); i++) {
      if (s.at(i) != t.at(i)) check = 0;
    }
    if (check)  {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}



Measured memory_bytes: 3620
k = int(input())
alist = [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]
print(alist[k-1])


Measured memory_bytes: 2940
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

typedef long long ll;

#ifdef iq
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int main() {
#ifdef iq
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b, m;
  cin >> a >> b >> m;
  vector <int> x(a), y(b);
  for (int i = 0; i < a; i++) cin >> x[i];
  for (int i = 0; i < b; i++) cin >> y[i];
  int ans = *min_element(x.begin(), x.end()) + *min_element(y.begin(), y.end());
  for (int i = 0; i < m; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    u--, v--;
    ans = min(ans, x[u] + y[v] - c);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  string s;
  while(getline(cin, s) && s!= "."){
    bool ok = true;
    stack<char> stk;
    REP(i, s.size()){
      if(s[i] == '(' || s[i] == '['){
        stk.push(s[i]);
      }else if(s[i] == ')' || s[i] == ']'){
        if(stk.empty()){
          ok = false;
          break;
        }
        char t = stk.top(); stk.pop();
        if(t == '(' && s[i] == ']'){
          ok = false;
           break;
        }
        if(t == '[' && s[i] == ')'){
          ok = false;
           break;
        }
      }
    }
    if(ok && stk.empty()) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }

  return 0;
}

Measured memory_bytes: 904
s = gets.chomp
n = s.length

result = true

(n / 2).times do |i|
    if s[i] != s[n - (i + 1)]
        result = false
        break
    end
end

if result
    ((n - 1) / 2).times do |i|
        if s[i] != s[((n - 1) / 2) - (i + 1)]
            result = false
            break
        end
    end
end

if result
    ((n - 1) / 2).times do |i|
        if s[(n + 3) / 2 + (i - 1)] != s[n - (i + 1)]
            result = false
            break
        end
    end
end

puts result ? "Yes" : "No"

Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int cnt(int n) {
	int res = 0;
	for (int i = 1; i <= n; i++) {
		if (n % i == 0) res++;
	}
	return res;
}

int main() {
	int n; cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i+=2) {
		if (cnt(i) == 8) ans++;
	}
	cout << ans << endl;
}

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

using namespace std;
int main ()
{   
    int a,b,c;
    cin >> a >> b >> c;
    cout << max(a,max(b,c))*10+min(min(a,b),c)+min(min(max(a,b),max(b,c)),max(c,a)) <<endl;
    return 0;
}












Measured memory_bytes: 256