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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N;
  cin >> N;
  vector<int> A(N);
  map<int, int> m;
  // bool flag = false;
  ll m1 = 0;
  // int m2 = 0;
  rep(i, N) {
    cin >> A[i];
    m[A[i]]++;
  }
  for (auto ite = m.begin(); ite != m.end(); ite++) {
    // cout << ite->_1 << ' ' << ite->_2 << endl;
    m1 += (ll)(ite->_2)*(ite->_2-1)/2;
  }
  // for (auto ite = m.begin(); ite != m.end(); ite++) {
  //   if (ite->_1 != m2) {
  //     if (m1 == ite->_2)
  //       flag = true;
  //   }
  // }
  // cout << m1 << endl;
  rep(i, N) {
    cout << m1-(ll)m[A[i]]*(m[A[i]]-1)/2+(ll)(m[A[i]]-2)*(m[A[i]]-1)/2 << endl;
  }
}


Measured memory_bytes: 8320
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
using namespace std;
using Graph = vector<vector<int>>;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;

#define For(N,i) for(int i = 0; i < N; i++)

int main(){
	string S,T;
	
	cin>>S>>T;
	int cnt = 0;
	for(int i = 0; i < 3; i++){
		if(S[i] == T[i] ){
			cnt++;
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << precision(10)
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"
#define NEWMAT(N, M, ini) MAT(N, vector<lint>(M, ini))
#define MOD 1000000007

typedef long long lint;
typedef pair<lint, lint> P;
typedef vector<lint> V;
typedef vector<vector<lint>> MAT;
bool lessPair(const P& l, const P& r){return l.second < r.second;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    lint N; cin >> N;
    lint K; cin >> K;

    lint res = N-K+1;
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100005;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,d,a,x,h;
    cin >> n >> d >> a;
    ll cnt = 0;
    vector<ll> damage(n+1,0);
    vector<P> monster(n);
    rep(i,n){
        cin >> x >> h;
        monster[i] = P(x,h);
    }
    SORT(monster);
    rep(i,n){
        ll heart = monster[i].second-damage[i],x = monster[i].first,b;
        if (heart <= 0){
            damage[i+1] += damage[i];
            continue;
        }
        if (heart%a == 0){
            b = heart;
            cnt += heart/a;
        }
        else{
            b = (heart/a+1)*a;
            cnt += heart/a+1;
        }
        ll k = lower_bound(all(monster),P(x+2*d,INF))-monster.begin();
        damage[i] += b;
        damage[k] -= b;
        damage[i+1] += damage[i];
    }
    PRINT(cnt);
}




Measured memory_bytes: 4992
# coding: utf_8
""" abc085b """

n, y = map(int, input().split())
y = y / 1000
for i in range(n + 1):
    for j in range(n + 1 - i):
        man = i * 10
        gos = j * 5
        sen = (n - i - j)
        if man + gos + sen == y:
            print(str.format('{0} {1} {2}', i, j, sen))
            exit()
print('-1 -1 -1')


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

struct UnionFind{
    vector<int> data;
    //data[i] = -x ... iが根であり、サイズがx
    //data[i] = x ... iの親がx

    //最初は全員根
    UnionFind(int size): data(size,-1){}

    bool union_set(int x, int y){//サイズがx>yになるようにしてから、xにyをつなげる
        x=root(x);
        y=root(y);
        if(x != y){
            if(data[y] < data[x]) swap(x,y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find_set(int x, int y){//ルートが一致するかどうかを返す
        return root(x) == root(y);
    }
    int root(int x){//根を見つける。ついでに深さ2にしちゃう
        return data[x]<0 ? x : data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};

struct Edge{
    int s,t,cost;
    bool operator<(const Edge &o) const{
        return cost < o.cost;
    }
};

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

    UnionFind uf(N);
    REP(i,M){
        int x,y,z;
        cin >> x >> y >> z;
        x--;
        y--;
        uf.union_set(x,y);
    }

    int ans = 0;
    REP(i,N){
        if(uf.data[i] < 0){
            ans ++;
        }
    }

    cout << ans << endl;


    return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;

    if (s.length() + 1 != t.length())
        goto fail;
    for (int i = 0; i < s.length(); i++)
        if (s[i] != t[i])
            goto fail;

    cout << "Yes";
    return 0;

fail:
    cout << "No";
    return 0;
}


Measured memory_bytes: 3624
package main

import (
	"fmt"
	"os"
)

func main() {
	var a,b,k int
	fmt.Scan(&k)
	fmt.Scanf("%d %d",&a,&b)
	for i:=a;i<=b;i++{
		if i%k == 0 {
			fmt.Println("OK")
			os.Exit(0)
		}
	}
	fmt.Println("NG")
}


Measured memory_bytes: 1824
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (a > b) {
       		ans = c / a;
           if (c % a != 0) {
             ans++;
           }
        } else {
       		ans = c / b;
           if (c % b != 0) {
             ans++;
           }
        }
		// 出力
		      
			System.out.println(ans);
	}
}

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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int max = a;
	if (b > max) {
		max = b;
	}
	if (c > max) {
		max = c;
	}

	cout << (a + b + c - max) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <sstream>
#include <istream>

using namespace std;
int main(int argc, const char * argv[]) {
    
    string s;
    cin >> s;
    string targ="2019/04/30";
    if (s <= targ) cout << "Heisei" << endl;
    else cout << "TBD" << endl;

    return 0;
}

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

int main(){
  int N,M;
  cin>>N>>M;
  set<int> S,G;
  for(int i=0;i<M;++i){
    int a,b;
    cin>>a>>b;
    if(a==1){
      S.insert(b);
    }
    if(b==N){
      G.insert(a);
    }
  }

  set<int> intersect;
  set_intersection(S.begin(),S.end(),G.begin(),G.end(),inserter(intersect,intersect.begin()));
  if(intersect.empty()){
    cout<<"IMPOSSIBLE"<<endl;
  }
  else{
    cout<<"POSSIBLE"<<endl;
  }


}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n,x,y;cin>>n>>x>>y;
    vector<ll>ans(n);
    REP(i,1,n+1){
        REP(j,i+1,n+1){
            ll mi=min((ll)j-i,abs(i-x)+1+abs(j-y));
            ans[mi]++;
        }
    }
    rep(i,n-1){
        cout<<ans[i+1]<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int INF_INT = 1e9;

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 TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    ll s;
    cin >> s;
    if(s <= 1000000000){
        cout << 0 << " " << 0 << " " << 1 << " "  << 0 << " " << 1 << " " << s << endl;
    }
    else{
        ll x,y;
        if(s % 1000000000 == 0){
            y = s / 1000000000; x = 0;
        } 
        else{
            y = (s / 1000000000) + 1; x = 1000000000 * y - s;
        }
        cout << "0 0 " << "1000000000 1 "<< x << " " << y << endl;
    }
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i=0; i<n; i++)
    cin >> s.at(i);
  
  bool flag = true;
  for(int i=1; i<n; i++) {
    for(int j=0; j<i; j++) {
      if(s.at(j) == s.at(i)) {
        flag = false;
        break;
      }
    }
    if(s.at(i).at(0) != s.at(i-1).at(s.at(i-1).size()-1)) 
      flag = false;
    if(flag == false)
      break;
  }
  
  if(flag == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;

class program
{
    static public int mod = 1000000007;
    static void Main()
    {
        long x = rlong();
        long a = 100;
        int n = 0;
        for (; a < x; n++)
        {
            a = (long)Floor(a*1.01m);
        }
        Write(n);
    }

    static int pow(int a, int b) { string binary = Convert.ToString(b, 2); int bileng = binary.Length; long a_power = a; long value = 1; for (int i = bileng - 1; i >= 0; i--) { if (binary[i] == '1') { value = value * a_power % mod; } a_power = a_power * a_power % mod; } return (int)value; }
    static string rstr() { return ReadLine(); }
    static int rint() { return int.Parse(ReadLine()); }
    static long rlong() { return long.Parse(ReadLine()); }
    static string[] stra() { return ReadLine().Split(' '); }
    static char[] chara() { string[] a = stra(); string b = ""; for (int i = 0; i < a.Length; i++) { b += a[i]; } return b.ToCharArray(); }
    static int[] inta() { string[] read_str_array = ReadLine().Split(' '); int[] return_int_array = new int[read_str_array.Length]; for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_int_array[countup_i] = int.Parse(read_str_array[countup_i]); } return return_int_array; }
    static long[] longa() { string[] read_str_array = ReadLine().Split(' '); long[] return_long_array = new long[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_long_array[countup_i] = long.Parse(read_str_array[countup_i]); } return return_long_array; }
    static double[] doublea() { string[] read_str_array = ReadLine().Split(' '); double[] return_double_array = new double[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_double_array[countup_i] = double.Parse(read_str_array[countup_i]); } return return_double_array; }
    static long GCD(long a, long b) { if (a < b) { long temp = a; a = b; b = temp; } if (a % b == 0) { return b; } else { long temp = b; b = a % b; a = temp; return GCD(a, b); } }
    static long LCM(long a, long b) { return a * b / GCD(a, b); }
    static void WriteArray2(int[,] a, int b, int c) { for (int i = 0; i < b; i++) { for (int j = 0; j < c; j++) { if (j != 0) Write(" "); Write(a[i, j]); } WriteLine(); } }
    static void WriteArray(int[] a, int b) { for (int i = 0; i < b; i++) {  Write(" "); Write(a[i]); } WriteLine(); }
}


Measured memory_bytes: 27536
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  int X=a*100+b*10+c;
  string ans="NO";
  if(X%4==0)
    ans="YES";
  cout<<ans;
  }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f first
#define se second
#define pb push_back
#define pf push_front
#define eb emplace_back
#define emp emplace
#define ins insert
#define sz(s) (int)s.size()
#define rep(i,a,b) for( int i=a;i<b;i++)
#define repr(i,a,b) for( int i=a;i>=b;i--)
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(n,m) memset(n,m,sizeof(n))
#define ii pair<int,int>
#define iii tuple<int, int, int>
#define si set<int>
#define vi vector<int>
#define vii vector<ii>
#define mi map<int,int>
#define lb lower_bound
#define ub upper_bound
#define present(s,x) (s.find(x) != s.end())
#define ford(container, it) for(auto it:container)
#define fors(container, it, a, b) for(auto it = a; it != b; it++)
#define Anurag_Gupta ios_base::sync_with_stdio(0);
#define IIIT_ALLD cin.tie(0);cout.tie(0);
#define mod 987654319
#define EPSILON 1e-9
#define PI acos(-1)
#define inf 1e17
#define int long long
#define debug(a) cerr<<#a<<": ";for(auto i:a)cerr<<i<<" ";cerr<<'\n';
#define trace(a) cerr<<#a<<": "<<a<<"\n"
#define gcd(a,b) __gcd(a,b)
using namespace std;
int add(int a, int b, int c){int res=a+b;return(res>=c?res-c:res);}
int mod_neg(int a, int b, int c){int res;if(abs(a-b)<c)res=a-b;else res=(a-b)%c;return(res<0?res+c:res);}
int mul(int a, int b, int c){int res=(int)a*b;return(res>=c?res%c:res);}
template<typename T>T power(T e, T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;}
template<typename T>T mdpower(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mul(x,p,m);p=mul(p,p,m);n>>=1;}return x;}
template<typename T>T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;\
t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}
template<typename T>T mod_inverse(T a, T n){T x,y,z=0;T d=extended_euclid(a,n,x,y);return(d>1?-1:mod_neg(x,z,n));}
/*------------------------------------------------------------------------------------------------------------------*/
const int N = 3005;
int dp[N][N][2];
int n;
int arr[N];
int solve(int i,int j,int flag)
{
    if(i<=0 or j<=0 or j<i or i>n) return 0;
    if(dp[i][j][flag]!=-1) return dp[i][j][flag];

   if(flag==0)
       return dp[i][j][flag] = max(arr[i]+solve(i+1,j,flag^1),arr[j]+solve(i,j-1,flag^1));
   else
       return dp[i][j][flag] = min(-arr[i]+solve(i+1,j,flag^1),-arr[j]+solve(i,j-1,flag^1));
        
   
}
int32_t main()
{
    Anurag_Gupta
    IIIT_ALLD
 
  
    
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
        cin>>arr[i],sum+=arr[i];
    
   
    memset(dp,-1,sizeof dp);
   int x = solve(1,n,0);
   cout<<x<<"\n";




  
 
 






 
#ifndef LOCAL_DEFINE
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}


Measured memory_bytes: 145108
def search(node):
    global ans

    if sum(is_visit) == n:
        ans += 1

    for i in range(n):
        if is_neighbor[node][i]:
            if not is_visit[i]:
                is_visit[i] = True
                search(i)
                is_visit[i] = False

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

is_neighbor = [[False for j in range(n)] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    is_neighbor[a - 1][b - 1] = True
    is_neighbor[b - 1][a - 1] = True

is_visit = [False for _ in range(n)]

ans = 0

is_visit[0] = True
search(0)
print(ans)

Measured memory_bytes: 3064
/*
    ThunderClap and Flash.
    Raunaq Singh
*/
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod)*(b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

set<string>ans;

void fillAns(ll i, ll n, string &s, char currAlpha){
    if(i==n){
        ans.in(s);
        return;
    }
    for(ll j=i-1;j>=0;j--){
        s.pb(s[j]);
        fillAns(i+1,n,s,currAlpha);
        s.pop_back();
    }
    s.pb(currAlpha);
    fillAns(i+1,n,s,currAlpha+1);
    s.pop_back();
}

void Flash(){
    ll n;
    cin>>n;
    string s="a";
    char currAlpha='b';
    fillAns(1,n,s,currAlpha);
    for(auto it:ans){
        cout<<it<<"\n";
    }
}

int main(int argc, char const *argv[]){
    ThunderClap;
    ll t=1;
    //cin>>t;
    for(ll i=1;i<=t;i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}

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

int main() {
  int H, W, i, j;
  cin >> H >> W;
  
  vector<vector<char>> a(H,vector<char>(W));
  for(i = 0; i < H; i++){
    for(j = 0; j < W; j++){
      cin >> a.at(i).at(j);
    }
  }



  for(j = 0; j < W; j++){
    bool tate = true;
    
    for(i = 0; i < H; i++){
      if(a.at(i).at(j) == '#'){
	tate = false;
	break;
      }
    }

    if(tate){
      for(i = 0; i < H; i++)
	a.at(i).at(j) = '|';
    }
  }
  
  for(i = 0; i < H; i++){
    bool yoko = true;
    
    for(j = 0; j < W; j++){
      if(a.at(i).at(j) == '#'){
	yoko = false;
	break;
      }
    }
    
    if(yoko){
      for(j = 0; j < W; j++)
	a.at(i).at(j) = '-';
    }
  }
  
  for(i = 0; i < H; i++){
    for(j = 0; j < W; j++){
      if(a.at(i).at(j) == '-'){
	continue;
      }
      if(a.at(i).at(j) == '|'){
	if(j == W-1){
	  cout << endl;
	}
	continue;
      }
      cout << a.at(i).at(j);

      if(j == W-1)
	cout << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;

int sqt[250005];
int n, m;
int tot[255];
int dp[255][255];

int solve(int ct)
{
	int ret = 0;
	dp[0][0] = 1;
	int cur = 0;
	for(int i = n - 1; i >= 0; i --) {
		int lb = sqt[n * n - i * i - 1] + 1, rb = sqt[4 * n * n - i * i] + 1;
		for(int j = 0; j <= n; j ++) dp[n - i][j] = dp[n - i - 1][j];
		while(cur < n && tot[cur] <= lb) {
			for(int j = 0; j <= n; j ++) dp[n - i][j] = 1LL * dp[n - i][j] * (tot[cur] - cur - j + m) % m;
			cur ++;
		}
		for(int j = n; j >= 0; j --) {
			dp[n - i][j] = 1LL * dp[n - i][j] * (rb - 2 * n - ct + i + 1 + j + m) % m;
			if(j > 0) dp[n - i][j] = (dp[n - i][j] + 1LL * dp[n - i][j - 1] * (lb - cur - j + 1 + m)) % m;
		}
	}
	while(cur < n) {
		for(int j = 0; j <= n; j ++) dp[n][j] = 1LL * dp[n][j] * (tot[cur] - cur - j + m) % m;
		cur ++;
	}
	return dp[n][ct];
}

int main()
{
	scanf("%d%d", &n, &m);
	rep(i, 2 * n) for(int j = i * i; j < (i + 1) * (i + 1); j ++)
	sqt[j] = i;
	sqt[4 * n * n] = 2 * n - 1;
	int ans = 0;
	for(int t = 2 * n - 1; t >= n; t --)
	tot[2 * n - 1 - t] = sqt[4 * n * n - t * t] + 1;
	for(int t = 0; t <= n; t ++)
	if(t & 1) ans = (ans - solve(t) + m) % m;
	else ans = (ans + solve(t)) % m;
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;
typedef long long int l;
#define mod 1000000007
#define t1 l t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define vl vector<l>
#define pb push_back
#define ub upper_bound
#define lb lower_bound

int main() {
fast;
string s;
cin>>s;
l k=0;
for(l i=0;i<s.size();i++)
{
    l a=s[i]-'0';
    k=k+a;
}
if(k%9==0)
cout<<"Yes\n";
else
cout<<"No\n";

	return 0;
}


Measured memory_bytes: 3724
package main

import (
	"fmt"
)

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

	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	flag := true
	sortedIndex := 0
	swapCount := 0

	for flag {
		flag = false
		for i := n - 1; i > sortedIndex; i-- {
			if a[i] < a[i-1] {
				a[i], a[i-1] = a[i-1], a[i]
				flag = true
				swapCount++
			}
		}
		sortedIndex++
	}

	str := fmt.Sprint(a)
	fmt.Println(str[1:len(str)-1])
	fmt.Println(swapCount)
}

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

#define ll long long
#define rep(i,n) for (int i=0;i<n;++i)

int main() {
    ll n;
    cin >> n;
    int asciibase=96;
    string name="";
    while(n>0){
        //cout << "###" <<endl;
        //cout << n << endl;
        if (n<=26){
            name.push_back(char(asciibase+n));
            break;
        }
        int c=n%26;
        n=(n-c)/26;
        //cout << c << endl;
        if(c==0){
            name.push_back('z');
            n--;
        }else{
            name.push_back(char(asciibase+c));
        }
        
    }
    reverse(name.begin(),name.end());
    cout << name << "\n";
}

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

using namespace std;

const int INF = 1 << 30;

struct Primal_Dual
{
  typedef pair< int, int > Pi;

  struct edge
  {
    int to, cap, cost, rev;
  };
  vector< vector< edge > > graph;
  vector< int > potential, min_cost, prevv, preve;

  Primal_Dual(int V) : graph(V) {}

  void add_edge(int from, int to, int cap, int cost)
  {
    graph[from].push_back((edge) {to, cap, cost, (int) graph[to].size()});
    graph[to].push_back((edge) {from, 0, -cost, (int) graph[from].size() - 1});
  }

  int min_cost_flow(int s, int t, int f)
  {
    int V = graph.size(), ret = 0;
    priority_queue< Pi, vector< Pi >, greater< Pi > > que;
    potential.assign(V, 0);
    preve.assign(V, -1);
    prevv.assign(V, -1);

    while(f > 0) {
      min_cost.assign(V, INF);
      que.push(Pi(0, s));
      min_cost[s] = 0;

      while(!que.empty()) {
        Pi p = que.top();
        que.pop();
        if(min_cost[p.second] < p.first) continue;
        for(int i = 0; i < graph[p.second].size(); i++) {
          edge &e = graph[p.second][i];
          int nextCost = min_cost[p.second] + e.cost + potential[p.second] - potential[e.to];
          if(e.cap > 0 && min_cost[e.to] > nextCost) {
            min_cost[e.to] = nextCost;
            prevv[e.to] = p.second, preve[e.to] = i;
            que.push(Pi(min_cost[e.to], e.to));
          }
        }
      }
      if(min_cost[t] == INF) return -1;
      for(int v = 0; v < V; v++) potential[v] += min_cost[v];
      int addflow = f;
      for(int v = t; v != s; v = prevv[v]) {
        addflow = min(addflow, graph[prevv[v]][preve[v]].cap);
      }
      f -= addflow;
      ret += addflow * potential[t];
      for(int v = t; v != s; v = prevv[v]) {
        edge &e = graph[prevv[v]][preve[v]];
        e.cap -= addflow;
        graph[v][e.rev].cap += addflow;
      }
    }
    return ret;
  }
};


int main()
{
  int N, M, K, B[101][100], T[100];

  cin >> N >> M >> K;
  ++M;
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < N; j++) cin >> B[i][j];
  }
  for(int i = 0; i < M - 1; i++) {
    cin >> T[i];
  }

  Primal_Dual flow(N + M + 3);
  int s = N + M, t = N + M + 1, add = N + M + 2;
  for(int i = 0; i < N; i++) flow.add_edge(s, i, 1, 0);
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < M; j++) flow.add_edge(i, j + N, 1, 100 - B[j][i]);
  }
  for(int j = 1; j < M; j++) flow.add_edge(j + N, add, T[j - 1], 0);
  flow.add_edge(N, t, INF, 0);
  flow.add_edge(add, t, N - K, 0);

  cout << 100 * N - flow.min_cost_flow(s, t, N) << endl;
}

Measured memory_bytes: 3408
N = int(input())

dp = [[0 for _ in range(3)] for _ in range(N + 1)]
# dp[day][a/b/c] = day日にa/b/cを行った場合の最大幸福度

for i in range(1, N + 1):
    s = list(map(int, input().split()))
    for j in range(3):
        dp[i][j] = max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]) + s[j]
