akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

ll D;
ll c[26];
ll s[365][26];
ll score[26];
ll last[26];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> D;
    REP(i, 0, 26) {
        cin >> c[i];
    }
    REP(i, 0, D) {
        REP(j, 0, 26) {
            cin >> s[i][j];
        }
    }
    ll t[D];
    REP(i, 0, D) {
        cin >> t[i];
        t[i]--;
    }
    fill(last, last + 26, -1);
    REP(i, 0, D) {
        ll contest = t[i];
        REP(j, 0, 26) {
            if (j == contest) {
                score[j] += s[i][j];
                last[j] = i;
            } else {
                score[j] -= c[j] * (i - last[j]);
            }
        }
        ll sum = 0;
        REP(j, 0, 26) {
            sum += score[j];
        }
        cout << sum << endl;
    }
}


Measured memory_bytes: 3712
#include<stdio.h>

int main(){
	int S, h, m, s;
	scanf("%d", &S);
	h = S / 3600;
	S %= 3600;
	m = S / 60;
	s = S % 60;

	printf("%d:%d:%d\n", h, m, s);

	return 0;
}

Measured memory_bytes: 592
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>

using namespace std;

/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;    
    }
    return sum;
}
/// 最小公倍数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){

long long n,k, s1=0,s2;
cin >> n >> k;
if(k%2 == 0){
    for(int i = 1; i <= n ; i++){
        if(i%k == k/2)s1++;
    }
}
s2 = n/k;
cout << s1*s1*s1 + s2*s2*s2;

}

Measured memory_bytes: 256
/**
*    author:  musasi
*    created: 19.04.2020 21:23:17
**/

#include <bits/stdc++.h>

using namespace std;
#define rep2(x,from,to) for(long long (x)=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define ASSERT(expr...) assert((expr))
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; }
typedef long long ll;
typedef pair<ll,ll > P;
typedef pair<ll,P > PP;
typedef pair<ll,PP > PPP;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int n,m;
signed main() {
   cin.tie(0);
   ios_base::sync_with_stdio(false);
   cin>>n>>m;
   vector<int> a(m);
   rep(i, m) cin >> a[i];
   int ans=0;
   rep(i,m)ans+=a[i];
   cout<<max(-1,n-ans)<<endl;
   return 0;
}

Measured memory_bytes: 3696
def main():
    msg = input()
    msg = msg[:-1]
    if len(msg) % 2 != 0:
        msg = msg[:-1]
    while len(msg) >= 2:
        before = msg[:int(len(msg) / 2)]
        after = msg[int(len(msg) / 2):]
        if before == after:
            print(len(msg))
            break
        msg = msg[:-2]


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    long long a, b, c;
    cin >> a >> b >> c;
    // cout << c * c + a * a + b * b - 2 * a * c - 2 * b * c + 2 * a * b << endl;
    // cout << 4 * a * b << endl;
    if(c - a - b > 0 && (c - a - b) * (c - a - b) > 4 * a * b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

int main(){
    long int h = 0;
    long int j = 1;
    long int sum = 0;
    cin >> h;

    for(int i = h; h > 0; h = h >> 1){
        sum += j;
        j *= 2;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
dp = [float('inf')]*n
dp[0] = 0
dp[1] = abs(h[0]-h[1])
if n==2: print(dp[1]);exit()
for i in range(2,n):
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]))
print(dp[-1])

Measured memory_bytes: 84896
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
a = LI()
M,m = max(a),min(a)
b,c = a.index(M)+1,a.index(m)+1

if M > 0 and m < 0:  # 符号を揃える
    print(2*N-1)
    if M <= -m:
        for i in range(1,N+1):
            a[i-1] += m
            print(c,i)
    else:
        for i in range(1,N+1):
            a[i-1] += M
            print(b,i)
else:
    print(N-1)

if max(a) <= 0 :
    for i in range(N,1,-1):
        print(i,i-1)
else:
    for i in range(1,N):
        print(i,i+1)


Measured memory_bytes: 62632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
const int mod = 1000000007;
int n,a,b;
std::vector<ll> p,q,test;
int main(){
  cin >> n;
  for (size_t i = 0; i < n; i++) {
    test.pb(i+1);
  }
  p.resize(n); q.resize(n);
  for (size_t i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (size_t i = 0; i < n; i++) {
    cin >> q[i];
  }
  int hoge = 0;
  do {
    int c=0; bool pyes=true,qyes=true;
    for(auto x:test){
      if(p[c] != x)pyes = false;
      if(q[c] != x)qyes = false;
      c++;
    }
    if(pyes) a = hoge;
    if(qyes) b = hoge;
    hoge++;
  }while (next_permutation(all(test)));
  cout << abs(a - b) << endl;
}


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

typedef long long ll;

#define for(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)
#define sz(x)        ((ll)(x).size())
#define inf          1<<25

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; }

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

