akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;

// alive edges :  path 1->n through this edge
// we have to consider only those
// because we can get lost in negative cycle of non alive edges.

const int maxn = 2500+5, maxm = 5000+5;
vector<vector<pair<int,int>>> g(maxn), gr(maxn);
vector<int>U(maxm),V(maxm),W(maxm),alive(maxm);
int n,m,p,neg_cycle=0;

vector<int> reachable(int s,vector<vector<pair<int,int>>>&g){
	vector<int>vis(n+1);
	queue<int>q;
	q.push(s);
	vis[s]=1;
	while( q.size() ){
		int u = q.front(); q.pop();
		for(auto [v,i]:g[u]){
			if( !vis[v] ){
				vis[v]=1;
				q.push(v);
			}
		}
	}
	return vis;
}

vector<int> spfa(int s,vector<vector<pair<int,int>>>&g){
	vector<int>dis(n+1,1e18);
	vector<int>inq(n+1);
	vector<int>cnt(n+1);
	queue<int>q;
	dis[s]=0;
	q.push(s);
	inq[s]=1;
	while( q.size() ){
		int u = q.front(); q.pop(); inq[u] = 0;
		for(auto [v,i]:g[u]){
			if( !alive[i] )continue;
			//bug4(u,v,i,alive[i]);
			if( dis[v] > dis[u] - W[i] + p ){
				//bug4(u,v,dis[v],dis[u]-W[i]+p);
				dis[v] = dis[u] - W[i] + p;
				cnt[v] += 1;
				if( cnt[v] > n+m ){
					neg_cycle = 1;
					return dis;
				}
				if( !inq[v] ){
					inq[v] = 1;
					q.push(v);
				}
			}
		}
	}
	return dis;
	
}


