akhauriyash/Code-Regression huggingface dataset:
n = gets.to_i
t = gets.chomp.split(" ").map(&:to_i)
m = gets.to_i

total = t.inject(0) {|s, i| s = s + i}

(0...m).each do |i|
  a,b = gets.chomp.split(" ").map(&:to_i)
  puts total - t[a-1] + b
end


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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }
  sort(v.rbegin(), v.rend());
  int alice = 0;
  int bob = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0)
      alice += v[i];
    else
      bob += v[i];
  }
  cout << alice - bob << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
#define N 100010
using namespace std;
int a[N],ans[N];

int main(){
	int n,k=1,temp=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
    {
        scanf("%d",a+i);
        temp+=k*a[i];
        k=-k;
    }
    ans[1]=temp;
    for(int i=2;i<=n;i++)
    {
        ans[i]=2*a[i-1]-temp;
        temp=ans[i];
    }
    for(int i=1;i<=n;i++)
    {
        printf("%d%c",ans[i],i==n?'\n':' ');
    }
	return 0;
}


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

using namespace std;
typedef long long int ll;
#define debug(val) "[ " << #val " : " << (val) << " ]\n"
#define space " "
#define space " "
#define vi vector<int>
#define PI atan(1)*4
#define pb push_back
#define ff first
#define ss second
#define PI atan(1)*4

const int INF = (int)1e9 ;
void solve() {
	string s,t;
	cin >> s ;
	cin >> t ;
	int n = (int)s.size() ;
	int m = (int)t.size() ;
	vector<vector<int> > dp(n,vector<int>(m,0)) ;
	dp[0][0] = 0 ;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(s[i] == t[j]) {
				dp[i][j]=1 ;
				if(i>0&&j>0) dp[i][j] += dp[i-1][j-1] ;
			}else{
				if(i>0)dp[i][j] = max(dp[i][j],dp[i-1][j]);
				if(j>0)dp[i][j] = max(dp[i][j],dp[i][j-1]);
			}
		}
	}
//	for(int i=0;i<n;i++){
//		for(int j=0;j<m;j++){
//			cerr << dp[i][j]<< space ;
//		}
//		cerr << endl;
//	}
	string res = "";
	int i = n-1 , j = m-1;
	while(i>0 && j >0 ) {
		if(s[i] == t[j]) {
            res += s[i] ;
            i--,j--;
		}else{
			if(dp[i-1][j] >= dp[i][j-1]){
				i--;
			}else{
				j--;
			}
		}
	}
	if(i >=0 || j >= 0 ) {
	    if(dp[i][j] != 0 ) res +=( (i == 0 ) ? s[i] : t[j] );
	}
	//cout << dp[n-1][m-1] << endl ;
	reverse(res.begin(), res.end());
	cout << res << endl;

}
int main() {
#ifdef _DEBUG // place in cmake-build-debug folder
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int q = 1;
    //cin >> q;
    for (int i = 1; i <= q; i++) {
        // cout << "Case #" << i << ": ";
        solve();
    }
}


Measured memory_bytes: 38504
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

int main(){
    string s; cin>>s;
    if(s=="Sunny") cout<<"Cloudy"<<endl;
    if(s=="Cloudy") cout<<"Rainy"<<endl;
    if(s=="Rainy") cout<<"Sunny"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int64_t ans = max(A, B);
  while (1) {
    if (ans % A == 0 && ans % B == 0) {
      break;
    }
    ans += max(A, B);
  }
  cout << ans << endl;
}

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

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,j;
    cin>>n;
    int p[n];
    vector<int>v,v1;
    for(int i=0;i<n;i++)
    {
        cin>>p[i];
        v.push_back(p[i]);
        v1.push_back(p[i]);
    }
    sort(v.begin(),v.end());
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(v[i]!=v1[i])
        {
            c++;
        }
    }
    c>=3?cout<<"NO\n":cout<<"YES\n";

    return 0;

}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  char str[100][101] = {0};
  int h = 0, w = 0;
  int i;//forのループ

  scanf("%d%d", &h, &w);
  for(i=0; i<h; i++){
    scanf("%s", str[i]);
  }