int main() {
    int N, K;
    cin >> N >> K;
    
    vector<int> x(N);
    rep(i, N) cin >> x[i];
    
    ll sum = 0;
    rep(i, N) sum += (x[i] < abs(K-x[i]) ? x[i] : abs(K-x[i]));
    cout << 2 * sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
main()
{
    int n;
    cin>>n;
    int a[n+1],b[n];
    for(int i=0;i<n+1;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
        cin>>b[i];
    int count=0;
    for(int i=0;i<n;i++)
    {
        int x=min(a[i],b[i]);
        b[i]-=x;
        a[i]-=x;
        int y=min(a[i+1],b[i]);
        b[i]-=y;
        a[i+1]-=y;
        count+=(x+y);
    }
    cout<<count<<"\n";
}

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

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

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

    vector<ld> coins(n);
    for(auto& i : coins) {
        cin >> i;
    }

    vector<vector<ld>> ans(n+1, vector<ld>(n+1,0));

    ans[0][0] = 1 - coins[0];
    ans[0][1] = coins[0];

    // For each coin
    for(int i = 1; i < n; i++) {
        // For each existing amount of heads
        for(int j = 0; j < n; j++) {
            ans[i][j]   += ans[i-1][j] * (1-coins[i]);
            ans[i][j+1] += ans[i-1][j] * coins[i];
        }
    }

    ld total = 0;
    for(int i = (n+1)/2; i <= n; i++) {
        total += ans[n-1][i];
    }

    cout << fixed;
    cout.precision(10);
    cout << total << endl;
}


Measured memory_bytes: 141056
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<queue>
#include<functional>
#define loop(n) for(int i = 0; i < n; i++)
#define FOR(x,y,z) for(int x = y; x < z; x++)
#define REP(i,n) FOR(i,0,n)
#define INF 9999999999999
#define VEC vector<int>
#define in push_back
#define ans(x) cout<<x<<endl
typedef long long ll;
using namespace std;
priority_queue<int, vector<int>, greater<int>> small;//chiisai
priority_queue<ll>large;//ookii
int main()
{
	ll n, k, a[300001],ruise[300001];
	cin >> n;
	REP(i, n) {
		cin >> a[i];
	}
	ruise[0] = a[0];
	REP(i, n-1) {
		ruise[i + 1] = ruise[i] + a[i+1];
	}
	ll mini = 922337203685477580;
	REP(i, n-1) {
		ll mae = ruise[i];
		ll ushiro = ruise[n - 1] - mae;
		mini = min(mini, abs(mae - ushiro));
	}
	cout << mini << endl;
	return 0;
}


Measured memory_bytes: 4608
//2019.8.24 by ljz
//email 573902690@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f
#define unl __int128
#define eps 5.6e-8
#define RG register
#define db double
#define pc(x) __builtin_popcount(x)
typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pb push_back
#define ull unsigned LL
#define gc getchar
//inline char gc() {
//    static char buf[100000],*p1,*p2;
//    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
inline int read() {
    res s=0,ch=gc();
    while(ch<'0'||ch>'9')ch=gc();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s;
}
//inline int read() {
//    res s=0,ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline void write(RG unl x){
//    if(x>10)write(x/10);
//    putchar(int(x%10)+'0');
//}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//clock_t start=clock();
//inline void ck(){
//    if(1.0*(clock()-start)/CLOCKS_PER_SEC>0.1)exit(0);
//}
const int N=2e5+10;
const int kcz=1e9+7;
namespace MAIN{
    char str[N];
    int n;
    inline void add(res &x,const res &y){
        x+=y,x>=kcz?x-=kcz:1;
    }
    inline int mul(const res &x,const res &y){
        return int(1LL*x*y%kcz);
    }
    inline int Add(const res &x,const res &y){
        return x+y>=kcz?x+y-kcz:x+y;
    }
    int dp[N];
    int t,ret;
    inline void MAIN(){
        n=read(),scanf("%s",str+1);
        t=0,ret=1;
        for(res i=1;i<=n*2;i++){
            if(t&1){
                if(str[i]=='W')t++;
                else{
                    if(!t){puts("0");return;}
                    ret=mul(ret,t--);
                }
            }else{
                if(str[i]=='W'){
                    if(!t){puts("0");return;}
                    ret=mul(ret,t--);
                }
                else t++;
            }
        }
        if(t){puts("0");return;}
        for(res i=1;i<=n;i++)ret=mul(ret,i);
        printf("%d\n",ret);
    }
}
int main(){
//    srand(19260817);
//    freopen("signin.in","r",stdin);
//    freopen("signin.out","w",stdout);
    MAIN::MAIN();
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n;
  cin >> n;
  vll counter(10000+1,0);
  REP(i,n){
    int a;
    cin >> a;
    counter[a]++;
  }
  vll ans;
  REP(i,10000+1){
    REP(j,counter[i]){
      ans.PB(i);
    }
  }
  REP(i,SZ(ans)){
    if(i) cout << " ";
    cout << ans[i];
  }
  cout <<endl;




  return 0;
}



Measured memory_bytes: 19352
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n,t;
    cin >> n >> t;

    vector<int> ti(n);
    rep(i,n) cin >> ti[i];

    int sum = t;

    rep(i,n-1){
        if(ti[i+1] - ti[i]  < t){
            sum += ti[i + 1] - ti[i];
        }
        else{
            sum += t ;
        }
        
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout <<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;

	VAR(int, n, m);
	VEC(string, a, n);
	VEC(string, b, m);
	bool ok = false;
	REP(hi, n - m + 1) {
		REP(wi, n - m + 1) {
			bool ok2 = true;
			REP(hj, m) {
				REP(wj, m) {
					ok2 &= (a[hi + hj][wi + wj] == b[hj][wj]);
				}
			}
			ok |= ok2;
		}
	}
	OUT(ok ? "Yes" : "No")BR;
  return 0;
}


Measured memory_bytes: 256
N, Y = map(int, input().split())

count = 0
for x in range(N+1):
    for y in range(N+1-x):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z==Y:
            count += 1
            print(x, y, z)
            break
    if count!=0:
        break
if count==0:
    print("-1 -1 -1")

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  char c[h][w];
  bool f[w];
  bool ff[h];
  for(int j=0;j<w;j++){
    f[j]=true;
  }
  for(int i=0;i<h;i++){
    ff[i]=true;
    for(int j=0;j<w;j++){
      cin>>c[i][j];
      if(c[i][j]=='#'){
        f[j]=false;
        ff[i]=false;
      }
    }
  }
  for(int i=0;i<h;i++){
    if(ff[i]) continue;
    for(int j=0;j<w;j++){
      if(f[j]) continue;
      cout<<c[i][j];
    }
    cout<<endl;
  }
}

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

