akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MAX = 1e5 + 5, MOD = 1e9 + 7;
constexpr ll LINF = 1ll << 60; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }, dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

ll N, K;

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

    if (K == 0) {
        write(N * N);
        return 0;
    }

    // R < K を数える
    ll cnt = 0;

    // b <= K はすべて R < b <= K
    cnt += K * N;

    for (ll b = K + 1; b <= N; ++b) {
        ll q = N / b;
        cnt += q * K;
        ll rest = N - q * b;
        cnt += min(K - 1, rest);
    }

    write(N * N - cnt);
}

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

int main() {
  string a; cin >> a;
  bool can = true;
  REP(i,a.size()){
    REP(j,a.size()){
      if(i == j) continue;
      if(a.at(i) == a.at(j))
      can = false;
    }
  }
if(can){
cout << "yes" << endl;
}
else cout << "no" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, a, b;
  cin >> n >> a >> b;
  int nn = n;
  while(n <= b){
    if(n >= a && n <= b) {
      cout << "OK\n";
      return;
    }
    n+=nn;
  }
  puts("NG\n");
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tc = 1;
  // cin >> tc;
  for(int i = 1; i <= tc; ++i) {
    // cout << "Case #" << i <<": ";
    solve();
  }
  return 0;
}

Measured memory_bytes: 3648
def myABS(x, y):
    buf = x - y
    if buf >= 0:
        return buf
    else:
        return buf * (-1)

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ab = myABS(a, b)
    bc = myABS(b, c)
    ac = myABS(a, c)
    if ((ab <= d) and (bc <= d)) or (ac <= d):
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3064
package main

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

const mod = 998244353
const facNum = 300001
const INF = 1001001001

var LIS []int
var dp []int
var cost []int

func dfs(graph [][]int, v int, p int) {
	i := lowerBound(dp, cost[v-1])
	old := dp[i]
	dp[i] = cost[v-1]
	LIS[v] = i
	if p != -1 {
		LIS[v] = max(i, LIS[p])
	}
	for _, nv := range graph[v] {
		if nv == p {
			continue
		}
		dfs(graph, nv, v)
	}
	dp[i] = old
}

func main() {
	sc := newScanner(os.Stdin)
	N := sc.i()
	cost = sc.is(N)
	graph := make([][]int, N+1)
	for i := 0; i < N-1; i++ {
		v, u := sc.i(), sc.i()
		graph[v] = append(graph[v], u)
		graph[u] = append(graph[u], v)
	}
	LIS = make([]int, N+1)
	dp = make([]int, N+1)
	for i := range dp {
		dp[i] = INF
	}
	dp[0] = -INF
	dfs(graph, 1, -1)

	for i := 1; i < N+1; i++ {
		fmt.Println(LIS[i])
	}
}

// fmt.Println("Yes")
// fmt.Println("No")

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}


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

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair

int n, a, b;

int main() {
  cin >> n >> a >> b;
  cout << (n - a + 1) * (n - b + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#pragma GCC optimize "trapv"
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int n; cin >> n;
  vector<pair<int,int>> vp;

  for(int i=1;i<=n;i++){
    int a,b; cin >> a >> b;
    vp.pb({a,b});
  }

  for(int i=0;i<=n-3;i++){
    int cnt = 0;
    for(int j=i;j<i+3;j++){
      if(vp[j].first==vp[j].second) cnt++;
    }
    if(cnt==3){
      cout << "Yes\n";
      return 0;
    }
  }

  cout << "No\n";
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;




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

string s;
cin >> s;
rep(i,3){
    if(s[i]==s[i+1]){
        cout << "Bad" << endl;
        return 0;
    }
}
cout << "Good" << endl;


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define N 100000
typedef struct Graph
{
  int group;
  int numOfAdj;
  int *adj;
} graph;
int n;//the number of users
graph *user;//array of users
void initUser(void);
void setConnection(int,int);
void setWholeGroup(void);
void setGroup(int,int);
int isGrouped(int,int);
void printGroup(void);//debugging
int main(void)
{
  int i;//counter
  int user1,user2;
  int num;//the number of relaions / questions
  scanf("%d",&n);
  user=(graph*)malloc(sizeof(graph)*n);
  initUser();
  scanf("%d",&num);
  for(i=0;i<num;i++)
    {
      scanf("%d%d",&user1,&user2);
      setConnection(user1,user2);
      setConnection(user2,user1);
    }
  setWholeGroup();
  //printGroup();
  scanf("%d",&num);
  for(i=0;i<num;i++)
    {
      scanf("%d%d",&user1,&user2);
      if(isGrouped(user1,user2)==1) printf("yes\n");
      else printf("no\n");
    }
  return 0;
}
void initUser(void)
{
  int i;//counter
  for(i=0;i<n;i++)
    {
      user[i].group=0;
      user[i].numOfAdj=0;
    }
}
void setConnection(int user1,int user2)
{
  int i;//counter
  int *temp;
  temp=user[user1].adj;
  user[user1].adj=(int*)malloc(sizeof(int)*(user[user1].numOfAdj+1));
  for(i=0;i<user[user1].numOfAdj;i++) user[user1].adj[i]=temp[i];
  user[user1].numOfAdj++;
  user[user1].adj[i]=user2;
  free(temp);
}
void setWholeGroup(void)
{
  int i;//counter
  int groupNum=0;
  for(i=0;i<n;i++)
    {
      if(user[i].group==0)
	{
	  groupNum++;
	  setGroup(i,groupNum);
	}
    }
}
void setGroup(int key,int num)
{
  int i;//counter
  user[key].group=num;
  for(i=0;i<user[key].numOfAdj;i++)
    {
      if(user[user[key].adj[i]].group!=user[key].group) setGroup(user[key].adj[i],num);
    }
}
int isGrouped(int user1,int user2)
{
  if(user[user1].group==user[user2].group) return 1;
  else return 0;
}
void printGroup(void)
{
  int i;//counter
  for(i=0;i<n;i++)
    {
      printf("%d: Group %d\n",i,user[i].group);
    }
}



Measured memory_bytes: 9528
import java.util.*;

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

    if(r<1200){
      System.out.println("ABC");
    }else if(r<2800){
      System.out.println("ARC");
    }else{
      System.out.println("AGC");
    }
  }
} 