//一番上の行
  for(i=1; i<=w+2; i++){
    printf("#");
  }
  printf("\n");

  for(i=0; i<h; i++){
    printf("#");
    printf("%s", str[i]);
    printf("#\n");
  }
//一番下の行
  for(i=1; i<=w+2; i++){
    printf("#");
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#define MAX_S 100000

int main(void) {
  int sx, sy, tx, ty;
  scanf("%d%d%d%d", &sx, &sy, &tx, &ty);

  char ANS[MAX_S];
  int dst = 0;
  for(int i = sy; i < ty; i++)
    ANS[dst++] = 'U';
  for(int i = sx; i < tx; i++)
    ANS[dst++] = 'R';
  for(int i = ty; i > sy; i--)
    ANS[dst++] = 'D';
  for(int i = tx; i > sx; i--)
    ANS[dst++] = 'L';
  ANS[dst++] = 'L';
  for(int i = sy; i < ty+1; i++)
    ANS[dst++] = 'U';
  for(int i = sx-1; i < tx; i++)
    ANS[dst++] = 'R';
  ANS[dst++] = 'D';
  ANS[dst++] = 'R';
  for(int i = ty; i > sy-1; i--)
    ANS[dst++] = 'D';
  for(int i = tx+1; i > sx; i--)
    ANS[dst++] = 'L';
  ANS[dst++] = 'U';
  ANS[dst++] = '\0';

  printf("%s\n", ANS);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
int main() {
  string S;
  ll K;
  cin >> S;
  cin >> K;
  for (int i=0; i<S.size(); i++) {
    if (S[i] != '1') {
      cout << S[i] << endl;
      return 0;
    }
    if (S[i] < '1' || '9' < S[i]) return 1;
    if (i == K-1) {
      cout << S[i] << endl;
      return 0;
    }
  }
  return 1;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int N;
    long a[100000];
    long b[100000];
    long sum[100000];
    long p[100000];
    long add_a[100000];
    long add_b[100000];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> p[i];
    }
    for(int i = 0; i < N; i++){
        add_a[i] = 0;
        add_b[i] = 0;
        a[i] = i+1;
        b[i] = N-i; 
    }
    for(int i = 0; i < N; i++){
        sum[i] = a[p[i]-1]+b[p[i]-1];
    }
    for(int i = 1; i < N; i++){
        if(sum[i] <= sum[i-1]){
            long diff = sum[i-1] - sum[i] + 1;
            sum[i] += diff;
            add_a[p[i]-1] = diff;
            add_b[p[i]-1] = diff;
            // /cout << diff << endl;
        }
    }
    for(int i = 1; i < N; i++){
        add_a[i] += add_a[i-1];
    }
    for(int i = N-2; i >= 0; i--){
        add_b[i] += add_b[i+1];
    }
    for(int i = 0; i < N-1; i++){
       cout << a[i] + add_a[i] << ' ';
    }
    cout << a[N-1]+add_a[N-1] << endl;
    for(int i = 0; i < N-1; i++){
        cout << b[i]+add_b[i] << ' ';
    }
    cout << b[N-1]+add_b[N-1] << endl;
}

Measured memory_bytes: 4864
#include <iostream>
#include <algorithm>
using namespace std;
int dp[100001];
int main( void )
{
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for( int i=0; i<N; i++ ) dp[i] = N;
  dp[N] = 0;
  int a[11] = {6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049};
  sort( a, a+11 );
  for( int i=10; i>=0; i-- ){
    for( int j=1; j<=N; j++ ){
      int m = j / a[i];
      for( int k=1; k<=min(m,8); k++ ){
        dp[j-k*a[i]] = min( dp[j-k*a[i]], dp[j]+k );
      }
    }
  }
  int ret = N;
  for( int i=0; i<=N; i++ ){
    ret = min( ret, dp[i] + i );
  }
  cout << ret << endl;
}

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

int main() {
    stack<int> s;
    string i;
    int a, b;
    while (cin >> i) {
        if (i == "+") {
            a = s.top(); s.pop();
            b = s.top(); s.pop();
            s.push(a + b);
        } else if (i == "-") {
            b = s.top(); s.pop();
            a = s.top(); s.pop();
            s.push(a - b);
        } else if (i == "*") {
            b = s.top(); s.pop();
            a = s.top(); s.pop();
            s.push(a * b);
        } else {
            s.push(atoi(i.c_str()));
        }
    }
    cout << s.top() << endl;

    return 0;
}


Measured memory_bytes: 3176
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long d = sc.NextLong();
        long[] c = sc.LongArray();
        long[,] s = new long[d, 26];
        for (int i = 0; i < d; i++)
        {
            for (int j = 0; j < 26; j++)
            {
                s[i, j] = sc.NextLong();
            }
        }

        long[] last = new long[26];

        for (int i = 0; i < d; i++)
        {
            long maxDiff = long.MinValue;
            long answerIndex = 0;
            long secondDiff = long.MinValue;
            long secondIndex = 0;
            long nextMaxScore = 0;
            for (int j = 0; j < 26; j++)
            {
                long diff = 0;
                diff += s[i, j];
                diff += c[j] * (i + 1 - last[j]);
                if (diff > maxDiff)
                {
                    secondDiff = maxDiff;
                    maxDiff = diff;
                    secondIndex = answerIndex;
                    answerIndex = j;
                }
                if (i != d - 1 && s[i + 1, j] > nextMaxScore)
                {
                    nextMaxScore = s[i + 1, j];
                }
            }
            if ((i != d - 1) && (s[i + 1, answerIndex] > s[i, answerIndex] + 300) && (s[i + 1, answerIndex] == nextMaxScore))
            {
                answerIndex = secondIndex;
            }
            last[answerIndex] = i;
            Console.WriteLine(answerIndex + 1);
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int main(){
	ios::sync_with_stdio(false);

	int n;
	string a, b;
	cin >> n >> a >> b;

	for(int i = 0; i < n; i++){
		bool good = true;
		for(int j = 0; i+j < n; j++)
			if(a[i+j] != b[j])
				good = false;
		if(good) cout << 2*n - (n-i), exit(0);
	}

	cout << 2*n;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C;
	cin >> A >> B >> C;
	cout << max(0, C - (A - B)) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define NIL -1
struct Node{int parent,left,right;};
struct Node T[41];
int n,P[41],I[41];
int search(int x[],int target,int size){
    for(int i=0;i<size;i++){
        if(x[i]==target) return i;
    }
    return 0;
}
void Postorder(int x){
    if(x!=NIL){
        Postorder(T[x].left);
        Postorder(T[x].right);
        if(x==P[0]) cout<<x;
        else cout<<x<<" ";
    }
}
void saisei(int x[],int s,int p,int size){
    int l=0,r=0,mid=search(x,s,size);
    int L[40],R[40];
    
    for(int i=0;i<size;i++){
        if(i<mid){L[l]=x[i];l++;}
        else if(i>mid){R[r]=x[i];r++;}
    }
    if(l!=0){
            T[P[p]].left=P[p+1];
            T[P[p+1]].parent=P[p];
            saisei(L,P[p+1],p+1,l);
    }
    if(r!=0){
            T[P[p]].right=P[p+l+1];
            T[P[p+l+1]].parent=P[p];
            saisei(R,P[p+l+1],p+l+1,r);
    }
    
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++) cin>>P[i];
    for(int i=0;i<n;i++) {
        cin>>I[i];
        T[i+1].parent=T[i+1].left=T[i+1].right=NIL;
    }
    saisei(I,P[0],0,n);
    Postorder(P[0]); cout<<endl;
    return 0;
}


Measured memory_bytes: 3108
#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 = 200005;
const int mod = 1000000007;

int ans[maxn];
int f[maxn];

int dfs(int x){
  if(x==0)return 0;
  if(f[x])return f[x];
  int cnt = 0;
  for(int i=0;i<20;i++)if(x&(1<<i))cnt++;
  return dfs(x%cnt) + 1;
}

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;
  string s;
  cin>>n>>s;
  int cc = 0;
  for(int i=0;i<n;i++)cc+=(s[i]=='1');
  int a = 0, b = 0;
  for(int i=0;i<n;i++){
    if(cc-1>0){
      a = (a * 2 + (s[i]=='1'))%(cc-1);
    }
    b = (b * 2 + (s[i]=='1'))%(cc+1);
  }
  int cura = 1, curb = 1;
  for(int i=n-1;i>=0;i--){
    if(s[i]=='1'){
      if(cc==1)ans[i] = 0;
      else {
        ans[i] = dfs((a + (cc-1) - cura)%(cc-1))+1;
      }
    } else {
      ans[i] = dfs((b + curb) %(cc+1))+1;
    }
    if(cc-1>0)cura = cura * 2 % (cc-1);
    curb = curb * 2 %(cc+1);
  }
  for(int i=0;i<n;i++)cout<<ans[i]<<endl;
  return 0;
}

Measured memory_bytes: 4536
#include <bits/stdc++.h>
#define ll long long
#define db double
using namespace std;
const int M=2e5+10,MOD=1E9+7;
ll sum[M],a[M];
int n;
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%lld",&a[i]);
    sum[n]=0;
    for(int i=n-1;~i;i--)
        sum[i]=(sum[i+1]+a[i])%MOD;
    ll ans=0;
    for(int i=0;i<n-1;i++)
        ans=(ans+a[i]*sum[i+1]%MOD)%MOD;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 6936
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vv vector
#define pp pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define fastio                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);
typedef pair<ll, ll> pll;
typedef vv<ll> vll;
typedef vv<pll> vpll;
// #define dbg

int main() {
	fastio;
	ll n;
	cin >> n;
	ll sz=0;
	for (ll i = 1; i <= n; i *= 26) {
		n -= i;
		sz++;
	}
	string ans;
	for(ll i=0; i< sz; i++){
		ans.push_back(n%26 +'a');
		n/=26;
	}
	reverse(all(ans));
	cout<<ans<<endl;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
 
//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 3e5 + 11;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int n, q, v[N], w[N], u, L;
vpii g[N];

main () {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> v[i] >> w[i];

	int m = min(n, (1 << 11) - 1);

	for (int i = 1; i <= m; ++i) {
		vi vv;
		int j = i;
		while (j) {
			vv.pb(j);
			j >>= 1;
		}

		j = sz(vv);
		for (int mask = 0; mask < (1 << j); ++mask) {
		    int s = 0, c = 0;
			for (int x = 0; x < j; ++x)
				if (mask & (1 << x)) {
					s += w[vv[x]];
				 	c += v[vv[x]];
				}      

			g[i].pb({s, c});
		}

		sort(all(g[i]));
		for (int x = 1; x < sz(g[i]); ++x) 
			g[i][x].s = max(g[i][x].s, g[i][x - 1].s);		

	}	
	
				
	cin >> q;

	while (q--) {
		cin >> u >> L;
		vi vv;
		while (u > m) {
			vv.pb(u);
			u >>= 1;
		}

		int ans = 0;
		for (int mask = 0; mask < (1 << sz(vv)); ++mask) {
			int s = 0, c = 0;
			for (int x = 0; x < sz(vv); ++x) 
				if (mask & (1 << x)) {
					s += w[vv[x]];
					c += v[vv[x]];
				}


			if (s <= L) {
				int j = upper_bound(all(g[u]), mp(L - s, inf)) - g[u].begin();
				ans = max(ans, c + g[u][j - 1].s);
			}
		}

		cout << ans << endl;
	}
}


Measured memory_bytes: 34416
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int A, B, C;
  cin>>A>>B>>C;

  if(A == B && B == C) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    long[] g = new long[n];
    for (int i=0;i<n;i++){
      g[i] = scan.nextLong()-i;
    }

    Arrays.sort(g);
    int t = 0;
    if (n%2 == 1){
      t = (int) (n-1)/2;
    }
    else{
      t = (int) n/2;
    }
    long base = g[t];
    long sum = 0;
    for (int i=0;i<n;i++){
      sum += find(base,g[i]);
    }

    System.out.println(sum);
  }

  static long find(long a, long b){
    if (b-a>= 0){
      return b-a;
    }
    else{
      return a-b;
    }
  }

}