int32_t main(){
	IOS
	cin >> n >> m >> p;
	for(int i=1;i<=m;i++){
		cin >> U[i] >> V[i] >> W[i];
		g[U[i]].push_back({V[i],i});
		gr[V[i]].push_back({U[i],i});
	}
	vector<int>vis1 = reachable(1,g);
	vector<int>visn = reachable(n,gr);
	for(int i=1;i<=m;i++){
		alive[i] =  vis1[ U[i] ] && visn[ V[i] ];
		//bug2(i,alive[i]);
	}
	vector<int> dis = spfa(1,g);
	if( neg_cycle ){
		cout << -1 << endl;
		return 0;
	}
	int ans =  max(-dis[n],0ll);
	cout << ans << endl;
	
	
}
/*
 * long long or int?
 * index out of bound?
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


Measured memory_bytes: 4280
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> sum(N),max(N);
  
  if(S.at(0)=='W')	sum.at(0)=1;
  else	sum.at(0)=0;
  for(int i=1;i<N;i++){
    if(S.at(i)=='W')	sum.at(i) = sum.at(i-1) + 1;
    else	sum.at(i)=sum.at(i-1);
  }
  
  max.at(0) = N-1-(sum.at(N-1)-sum.at(0));
  for(int i=1;i<N;i++){
    max.at(i) = sum.at(i-1) + N-1-i-(sum.at(N-1)-sum.at(i));
  }
  
  sort(max.begin(),max.end());
  cout << max.at(0) << endl;
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int A,B;
    cin >> A >> B;
    int ans = 0;
    if(A > B){
        ans += A;
        A--;
    }else{
        ans += B;
        B--;
    }
    ans += max(A, B);
    cout << ans << endl;
}

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

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

    int ans = 0;
    rep(i, s.size()) {
        if (s[i] == '+')
            ans++;
        else
            ans--;
    }
    cout << ans << endl;

    return 0;
}


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

string solve(long long int n)
{
  string s;
  long long int cnt=0,m=n,d;
  if(n==0)
    return "0";
  while(n!=0)
  {
      d=n%(-2);
      n/=(-2);
      if(d<0)
      {
          d+=2;
          n++;
      }
      if(d==0)
        s+='0';
      else
        s+='1';
  }
  reverse(s.begin(),s.end());
  return s;
}

int main()
{
    ios_base::sync_with_stdio(false);
    long long int n;
    cin>>n;
    cout<<solve(n)<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;
 
const int mx = 100005;
int dp[6][mx];
 
int main(){
    int n;
    cin >> n;
    int v = static_cast<int>(n/1.08);
    
    if (v*1.08==n) {
        cout << v << endl;
    }
    else if ((v+1)*1.08>n && (v+1)*1.08<n+1){
        cout << v+1 << endl;
    }
    else {
        cout << ":(" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int sum[1001*1001]={0};
int sum1[1001*1001]={0};
int main(void){
	int n,m;
	int i,j;
	int high,low,base,mid;
	int a[1001];
	int k,l;
	int MIN;
	int ans;
	int sgm;
	while(1){
		cin>>n>>m;
		if(n==0&&m==0)	break;
		for(i=0;i<n;i++){
			cin>>a[i];
		}
		a[n]=0;
		sort(a,a+n+1);
		//for(i=0;i<=n;i++)	 cout<<a[i]<<endl;cout<<endl;
		int flg;
		MIN=INT_MAX;
		ans=0;
		l=0;
		for(i=0;i<=n;i++){
			for(j=0;j<=n;j++){
				sum[l]=a[i]+a[j];
				l++;
			}
		}
		sort(sum,sum+l);
		//for(i=0;i<l;i++)	cout<<i+1<<" "<<sum[i]<<endl;
		k=0;
		for(i=0;i<l;i++){
			if(sum[i]!=sum[i+1]){
				sum1[k]=sum[i];
				k++;
			}
		}
		//for(i=0;i<k;i++)	cout<<i+1<<" "<<sum1[i]<<endl;
		for(i=0;i<k;i++){
			sgm=sum1[i];
			if(sgm<=m){
				base=m-sgm;
				high=k-1;
				low=0;
				flg=0;
				while(low<=high){
					mid=(high+low)/2;
					if(base<sum1[mid]){
						high=mid-1;
					}
					else if(base>sum1[mid]){
						low=mid+1;
					}
					else{
						flg=1;
						break;	
					}
				}
				if(flg==1){
					sgm+=base;
				}	
				else{
					sgm+=sum1[high];
				}
			}
			//cout<<"M="<<MIN<<" "<<"SA="<<m-sgm<<" "<<"SGM="<<sgm<<endl;
			if(MIN>m-sgm&&m>=sgm){
				MIN=m-sgm;
				ans=sgm;
				//cout<<"ans="<<ans<<endl;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 8908
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD = 1000000007;

int main() {
  ll N, K;
  cin >> N >> K;
  
  //累積和
  vector<ll> sum(N+2);
  for( ll i = 0; i <= N; i++ ) sum.at(i+1) = sum.at(i)+i;
  
  ll ans = 0;
  for( ll i = K; i <= N+1; i++ ){
    ll MIN = sum.at(i);
    ll MAX = sum.at(N+1) - sum.at(N+1-i);
    ans += (MAX-MIN)+1;
    ans %= MOD;
  }
  cout << ans << endl;
}

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

int main()
{
    long n;
    long a[200000];
    std::vector<long> b;
    std::cin >> n;
    for(long i=0; i<n; i++){
        std::cin >> a[i];
    }
    long counter=n-1;
    while(counter>=0){
        std::cout << a[counter] << " ";
        counter-=2;
    }
    if(counter==-2){
        counter=1;
    }
    if(counter==-1){
        counter=0;
    }
    while(counter<n-1){
        std::cout << a[counter] << " ";
        counter+=2;
    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 3712
#pragma GCC optimize("O2")

#include <bits/stdc++.h>
#ifdef DEBUG
    #include "debug.hpp"
#endif

using namespace std;

#define all(c) (c).begin(), (c).end()
#define traverse(c, it) for(auto it = (c).begin(); it != (c).end(); it++)
#define rep(i, N) for(int i = 0; i < (N); i++)
#define rep1(i, N) for(int i = 1; i <= (N); i++)
#define rep2(i, s, e) for(int i = (s); i <= (e); i++)
#define rep3(i, s, e, d) for(int i = (s); (d) >= 0 ? i <= (e) : i >= (e); i += (d))
#define pb push_back


#ifdef DEBUG
    #define debug(x...) {dbg::depth++; string dbg_vals = dbg::to_string(x); dbg::depth--; dbg::fprint(__func__, __LINE__, #x, dbg_vals);}
    #define light_debug(x) {dbg::light = 1; dbg::dout << __func__ << ":" << __LINE__ << "  " << #x << " = " << x << endl; dbg::light = 0;}
#else
    #define debug(x...)
    #define light_debug(x) 
#endif

template<typename T>
T& ckmin(T& a, T b){ return a = a > b ? b : a; }

template<typename T>
T& ckmax(T& a, T b){ return a = a < b ? b : a; }

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

namespace ioUtils {

    char vector_delimiter = ' ';

    template<typename T>
    istream& operator >>(istream&, vector<T>&);

    template<typename... Ts>
    istream& operator >>(istream& is, pair<Ts...>& p){
        is >> p.first >> p.second;
        return is;
    }

    template<typename T> 
    istream& operator >>(istream& is, vector<T>& v){
        for(auto& e : v) is >> e;
	       return is;
    }

    template<typename T>
    ostream& operator <<(ostream&, vector<T>&);

    template<typename... Ts>
    ostream& operator <<(ostream& os, pair<Ts...>& p){
        os << p.first << " " << p.second;
        return os;
    }

    template<typename T>
    ostream& operator <<(ostream& os, vector<T>& v){
        for(auto&& e : v) os << e << vector_delimiter;
        return os;   
    }   
}

using namespace ioUtils;

int N, W;
vector<pii> a;
ll dp[100][100001];
bool ch[100][100001];

ll rec(int i, int w){
	if(i >= N) return 0;
	if(ch[i][w]) return dp[i][w];

	ch[i][w] = 1;

	dp[i][w] = rec(i + 1, w);
	if(w + a[i].first <= W) 
		ckmax(dp[i][w], a[i].second + rec(i + 1, w + a[i].first));
	return dp[i][w];
}

signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    #ifdef DEBUG
        freopen("debug", "w", stderr);
    #endif
    
    cin >> N >> W;
    a.resize(N);
    cin >> a;
    cout << rec(0, 0) << '\n';

    #ifdef DEBUG
        dbg::dout << "\nExecution time: " << clock() << "ms\n";
    #endif

    return 0;
}


Measured memory_bytes: 84940
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int main()
{
	fast
	int n,i,j;
	cin>>n;
	double dp[n+1][n+1]={0},p[10000];
	
	for(i=1;i<=n;i++)cin>>p[i];
	dp[1][0]=1-p[1];
	dp[1][1]=p[1];
	for(i=2;i<=n;i++)
	{
		dp[i][i]=dp[i-1][i-1]*p[i];
		dp[i][0]=dp[i-1][0]*(1-p[i]);
	}
	for(i=2;i<=n;i++)
	for(j=1;j<i;j++)
	{
		dp[i][j]=(1-p[i])*dp[i-1][j]+p[i]*dp[i-1][j-1];
	}
	double ans=0;
	for(i=n/2+1;i<=n;i++)
		ans+=dp[n][i];
	printf("%0.12f\n",ans);
} 

Measured memory_bytes: 70528
using System;

class Program
{
    static void Main()
    {
        while (true)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int x = int.Parse(s[1]);
            if (n == 0 && x == 0)
                break;

            int count = 0;
            for (int i = 1; i <= n; i++)
                for (int j = i + 1; j <= n; j++)
                    for (int k = j + 1; k <= n; k++)
                    {
                        if (i + j + k == x)
                            count++;
                    }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 9152
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"3
7 1
2
5
10"# => r#"8"#,

r#"2
8 20
1
10"# => r#"29"#,

r#"5
30 44
26
18
81
18
6"# => r#"56"#,
}


fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize,
        d: usize, x: usize,
        a: [usize; n],
    }

    let mut ans = x;

    for i in 0..n {
        // print!("a[{}]=", i);
        for j in 0..d + 1 {
            if 1 + a[i] * j <= d {
                // print!("{},", 1 + a[i] * j);
                ans += 1;
            }
        }
        // println!("");
    }

    ans.to_string()
}

Measured memory_bytes: 4352
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
	string a,b;
	cin >> a >> b;
	bool ok=false;
	int na=a.size();
	int nb=b.size();
	rep(i,na-nb+1){
		bool check=true;
		rep(j,nb){
			if(a[i+j]==b[j]||b[j]=='_')
				continue;
			else
				check=false;
		}
		if(check)
			ok=true;
		if(ok)
			break;
	}
	if(ok)
		puts("Yes");
	else
		puts("No");
	return 0;
}


Measured memory_bytes: 1164
let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int

stdin.ReadLine()

()
|> readIntArray
|> fun arr ->
    let iMax = arr |> Array.length |> (-) <| 1
    [ 0 .. iMax ]
    |> List.map (fun x ->
        (Array.sum arr.[0..x] - Array.sum arr.[x + 1..iMax])
        |> abs)
    |> List.min
    |> printfn "%d"


Measured memory_bytes: 30184
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
template<class T>int digid(T x){
    if(x>=1&&x<10)return 1;
    else if(x>=10&&x<100)return 2;
    else if(x>=100&&x<1000)return 3;
    else if(x>=1000&&x<10000)return 4;
    else if(x>=10000&&x<100000)return 5;
    else if(x>=100000&&x<1000000)return 6;
    else if(x>=1000000&&x<10000000)return 7;
    else if(x>=10000000&&x<100000000)return 8;
    else if(x>=100000000&&x<1000000000)return 9;
    else if(x>=1000000000&&x<10000000000)return 10;
    else if(x>=10000000000&&x<100000000000)return 11;
    else return -1;
}
long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    ll candiv=-1;
    int res=1<<30;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0)candiv=i;
        chmin(res,max(digid(candiv),digid(n/candiv)));
    }
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> vec(n);
	for(int i = 0; i < n; ++i){
		cin>>vec[i];
	}
	sort(vec.begin(), vec.end());
	vec.erase(unique(vec.begin(), vec.end()), vec.end());
	cout<<vec.size()<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;



public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder s = new StringBuilder(sc.next());
		StringBuilder prefix = new StringBuilder();
		StringBuilder suffix = new StringBuilder();
		int q = sc.nextInt();
		boolean rev = false;
		for (int i=0;i<q;i++) {
			int a = sc.nextInt();
			if (a==1) {
				rev = !rev;
				StringBuilder tmp = suffix;
				suffix = prefix;
				prefix = tmp;
			} else {
				int f = sc.nextInt();
				String c = sc.next();
				if (f==1) {
					prefix.append(c);
				} else {
					suffix.append(c);
				}
			}
		}
		
		prefix.reverse();
		
		if (rev) {
			s.reverse();
		}
		
		System.out.println(prefix.toString() + s + suffix);



	
	}
	


}





Measured memory_bytes: 120728
using System;
using System.Linq;

namespace ITP1_2_C_Sorting_Three_Numbers
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine( Console.ReadLine().Split( ' ' ).Select( int.Parse ).OrderBy( n => n ).Select( n => n.ToString() ).Aggregate( (acc, n) => acc + " " + n ) );
        }
    }
}

Measured memory_bytes: 6420
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,n;
  cin>>n>>a>>b;
  long long ans=0;
  long long now;cin>>now;
  for(int i=1;i<n;i++){
    long long va;cin>>va;
    ans+=min(a*(va-now),b);
    now=va;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<string>

using namespace std;

priority_queue<int>q;

int main()
{
    int k;
    string com;
    while(cin>>com){
        if(com=="end"){
            break;
        }else if(com=="extract"){
            printf("%d\n",q.top());
            q.pop();
        }else{
            scanf("%d",&k);
            q.push(k);
        }
    }
    return 0;
}


Measured memory_bytes: 7204
#include<iostream>
#include<cstring>
using namespace std;
string a,b;
int dp[3001][3001];
int lcs2(int n,int m)
{
	if(n>=a.length()||m>=b.length())
	 return dp[n][m]=0;
	 if(dp[n][m]!=-1)
	  return dp[n][m];
	 if(a[n]==b[m])
	  return dp[n][m]=1+lcs2(n+1,m+1);
	 else
	   return dp[n][m]=max(lcs2(n+1,m),lcs2(n,m+1));
	  
	 
}
void print()
{ 
 int lcs=lcs2(0,0);
   int i=0,j=0;
   string p;
 while(lcs>0)
   { if(a[i]==b[j])
   	   {
		  p.push_back(a[i]);
		  i++;
		  j++;
		  lcs--;
	}
   	   else if(dp[i][j+1]>dp[i+1][j])
   	        j++;
   	        else
   	        i++;
   	        
   }    
	cout<<p;
	
}
int main()
{
 cin>>a>>b;
 memset(dp,-1,sizeof(dp));
   print();	
	
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()

int main(){
  ll k, n;
  cin >> k >> n;
  if(500*k>=n){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  string S; cin >> S;
  vector<int> wi;

  int n = S.size();
  REP(i, n) {
    if (S[i] == 'B') continue;
    wi.push_back(i);
  }

  ll ans = 0;
  for (ll i = 0; i < wi.size(); ++i) {
    ans += wi[i]-i;
  }

  cout << ans << endl;
}

Measured memory_bytes: 1532
#include "bits/stdc++.h"
using namespace std;
template<typename T, typename S> void amax(T &a, S b){ if(a < b) a = b; }
template<typename T, typename S> void amin(T &a, S b){ if(a > b) a = b; }
#define rep(a,b,c) for(int a = b; a < c; a++)
#define per(a,b,c) for(int a = b; a > c; a--)
#define rit(it,v) for(auto &it:v)
#define mset(a, b) memset(a, b, sizeof(a))
#define mt make_tuple
#define pb push_back
using ii = pair<int,int>;
using ll = long long;
using vi = vector<int>;
using ld = long double;
using vll = vector<ll>;
const ll mod = 1000000007;
ll powm(ll a, ll b){ll ans=1;a %= mod;for(;b;b>>=1){if(b&1)ans=ans*a%mod;a = a*a%mod;}return ans;}
const int maxn = 101010;
int main(){
	int n, m; cin >> n >> m;
	multiset<int> d[111];
	while(m--){
		int a, b; cin >> a >> b;
		a--; b--;
		d[a].insert(b);
		d[b].insert(a);
	}
	rep(e, 0, n) cout << d[e].size() << endl;
	return 0;
}


Measured memory_bytes: 256
import sys

lines = sys.stdin.readlines()

X = lines[0].split(' ')
Y = lines[1].split(' ')

N = int(X[0])
M = int(X[1])

d = 0
for i in range(M):
    d = d + int(Y[i])

if d > N:
  print(-1)
else:
  print(N-d)

Measured memory_bytes: 9492
N = int(input())
A = list(map(int, input().split()))
cnt = 0

for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0:
      if A[i] % 5 != 0:
        cnt += 1

if cnt > 0:
	print('DENIED')
else:
	print('APPROVED')

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define REVREP(i, n)      for(ll i = n - 1; i >= 0 ; i--)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define VC                vector<char>
#define VVC               vector<vector<char>>
#define INF               (ll)2e9
#define INF_LL            1LL<<60
//#define MOD             998244353
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }
template<class T> bool chmax(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }

void Solve()
{
	ll N;
	cin >> N;
	VL A(N);
	REP(i, N) cin >> A[i];
	ll Q;
	cin >> Q;
	VL B(Q), C(Q);
	REP(i, Q) cin >> B[i] >> C[i];
	sort(ALL(A));

	ll ans = accumulate(ALL(A), (ll)0);
	VL val(100000 + 5, 0); 

	REP(i, N) {
		val[A[i]]++;
	}

	REP(i, Q) {
		ll nowNum = val[B[i]];
		ll nextNum = val[C[i]];

		val[B[i]] = 0;
		val[C[i]] += nowNum;
		ans -= nowNum * B[i];
		ans += nowNum * C[i];
		cout << ans << endl;
	}
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


Measured memory_bytes: 6272
import java.util.Scanner;

public class Main {
	

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int h = Integer.parseInt(sc.next());
		int w = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		
		int n = h*w;
		
		Data []data = new Data [n+1];
		
		for(int i = 0 ;i < h ;i++) {
			for(int j = 0 ; j < w ;j++) {
				int a = Integer.parseInt(sc.next());
				data[a] = new Data(i+1,j+1);
				}
			}
		
		int []sum = new int [n+1];
		
		for(int i = d+1 ;i <= n ;i++) {
				int p = data[i].geth() - data[i-d].geth();
				int q = data[i].getw() - data[i-d].getw();
				
				int P = Math.abs(p);
				int Q = Math.abs(q);
				
				sum[i] = sum[i-d] + P + Q;
		}
		
		int q = Integer.parseInt(sc.next());
		int []ans = new int [q];
		
		for(int i = 0 ;i < q ;i++) {
			int l = Integer.parseInt(sc.next());
			int r = Integer.parseInt(sc.next());
			ans[i] = sum[r] - sum[l];
		}
		

		for(int i = 0 ;i < q ;i++) {
			System.out.println(ans[i]);
		}
	

	}	
}
class Data{
	
	private int h;
	private int w;
	
	public Data(int h,int w) {
		this.h = h;
		this.w = w;
	}
	
	public int geth() {
		return h;
	}
	public int getw() {
		return w;
	}
}


Measured memory_bytes: 68428
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

int main(){
    
    int n;
    cin >> n;
    vector<int> a(n,0), b(n,0), c(n+1,0), d(n+1,0);
    rep(i,n){
        cin >> a[i];
        c[a[i]]++;
    }
    rep(i,n){
        cin >> b[i];
        d[b[i]]++;
    }

    int x = 0;
    rep(i,n+1) x = max(x, c[i] + d[i]);
    if(x > n){
        cout << "No" << "\n";
        return 0;
    }
    
    rep(i,n){
        c[i+1] += c[i];
        d[i+1] += d[i];
    }
    
    x = 0;
    rep(i,n) x = max(x, c[i+1] - d[i]);
    
    cout << "Yes" << "\n";
    
    rep(i,n) cout << b[(i+n-x)%n] << ' ';
    cout << "\n";
    
    return 0;
}



Measured memory_bytes: 5976
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        int topping = 0;
        for (int i = 0; i < a.length(); i++) {
            if (a.charAt(i) == 'o') topping += 100;
        }
        
        System.out.println(700 + topping);
    }
}


Measured memory_bytes: 23764
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  REP(i,s.size()){
    if(s[i]=='1') x++;
  }
  OUT(x);
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

#define ARRAY_SIZE 200000

int data[ARRAY_SIZE];

int search_max(int* data, int size)
{
  int max_index = 0;
  for(int i = 1; i < size; i++) {
    if(data[max_index] < data[i]) {
      max_index = i;
    }
  }
  return max_index;
}

int search_r(int* data, int size, int max_index)
{
  int max_value = data[max_index];
  int left_target, right_target;
  int best_value = INT_MAX;
  int best_index;

  left_target = max_value / 2;
  if(max_value % 2 == 0) {
    right_target = left_target;
  } else {
    right_target = left_target + 1;
  }

  for(int i = 0; i < size; i++) {
    if(i == max_index) {
      continue;
    }
    if(abs(data[i]-left_target) < best_value) {
      best_index = i;
      best_value = abs(data[best_index]-left_target);
    }
    if(abs(data[i]-right_target) < best_value) {
      best_index = i;
      best_value = abs(data[best_index]-right_target);
    }
  }
  return data[best_index];
}

int main()
{
  int n;
  int max_index, r;

  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    scanf("%d", &data[i]);
  }
  max_index = search_max(data, n);
  r = search_r(data, n, max_index);
  printf("%d %d\n", data[max_index], r);
  return 0;
}


Measured memory_bytes: 640
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def cmb(n, r, mod=10 ** 9 + 7):
    if r < 0 or n < r:
        return 0
    r = min(r, n - r)
    numerator, denominator = 1, 1
    for i in range(1, r + 1):
        numerator = (numerator * (n + 1 - i)) % mod
        denominator = (denominator * i) % mod
    return numerator * pow(denominator, mod - 2, mod) % mod


def solve():
    N, M, K = map(int, rl().split())
    MOD = 10 ** 9 + 7
    
    ans = 0
    for i in range(N):
        for j in range(M):
            tmp = (N - i) * (M - j) * (i + j) % MOD
            if i != 0 and j != 0:
                tmp *= 2
            ans = (ans + tmp) % MOD
    ans = ans * cmb(N * M - 2, K - 2) % MOD
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 39152
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);
    int a, b;
    cin >> a >> b;
    cout << (a <= 9 && b <= 9 ? a * b : -1) << endl;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int n,m,k;

struct mod_fac{
    private:
        vector<ll> f,i_f;
        int n;ll MOD;
    public:
        void init(int n,ll m){
            MOD=m;
            f.resize(n+1,0);
            i_f.resize(n+1,0);
            f[0]=1;
            rep(i,n){
                f[i+1]=f[i]*(i+1)%MOD;
            }
            i_f[n]=power(f[n],MOD-2);
            per(i,n){
                i_f[i]=(i_f[i+1]*(i+1))%MOD;
            }
        }
        ll power(ll a ,ll x){
            if (x==0) return 1;
            if (x==1) return a%MOD;
            if (x==2) return (a*a)%MOD;
            if (x%2==1) return (a*power(power(a,(x-1)/2),2))%MOD;
            return (power(power(a,x/2),2))%MOD;
        }
        ll fac(int x){
            return f[x];
        }
        ll invfac(int x){
            return i_f[x];
        }
        ll comb(int m,int k){
            if (m<0 or k<0) return 0;
            if (m<k) return 0;
            return (((f[m]*i_f[k])%MOD)*i_f[m-k])%MOD;
        }
};
ll ans=0;
int main(){
    cin >> n >> m >> k;
    mod_fac M;M.init(n*m,mod);
    rep(d,n){
        (ans+=d%mod*(n-d)%mod*m%mod*m%mod*M.comb(n*m-2,k-2)%mod) %= mod;
    }
    rep(d,m){
        (ans+=d%mod*(m-d)%mod*n%mod*n%mod*M.comb(n*m-2,k-2)%mod) %= mod;
    }
    cout << ans%mod << endl;
}

Measured memory_bytes: 3328
#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:128777216")
  
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <sstream>
  
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
  
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <string.h>
  
#include <memory.h>
#include <cassert>
#include <time.h>
  
using namespace std;
  
#define forn(i,n) for (int i = 0; i < (int)(n); i++)
#define fornd(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define forab(i,a,b) for (int i = (int)(a); i <= (int)(b); i++)
#define forabd(i, b, a) for (int i = (int)(b); i >= (int)(a); i--)
#define forit(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
  
#define _(a, val) memset (a, val, sizeof (a))
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
  
typedef long long lint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vii;
  
const lint LINF = 1000000000000000000LL;
const int INF = 1000000000;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;
  
#ifdef MY_DEBUG
#define dbgx( x ) { cerr << #x << " = " << x << endl; }
#define dbg( ... ) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#else
#define dbgx( x ) {  } 
#define dbg( ... ) {  } 
#endif
  
void prepare(string s)
{
#ifdef MY_DEBUG
    freopen ("input.txt", "r", stdin);
    //freopen ("output.txt", "w", stdout);
#else
    if (s.length() != 0)
    {
        freopen ((s + ".in").c_str(), "r", stdin);
        freopen ((s + ".out").c_str(), "w", stdout);
    }
#endif
}

const int MOD = 998244353;
const int NMAX = 2000050;

int n, m, k;
int cnt[NMAX];
int f[NMAX];
int revf[NMAX];

int add(lint a, lint b) {
  return (a + b) % MOD;
}

int mul(lint a, lint b) {
  return (a * b) % MOD;
}

int bpow(int n, int k) {
  int res = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) {
      res = mul(res, n);
    }
    n = mul(n, n);
  }
  return res;
}

int cnk(int n, int k) {
  return mul(mul(f[n], revf[k]), revf[n - k]);
}


void read() {
  scanf("%d %d %d", &n, &m, &k);
}

void solve() {
  f[0] = 1;
  revf[0] = 1;
  forab(i, 1, NMAX - 1) {
    f[i] = mul(f[i - 1], i);
    revf[i] = bpow(f[i], MOD - 2);
  }

  cnt[0] = mul(m, bpow(m - 1, n - 1));

  forab(i, 1, n - 1) {
    cnt[i] = mul(m, bpow(m - 1, n - 1 - i));
    cnt[i] = mul(cnt[i], cnk(n - 1, i));
  }

  int ans = 0;
  forab(i, 0, k) {
    ans = add(ans, cnt[i]);
  }
  printf("%d\n", ans);
}

int main() {
  prepare("");

  read();
  solve();

  // forn(i, 10) {
  //   forn(j, i + 1) {
  //     dbg("%d ", cnk(i, j));
  //   }
  //   dbg("\n");
  // }
  return 0;
}

Measured memory_bytes: 20192
#include <stdio.h>

int main(){
  int a[2],f=1,i;
  for(i=0;i<2;i++){
    scanf("%d",&a[i]);
    if(a[i]>9) f=0;
  }
  if(f){
    printf("%d",a[0]*a[1]);
  }else{
    printf("-1");
  }
  return(0);
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
	int a;
	cin >> a;
	if(a%(a/100000000+a%100000000/10000000+a%100000000%10000000/1000000+a%100000000%10000000%1000000/100000+a%100000000%10000000%1000000%100000/10000+a%100000000%10000000%1000000%100000%10000/1000+a%100000000%10000000%1000000%100000%10000%1000/100+a%100000000%10000000%1000000%100000%10000%1000%100/10+a%100000000%10000000%1000000%100000%10000%1000%100%10) == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}

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

int mypow(int a,int b){//a^b
    int num=1;
    while(b!=0){
        num*=a;
        b--;
    }
    return num;
}

int main(){
    int n,m,i;cin>>n>>m;//n:桁 m:条件の個数
    int ans=0;
    vector<int> distin(n+1,-1);//桁についての情報
    
    if(n==1 && m==0){cout<<0<<endl;return 0;}
    
    for(i=0;i<m;i++){
        int s,c;
        cin>>s>>c;
        if(distin[s]!=-1 && c!=distin[s]){//同じ桁に違う数字は入れない
            cout<<-1<<endl;
            return 0;
        }
        distin[s]=c;//左からs桁目にc
    }

    
    if(n==1 && distin[1]==0){cout<<0<<endl;return 0;}
    if(n!=1 && distin[1]==0){cout<<-1<<endl;return 0;}

    for(i=1;i<=n;i++){
        if(distin[i]!=-1){
            ans+=(mypow(10,n-i)*distin[i]);
        }
    }

    int keta=0,num=ans;
    while(num!=0){
        keta++;
        num/=10;
    }

    if(keta!=n){
        ans+=(mypow(10,n-1));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn
object Main extends App {
  val input = StdIn.readLine()
  val a = input.split(" ")(0).toInt
  val b = input.split(" ")(1).toInt
  val product = a * b
  if (product % 2 == 1)
    println("Odd")
  else
    println("Even")
}


Measured memory_bytes: 25664
a,b,c = map(int,input().split())
if a == b:
  if a != c and b !=c:
    print('Yes')
  else:
    print('No')
elif a == c:
  if a != b and c != b:
    print('Yes')
  else:
    print('No')
elif b == c:
  if b != a and c != a:
    print('Yes')
  else:
    print('No')
elif a == b == c:
  print('No')
else:
  print('No')

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <unordered_set>
using namespace std;

int k, t, a[1100];

int main() {
	scanf("%d%d", &k, &t);
	for (int i = 1; i <= t; i++)
		scanf("%d", &a[i]);
	sort(a + 1, a + t + 1);
	if (a[t] * 2 - 1 <= k)
		printf("0\n");
	else
		printf("%d\n", k - 2 * (k - a[t]) - 1);
}


Measured memory_bytes: 256
a,b,m=list(map(int,input().split()))
alst=list(map(int,input().split()))
blst=list(map(int,input().split()))

ans=10**10

for i in range(m):
    x,y,c=list(map(int,input().split()))

    ans=min(ans,alst[x-1]+blst[y-1]-c)

ans=min(ans,min(alst)+min(blst))

print(ans)

Measured memory_bytes: 18740
#include<iostream>
#include<string.h>

using namespace std;

int w,h;
char field[50][50];
bool check[50][50];
int dx[] = {-1,0,1,0},dy[] = {0,-1,0,1};
int sum = 0;
bool black = false,white = false;

void bfs(int x,int y);

int main(){
	while(true){
		cin >> w >> h;
		if(w == 0 && h == 0) break;
		memset(field,0,sizeof(field));
		memset(check,0,sizeof(check));
		
		for(int i = 0;i < h;i++){
			for(int j = 0;j < w;j++){
				cin >> field[i][j];
			}
		}
		
		int b_sum = 0,w_sum = 0;
		for(int i = 0;i < h;i++){
			for(int j = 0;j < w;j++){
				sum = 0;
				black = false;
				white = false;
				if(check[i][j] == false && field[i][j] == '.'){
					bfs(j,i);
				}
				if(black && !white){
					b_sum += sum;
				}else if(!black && white){
					w_sum += sum;
				}
			}
		}
		
		cout << b_sum << " " << w_sum << endl;
	}
	return 0;
}

void bfs(int x,int y){
	check[y][x] = true;
	sum++;
	for(int i = 0;i < 4;i++){
		if(0 <= x + dx[i] && x + dx[i] < w && 0 <= y + dy[i] && y + dy[i] < h){
			if(field[y + dy[i]][x + dx[i]] == 'B'){
				black = true;
			}else if(field[y + dy[i]][x + dx[i]] == 'W'){
				white = true;
			}
		}
	}
	for(int i = 0;i < 4;i++){
		if(0 <= x + dx[i] && x + dx[i] < w && 0 <= y + dy[i] && y + dy[i] < h && check[y + dy[i]][x + dx[i]] == false && field[y + dy[i]][x + dx[i]] == '.'){
			bfs(x + dx[i],y + dy[i]);
		}
	}
}


Measured memory_bytes: 3124
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 1005;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  ll s10 = 1, s9=1,s8=1;
  for(int i=0;i<n;i++){
    s10 = s10 * 10 % mod;
    s9  = s9 * 9 % mod;
    s8 = s8 * 8 % mod;
  }
  ll ret = ((s10 - 2 * s9 + s8)%mod+mod)%mod;
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 3632
import java.util.*; 
import java.io.*; 
import java.lang.Math; 
public class Main
{
     public static void main(String []args)
     {
         Scanner in=new Scanner(System.in);
        int t,n,k,i,j=0,x;
        double m;
        
            n=in.nextInt();
            x=in.nextInt();
            t=in.nextInt();
            m=Math.ceil((double)n/x);
            m=m*t;
            System.out.println((int)m);
            
        
     }
}


Measured memory_bytes: 35736
#include <iostream>
#include <fstream>
#include <algorithm>
#include <functional>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define sq(x) ((x) * (x))
#define err(x) cerr << "["#x"]  " << (x) << "\n";
#define errp(x) cerr << "["#x"]  {" << ((x).first) << ", " << ((x).second) << "}\n";
#define errv(x) {cerr << "["#x"]  [";for(const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
#define errvn(x, n) {cerr << "["#x"]  [";for(auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
#define errf() cerr << "\n\n";

//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast, unroll-loops", "omit-frame-pointer","inline")
//#pragma GCC option("arch=native","tune=native","no-zero-upper")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2")

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getrnd(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

ll getrndll(ll l, ll r) {
    return uniform_int_distribution<ll>(l, r)(rng);
}

template <typename T1, typename T2>
inline bool relax(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

template <typename T1, typename T2>
inline bool strain(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

// :::::::::::::::::::::::::::::::

void solve() {
    ll n;
    cin >> n;
    
    ll ans = 0;
    for (ll d = 1; d * d <= n - 1; ++d) {
        if ((n - 1) % d == 0) {
            if (d != 1)
                ++ans;
            if (n - 1 != d * d)
                ++ans;
        }
    }
    
    auto can = [&](ll x) -> bool {
        ll cur = n;
        while (cur % x == 0)
            cur /= x;
        return cur % x == 1;
    };
    
    for (ll d = 1; d * d <= n; ++d) {
        if (n % d == 0) {
            if (d != 1 && can(d)) ++ans;
            if (can(n / d) && d * d != n) ++ans;
        }
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    srand(time(0));
    
    int t = 1;
//    cin >> t;
    while (t--)
        solve();
    
    return 0;
}



Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int xi[100010];
long long pos[100010], neg[100010];
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		cin >> xi[i];
	}
	int a = 0;
	for (int i = 1; i <= n; ++i) {
		if (xi[i] >= 0) {
			++a;
			if (a == 1) {
				pos[a] = xi[i];
				continue;
			}
			pos[a] = pos[a - 1] + abs(xi[i] - xi[i - 1]);
		}
	}
	int b = 0;
	for (int i = n; i >= 1; --i) {
		if (xi[i] < 0) {
			++b;
			if (b == 1) {
				neg[b] = -xi[i];
				continue;
			}
			neg[b] = neg[b - 1] + abs(abs(xi[i]) - abs(xi[i + 1]));
		}
	}
	long long answer = 9e18;
	for (int i = 0; i <= k; ++i) {
		if (min(a, i) + min(k - i, b) == k) {
			//cout << i << " " << pos[min(a, i)] << " " << neg[min(k - i, b)] << '\n';
			answer = min(answer, 2 * pos[min(a, i)] + neg[min(k - i, b)]);	
		}
		
	} 
	for (int i = 0; i <= k; ++i) {
		if (min(b, i) + min(k - i, a) == k) {
			//cout << i << " " << pos[min(a, i)] << " " << neg[min(k - i, b)] << '\n';
			answer = min(answer, pos[min(k - i, a)] + 2 * neg[min(i, b)]);	
		}
		
	} 
	cout << answer;
}

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

typedef long long ll;

int main() {
    int N, A;
    cin >> N;
    map<int, int> mp;
    rep(i, N) {
        cin >> A;
        mp[A]++;
    }
    int ans = 0;
    for (auto i : mp) {
        ans += i.second % 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 4864