Measured memory_bytes: 22228
#include <iostream>
using namespace std;
int main() {
    int N,cnt=0;
    string S;
    cin >> N >> S;
    for (int i=0; i<N-2; i++) {
        if (S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C') cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

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

  vector<int> s;
  for (int i = 0; i < S.size() - 2; i++) {
    for (int j = i; j < S.size() - 2; j++) {
      int a = (S[j] - '0'), b = (S[j + 1] - '0'), c = (S[j + 2] - '0');
      s.push_back(abs(753 - (a * 100 + b * 10 + c)));
    }
  }
  sort(s.begin(), s.end());
  cout << s[0] << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

class DICE{
	int tmp, tmp2;
public:
	int x[6];
	void nextN();
	void nextE();
	void nextW();
	void nextS();
	void nextR();
	void nextL();
	void SetT(int a,int b);
	void SetS(int a);
};

void DICE::nextN(){
	tmp=x[0];
	x[0]=x[1];
	x[1]=x[5];
	x[5]=x[4];
	x[4]=tmp;
}

void DICE::nextE(){
	tmp=x[0];
	x[0]=x[3];
	x[3]=x[5];
	x[5]=x[2];
	x[2]=tmp;
}

void DICE::nextW(){
	tmp=x[0];
	x[0]=x[2];
	x[2]=x[5];
	x[5]=x[3];
	x[3]=tmp;
}

void DICE::nextS(){
	tmp=x[0];
	x[0]=x[4];
	x[4]=x[5];
	x[5]=x[1];
	x[1]=tmp;
}

void DICE::nextR(){
	tmp=x[1];
	x[1]=x[2];
	x[2]=x[4];
	x[4]=x[3];
	x[3]=tmp;
}

void DICE::nextL(){
	tmp=x[1];
	x[1]=x[3];
	x[3]=x[4];
	x[4]=x[2];
	x[2]=tmp;
}

void DICE::SetS(int a){
	if(x[2]==a) {
		nextR();
	}else if(x[3]==a){
		nextL();
	}else if(x[4]==a){
		nextR();
		nextR();
	}
}

void DICE::SetT(int a, int b){
	tmp=a;
	tmp2=b;
	for(int i=0; i<6; i++){
		if(x[i]==a){
			switch(i){
				case 0:
					SetS(b);
					break;
				case 1:
					nextN();
					SetS(b);
					break;
				case 2:
					nextE();
					SetS(b);
					break;
				case 3:
					nextW();
					SetS(b);
					break;
				case 4:
					nextS();
					SetS(b);
					break;
				case 5:
					nextN();
					nextN();
					SetS(b);
			}
		}
	}
}



int main(){
	DICE d;
	int q;
	int top,x1;
	cin>>d.x[0]>>d.x[1]>>d.x[2]>>d.x[3]>>d.x[4]>>d.x[5];
	cin>>q;
	int *a = new int[q];
	for(int i=0 ; i<q ; i++){
		cin >> top >> x1;
		d.SetT(top , x1);
		a[i]=d.x[2];
	}
	for(int i=0 ; i<q ; i++){
		cout << a[i] << endl;
	}
	delete [] a;
	return 0;
}

Measured memory_bytes: 1192
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
int main() {
    int A, B, T;
    cin >> A >> B >> T;
    int ans =0;
    int time = A;

        while(time <= T+0.5){
            ans += B;
            time += A;
        }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long m = sc.nextLong();

		List<Long> list = new ArrayList<>();

		long sum = 0;

		while (sc.hasNext()) {
			sum += sc.nextLong();
		}

		long ret = n - sum;

		if (ret < 0) {
			System.out.println(-1);
		} else {
			System.out.println(ret);
		}
	}

}


Measured memory_bytes: 47780
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))
ret = [[0] * w for i in range(h)]