Measured memory_bytes: 61996
N,W=map(int,input().split())

def solve_knapsack(capacity):
    # basic checks
 
    dp = [0]*(capacity + 1)
    # populate the capacity = 0 columns, with '0' capacity we have '0' profit

    for i in range(0, N):
        weights,profits = map(int,input().split())
        for c in range(capacity, weights-1, -1):
            tmp = profits + dp[c - weights]
            if tmp > dp[c]: dp[c] = tmp
 
    # maximum profit will be at the bottom-right corner.
    return dp[capacity]
res = solve_knapsack(W)
print(res)

Measured memory_bytes: 7668
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	string s, t; cin >> s >> t;
	t = t.substr(0, t.size() - 1);
	if (s == t)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main()
{
  ll n, r;
  cin >> n >> r;

  if (n >= 10)
  {
    cout << r << endl;
    return 0;
  }

  cout << r + 100 * (10 - n) << endl;

  return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, K): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };
    let A: Vec<usize> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let mut c = std::collections::HashMap::new();
    let mut acc = 0;
    let mut res: i64 = 0;
    let mut s = std::collections::VecDeque::new();
    s.push_back(0);
    c.insert(0, 1);
    for i in 1..(N + 1) {
        if s.len() >= K {
            *c.get_mut(&s.pop_front().unwrap()).unwrap() -= 1;
        }
        acc = (acc + A[i - 1]) % K;
        let lack = (K + i - acc) % K;
        res += *c.get(&lack).unwrap_or(&0);
        s.push_back(lack);
        *(c.entry(lack).or_insert(0)) += 1;
    }
    let ans = res;

    println!("{}", ans);
}