print(max(dp[N]))


Measured memory_bytes: 24308
#include <iostream>
#include<stdio.h>

using namespace std;

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	
	if(a + b + c >= 22){
      cout << "bust" <<endl;
    }
  	else if(a + b + c <= 21){
      cout << "win" << endl;
    }
}

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

int main() {
    int N;  cin >> N;
    bool ok = true;
    for (int i = 0; i < N; ++i) {
        int a;  cin >> a;
        if (a % 2 == 0) {
            if (a % 3 && a % 5) ok = false;
        }
    }
    cout << (ok ? "APPROVED" : "DENIED") << endl;
}


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

using namespace std;
using ll = long long;

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

  ll a, b;
  cin >> a >> b;

  auto f = [](ll n) {
    ll r = n / 4;
    ll ret = 0;
    for (ll i = r * 4; i <= n; i++) {
      ret ^= i;
    }
    return ret;
  };

  cout << (f(b) ^ f(a - 1)) << endl;

  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const LL mod = (1e9 + 7);

int n, a, num[100005], num2[100005];
map<int, int> mps, mps2, mps3;

int main()
{
    scanf("%d", &n);
    for(int i = 1;i <= n;i++)
    {
        scanf("%d", &a);
        mps[a]++;
        if(mps[a] >= 2&&!mps2[a])
            num[++num[0]] = a, mps2[a] = 1;
        if(mps[a] >= 4&&!mps3[a])
            num2[++num2[0]] = a, mps3[a] = 1;
    }
    sort(num + 1, num + 1 + num[0]);
    sort(num2 + 1, num2 + 1 + num2[0]);
    if(num[0] < 2&&num2[0] == 0)
        puts("0");
    else
    {
        LL ans = 0;
        if(num2[0])
            ans = 1ll * num2[num2[0]] * num2[num2[0]];
        if(num[0] >= 2)
            ans = max(ans, 1ll * num[num[0]] * num[num[0] - 1]);
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  string a, b;
  cin >> a >> b;
  if (a.size() > b.size())
  {
    cout << "GREATER" << endl;
  }
  else if (a.size() < b.size())
  {
    cout << "LESS" << endl;
  }
  else
  {
    if (a == b)
    {
      cout << "EQUAL" << endl;
    }
    else if (a < b)
    {
      cout << "LESS" << endl;
    }
    else
    {
      cout << "GREATER" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    if(n%2==0){
        cout<<n/2<<endl;
    }else{
        cout<<(n/2)+1<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;

void main()
{
	foreach (line; stdin.byLine) {
		auto n = line.chomp.to!int;
		if (!n) break;
		BigInt factor = 1;
		foreach (i; 1..n+1) {
			factor *= i;
		}
		int cnt;
		foreach_reverse (s; factor.to!string) {
			if (s == '0') cnt++;
			else break;
		}
		cnt.writeln;
	}
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)

int N,Q;

vector<pair<int,string> > vec;

int main() {
    cin>>N>>Q;
    rep(i,N) {
        int val;
        string ss;
        cin>>val>>ss;
        vec.push_back(make_pair(val,ss));
    }
    vec.push_back(make_pair(0,"kogakubu10gokan"));
    sort(vec.begin(),vec.end());

    rep(i,N) {
        if(vec[i].first <= Q && Q < vec[i+1].first) {
            cout<<vec[i].second<<endl;
            return 0;
        }
    }
    cout<<vec[N].second<<endl;
    return 0;
}

Measured memory_bytes: 1220
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
bool prime(int n){
  bool res=true;
  int buf=sqrt(n)+1;
  for(int i=2;i<buf;i++){
    if(n%i==0){
      res=false;
      break;
    }
  }
  return res;
}
signed main(){
  int n=100001;
  vector<int> p;
  for(int i=3;i<n;i++){
    if(prime(i)){
      if(prime((i+1)/2))
      p.push_back(i);
    }
  }
  int num=p.size();
  int q;cin>>q;
  vector<int> l(q);
  vector<int> r(q);
  rep(i,q)cin>>l[i]>>r[i];
  rep(i,q){
    auto it=upper_bound(p.begin(),p.end(),r[i]);
    auto it2=lower_bound(p.begin(),p.end(),l[i]);
    int res=it-it2;
    cout<<res<<endl;
  }
  return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

void core(){
	vector<string> v;
	int N,L;
	cin >> N >> L;
	string str;
	for (int i = 0; i < N; i++){
		cin >> str;
		v.push_back(str);
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < N; i++){
		cout << v[i];
	}
	cout << endl;
}

int main(){
	core();
	getchar(); getchar();
	return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())

S = []
D = [-1,0,1]

for _ in range(H):
    S.append(input())

Ans = ["" for _ in range(H)]

for h in range(H):
    for w in range(W):
        if S[h][w]==".":
            cnt = 0
            for dh in D:
                for dw in D:
                    if h+dh >= 0  and  h+dh < H  and  w+dw >= 0  and  w+dw < W  and  S[h+dh][w+dw] == "#":
                        cnt += 1
            Ans[h] += str(cnt)
        else:
            Ans[h] += "#"

for h in range(H):
    print(Ans[h])



Measured memory_bytes: 3064
#n = gets.chomp.to_i
#arr = gets.chomp.split(" ").map{|i|i = i.to_i}
a = []
a << gets.chomp.to_i
a << gets.chomp.to_i
a << gets.chomp.to_i
a << gets.chomp.to_i
a << gets.chomp.to_i
k = gets.chomp.to_i
flag=0
j = 1
5.times do|i|
  #puts "i=#{i}, a[i]=#{a[i]}"
  for jj in j..4 do
    #puts "jj=#{jj}, a[jj]=#{a[jj]}"
    if ((a[jj]-a[i]).abs > k) then
      flag = 1
      break 
    end
  end
  j+=1
  if flag==1 then 
    break
  end
end
if flag==1 then 
  puts ":("
else 
  puts "Yay!"
end

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int H, W, D;
pair<int, int> pr[90005];
ll d[900005];

int main(void) {
    scanf("%d %d %d", &H, &W, &D);
    for (int i=1; i<=H; i++) for (int j=1; j<=W;j++) {
      int a;
      scanf("%d", &a);
      pr[a] = mp(i, j);
    }
    
    for(int i=1; i<=H*W; i++) {
      if (i<=D) d[i] = 0;
      else {
        d[i] += abs(pr[i].first - pr[i-D].first) + abs(pr[i].second - pr[i-D].second) + d[i-D];
      }
    }
    
    int Q, ans = 0;
    scanf("%d", &Q);
    rep(i, 0, Q){
      int l, r;
      scanf("%d %d", &l, &r);
      printf("%lld\n", d[r] - d[l]);
    }

	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


string s;

int main(){

	cin >> s;

	rep(i, s.size()) {
		if (s[i] == 'C')s[i] = 'Z';
		else if (s[i] == 'B')s[i] = 'Y';
		else if (s[i] == 'A')s[i] = 'X';
		else s[i] -= 3;
	}

	cout << s << endl;

	return 0;
}


Measured memory_bytes: 3204
//%std
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
int vis[101];
int main()
{
	for(int i=1;i<=9;++i)	
		for(int j=1;j<=9;++j)
			vis[i*j]=1;
	int x=read();
	puts(vis[x]?"Yes":"No");
	return 0;
}


Measured memory_bytes: 256
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

def kaibun(s):
    n = len(s)
    for i in range((len(s)+1)//2):
        if s[i] != s[n-1-i]:
            return False
    return True

S = ns()
N = len(S)
#print(S)
#print(S[0:(N-1)//2])
#print(S[(N+3)//2-1:N])
if kaibun(S) != True:
    print('No')
elif kaibun(S[0:(N-1)//2]) != True:
    print('No')
elif kaibun(S[(N+3)//2-1:N]) != True:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 3064
for _ in range(int(input())):
  x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())
  if abs((x2 - x1)*(y4 - y3) - (y2 - y1)*(x4 - x3)) < 1e-10:
     print("YES")
  else:
     print("NO")
  


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int main()
{
    ios_base::sync_with_stdio(0);
    int t, i, j, k, p, q, r, x, y, u, v, n, m;
    cin >> n >> m;
    int sum = 0;
    fo(i, m)
    {
        int i;
        cin >> i;
        sum += i;
    }
    if (n - sum < 0)
        cout << -1;
    else
        cout << n - sum;
    return 0;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        g[u - 1].pb(v - 1);
        g[v - 1].pb(u - 1);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (v == par)
            continue;
        dfs(v, u);
    }
}


Measured memory_bytes: 10692
/*
    ThunderClap and Flash.
    Raunaq Singh
*/
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod)*(b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

void Flash(){
    ll n;
    cin>>n;
    ll a[n];
    bool ans=true;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        if(!(a[i]&1)){
            if(a[i]%3 && a[i]%5){
                ans=false;
            }
        }
    }
    if(ans){
        cout<<"APPROVED\n";
    }else{
        cout<<"DENIED\n";
    }
}

int main(int argc, char const *argv[]){
    ThunderClap;
    ll t=1;
    //cin>>t;
    for(ll i=1;i<=t;i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
   long long int a,b,c;
    cin >> a  >> b >> c;
    if(a==b||a==c||b==c)
    {
        if(a==b&&b==c)
            cout <<"No";
        else
            cout << "Yes";
    }
        
    else
        cout << "No";
}


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

using namespace std;

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

	vector<long> a(N);
	long sum = 0, sub_sum = 0;
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
		sum += a[i];
		if (i % 2 == 1)
		{
			sub_sum += a[i];
		}
	}

	vector<long> rain(N, 0);
	rain[0] = sum - 2 * sub_sum;
	for (int i = 0; i < N - 1; ++i)
	{
		rain[i + 1] = 2 * a[i] - rain[i];
	}

	for (int i = 0; i < N; ++i)
	{
		cout << rain[i];
		if (i < N - 1)
		{
			cout << " ";
		}
	}
	cout << endl;
}

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

using namespace std;

int main(){
    long long int h, r;
    cin>>h>>r;
    if(h == 1 || r == 1){
        cout<<1<<endl;
        return 0;
    }
    cout << ((h+1)/2)*((r+1)/2) + (h/2)*(r/2);
    return 0;
}

Measured memory_bytes: 256
//This Code was made by Chinese_zjc_.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <ctime>
#include <atcoder/all>
#define int long long
#define double long double
using namespace std;
const double PI = acos(-1);
const double eps = 0.0000000001;
const int INF = 0x3fffffffffffffff;
const int MOD = 998244353;
deque<vector<int>> ans;
vector<int> tmp;
int n, h, sum[100005], F[100005], Finv[100005], G[100005], ANS;
int C(int M, int N)
{
    return F[M] * Finv[N] % MOD * Finv[M - N] % MOD;
}
int power(int A, int B)
{
    int res = 1;
    while (B)
    {
        if (B & 1)
        {
            res = res * A % MOD;
        }
        A = A * A % MOD;
        B >>= 1;
    }
    return res;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n << 1; ++i)
    {
        cin >> h;
        ++sum[h];
    }
    F[0] = 1;
    for (int i = 1; i <= 100000; ++i)
    {
        F[i] = F[i - 1] * i % MOD;
    }
    Finv[100000] = power(F[100000], MOD - 2);
    for (int i = 100000; i; --i)
    {
        Finv[i - 1] = Finv[i] * i % MOD;
    }
    G[0] = 1;
    for (int i = 1; i <= 100000; ++i)
    {
        G[i] = G[i - 1] * (i + i - 1) % MOD;
    }
    for (int i = 1; i <= 100000; ++i)
    {
        if (sum[i])
        {
            tmp.clear();
            for (int j = 0; j <= sum[i] >> 1; ++j)
            {
                int v = C(sum[i], j << 1) * G[j] % MOD;
                if (j & 1)
                {
                    v = MOD - v;
                }
                tmp.push_back(v);
            }
            ans.push_back(tmp);
        }
    }
    while ((int)ans.size() > 1)
    {
        tmp = atcoder::convolution(ans[0], ans[1]);
        ans.pop_front();
        ans.pop_front();
        ans.push_back(tmp);
    }
    tmp = ans[0];
    ans.pop_front();
    for (int i = 0; i < tmp.size(); ++i)
    {
        ANS = (ANS + tmp[i] * G[n - i]) % MOD;
    }
    cout << ANS << endl;
    return 0;
}

Measured memory_bytes: 12288
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
typedef long long ll;
int op(int a, int b) {
	return max(a, b);
}
int e() {
	return -1;
}
int main() {
	int N, Q;
	cin >> N >> Q;
	segtree<int, op, e> seg(N);
	for (int i = 0; i < N; ++ i) {
		int x;
		cin >> x;
		seg.set(i, x);
	}
	for (int i = 0; i < Q; ++ i) {
		int t, x, y;
		cin >> t >> x >> y;
		if (t == 1) {
			seg.set(x-1, y);
		} else if (t == 2) {
			cout << seg.prod(x-1, y) << endl;
		} else {
			cout << seg.max_right(x-1, [y](int v){ return v < y; })+1 << endl;
		}
	}
}


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

    int sum = 1;
    int ans = 1;
    while (sum < B) {
        sum += A - 1;
        ans++;
    }

    cout << ans - 1  << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
namespace lib
{
	#define ll long long
	#define ull unsigned long long
	#define rgi register int
	#define rgl register long long
	#define rgc register char
	const double pi=acos(-1); 
	using namespace std;
	class fastio
	{
		private:
			#define _NUMLEN 112
			char _num[_NUMLEN],_ch; int _f,_head; bool _useSTD;
		public:
			fastio() {_f=0,_head=0,_useSTD=0,SUF=_ch=' ';}
			char SUF;
			inline void ioSTD() {_useSTD=1; ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); }
			inline void gc(char & _c) {if(_useSTD)cin>>_c; else _c=getchar(); }
			inline void pc(char _c) {if(_useSTD)cout<<_c; else putchar(_c); }
			template<typename _T> inline fastio & operator - (_T & _x)
			{
				if(_useSTD)cin>>_x; else{
					_x=0; 
					while(!isdigit(_ch)) _f|=_ch=='-',gc(_ch); 
					while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),gc(_ch); 
					_f&&(_x=-_x,_f=0); 
				}return *this; 
			}
			template<typename _T> inline fastio & operator + (_T _x)
			{
				if(_useSTD)cout<<_x<<SUF; else{
					_T _k; 
					if(_x==0) {pc('0'),pc(SUF);return *this;} if(_x<0) pc('-'),_x=-_x;
					while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k; while(_head>0) pc(_num[_head]),--_head;
					pc(SUF);
				}return *this; 
			}
			template<typename _T> inline fastio & operator >> (_T & _x) {cin>>_x;return *this;}
			template<typename _T> inline fastio & operator << (_T _x) {cout<<_x;return *this;}
			#define edn pc('\n')
	}io;
	inline void fileio(string _r,string _w) {if(_r[0]!='-')freopen(_r.c_str(),"r",stdin); if(_w[0]!='-')freopen(_w.c_str(),"w",stdout); }
	#define mem(_x,_set) memset(_x,_set,sizeof(_x))
}
using namespace lib;
// ----------------------------

#define int ll
const int maxn=200004;
const int mod=1000000007,inf=1000000007;

inline int powmod(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1) (res*=a)%=mod;
		(a*=a)%=mod;
		b>>=1;
	}
	return res;
}
inline int inv(int a) {return powmod(a,mod-2);}
int f[maxn];
int c[maxn];

signed main()
{
	// fileio("tt.in","tt.out");
	// io.ioSTD();
	// io.SUF='\n';
	int n,k,ans=0;
	io-n-k;
	k=min(n,k);
	c[0]=f[0]=1;
	for(rgi i=1;i<=n;++i) f[i]=f[i-1]*(n-i)%mod*inv(i)%mod;
	for(rgi i=1;i<=n;++i) c[i]=c[i-1]*(n-i+1)%mod*inv(i)%mod;
	for(rgi i=0;i<=k;++i) (ans+=c[i]*f[i])%=mod;
	io+ans;
	return 0;
}
// ----------------------------
// by imzzy


Measured memory_bytes: 3328
#include<iostream>
#include<list>
#include<vector>
#include<string>

using namespace std;

int main(){
    string s;
    cin >> s;
  
    int size = s.size();
  	int size_alpha = 26; 
    vector<int> count(size_alpha, 0);
    int offset = 97;
  	int tmp_index;
    bool beautiful = true;
  
  	for (int i=0; i<size; ++i){
      tmp_index = s[i]-offset;
      count[tmp_index]++;
    }
    
    for (int i=0; i<size_alpha; ++i){
      if (count[i] % 2 == 0){
        continue;
      }
      else{
        beautiful = false;
        break;
      }
    }

    if (beautiful){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
}


Measured memory_bytes: 256
person_num = int(input())

comments = []
for i in range(person_num):
    comments_num = int(input())
    comment = []
    for j in range(comments_num):
        comment.append(list(map(int, input().split())))
    comments.append(comment)

honest_max = 0
for i in range(2 ** person_num):
    check = list(bin(i)[2:].zfill(person_num))
    for j in range(person_num):
        if check[j] == "1":
            for comment in comments[j]:
                if check[comment[0]-1] != str(comment[1]):
                    break
            else:
                continue
            
            break
    else:
        if honest_max < check.count("1"):
            honest_max = check.count("1")

print(honest_max)

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

#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define TC int tc; cin >> tc; while(tc--)

using namespace std;

const int INF = 1e9 + 7;


int main(void)
{
	FAST;
	int n; cin >> n;
	vector<int> a(n);
	for(int &t : a) cin >> t;
	
	ll ans = 0;
	for(int i = 1; i < n; i++){
		if(a[i-1] > a[i]){
			ans += (a[i-1] - a[i]);
			a[i] = a[i-1];
		}
	}
	cout << ans << '\n';
	
	return 0;
}


Measured memory_bytes: 3952
a = [list(map(int, input().split())) for _ in range(3) ]
n = int(input())
b = [int(input()) for i in range(n)]
for j in range(n):
    for k in range(3):
        for l in range(3):
            if b[j] == a[k][l]:
                a[k][l] = "o"
if a[0][0] == "o" and a[0][1] == "o" and a[0][2] == "o":
    print("Yes")
elif a[1][0] == "o" and a[1][1] == "o" and a[1][2] == "o":
    print("Yes")
elif a[2][0] == "o" and a[2][1] == "o" and a[2][2] == "o":
    print("Yes")
elif a[0][0] == "o" and a[1][0] == "o" and a[2][0] == "o":
    print("Yes")
elif a[0][1] == "o" and a[1][1] == "o" and a[2][1] == "o":
    print("Yes")
elif a[0][2] == "o" and a[1][2] == "o" and a[2][2] == "o":
    print("Yes")
elif a[0][0] == "o" and a[1][1] == "o" and a[2][2] == "o":
    print("Yes")
elif a[0][2] == "o" and a[1][1] == "o" and a[2][0] == "o":
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9200