line = []

for i, item in enumerate(a):
    line.extend([i+1] * item)

for i, item in enumerate(line):
    sho = i // w
    amari = i % w
    if sho % 2 == 0:
        ret[sho][amari] = item
    else:
        ret[sho][w-1-amari] = item

for item in ret:
    print(' '.join(map(str, item)))


Measured memory_bytes: 3572
N=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
X=make_divisors(N)
m=N
for i in range(len(X)//2):
    if X[2*i]+X[2*i+1]-2 < m:
        m=X[2*i]+X[2*i+1]-2
if len(X)%2==1:
    if 2*X[-1]-2<m:
        m=2*X[-1]-2
print(m)

Measured memory_bytes: 3268
//Author: AnandRaj uux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{
	int n,m;
	cin>>n>>m;
	vi A(m);
	take(A,0,m);
	ll sum=0;
	for(auto a:A) sum+=a;
	cout<<max(-1ll,n-sum)<<endl;
}		

Measured memory_bytes: 3652
#AGC015-A
n,a,b = map(int,input().split())

mi = a * (n-2)
ma = b * (n-2)
result = ma - mi + 1
if a > b:
    print(0)
elif n == 1 and a != b:
    print(0)
elif n == 1 and a == b:
    print(1)
    
else:
    print(result)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define f   first
#define s   second
#define pb          push_back
#define mod         1000000007
#define hell        998244353
#define inf         1000000000000000000LL
using namespace std;
ll n,k,m;
//ll dp[15][1005];
ll dp[100005];
ll lvl[100005];
ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2){res=(res*x)%mod;}
        x=(x*x)%mod;
        y/=2;
    }
    return res;
}
ll invmod(ll x)
{ return power(x,mod-2);}
void solve()
{   ll W,X,D;
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes\n";
    else cout<<"No\n";
    


    
   

    
}