Measured memory_bytes: 19680
'use strict'

function main(s) {

  s = s.split('\n').map(x => Number(x));
  const a = s[0];
  const b = s[1];
  const h = s[2];

  const area = ((a + b) * h) / 2
  console.log(area);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
if __name__ == '__main__':

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

	A = [-1 for _ in range(n)]
	B = []
	for i in range(m):
		x,y = map(int,input().split())
		B.append([x,y])

	flg = True
	
	for a in B:
		x = a[0]
		y = a[1]

		if A[x-1] == -1:
			A[x-1] = y
		else:
			if A[x-1] != y:
				flg = False
				break

	ans = 0
	if flg:
		#穴埋め
		for i,j in enumerate(A):
			if j == -1:
				if i == 0 and len(A) != 1:
					A[i] = 1
				else:
					A[i] = 0

		tmp = ""
		for k in range(n):
			tmp += str(A[k])
		tmp = str(int(tmp))
		if len(tmp) == n :
			ans = int(tmp)
		else:
			ans = -1
	else:
		ans = -1

	print(ans)


Measured memory_bytes: 9152
n = gets.to_i

h = gets.split(' ').map(&:to_i)

dp = Array.new(h.length,0)
dp[0] = 0
dp[1] = (h[1]-h[0]).abs
for i in 1..h.length-2
	#puts "#{i}, #{dp[i-1]}+#{(h[i-1]-h[i+1]).abs}, #{dp[i]}+#{(h[i]-h[i+1]).abs}"
	dp[i+1] = [dp[i-1]+(h[i-1]-h[i+1]).abs, dp[i]+(h[i]-h[i+1]).abs].min
end

puts dp[h.length-1]

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

int main() {
	int N;
	cin >> N;
	int a=0, b=0, c=0, x, y, z;
	rep(i, N) {
		a = i+1;
		b += (N-1)/a;
	}
	std::cout << b << '\n';
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using NX = System.Int64;


public class Prog
{
    public static void Solve()
    {
        long N = NextLong();
        int[] A = LineInt();
        int num = 1;
        bool ok = false;
        for (int i = 0; i < N; i++) {
            if (A[i] == num) {
                ok = true;
                num++;
            }
        }
        if (ok) { Console.WriteLine(N - num + 1); }
        else { Console.WriteLine(-1); }
    }
    public static long RepPow(long x, long p, long m = 1000000007)
    {
        if (p == 0) return 1;
        if (p == 1) return x % m;
        long b = RepPow(x, p / 2, m) % m;
        if (p % 2 == 0) { return (b * b) % m; }
        else { return (x * ((b * b) % m)) % m; }
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        return;
    }
    public static long GCD(long a, long b)
    {
        if (a < b) GCD(b, a);
        long d = a % b;
        while (b != 0)
        {
            d = a % b;
            a = b;
            b = d;
        }
        return a;
    }
    public static long LCM(long a, long b)
    {
        return a / GCD(a, b) * b;
    }
}
public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 34396
#include <iostream>

int n;
long long a[100005];
int main(){
  std::cin>>n;
  for(int i=0;i<n;++i)
    std::cin>>a[i];
  
  bool yes=true;
  for(int i=0;i<n;++i)
    if(a[i]%2!=0)
      yes=false;
  if(yes)
    std::cout<<"second"<<std::endl;
  else
    std::cout<<"first"<<std::endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18

priority_queue<llint,vector<llint>,greater<llint>> que;
priority_queue<llint> q;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

llint n;


void solve(){
	cin >> n;
	llint ans=0;
	for(int i=1;i<=n;i++){
		if(i%3!=0 && i%5!=0)ans+=i;
	}
	cout << ans << endl;


}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 3636
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        try {
            String string = in.readLine();
            char[] array = string.toCharArray();
            int res = 0;
            for (int i = 1; i < string.length(); i++) {
                if (array[i] == array[i-1]) {
                    if (array[i] == '0') {
                        array[i] = '1';
                    } else {
                        array[i] = '0';
                    }
                    res++;
                }
            }
            System.out.println(res);
        } catch (IOException ex) {

        }
    }

}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    vector<P> a;
    rep(i, n){
        int x, y;
        cin >> x >> y;
        a.push_back(make_pair(x, y));
    }
    ll ans = 0;
    sort(a.begin(), a.end());
    priority_queue<int> que;
    int idx = 0;
    for(int d = 1; d <= m; d++){
        while(a[idx].first == d){
            que.push(a[idx].second);
            idx++;
        }
        if(!que.empty()){
            ans += que.top();
            que.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1908
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int n; cin >> n;
  string s; cin >> s;
  string t = "ABC";
  auto itr = s.find(t, 0);
  int ans{};
  while (itr != s.npos) {
    itr = s.find(t, itr + t.size());
    ++ans;
  }
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        n: u32,
        m: u32
    }
    println!("{}",
        n * (n-1) / 2 +
        m * (m-1) / 2);
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
#define YOSHI 2000000

int A[YOSHI];
int size;

void maxHeapify(int i){
    int l,r,largest,t;
    
    l = 2 * i;
    r = 2 * i + 1;
    
    if(l <= size && A[l] > A[i]) largest = l;
    else largest = i;
    
    if(r <= size && A[r] > A[largest]) largest = r;
    
    if(largest != i){
        t = A[i];
        A[i] = A[largest];
        A[largest] = t;
        maxHeapify(largest);
    }
}

int extract(){
    int i;
    
    if(size < 1) return -200000000;
    
    i = A[1];
    A[1] = A[size--];
    maxHeapify(1);
    
    return i;
}

void increase(int i,int k){
    int num;
    
    if(k < A[i]) return;
    
    A[i] = k;
    
    while(i > 1 && A[i / 2] < A[i]){
        num = A[i];
        A[i] = A[i / 2];
        A[i / 2] = num;
        i = i / 2;
    }
}

void insert(int k){
    size++;
    A[size] = -200000000;
    increase(size,k);
}

int main(){
    char array[20];
    int k;
    while(1){
        scanf("%s",array);
        if(array[0] == 'i'){
            scanf("%d",&k);
            insert(k);
        }
        else if(strcmp(array,"extract") == 0){
            printf("%d\n",extract());
        }
        else break;
    }
}


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

int main()
{
	string a; cin>>a;
	int n=a.length();
	//int dp[n], B[n];
	//for(int i=0;i<n;i++) A[i]= a[i]=='g' ? 1 : -1;
	//dp[0]=0;
	int ans=0;
	//int m= ((n/2) &1) ? n/2+1 : n/2;
	for(int i=0;i<n;i++)
	{
		if (a[i]=='p') ans++;
	}
	cout<<(n/2)-ans;
}

Measured memory_bytes: 512
fun main(args: Array<String>){
    val N = readLine()!!.toMutableList().map { it.toString() }
    var a = mutableListOf<String>()

    for(i in N){
        if(i == "B"){
            a = a.dropLast(1).toMutableList()
        }else if(i == "0"){
            a.add("0")
        }else{
            a.add("1")
        }
    }
    println(a.joinToString(separator = ""))
}



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

#define ll long long
#define pb push_back

vector<int>g[100003];
vector<int>v(100003);
queue<int>q;

char a[7][7];
char b[7][7];

int m,n,k;

void copy_matrix()
{
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            b[i][j]=a[i][j];

        }
    }
    return ;
}