using namespace std;

#define pb            push_back
#define mp            make_pair
#define po            pop_back
#define fi            first
#define se            second
#define mxn           200005
#define ll            long long int
#define ldb           long double
#define fr(i,a,b,k)   for(int i=a ; i<b ; i+=k)
#define frr(i,a,b,k)  for(int i=a ; i>b ; i-=k)
#define all(v)        v.begin(),v.end()
#define endl          "\n"
#define deg(x)        cout<<endl<<#x<<" = "<<(x)<<endl;
#define casep(x)      cout<<"Case #"<<(x)<<": ";
#define fast          ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef pair<int,int> pp;
typedef vector<int> vi;
typedef vector<pp> vpp;
typedef vector<vi> vvi;

const ll inf = LLONG_MAX;

ll power_mod(int a, int n, int mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
ll power(ll a,ll n){if(n==0){return 1;}ll p=power(a,n/2);p = (p * p);if (n%2==1){p=(p*a);}return p;}
int gcd(int a,int b){ return __gcd(a,b);}
int lcm(int a,int b){return a*b/__gcd(a,b);}
vector<vi> adj;
bool vis[mxn];

ll dfs(ll x) {

    vis[x] = 1;
    ll n = 1;
    for(auto u : adj[x]) {
        if(vis[u])continue;
        vis[u] = 1;
        n += dfs(u);
    }

    return n;
}

void run(ll test){

    ll n,m;
    cin >> n >> m;
    adj = vector<vi>(n);
    memset(vis,0,n+1);

    fr(i,0,m,1) {
        ll x,y;
        cin >> x >> y;
        x--;
        y--;
        if(find(adj[x].begin(),adj[x].end(),y) == adj[x].end()) {
            adj[x].pb(y);
            adj[y].pb(x);
        }
    }


    ll ans = 0;
    fr(i,0,n,1) {
        if(!vis[i]) {
            ll nodes = dfs(i);
            ans = max(nodes,ans);
        }
    }

    cout << ans;

}

int main(){

    fast;
    int t=1;
    // cin >> t;
    for(int i=1 ; i<=t ; i++){
        run(i);
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 23628
from collections import deque
*N, = map(int, input().split())
used = set([i for i in N if i != -1])
deq = deque({i for i in range(1, 10)} - used)
C = [1, 10, 1, 100, 10, 1, -100, -10, -1]
def solve():
    res = 0
    for i in range(9):
        res += C[i] * N[i]
    return+(res == 0)

def dfs(c, rest):
    if rest == 0:
        return solve()

    if N[c] != -1:
        return dfs(c+1, rest)

    res = 0
    for i in range(rest):
        v = deq.popleft()
        N[c] = v
        res += dfs(c+1, rest-1)
        deq.append(v)
    N[c] = -1
    return res
print(dfs(0, len(deq)))

Measured memory_bytes: 8036
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;
    
    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int T = cin.nextInt();
        int[] A = cin.ArrayInt(N);

        int preMin = int.MaxValue;
        int best = 0;
        int same = 0;
        for (int i = 0; i < N; i++)
        {
            preMin = Math.Min(preMin, A[i]);
            int diff = A[i] - preMin;
            if(diff > best)
            {
                best = diff;
                same = 1;
            }
            else if(diff == best)
            {
                same++;
            }
        }
        Console.WriteLine(same);
    }
    
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 20576
N = gets.to_i
S = gets.chomp.chars

require 'set'
ans = 0
(1..(N - 1)).each do |i|
  a = Set.new(S[0...i])
  b = Set.new(S[i..-1])
  c = (a & b).size
  ans = c if c > ans
end
puts ans

Measured memory_bytes: 2428
// Problem : B - Papers, Please
// Contest : AtCoder Beginner Contest 155
// URL : https://atcoder.jp/contests/abc155/tasks/abc155_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

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

#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);
#define endl "\n"
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;

int32_t main()
{
	IOS;
	int t = 1;
	//cin >> t;	
	for(int msi = 1; msi <= t; msi++)
	{
		bool flag = true;
		int n; cin >> n;
		vector<int> v(n);
		for(int i = 0; i < n; i++){
			int x;
			cin >> x;
			if(x%2 == 0){
				if(x%3 == 0 or x%5 == 0){
					continue;
				}else{
					flag = false;
				}
			}
		}
		if(flag){
			cout <<"APPROVED";
		}else{
			cout <<"DENIED";
		}
	}	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int F[100][10];
int P[100][11];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	REP(i,n) REP(j,10) cin >> F[i][j];
	REP(i,n) REP(j,11) cin >> P[i][j];
	int ans = -(1<<30);
	for(int bit = 1; bit < (1<<10); bit++){
		int tmp = 0;
		REP(i,n){
			int c=0;
			REP(j,11){
				if((bit & (1<<j)) && F[i][j]) c++;
			}
			tmp += P[i][c];
		}
		ans = max(ans, tmp);
	}
	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define pii pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#define fio freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define vll vector<long long int>
#define vpii vector<pair<int,int>>
#define dsc [](int a,int b)->bool {return a>b;}
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define MAX 1000000000000000000
#define test int t; cin>>t;
#define MOD 1000000007LL
#define all(x) (x).begin(),(x).end()

using namespace std;

ll nxt(){
    ll x;
    cin>>x;
    return x;
}

vector<ll>primes;

void generateP(){
    vector<bool> p(1000000,0);
    for(int i = 3; i<1000; i+=2){
        if(p[i] == 0){
            for(int j = i*i; j<1000000; j+=i+i){
                p[j] = 1;
            }
        }
    }
    primes.pb(2);
    for(int i = 3; i < 1000000; i+=2){
        if(!p[i]) primes.pb(i);
    }
}

int main()
{
    #ifndef ONLINE_JUDGE
        fio
    #endif
    IOS
    
    generateP();

    map<ll,ll> primeFact;
    //bool pairWise = true, setWise = true;

    ll n = nxt();
    
    vector<ll>a(n);

    generate(all(a),nxt);

    for(ll x: a){
        if(x == 1) continue;
        ll sqrx = sqrt((double)x);
        //bool f = false;
        for(int i = 0; primes[i]<=sqrx; i++){
            if(x%primes[i] == 0){
                //if(pairWise && primeFact[primes[i]]) pairWise = false;
                primeFact[primes[i]]++;
                //f = true;
                while(x && x%primes[i] == 0){
                    x/=primes[i];
                    //sqrx = sqrt((double)x);
                }
            }
        }
        if(x>1){
            primeFact[x]++;
        }
    }

    ll maxCNT = 0;
    for(auto it = primeFact.begin(); it!=primeFact.end(); it++){
        maxCNT = max(maxCNT,(*it).second);
        //cout<<(*it).first<<" "<<(*it).second<<endl;
    }

    //if(maxCNT>=n) setWise = false;

    if(maxCNT<=1) cout<<"pairwise coprime"<<endl;
    else if(maxCNT<n) cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;

    return 0;
}

Measured memory_bytes: 16392
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <ctime>
#include <queue>
#include <sstream>
#include <utility>
#include <bitset>

using namespace std;

#define MP make_pair 
#define PB push_back 
#define INF (1000000007) 
#define eps 1e-8

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

int n,m,e;
int a[200005],c[200005],b[200005],d[200005];

int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) 
	{
		cin>>a[i];
		c[a[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(!c[i]) continue;
		int l=max(i-c[i]+1,1);
		b[l]++;
		b[i+1]--;
//		cout<<i<<"  "<<l<<" "<<i+1<<endl;
	}
	for(int i=1;i<=n;i++) 
	{
		d[i]=d[i-1]+b[i];
		if(!d[i]) e++;
	}
//	cout<<e<<endl<<endl;
//	for(int i=1;i<=n;i++) cout<<d[i]<<" ";
//	cout<<endl;
	for(int i=1;i<=m;i++)
	{
		int x,p;
		cin>>x>>p;
		if(!(a[x]-c[a[x]]+1<1)) d[max(a[x]-c[a[x]]+1,1)]--;
		if(!d[max(a[x]-c[a[x]]+1,1)]) e++;
		c[a[x]]--;
		a[x]=p;
		c[p]++;
		if(!d[max(a[x]-c[a[x]]+1,1)]) e--;
		if(!(a[x]-c[a[x]]+1<1)) d[max(a[x]-c[a[x]]+1,1)]++;
		cout<<e<<endl;
//		for(int i=1;i<=n;i++) 
	}
	return 0;
}

Measured memory_bytes: 4480
n, m = gets.split.map(&:to_i)
X = gets.split.map(&:to_i)

sorted = X.sort

diff = []
sorted.each_with_index do |x, i|
  next if i == 0

  diff[i - 1] = (sorted[i] - sorted[i - 1]).abs
end

sorted_diff = diff.sort.reverse

if n >= m
  puts 0
else
  (n - 1).times do
    sorted_diff.shift
  end

  p sorted_diff.reduce(:+)
end


Measured memory_bytes: 11248
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = ~(1<<31);
#define fs first
#define sc second
#define pb push_back

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
    return (a % b + b) % b;
}
int n,m;
vi E[100'050];
int memo[100'050];

int dp(int at) {
    if(memo[at] != -1) return memo[at];
    int val = 0;
    iter(it,E[at]) {
        val = max(val, dp(*it)+1);
    }
    return memo[at] = val;
}

int main() {
    cin.sync_with_stdio(false);
    cin >> n >> m;
    memset(memo,-1,sizeof(memo));
    rep(i,0,m) {
        int x,y;
        cin >> x >> y;
        x--;y--;
        E[x].pb(y);
    }
    int ans = 0;
    rep(i,0,n) ans = max(ans, dp(i));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
int main() {
  int Length, Width, C, sum = 0, res = 0;
  cin >> Length >> Width >> C;
  vector<int> B(Width);
  vector<vector<int>> A(Length,vector<int>(Width));
  for(int i = 0; i < Width; i++) cin >> B[i];
  for(int i = 0; i < Length; i++) {
    for(int j = 0; j < Width; j++) {
      cin >> A[i][j];
    }
  }
  for(int i = 0; i < Length; i++) {
    for(int j = 0; j < Width; j++) {
      sum += A[i][j] * B[j];
    }
    sum += C;
    if(sum > 0) res++;
    sum = 0;
  }
  cout << res << endl;
}
      
  
  

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
constexpr lint MOD = 1000000007;

template <typename T>
T power(T x, T n, T mod)
{
    T ans = 1;
    while (n>0)
    {
        if (n & 1) ans = ans * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return ans;
}

vector<lint> factorial;
vector<lint> facInv;
void cPrecal(int n)
{
    factorial = facInv = vector<lint>(n+1, 1);
    for (int i=1; i<=n; i++)
    {
        factorial[i] = factorial[i-1] * i % MOD;
        facInv[i] = power(factorial[i], MOD-2, MOD);
    }
}

lint nCr(int n, int r)
{
    if (n<r || r<0) return 0;
    else return (factorial[n] * facInv[r] % MOD) * facInv[n-r] % MOD;
}


int H, W, A, B;

int main()
{
    cin >> H >> W >> A >> B;
    cPrecal(H+W);
    lint ans = 0;
    for (int i=0; i<H-A; i++)
    {
        ans += nCr((B-1)+i, i) * nCr((W-B-1)+H-i-1, H-i-1);
        ans %= MOD;
    }
    cout << ans << endl;
}


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

int main(){
  int n,i,A=0,B=0;
  cin>>n;
  vector<int> a(n);
  for(i=0;i<n;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  for(i=0;i<n;i+=2){
    A+=a.at(i);
  }
  for(i=1;i<n;i+=2){
    B+=a.at(i);
  }
  cout<<A-B<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<double> x(n);
	vector<string> u(n);
	rep(i, n) cin >> x[i] >> u[i];

	double sum = 0.;
	rep(i, n) {
		sum += ((u[i] == "JPY") ? 1. : 380000.) * x[i];
	}
	printf("%f\n", sum);
	return 0;
}

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

int main()
{
    long long x,y,z;
    cin>>x>>y>>z;
    long long ans;
    ans=(x-z)/(y+z);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,flag=0;
  cin >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
     cin >> a.at(i);
    if((i+1)%2==1&&a.at(i)%2==1){
      flag++;
    }
  }
  cout << flag << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int MOD = 1000000007;

int main()
{
	int n = 0;
	cin >> n;
	string ans = "NO";
	if (n == 3 || n == 5 || n == 7)
	{
		ans = "YES";
	}
	cout << ans << "\n";
	return 0;
}

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

int main()
{
  int a=0;
  int b=0;
  int c=0;
  string s;
  cin >> s;
  for(int i=0;i<3;i++)
  {
    if(s.at(i)=='a') a++;
    if(s.at(i)=='b') b++;
    if(s.at(i)=='c') c++;
  }
  if(a==1&&b==1&&c==1) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

const int V_MAX=10000;

vector<int> G[V_MAX];
vector<int> RG[V_MAX];
vector<bool> check(V_MAX);
vector<int> connect(V_MAX);
vector<int> label(V_MAX);
int counter=0;

void label_dfs(int s){
	if(check[s]==true){return;}
	check[s]=true;
	for (int i=0;i<G[s].size();i++){
		if(check[G[s][i]]==false){
			label_dfs(G[s][i]);
		}
	}
	label[counter]=s;
	counter++;
	return;
}

void dfs(int s,int l){
	if(connect[s]!=-1){return;}
	connect[s]=l;
	for (int i=0;i<RG[s].size();i++){
		if(connect[RG[s][i]]==-1){
			dfs(RG[s][i],l);
		}
	}
	return;
}

int main(){
	int V,E,Q,s,t,u,v;
	cin >> V >> E;
	for (int i=0;i<E;i++){
		cin >> s >> t;
		G[s].push_back(t);
		RG[t].push_back(s);
	}
	
	counter=0;
	fill(check.begin(),check.end(),false);
	
	for (int i=0;i<V;i++){
		label_dfs(i);
	}
	
	
	fill(connect.begin(),connect.end(),-1);
	for (int i=V-1;i>-1;i--){
		dfs(label[i],label[i]);
	}
	
	cin >> Q ;
	for(int i=0;i<Q;i++){
		cin >> u >> v;
		cout << (connect[u]==connect[v]) << endl;
	}
	/*
	for (int i=0;i<V;i++){
		cout << connect[i] << endl;
	}
	*/
	return 0;
}

Measured memory_bytes: 2856
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
  int N, ans=0, temp;
  char S[300001];
  cin >> N;
  scanf("%s", S);
  for(int i = 1; i< N; i++){
    if(S[i] == 'E')ans++;
  }
  temp = ans;
  for(int i = 1; i < N; i++){
    if(S[i-1] == 'W') temp++;
    if(S[i] == 'E') temp--;
    if(temp < ans) ans = temp;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
 
typedef unsigned long long UInt64;
typedef long long Int64;
 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
using namespace std;

int maze[12][12];

void show()
{
	rep(i,12)
	{
		rep(j,12)
		{
			cout<<maze[i][j];
		}
		cout<<endl;
	}

}

void dfs(int x,int y)
{
	maze[x][y]=0;
	rep(i,4)
	{
		int nx=x+dx[i];
		int ny=y+dy[i];

		if(0<=nx&&nx<12&&0<=ny&&ny<12&&maze[nx][ny]==1)
			dfs(nx,ny);
	}

}
int main()
{
	string str;
	while(cin>>str)
	{
		int ans=0;
		rep(i,12) maze[0][i]=str[i]-'0';
		rep(i,11)
		{
			cin>>str;
			rep(j,12)
			{
				maze[i+1][j]=str[j]-'0';
			}
		}

		rep(i,12) rep(j,12)
		{
			if(maze[i][j]==1)
			{
				ans++;
				dfs(i,j);
			}
		}

		cout<<ans<<endl;

	}
	return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main(){

	string S;
	cin >> S;
	int moji[(int)S.size()];
	for(int i = 0; i < (int)S.size(); i++){
		int str = atoi(S.substr(i,1).c_str());
		moji[i] = str;
	}
	int ans = 0;
	for(int j = 0; j < (int)S.size() - 1; j++){
		if(moji[j] == 1 && moji[j + 1] == 1){
			ans++;
			moji[j + 1] = 0;
		}
		if(moji[j] == 0 && moji[j + 1] == 0){
			ans++;
			moji[j + 1] = 1;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 896
import Control.Monad
  ( replicateM )

type Pair = (Int, Int)

main :: IO ()
main = do
  n  <- readLn
  lr <- replicateM n readPair
  print $ counter n lr

readPair :: IO Pair
readPair = do
  [l,r] <- map read . words <$> getLine
  return (l,r)

counter 
  :: Int -> [Pair] -> Int
counter n lr = n + sum (map (uncurry $ flip (-)) lr)

Measured memory_bytes: 1404
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int k, x;
  cin >> k >> x;
  rep (i, x - k + 1, x + k) cout << i << (i != x + k - 1 ? " " : "\n");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int A;
  int B;
  int C;
  cin >>A>>B>>C;
  int x=(A*B)/2;
  cout << x<< endl;
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 998244353
#define MAX 100
#define INF 800000000

int main(){
  int N;
  string S;
  cin>>N>>S;
  vector<int> sum_black(N+1,0);
  for(int i=0;i<N;i++){
    if(S.at(i)=='#'){
      sum_black.at(i+1)+=1;
    }
    sum_black.at(i+1)+=sum_black.at(i);
  }

  int ans=N;
  for(int i=0;i<=N;i++){
    ans=min(sum_black.at(i)+N-i-(sum_black.at(N)-sum_black.at(i)),ans);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1412
/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'
#define PI 3.14159265359

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

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

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

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1010;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int) 1e9 + 7;
int n , m;
char a[maxn][maxn];
int dp[maxn][maxn];
string in;

signed main() {
    
    fio;
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        cin >> in;
        for(int j = 0; j < m; j++){
            a[i][j + 1] = in[j];
        }
    }
    
    dp[1][1] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(a[i][j] == '#') continue;
            if(a[i - 1][j] == '.'){
                dp[i][j] += dp[i - 1][j];
                dp[i][j] %= mod;
            }
            if(a[i][j - 1] == '.'){
                dp[i][j] += dp[i][j - 1];
                dp[i][j] %= mod;
            }
        }
    }
    
    cout << dp[n][m] << endl;
    
    
    return 0;
    
}


Measured memory_bytes: 9216
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

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

    bool D[100] = {false};
    int ans = 0;
    REP(i, N) {
        int d;
        cin >> d;

        if (!D[d]) {
            D[d] = true;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
import sys
input = sys.stdin.readline
def sc(s):
    b = None
    nc = 0
    kk = [0]*len(s)
    for i, c in enumerate(s):
        if c == ".":
            if c == b:
                nc += 1
            else:
                si = i
        else:
            if b == ".":
                for j in range(si, i):
                    kk[j] = i - si
            nc = 0
        b = c
    return kk
d = []
d2 = []
d3 = []
for h in range(H):
    s = input().strip()
    d.append(s)
    d2.append(sc(s+"#"))

d = list(zip(*d))
for s in d:
    d3.append(sc("".join(s)+"#"))
r = 0
for i in range(H):
    for j in range(W):
        r = max(r, d2[i][j] + d3[j][i]-1)
print(r)


Measured memory_bytes: 387840
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] data = new int[5];
		int ave = 0;

		for(int i = 0;i<5;i++) data[i] = sc.nextInt();

		for(int k : data) ave += (k<40)? 40 : k;
		ave /= 5;

		System.out.println(ave);
	}

}

Measured memory_bytes: 26140
N,Ma,Mb=map(int,input().split())
INF=40*100+1
dp=[[INF for i in range(10*N+1)] for j in range(10*N+1)]
dp[0][0]=0
ans=INF
for p in range(N):
  a,b,c=map(int,input().split())
  for i in range(len(dp)-1,-1,-1):
    for j in range(len(dp[i])-1,-1,-1):
      if dp[i][j]!=INF:
        dp[i+a][j+b]=min(dp[i+a][j+b],dp[i][j]+c)
        if (i+a)/(j+b)==Ma/Mb:
          ans=min(ans,dp[i+a][j+b])
          
if ans==INF:
  print(-1)
else:
  print(ans)

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

int bo[8][8] = {
    {1, 0, 1, 0, 1, 0, 1, 0},
    {1, 1, 1, 1, 1, 1, 1, 1},
    {1, 0, 1, 0, 1, 0, 1, 0},
    {1, 1, 1, 1, 1, 1, 1, 1},
    {1, 0, 1, 0, 1, 0, 1, 0},
    {1, 1, 1, 1, 1, 1, 1, 1},
    {1, 0, 1, 0, 1, 0, 1, 0},
    {1, 1, 1, 1, 1, 1, 1, 1}
};

int main() {
    int q;
    cin >> q;
    while (q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--, b--, c--, d--;
        int cnt = 0;
        for (int i = a; i <= c; i++) {
            for (int j = b; j <= d; j++) {
                if (bo[i][j]) cnt++;
            }
        }
        cout << cnt << '\n';
    }
}


Measured memory_bytes: 3076
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<P, P> PP;
struct edge {int to, cost;};

signed main() {
	int n; cin >> n;
	int ans = 0;
	rep(i, n) {
		int a; cin >> a; ans += a;
	}
	cout << ans - n << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int data1, data2, seki;
  
  scanf("%d%d", &data1, &data2);

  seki = data1 * data2;

  if(seki % 2 == 0){
    printf("Even\n");
  } else {
    printf("Odd\n");
  }
    
  return 0;                    

}

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

const int mod = 1000000007;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int pow(int a, int b, int res = 1) {
	for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a);
	return res;
}
const int MAXN = 410;
int pre[MAXN][MAXN];
int f[MAXN][MAXN];
int n, C, A[MAXN], B[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	for (int i = 0; i != MAXN; ++i)
		for (int j = 1; j != MAXN; ++j)
			reduce(pre[i][j] = pre[i][j - 1] + pow(j, i) - mod);
	std::cin >> n >> C;
	for (int i = 1; i <= n; ++i) std::cin >> A[i];
	for (int i = 1; i <= n; ++i) std::cin >> B[i];
	f[0][0] = 1;
	for (int i = 1; i <= n; ++i)
		for (int j = 0; j <= C; ++j)
			for (int k = 0; k <= j; ++k)
				reduce(f[i][j] += mul(f[i - 1][j - k], pre[k][B[i]] - pre[k][A[i] - 1] + mod) - mod);
	std::cout << f[n][C] << std::endl;
	return 0;
}


Measured memory_bytes: 1536
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;

int main()
{
	long long n, m; 
	scanf("%lld%lld", &n, &m);
	printf("%lld", abs((n - 2) * (m - 2)));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 
  int n,h;
  cin>>n>>h;

  vector<pair<int, int> > pairs(n);
  int max_a=0;
  for(int i=0;i<n;i++){
    cin>>pairs.at(i).second>>pairs.at(i).first;
    max_a=max(pairs.at(i).second,max_a);
  }

  sort(pairs.begin(), pairs.end(),greater<>());

  int cnt=0;
  int i=0;
  while(h>0){
    if(i<n && max_a<pairs.at(i).first){
      h-=pairs.at(i).first;
      cnt++;
      i++;
    }else{
      int wk = ceil((double)h/(double)max_a);
      h-=wk*max_a;
      cnt += wk;
    }
  }

  cout<<cnt<<endl;

  return 0;
}

Measured memory_bytes: 4040
N = int(input())
A = list(map(int, input().split()))
r = 0
now = 0
ans = 0
for i in range(N):
    while N > r:
        if now & A[r] != 0:
            break
        now += A[r]
        r += 1
    now -= A[i]
    ans += r-i
print(ans)

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

#define NMAX 100001
#define MAX(a, b) (a > b ? a : b)

using namespace std;

//ifstream fin("f.in");
//ofstream fout("f.out");

int apples, pieces;
int pies;

int main()
{
    cin >> apples >> pieces;
    pies = (apples * 3 + pieces ) / 2;
    cout << pies << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		Set<String> set = new HashSet<>();
		String first = sc.next();
		set.add(first);
		
		char tail = first.charAt(first.length() - 1);
		for (int i = 0; i < n - 1; i++) {
			String word = sc.next();
			if (!set.add(word) || tail != word.charAt(0)) {
				System.out.println("No");
				sc.close();
				return;
			}
			tail = word.charAt(word.length() - 1);
		}
		
		System.out.println("Yes");
		
		sc.close();
	}
}




Measured memory_bytes: 27124