int main()
{
    ll t=1;
    //cin>>t;
    
    while(t--)
        solve();

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll labs(ll a){
	if(a<0LL){
		return -a;
	}
	return a;
}

ll x,k,d;

int main(void){
	scanf("%lld%lld%lld",&x,&k,&d);
	if(x>0LL){
		ll re=x/d;
		if(re>k){
			x-=k*d;
			printf("%lld\n",x);
			return 0;
		}
		x-=d*re;
		k-=re;
	}else{
		ll re=labs(x)/d;
		if(re>=k){
			x+=k*d;
			printf("%lld\n",labs(x));
			return 0;
		}
		x+=d*re;
		k-=re;
		if(x<0LL){
			x+=d;
			k--;
		}
	}
	if(k%2LL==0){
		printf("%lld\n",x);
	}else{
		printf("%lld\n",labs(x-d));
	}
	return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
void dump(){cout<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cout<<h<<", ";dump(forward<Ts>(t)...);}
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}

void solve1();void solve2();
int main(){
  solve1();
  return 0;
}

void solve1(){

  int r;
  cin>>r;
  cout<<r*r<<endl;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

class Program {
    static void Main (string[] args) {
        string s = Console.ReadLine();
        string t = Console.ReadLine();
        
        int ans = 0;

        for(int i=0;i < 3;i++ ){
            if(s[i] == t[i]) ans ++;
        }

        Console.WriteLine(ans);

    }
}

Measured memory_bytes: 11092
class Node:
    def __init__(self, text, pos):
        self.text = text
        self.pos = pos
        self.next_nodes = []

    def add_next(self, node):
        self.next_nodes.append(node)


def all_pats():
    pat = []
    for i in range(H):
        for j in range(W):
            pat.append((i, j))
    return pat


def dfs(start):
    queue = []
    queue.append(start)
    count = dict()
    count[start.pos] = 0

    while True:
        if not queue:
            break
        node = queue[0]
        queue = queue[1:]

        for next_node in node.next_nodes:
            if next_node.pos in count:
                continue
            count[next_node.pos] = count[node.pos] + 1
            queue.append(next_node)
    return max(count.values())


H, W = [int(x) for x in input().split(" ")]
nodes = dict()
for i in range(H):
    for j, text in enumerate(input()):
        nodes[(i, j)] = Node(text, (i, j))


for i in range(H):
    for j in range(W):
        node = nodes[(i, j)]
        if node.text == "#":
            continue
        for pos in [(i-1, j), (i, j-1), (i+1, j), (i, j+1)]:
            if 0 <= pos[0] <= H-1 and 0 <= pos[1] <= W-1 and nodes[pos].text == ".":
                node.add_next(nodes[pos])


all_pats = all_pats()

counts = []
for start in all_pats:
    counts.append(dfs(nodes[start]))

print(max(counts))


Measured memory_bytes: 42972
#include<bits/stdc++.h>
using namespace std;
#define Elhabashy ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
const int N=1e4+10,mod=1e9+7;
typedef long long ll;
ll d,dp[N][102][3];
string k;
int solve(int i=0,int sum=0,bool f=0){
    if(i==k.length()){
        if(sum==0)return 1;
        return 0;
    }
    ll &ret=dp[i][sum][f];
    if(~ret)return ret;

    int num;
    if(!f)num=k[i]-'0';
    else num=9;
    ret=0;
    for(int j=0;j<=num;j++){
        bool flag=f;
        if(j<num)flag=1;
        int tmp=sum;
        tmp+=j;
        tmp%=d;
        ret+=solve(i+1,tmp,flag);
        ret%=mod;
    }
    return ret%mod;
}
int main(){
    Elhabashy
    input();
    cin>>k>>d;
    memset(dp,-1,sizeof dp);
    cout<<(solve()-1+mod)%mod<<endl;
}


Measured memory_bytes: 28340
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

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

int n, a, mx;
long long ans;

int main()
{
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (i) {
      ans += max(mx - a, 0);
    }
    mx = max(mx, a);
  }
  cout << ans << E;
  //system("pause");
  return 0;
}

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

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<ll> a(n), b(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];

    vector<ll> c(n);
    rep(i,n) c[i]=a[i]-b[i];
    ll misum = 0; ll plsum = 0;
    rep(i,n) {
        if (c[i]<0) misum += (-1*c[i]/2);
        else if (c[i]>0) plsum += c[i];
    }

    if(plsum <= misum) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 512
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

a, b, c, d = MAP()
i = 0
while True:
    if i % 2:
        a -= d
    else:
        c -= b
    i += 1
    if a <= 0 and c > 0:
        print('No')
        exit()
    elif a > 0 and c <= 0:
        print('Yes')
        exit()


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

using ll = long long;

int main(){
	int n;
	cin >> n;
	ll ans = 1ll << 60, a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < 2; i++){
		ll sum = 0, tmp = 0;
		for(int j = 0; j < n; j++){
			bool pos = i % 2 == j % 2;
			sum += a[j];
			if(pos && 0 < sum || !pos && sum < 0) continue;
			tmp += abs(sum) + 1;
			sum = pos ? 1 : -1;
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int a[n + 1], dp[n + 1];
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        dp[i] = 0;
    }
    dp[1] = 0;
    dp[2] = abs(a[2] - a[1]);
    for(int i = 3; i <= n; i++) {
        dp[i] = min(dp[i - 2] + abs(a[i - 2] - a[i]), dp[i - 1] + abs(a[i - 1] - a[i]));
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    while (true) {
        int n, p; cin >> n >> p;
        if (n==0 && p==0) break;

        vector<int> vec(n, 0);
        int cur = 0;
        int total = p;
        while (true) {
            if (p) {
                p--;
                vec[cur]++;
            } else {
                p += vec[cur];
                vec[cur] = 0;
            }
            if ((*max_element(all(vec))==total) && (!p)) {
                cout << cur << endl;
                break;
            }
            cur++;
            cur %= n;
        }
    }
}


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

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

  string S;
  cin >> S;
  int N = S.size()+1, M = 0;
  int A[N] = {}, B[N] = {};
  bool ans = false;
  for(int i=0;i<N-1;i++){
    if(ans){
      if(S[i] == '<'){
        M++;
        A[i+1] = M;
      }
      else{
        ans = false;
        M = 0;
      }
    }
    else{
      if(S[i] == '<'){
        ans = true;
        A[i] = 0;
        A[i+1] = 1;
        M++;
      }
    }
  }
  ans = false;
  M = 0;
  for(int i=N-2;i>=0;i--){
    if(ans){
      if(S[i] == '>'){
        M++;
        B[i] = M;
      }
      else{
        ans = false;
        M = 0;
      }
    }
    else{
      if(S[i] == '>'){
        ans = true;
        B[i+1] = 0;
        B[i] = 1;
        M++;
      }
    }
  }
  int64_t sum = 0;
  for(int i=0;i<N;i++){
    sum += max(A[i], B[i]);
  }
  cout << sum << endl;
}

Measured memory_bytes: 4764
#include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
    long long int a,b,c,d;
    cin >> a >> b;
    c = a*b;
    d = c/2;
    if((a == 0)||(b == 0)){
        cout << 0 << endl;
    }else if((a == 1)||(b == 1)){
    	cout << 1 << endl;
    }else if((a%2==0)||(b%2==0)){
        cout << (a*b)/2 << endl;
    }else{
    	cout << (a*b+1)/2 << endl;
    }
 
    return 0;
} 

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