void color(int i,int j)
{
    for(int x=0;x<m;x++)
    {
        if(i&(1<<x))
        {
            for(int y=0;y<n;y++)
            {
                b[x][y]='$';
            }
        }
    }
    for(int x=0;x<n;x++)
    {
        if(j&(1<<x))
        {
            for(int y=0;y<m;y++)
            {
                b[y][x]='$';
            }
        }
    }
}

bool check()
{
    int black=0;
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(b[i][j]=='#')
            {
                black++;
            }
        }
    }
    if(black==k)
    {
        return true;
    }
    return false;
}

void solve()
{
    cin>>m>>n>>k;
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            cin>>a[i][j];
        }
    }
    int total = 0;
    for(int i=0;i<(1<<m);i++)
    {
        for(int j=0;j<(1<<n);j++)
        {
            copy_matrix();
            color(i,j);
            if(check())
            {
                total++;
            }
        }
    }
    cout<<total<<endl;
}

int main()
{
    solve();
}











Measured memory_bytes: 5980
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int L;

  cin >> L;
  L--;

  vector<pair<pair<int,int>,int> > ans;

  bool f = false;
  int sum = 0;
  for(int i=0;i<20;i++){
    int q = 19 - i;
    bool p = (L >> q) & 1;

    debug(f);

    if (p && i)
      ans.push_back({{1, i+1}, sum});
    sum += p << q;

    if (f) {
      ans.push_back({{i, i+1}, 1<<q});
      ans.push_back({{i, i+1}, 0});
    }

    f |= p;
  }

  ans.push_back({{1, 20}, sum});

  cout << 20 << " " << ans.size() << endl;

  for (auto e : ans) {
    cout << e.first.first << " " << e.first.second << " " << e.second << endl;
  }


  return 0;
}


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