class Cmondai
{
    static void Main()
    {
        var S = Console.ReadLine();
        var oddZeroCount = 0;
        var oddOneCount = 0;
        var evenZeroCount = 0;
        var evenOneCount = 0;
        for (int i=0;i<S.Length;++i)
        {
            //偶数
            if (i % 2 == 0)
            {
                if (S[i] == '0') evenZeroCount++;
                else evenOneCount++;
            }
            //奇数
            else
            {
                if (S[i] == '0') oddZeroCount++;
                else oddOneCount++;
            }
        }
        var ans = Math.Min(evenOneCount + oddZeroCount, evenZeroCount + oddOneCount);
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13116
import math
B = []
while True:
    n = int(input())
    s = 0
    if n != 0:
        S = list(map(float,input().split()))
        for i in range(n):
            s += S[i] * S[i]
        m_2 = s / n
        mm = (sum(S) / n)**2
        B.append(math.sqrt(m_2 - mm))
    else:
        for i in range(len(B)):
            print(B[i])
        break



Measured memory_bytes: 5776
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  ll h,n;
  cin>>h>>n;
  ll s=0;
  for(auto&& i:irange(0l,n)) {
    ll a;
    cin>>a;
    s += a;
  }
  if (s >= h) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
# distance between two nodes is dis(root, a)+dis(root, b)-2*(dis(lca(a,b),root))
# taking mod 2 last term is eliminated 
# all nodes having dis as odd parity from root will be white color
# all nodes having dis as even parity from root will be even color
import sys
import os
sys.setrecursionlimit(1000000)
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
	for i , w in adj[u]:
		if i==p:
			continue
		dis[i]=dis[u]+w
		dis[i]=dis[i]%2
		dfs(i , u)
def main():
	n = int(input())
	for i in range(n-1):
		x, y , w = map(int , input().split())
		w = w%2
		adj[x].append([y , w])
		adj[y].append([x, w])
	dfs(1, 0)
	for i in range(1,n+1):
		print(dis[i])
if __name__ =="__main__":
	main()

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

int main(){
	string s1, s2;
	int a, b;
	string cut;
	cin >> s1 >> s2 >> a >> b >> cut;
	if(s1==cut) cout << a-1 << ' ' << b;
	else cout << a << ' ' << b-1;
}

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

int main(){
    int n; cin >> n;
    vector<int>a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        --a[i];
    }

    for(int c = 0, now = 0; true; c++){
        if(now == 1){
            cout << c << endl;
            break;
        }

        if(c >= n){
            cout << -1 << endl;
            break;
        }
        
        now = a[now];
    }
}

Measured memory_bytes: 3764
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
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; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n;
  string t;
  ll to = 0;
  ll no;
  string mo;
  cin >> n;
  map<string, ll> aa; 
  rep(i,n){
    cin >> mo >> no;
    to = to + no;
    aa[mo] = to;
  }
  cin >> t;
  pri(to-aa[t]);

  return 0;
}


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

int main()
{   int a,b,c,d,n,m;
    while(~scanf("%d %d %d %d",&a,&b,&c,&d))
    {   n=0,m=0;
        n=a*b;
        m=c*d;
        if(n>m)
        {
            printf("%d\n",n);
        }
        else if(n<m)
        {
            printf("%d\n",m);
        }
        else if(n==m)
        {
            printf("%d\n",n);
        }
    }
    return 0;
}


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

struct edge{
	int to, w, p;
};
vector<edge> x[110];
int n, m, a, b, c, vis[110];

int dfs(int s, int t, int r)
{
	if (s == t)return r;
	vis[s] = true;
	for (int i = 0; i < x[s].size(); ++i){
		if (!vis[x[s][i].to] && x[s][i].w > 0){
			int temp = dfs(x[s][i].to, t, min(r, x[s][i].w));
			if (temp > 0){
				x[s][i].w -= temp;
				x[x[s][i].to][x[s][i].p].w += temp;
				return temp;
			}
		}
	}
	return 0;
}

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i){
		scanf("%d%d%d", &a, &b, &c);
		x[a].push_back(edge{b, c, x[b].size()});
		x[b].push_back(edge{a, 0, x[a].size() - 1});
	}
	int res = 0;
	while (true){
		memset(vis, 0, sizeof(vis));
		int temp = dfs(0, n - 1, 1 << 30);
		if (temp == 0)break;
		res += temp;
	}
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 3308
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reverse_Sequence
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            List<char> temp = new List<char>();

            foreach (char c in input)
            {
                temp.Add(c);
            }

            for (int i = temp.Count-1; i >= 0; --i)
            {
                Console.Write(temp[i]);
            }
            Console.WriteLine();
        }
    }
}



Measured memory_bytes: 13772
#include<iostream>
using namespace std;
#define ll long long int
int main()
{
    int t;
    //cin>>t;
    //while(t--)
    //{
    ll a,b,i,j,mx=0,cn=0,k;
    string s,ss;
    cin>>a;
    ll ar[a];
    for(i=0;i<a;i++)cin>>ar[i];
    for(i=0;i<a-2;i++)
    {
        for(j=i+1;j<a-1;j++)
        {
            if(ar[i]==ar[j])continue;
            else
            {
                for(k=j+1;k<a;k++)
                {
                    if(ar[j]==ar[k] or ar[i]==ar[k])continue;else
                    {
                        if(ar[i]+ar[j]>ar[k] and ar[i]+ar[k]>ar[j] and ar[j]+ar[k]>ar[i])cn++;
                    }
                }
            }
        }
    }
    cout<<cn<<endl;
    // }
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
#define repl(k,n) for(k=0;k<n;++k)

int main() {
	int N;
	cin >> N;
	vector<int> l(N);
	int i,j,k;
	rep(i, N)cin >> l[i];
	int count=0;
	for (i = 0; i < N;i++) {
		for (j = i+1; j < N;j++) {
			for (k = j+1; k < N; k++) {
				if (l[i] != l[j] && l[j] != l[k] && l[k] != l[i]) {
					if (l[i] + l[j] > l[k] && l[k] + l[j] > l[i] && l[i] + l[k] > l[j])count++;
				}
			}
		}
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <limits.h>
#include <queue>
#define MAX 100000
#define INF INT_MAX
using namespace std;

class Edge{
public:
  int to,cost;
  Edge(int t,int c){to=t; cost=c;}
};

typedef pair<int,int> P;

vector<Edge> G[MAX+1];
int V,E;
int d[MAX+1];
void solve(int r){

  fill(d,d+MAX+1,INF);
  
  priority_queue<P,vector<P>,greater<P> > qu;

  qu.push(P(0,r));
  d[r]=0;
  
  while(!qu.empty()){

    P p=qu.top();
    qu.pop();
    int v=p.second;

    if(d[v]<p.first) continue;
    for(int i=0;i<G[v].size();i++){
      Edge *e=&G[v][i];
      if(d[v]+e->cost < d[e->to]){
	d[e->to]=d[v]+e->cost;
	qu.push(P(d[e->to],e->to));
      }
    }
  }
  
}



int main(){

  int r;
  cin>>V>>E>>r;
  int s,t,c;
  for(int i=0;i<E;i++){
    cin>>s>>t>>c;
    Edge e1(t,c);
    G[s].push_back(e1);

  }

  solve(r);
  for(int i=0;i<V;i++){
    if(d[i]==INF)cout<<"INF"<<endl;
    else cout<<d[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 12976
p, g = 998244353, 3
invg = pow(g, p-2, p)
W = [pow(g, (p - 1) >> i, p) for i in range(24)]
iW = [pow(invg, (p - 1) >> i, p) for i in range(24)]

def fft(k, f):
    for l in range(k)[::-1]:
        d = 1 << l
        u = 1
        for i in range(d):
            for j in range(i, 1 << k, 2*d):
                f[j], f[j+d] = (f[j] + f[j+d]) % p, u * (f[j] - f[j+d]) % p
            u = u * W[l+1] % p

def ifft(k, f):
    for l in range(k):
        d = 1 << l
        u = 1
        for i in range(d):
            for j in range(i, 1 << k, 2*d):
                f[j+d] *= u
                f[j], f[j+d] = (f[j] + f[j+d]) % p, (f[j] - f[j+d]) % p
            u = u * iW[l+1] % p

def convolve(a, b):
    n0, n1 = len(a), len(b)
    k = (max(n0, n1) - 1).bit_length() + 1
    n = 1 << k
    a = a + [0] * (n-n0)
    b = b + [0] * (n-n1)
    fft(k, a), fft(k, b)
    for i in range(n):
        a[i] = a[i] * b[i] % p
    ifft(k, a)
    invn = pow(n, p - 2, p)
    return [a[i] * invn % p for i in range(n0 + n1 - 1)]

N, M = map(int, input().split())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
print(*convolve(A, B))


Measured memory_bytes: 203168
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    class CmbMod:
        def __init__(self, n, p):
            """
            二項係数nCr(n個の区別できるものからr個のものを選ぶ組み合わせの数)をpで割った余りを求める
            """
            self.n = n
            self.p = p
            self.fact = [1, 1]
            self.factinv = [1, 1]
            self.inv = [0, 1]

        def cmb_mod(self, n, r):
            """
            二項係数nCr(mod p)をO(r)にて計算。nが大きいがrは小さい時に使用。
            """
            numer, denom = 1, 1
            for i in range(r):
                numer = (numer * (n - i)) % self.p
                denom = (denom * (i + 1)) % self.p
            return (numer * pow(denom, self.p - 2, self.p)) % self.p

        def prep(self):
            """
            二項係数nCr(mod p)をO(1)で求める為の前処理をO(N)にて実行。
            """
            for i in range(2, self.n + 1):
                self.fact.append((self.fact[-1] * i) % self.p)
                self.inv.append((-self.inv[self.p % i] * (self.p // i)) % self.p)
                self.factinv.append((self.factinv[-1] * self.inv[-1]) % self.p)

        def cmb_mod_with_prep(self, n, r):
            """
            二項係数nCr(mod p)をO(1)で求める。事前にprepを実行する事。
            """
            if (r < 0) or (n < r):
                return 0
            r = min(r, n - r)
            return self.fact[n] * self.factinv[r] * self.factinv[n - r] % self.p

    n, k = map(int, input().split())

    cmb = CmbMod(n, mod)
    cmb.prep()
    for i in range(1, k + 1):
        res = cmb.cmb_mod_with_prep(n - k + 1, i) * cmb.cmb_mod_with_prep(k - 1, i - 1)
        res %= mod
        print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3572
#include<iostream>
#include<vector>
#include<cstdlib>
#include<algorithm>
#include<climits>
#include<queue>
#include<stack>
#include<cmath>
#include<iterator>
typedef long long ll;
using namespace std;
#define rep(x, y)   for (ll i = x; i <= y; i ++)
#define repi(x, y)  for (ll i = x; i >= y; i --)
priority_queue< ll > cancel;
ll arr[200005];
ll brr[200005];
bool dp[200005];
int main()
{
    ll test=1;
    // cin>>test;
    for(ll z=0;z<test;z++)
    {
        ll n,k;
        cin>>n>>k;
        for(ll i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        sort(arr,arr+n);
        for(ll i=0;i<arr[0];i++)
        {
            dp[i]=false;
        }
        for(ll i=arr[0];i<=k;i++)
        {
            bool flag=false;
            for(ll j=0;(arr[j]<=i && j<n);j++)
            {
                // if(i==5)
                // {
                //     cout<<!(dp[i-arr[j]])<<" "<<i-arr[j]<<endl;
                // }
                flag|=!(dp[i-arr[j]]);
            }
            dp[i]=flag;
        }  
        
        if(dp[k]==true)
        {
            cout<<"First"<<endl;
        }
        else
        {
            cout<<"Second"<<endl;
        }
         
    }
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> ps;
  for(int i=2; i<=1000; i++){
      bool c=true;
      for(int j=2; j<=sqrt(i); j++){
          if(i%j==0){
              c=false;
              break;
          }
      }
      if(c==true) ps.push_back(i);
  }
  bool ok=true;
  rep(j,ps.size()){
      int tmp=0;
      rep(i,n){
          if(a[i]%ps[j]==0) tmp++;
          if(tmp>1){
              ok=false;
              break;
          }
      }
  }

  map<int,int> m;
  rep(i,n){
      int ta=a[i];
      if(a[i]<=1000) continue;
      bool pp=true;
      rep(j,ps.size()){
          if(ta%ps[j]==0){
              ta/=ps[j];
          }
      }
      if(ta>1000){
          if(m[ta]){
              ok=false;
              break;
          }
          m[ta]++;
      }
  }

  if(ok==true){
      cout << "pairwise coprime" << endl;
      return 0;
  }

  int now=a[0];
  rep(i,n-1){
      now=gcd(now,a[i+1]);
  }
  if(now==1){
      cout << "setwise coprime" << endl;
      return 0;
  }
  cout << "not coprime" << endl;  

return 0;
}

Measured memory_bytes: 7220
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define mod 1000000007
#define vll vector<ll>
ll val[105],wt[105],ti[105][100005];

ll func(ll len,ll w)
{
    if(len<=0 || w<=0) return 0;

    if(ti[len][w]!=-1) return ti[len][w];

    if(wt[len]<=w)
    {
       return ti[len][w]= max(val[len]+func(len-1,w-wt[len]),func(len-1,w));
    }
    else
       return ti[len][w]=func(len-1,w);

}


int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,w;
	cin>>n>>w;
	memset(ti,-1,sizeof ti);
	for(ll i=1;i<=n;i++)
        cin>>wt[i]>>val[i];

    ll ans=func(n,w);
    cout<<ans<<endl;

	return 0;
}



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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;

struct edge { int to,cost; };

int main() {
  int N;cin>>N;
  map<int,int> mp;
  REP(i,N) {
    int a;cin>>a;
    mp[a]++;
  }
  int tmp = 0;
  for (auto m:mp) {
    if (m.second > 1) {
      tmp += m.second-1;
    }
  }
  int action_cnt = (tmp+1)/2;
  OUT(N-action_cnt*2);

  return 0;
}

Measured memory_bytes: 4992
#include <numeric>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <iostream>
#include <sstream>
#include <vector>
#include <cstdio>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <string>
#include <bitset>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <tuple>
#include <sstream>

using namespace std;

#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; for (auto& e : a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; for (auto& e : a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; for (auto& r : a) { for (auto& e : r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; for (auto& e : a) { cerr << e.field << " ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif

#define forn(a, e) for (int a = 0; a < (int)(e); a++)
#define forr(a, s, e) for (int a = s; a < (int)(e); a++)

using i64 = long long;

template<typename T>
using Pair = array<T, 2>;

struct edge_t {
    i64 u, v, c;
};

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

    int n, m, p;
    while (cin >> n >> m >> p) {
        vector<edge_t> edges(m);
        forn(i, m) {
            cin >> edges[i].u >> edges[i].v >> edges[i].c;
            edges[i].c = p - edges[i].c;
        }

        vector<i64> d(n + 1, 1e18);
        d[1] = 0;
        forn(i, n - 1) {
            forn(j, m) {
                if (d[edges[j].u] != 1e18) {
                    d[edges[j].v] = min(d[edges[j].v], d[edges[j].u] + edges[j].c);
                }
            }
        }

        auto old = d;
        i64 val = d[n];
        forn(j, m) {
            if (d[edges[j].u] != 1e18) {
                d[edges[j].v] = min(d[edges[j].v], d[edges[j].u] + edges[j].c);
            }
        }
        forn(i, n + 1) {
            if (old[i] != d[i]) {
                d[i] = -1e9 - 1;
            }
        }

        forn(i, n) {
            forn(j, m) {
                if (d[edges[j].u] != 1e18) {
                    d[edges[j].v] = min(d[edges[j].v], d[edges[j].u] + edges[j].c);
                }
            }
        }

        if (d[n] != val) {
            cout << -1 << endl;
        } else {
            cout << max(0ll, -val) << endl;
        }
    }
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	int N;

	cin >> N;

	int A[N + 1];
	int B[N + 1];
	int C[N];

	for (int i = 1; i <= N; i++)
	{
		cin >> A[i];
	}
	for (int i = 1; i <= N; i++)
	{
		cin >> B[i];
	}
	for (int i = 1; i <= N - 1; i++)
	{
		cin >> C[i];
	}

	/* 計算 */
	int manzoku = 0;

	for (int i = 1; i <= N; i++)
	{
		int buf1 = A[i];
		manzoku += B[buf1];

		if (A[i] == A[i - 1] + 1 && i != 1)
		{
			int buf2 = A[i - 1];
			manzoku += C[buf2];
		}
	}

	cout << manzoku << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define ll long long
//#define f(i,a,b) for(ll i=a; i<b; i++)

int main(){

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

	ll a,ans,flag=true;
	ll i=5;
	while(i--){

		cin>>a;
		if(a==0 && flag){

			ans=5-i;
			flag=false;
		}
	}
	cout<<ans;
	// fclose(stdin);
	// fclose(stdout);
}

Measured memory_bytes: 3132