void solve()
{
	int a,b,n;
 
	while(cin >> a >>b >> n)
	{
		int remain = a % b;
		int ret = 0;
		for(int i=0;i<n;i++)
		{
			remain *= 10;
			ret += remain / b;
			remain %=  b;
		}
	cout << ret << endl;
	}
}

int main(void)
{
	solve();
	return(0);
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

signed main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) { cin >> S[i]; }
  //ワーシャル-フロイド
  //全点最短路門問題

  int N = H * W;
  // d[from][to] は、fromとtoの間のコスト。初期値はMAX。
  vector<vector<ll>> d(N, vector<ll>(N, INF_LL));
  //自分自身への移動はコストなし
  rep(i, N) { d[i][i] = 0; }

  rep(i, N) {
    int w = i % W;
    int h = i / W;
    rep(j, 4) {
      if (S[h][w] == '.') {
        int nw = w + dx[j];
        int nh = h + dy[j];

        if (nw >= 0 && nw < W && nh >= 0 && nh < H) {
          if (S[nh][nw] == '.') {
            d[i][nh * W + nw] = 1;
            d[nh * W + nw][i] = 1;
          }
        }
      }
    }
  }

  rep(i, N) {
    rep(j, N) {
      rep(k, N) { chmin(d[j][k], d[j][i] + d[i][k]); }
    }
  }

  int ans = 0;
  rep(i, N) {
    rep(j, N) {
      PRINT(i)
      PRINT(j)
      PRINT(d[i][j])
      if (d[i][j] != INF_LL) {
        chmax(ans, d[i][j]);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1536
a,b = map(int, input().split())
s = input()

first = s[:a]
hyphen = s[a]
second = s[a+1:]

if len(second) == b and hyphen == "-":
  try:
    int(first)
    int(second)
    print("Yes")
  except:
    print("No")
    
else:
  print("No")
  	

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
    int N;
    int ans = 0;
    cin >> N;
    map<ull, int> count;
    for (ull i = 0; i < N; ++i)
    {
        ull a;
        cin >> a;
        ++count[a];
    }
    for (auto i = count.begin(); i != count.end(); ++i)
    {
        if (i->second % 2 == 1)
        {
            ++ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 9760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.stream.Collectors;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        String[] first = stdin.readLine().split(" ");
        int h = Integer.parseInt(first[0]);
        int w = Integer.parseInt(first[1]);
        int k = Integer.parseInt(first[2]);
        char[][] s = new char[h][w];
        for (int i = 0; i < h; i++) {
            s[i] = stdin.readLine().toCharArray();
        }

        int[] c = new int[h];
        int[] d = new int[h];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (s[i][j] == '#') {
                    c[i]++;
                    d[i]++;
                }
            }
        }

        int[][] cakes = new int[h][w];
        int cake = 1;
        for (int i = 0; i < h; i++) {
            if (c[i] == 0) {
                continue;
            }

            for (int j = 0; j < w; j++) {
                cakes[i][j] = cake;
                if (s[i][j] == '#' && c[i] > 1) {
                    cake++;
                    c[i]--;
                }
            }
            cake++;
        }

        for (int i = 0; i < h; i++) {
            if (d[i] != 0) {
                continue;
            }

            boolean ok = false;
            for (int x = i; x < h; x++) {
                if (d[x] == 0) {
                    continue;
                }
                for (int y = 0; y < w; y++) cakes[i][y] = cakes[x][y];
                ok = true;
                break;
            }

            if (ok) {
                continue;
            }

            for (int x = i; x >= 0; x--) {
                if (d[x] == 0) {
                    continue;
                }
                for (int y = 0; y < w; y++) cakes[i][y] = cakes[x][y];
                ok = true;
                break;
            }
        }

        for (int[] row : cakes) {
            String line = Arrays.stream(row).mapToObj(Integer::toString).collect(Collectors.joining(" "));
            System.out.println(line);
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}


Measured memory_bytes: 35680