akhauriyash/Code-Regression huggingface dataset:
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int n, t[4*N],a[N];
//building the tree
void build(int a[], int v=1, int tl=1, int tr=n) {
    if (tl == tr) {
        t[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = t[v*2] + t[v*2+1];
    }
}
//queries
int sum(int l, int r,int v=1, int tl=1, int tr=n ) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr)
        return t[v];
    int tm = (tl + tr) / 2;
    return sum( l, min(r, tm),v*2, tl, tm)
           + sum(max(l, tm+1), r,v*2+1, tm+1, tr );
}
//
void update(int pos, int new_val,int v=1, int tl=1, int tr=n ) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(pos,new_val,v*2, tl, tm);
        else
            update(pos,new_val,v*2+1, tm+1, tr);
        t[v] = t[v*2] + t[v*2+1];
    }
}
void solve(){
  int n,s=0;cin>>n;map<int,int>m;
  rep(i,1,n)cin>>a[i],m[a[i]]++,s+=a[i];
  int q;cin>>q;
  rep(i,1,q){
    int x,y;cin>>x>>y;
    s+=(y-x)*m[x];
    m[y]+=m[x];m[x]=0;
    cout<<s<<"\n";
  }
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 10348
#include<bits/stdc++.h>
#define int long long
using namespace std;

const int mod = 1e9+7;


int32_t main(){

    string s;   cin >> s;
    bool done = 0;
    int fi = -1 , se =-1;

    for(int x=0;x<s.size();x++){
        if(s[x] == 'C' and (!done)){
            fi = x ;    done = 1;
        }

        if(s[x] == 'F')
            se = x;
    }

    if(fi == -1 or se == -1){
        return cout << "No"   , 0;
    }

    cout << (fi <= se ? "Yes" : "No");


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int s[4] = {},a,b;
  cin >> a >> b;s[a-1]++;s[b-1]++;
  cin >> a >> b;s[a-1]++;s[b-1]++;
  cin >> a >> b;s[a-1]++;s[b-1]++;
  if(s[0]!=3 && s[1]!=3 && s[2]!=3 && s[3]!=3) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
S = input()
i = len(S)
while i > 0:
    if S[i - 5:i] in {'dream', 'erase'}:
        i -= 5
    elif S[i - 6:i] == 'eraser':
        i -= 6
    elif S[i - 7:i] == 'dreamer':
        i -= 7
    else:
        print('NO')
        break
else:
    print('YES')


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,M;
    cin>>N>>M;
    int ans=1;
    for(int i=1;i*i<=M;i++){
        if(M%i!=0) continue;
        int x=M/i;
        if(x>=N) ans=max(ans,i);
        if(i>=N) ans=max(ans,x);

    }
    cout << ans <<endl;



}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	int n;
	char s[10001];
	int i,len=0,x=0;
	scanf("%d %s",&n,s);
	len=strlen(s);
	for(i=0;i<len;i++){
		x=s[i]-'A';
		x=x+n;
		x=x%26;
		printf("%c",'A'+x);
	}
	return 0;
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define pback push_back
#define mpair make_pair
#define MODN 1000000007

using namespace std;

#define ull long long

int main(){

    int a;
    string s;
    cin >> a;
    cin >> s;

    cout << (a >= 3200 ? s : "red");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#define INF 1000000000
using namespace std;
double mp[101][101];
bool flg[101];
double dis[101];
int n;

double prim() {
  double sum = 0;
  for(int i=0;i<=n;i++) flg[i] = 0,dis[i] = INF;
  dis[0] = 0;

  for(int q=0;q<n;q++) {
    int nx;
    double dmin = INF;
    for(int i=0;i<n;i++) 
      if(dmin > dis[i] && flg[i] == 0) dmin = dis[i],nx = i;
    flg[nx] = 1;
    sum+=dmin;
    for(int i=0;i<n;i++) 
      if(mp[nx][i] < dis[i]) dis[i] = mp[nx][i];
  }
  return sum;

}

int main() {


  while(1) {
    cin >> n;
    if(n == 0) break;

    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
	mp[i][j] = INF;

    for(int i=0;i<n;i++) {
      double x[101],y[101],z[101],r[101];
      cin >> x[i] >> y[i] >> z[i] >> r[i];
      
      for(int j=0;j<i;j++) {
	mp[i][j] = sqrt ((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])+(z[i]-z[j])*(z[i]-z[j]) )-r[i]-r[j];
	//	cout << mp[i][j] << endl;
	if(mp[i][j] < 0) mp[i][j] = 0;
	mp[j][i] = mp[i][j];
      }
    }

    printf("%.3f\n",prim());
  }

  return 0;
}

Measured memory_bytes: 1328
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll a[n + 1], b[n + 1], c[n + 1];
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++) cin >> c[i];
    sort(a, a + n);
    sort(c, c + n);
    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        ll idxa = lower_bound(a, a + n, b[i]) - a;
        ll idxc = upper_bound(c, c + n, b[i]) - c;
        ans += idxa * (n - idxc);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
a, b = map(int, input().split())
if a <= 0 <= b:
    ans = 'Zero'
elif a <= b < 0:
    if (b-a+1) % 2:
        ans = 'Negative'
    else:
        ans = 'Positive'
else:
    ans = "Positive"
print(ans)


Measured memory_bytes: 9064
// link:https://atcoder.jp/contests/dp/tasks/dp_a
// [prajwal1721]
// g++ -Wall -Wextra -Wshadow filename.cpp
// ./a.out >input <output
/*comments:
*/



#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b))
#define bits(x) __builtin_popcountll(x)
#define vi              vector<int>
#define vl              vector<ll>
#define all(v)          v.begin(),v.end()
#define UNIQUE(X)       (X).erase(unique(all(X)),(X).end())



typedef long long int ll;
void solve()
{
    ll n,t,m;cin>>n;
    vector<ll> v;
    for(int i=0;i<n;i++){cin>>t;v.push_back(t);}
    ll ans[n+1]={0};
    for(int i=1;i<=n;i++)ans[i]=INT32_MAX;
    ans[1]=0;
    for(int i=1;i<=n;i++)
    {
        if(i+1<=n)ans[i+1]=min(ans[i+1],abs(v[i]-v[i-1])+ans[i]);
        if(i+2<=n)ans[2+i]=min(ans[i+2],abs(v[i+1]-v[i-1])+ans[i]);
    }
    cout<<ans[n]<<'\n';

}


int main()
{ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // ll t;cin>>t;
    // cout<<t<<"Hi test complete\n";
    // while(t--)
        {
            solve();
        }


    return 0;
}

Measured memory_bytes: 5040
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] h = new int[N];
        dp = new long[N];
        for (int i = 0; i < N; i++) {
            h[i] = sc.nextInt();
        }
        Arrays.fill(dp, INF);
        dp[0] = 0;
        for (int i = 0; i < N; i++) {
            long c = INF;
            for (int j = 1; j <= K; j++) {
                if (i + j >= N) {
                    break;
                }
                dp[i + j] = Math.min(dp[i + j], dp[i] + Math.abs(h[i] - h[i + j]));
            }
        }
        System.out.println(dp[N - 1]);
    }
}

Measured memory_bytes: 50072
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int A, B, T;
    cin >> A >> B >> T;
    cout << (B * (T / A)) << endl;
    return 0;
}

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

#define WHITE 1
#define BLACK 2
#define GRAY 3
#define M 100
#define INFTY (1<<21)

int n,color[M],A[M][M];

int prim(){
  int d[M],p[M],u = -1,min;

  for(int i = 0;i < n;i++){
    color[i] = WHITE;d[i] = INFTY;p[i] = -1;
  }
  d[0] = 0;

  while(1){
    min = INFTY;
    u = -1;
    for(int i = 0;i < n;i++){
      if(color[i] != BLACK && d[i] < min){
        min = d[i];
        u = i;
      }
    }
    if(u == -1) break;

    color[u] = BLACK;

    for(int i = 0;i < n;i++){
      if(color[i] != BLACK && A[u][i] != -1){
        if(A[u][i] < d[i]){
          d[i] = A[u][i];
          p[i] = u;
          color[i] = GRAY;
        }
      }
    }
  }

  int re = 0;
  for(int i = 0;i < n;i++){
    if(p[i] != -1) re += A[i][p[i]];
  }

  return re;
}

int main(){

  cin >> n;
  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      cin >> A[i][j];
    }
  }

  cout << prim() << endl;

  return 0;
}



Measured memory_bytes: 3112
import java.io.*;
import java.nio.CharBuffer;
import java.util.ArrayList;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        int[] a = new int[n + 1];
        int[] b = new int[n + 1];
        for (int i = 1; i <= n; ++i)
            a[i] = scanner.nextInt();
        ArrayList<Integer> ans = new ArrayList<>(n);
        for (int i = n; i >= 1; --i) {
            if (b[i] % 2 != a[i]) {
                for (int j = 1; j * j <= i; ++j) {
                    if (i % j == 0) {
                        b[j] ^= 1;
                        if (j * j != i)
                            b[i / j] ^= 1;
                    }
                }
                ans.add(i);
            }
        }
        writer.println(ans.size());
        for (int i = ans.size() - 1; i >= 0; --i)
            writer.print(ans.get(i) + " ");
        writer.println();

        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        int nextInt() {
            return Integer.valueOf(next());
        }

        long nextLong() {
            return Long.valueOf(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 48408
#include<stdio.h>
int X[]={0,1,0,-1};
int Y[]={1,0,-1,0};
int main(){
  int h,w,i,j,d[300][300],y[100010],x[100010],a,b=1e9+1,ny,nx,t,r;
  char s[300][300];
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      scanf(" %c",&s[i][j]);
      if(s[i][j]=='%')s[y[0]=i][x[0]=j]='#';
      d[i][j]=1e9;
    }
  }
  d[y[0]][x[0]]=t=0;
  for(r=1;r-t;t++){
    for(i=0;i<4;i++){
      ny=y[t]+Y[i];
      nx=x[t]+X[i];
      if(s[ny][nx]=='#'||ny<0||ny>=h||nx<0||nx>=w)continue;
      d[ny][nx]=d[y[t]][x[t]]+1;
      if(s[ny][nx]=='@')a=d[ny][nx];
      if(s[ny][nx]=='$'&&b>d[ny][nx])b=d[ny][nx];
      s[y[r]=ny][x[r]=nx]='#';
      r++;
    }
  }
  //printf("%d %d\n",a,b);
  printf("%s\n",a>=b||a==1e9?"No":"Yes");
  return 0;
}
  

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

int cnt;
int main(){
	int a, b;
	cin>>a>>b;
	
	for(int i=(b-1)/0.1; i<=(b+1)/0.1; i++){
		if(int(i*0.08)==a && int(i*0.1)==b){
			cnt++;
			cout<<i<<endl;
			break;
		}
	}
		
	if(cnt==0) cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define ALL(a) a.begin(),a.end()
#define PI  acos(-1)
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
typedef long double ld;
int main() {
    int n, ma, mb; cin >> n >> ma >> mb;
    int A[41], B[41], C[41], dp[41][411][411];
    rep(i, n) cin >> A[i] >> B[i] >> C[i];
    Fill(dp, 1 << 27);dp[0][0][0]=0;
    rep(i, n) {
        rep(ca, 411) {
            rep(cb, 411) {
                if (dp[i][ca][cb] == 1 << 27) continue;
                dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb]);
                dp[i + 1][ca + A[i]][cb + B[i]] = min(dp[i + 1][ca + A[i]][cb + B[i]], dp[i][ca][cb] + C[i]);
            }
        }
    }int ans = 1 << 28;
    req(ca, 410) {
        req(cb, 410) {
            if (ca * mb == cb * ma) ans = min(ans, dp[n][ca][cb]);
        }
    }
    if(ans == 1 << 27) ans = -1;
    cout << ans << endl;
}

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

int main() {
	long long n, m;
	cin >> n >> m;
	if (n >= 2 && m >= 2)cout << (n - 2)*(m - 2) << endl;
	else if (n == 1 && m >= 2)cout << m - 2 << endl;
	else if (n >= 2 && m == 1)cout << n - 2 << endl;
	else if (n == 1 && m == 1)cout << 1 << endl;
}


Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <limits>//setprecision
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#include <numeric> //accumulate,,,
#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
const int MOD = 1000000007;
typedef pair<long long,long long> P;

void chmax(long long &a,long long b){if(a < b) a = b;}
void chmin(long long &a,long long b){if(a > b) a = b;}

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % MOD;
    return res %= MOD;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a; else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    string S,T;cin >> S >> T;
    //所属判定
    vector<bool> alpha(26);
    bool ok = true;
    for(int i = 0;i<T.size();i++) alpha.at(T.at(i)-'a') = true;
    for(int i = 0;i<S.size();i++) alpha.at(S.at(i)-'a') = false;
    for(int i = 0;i<26;i++) if(alpha.at(i)) ok = false;
    if(!ok){
        cout << -1 << endl;
        return 0;
    }
    vector<vector<long long>> alphaIndex(26);
    for(long long i = 0;i<S.size();i++){
        alphaIndex.at(S.at(i)-'a').push_back(i+1);
    }
    long long ans = 0;
    long long nowIndex = 0;
    for(int i = 0;i<T.size();i++){
        //出現場所を二分探索 前のindexより後の方が良い
        long long left = -1,right = alphaIndex.at(T.at(i)-'a').size()-1;
        while(right - left > 1){
            long long mid = left+(right-left)/2;
            if(nowIndex >= alphaIndex.at(T.at(i)-'a').at(mid)){
                left = mid;
            }
            else{
                right = mid;
            }
        }
        if(nowIndex < alphaIndex.at(T.at(i)-'a').at(right)){
            ans += alphaIndex.at(T.at(i)-'a').at(right)-nowIndex;
            nowIndex = alphaIndex.at(T.at(i)-'a').at(right);
        }
        else{
            ans += S.size()-nowIndex;
            ans += alphaIndex.at(T.at(i)-'a').front();
            nowIndex = alphaIndex.at(T.at(i)-'a').front();
        }
        if(nowIndex == S.size()) nowIndex = 0;
        //cout << ans << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4560
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
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; }

using namespace std;
typedef pair<ll, ll> pint;


void yesno(bool b) {
    if (b) {
        cout << "Yes" << endl;
    }     else {
        cout << "No" << endl;
    }

}

int main(){
    int N;
    cin >> N;
    set<string> S;
    rep(i, N) {
        string t;
        cin >> t;
        S.insert(t);
    }
    int ans = 0;
    for(auto i: S) {
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 19096
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, modinv, bitSearch, bitList, dfs, bfs, dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color; vll path; vl D; ll C;
//***********//
int main() {
	cin >> N >> K;
	ll ans = N;
	ans = min(ans, N % K);
	ll pre = abs(N % K - K);
	ans = min(ans, pre);
	pre = abs(pre - K);
	ans = min(ans, pre);
	cout << ans;
}

Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut ws = s.trim().split_whitespace();
    let _ = ws.next().unwrap();
    let x = ws.next().unwrap();
    println!("A{}C", x.chars().nth(0).unwrap());
}



Measured memory_bytes: 4352
#include<stdio.h>

int main(){
  int n,a[2][100],sum=0,max=0,i,j;
  scanf("%d",&n);
  for(i=0;i<2;i++){
    for(j=0;j<n;j++){
      scanf("%d",&a[i][j]);
    }
  }
  for(i=0;i<n;i++){
    sum=0;
    for(j=0;j<n;j++){
      if(j<i)sum+=a[0][j];
      else if(j==i)sum+=a[0][j]+a[1][j];
      else sum+=a[1][j];
    }
    if(max<sum) max=sum;
  }
  printf("%d\n",max);
}

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

int main(){
	int N,A,B;
	string s;

	cin>>N>>A>>B;
	cin>>s;

	int cnt=0,cntA=0,cntB=0;
	for(int i=0;i<N;i++){
		if(cntA+cntB<A+B){
			if(s[i]=='a'){
				cout<<"Yes"<<endl;
				cntA++;
			}
			else if(s[i]=='b'){
				if(cntB<B){
					cout<<"Yes"<<endl;
					cntB++;
				}
				else{
					cout<<"No"<<endl;
				}
			}
			else {
				cout<<"No"<<endl;
			}
		}
		else{
			cout<<"No"<<endl;
		}
	}
	return 0;

}


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

struct StNumCnt
{
  StNumCnt() :
    m_nNum(0), m_nCnt(0)
  { }

  int m_nNum;
  int m_nCnt;
};

void input(vector<int>& rvnNum)
{
  int nSize;
  cin >> nSize;
  rvnNum.resize(nSize);

  for (int& rnElm : rvnNum)
    cin >> rnElm;
}

int calcMaxTogetherCnt(const vector<int>& cnrvnNum)
{
  map<int, int> mpNumCnt;
  for (int nNum : cnrvnNum)
  {
    mpNumCnt[nNum]++;
    mpNumCnt[nNum - 1]++;
    mpNumCnt[nNum + 1]++;
  }

  int nMaxCnt = 0;
  for (pair<const int, int> PNumCnt : mpNumCnt)
    nMaxCnt = max(PNumCnt.second, nMaxCnt);

  return nMaxCnt;
}

int main()
{
  vector<int> vnNum;

  input(vnNum);
  cout << calcMaxTogetherCnt(vnNum) << endl;

  return 0;
}

Measured memory_bytes: 8008
import sys

n = int(input())

h = list(map(int, input().split()))

max_num = 0
for i in range(len(h)):
  max_num = max(max_num, h[i])
  if max_num - h[i] >= 2:
    print("No")
    sys.exit(0)
    
print("Yes")

Measured memory_bytes: 14396
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

// 素数。エラトステネスの篩
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}

void Main()
{
    int q;cin>>q;
    int n=1e5+10;
    sieve(n+10);

    VI c(n);
    FOR(i,1,n){
        if(IsPrime[i] && IsPrime[(i+1)/2]){
            c[i]++;
        }
        c[i] += c[i-1];
    }

    REP(i,q){
        int l,r;cin>>l>>r;
        cout<<c[r]-c[l-1]<<endl;
    }

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <string>
#include <iostream>
#define SIZE 100005
#define INF 100000000000000000LL

using namespace std;
int main()
{

	set<char> s;
	string t;
	map<char, int>m;
	int n;
	cin >> n;
	string march = "MARCH";
	for (int i = 0; i < n; i++) {
		cin >> t;
		if (march.find(t[0]) == string::npos) continue;
		if (s.find(t[0]) == s.end() ) {
			s.insert(t[0]);
			m[t[0]] = 1;
		}
		else {
			m[t[0]] = m[t[0]] + 1;
		}
	}
	vector<char> v(m.size());
	
	long long sum = 0;
	char cr[3];
	if (m.size() < 3) {
		cout << 0;
	}
	else {
		for (int i = m.size() - 1; i > int(m.size()) - 4; i--) {
			v[i] = 1;
		}
		vector<int> vec(s.begin(), s.end());
		set<string> oc;
		memset(cr, 0, sizeof(cr));
		do {
			long long tmp = 1;
			int cnt = 0;
			for (int i = 0; i < v.size(); i++) {
				if (v[i] == 0)continue;
				char c = vec[i];
				int mc = m[c];
				tmp *= mc;
				cr[cnt]=c;
				cnt++;
			}
			sort(cr, cr + 3);
			
			if (oc.find(cr) == oc.end()) {
				sum += tmp;
				oc.insert(cr);
			}
		} while (next_permutation(v.begin(), v.end()));
		cout << sum;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <map>
typedef long long ll;
using namespace std;
#define rep(i,n) for (int i = 0; i <= int(n); i++)
#define mod 1000000007

int main() {
	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200) {
		cout << s << endl;
	}
	else {
		cout << "red" << endl;
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ld x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
ll fact_[5000000];
ll comb(ll x, ll y, ll mod = Mod) {
	if (!fact_[0]) {
		fact_[0] = 1;
		for (int i = 1; i < 5000000; i++) {
			fact_[i] = fact_[i - 1] * i % mod;
		}
	}
	if (x < y) return 0;
	return mod_pow(fact_[x], mod, mod) *
		mod_pow(fact_[x - y], mod - 2, mod) % mod *
		mod_pow(fact_[y], mod - 2, mod) % mod;
}//xCy
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int x[2];
signed main() {
	cin >> x[0] >> x[1];
	int ans = 0;
	for (int i = 0; i < 2; i++) {
		for (int j = 1; j <= 3; j++) {
			if (x[i] == j) {
				ans += 3 - j + 1;
			}
		}
	}
	ans *= 100000;
	if (x[0] == x[1] && x[0] == 1)  ans += 400000;
	cout << ans << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;





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

int arr[n];for(int index = 0 ;index < n;index++)
{
    cin>>arr[index];
}

int ans = 0;
for(int index = 0 ;index< n ;index++)
    if(arr[index]==index+1)
    ans++;

for(int index = 0;index < n;index+=2)
{
    if(arr[index]==index+1&&arr[index+1]==index+2)
    {
        ans--;
    }
    else
        index--;
}
cout<<ans<<endl;

 return 0;
}


Measured memory_bytes: 4020
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  int x, y;
  cin >> x >> y;
  cout << x + y / 2 << endl;
}


Measured memory_bytes: 256
/* Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define foref(i, a, b) for (int i = b - 1, to = a; i >= to; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(v) (int)v.size()
#define pb push_back
typedef long long Long;
typedef pair<Long, Long> Pair;
const Long MX = (1e7);
Long f[MX + 2];
Long div(Long x) {
  Long ans = 1;
  while (x > 1) {
    Long fact = f[x];
    Long cnt = 1;
    while (x % fact == 0) {
      cnt++;
      x /= fact;
    }
    ans *= cnt;
  }
  return ans;
}
void solve() {
  for (int i = 1; i <= MX; i++) f[i] = i;
  for (Long i = 2; i * i <= MX; i++)
    if (f[i] == i) {
      for (Long j = i * i; j <= MX; j += i) f[j] = i;
    }
  Long n;
  cin >> n;
  Long ans = 0;
  fore(i, 0, n) {
    ans += (Long)div(i + 1) * (Long)(i + 1);
  }
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t = 1;
  //cin >> t;
  while (t--) solve();

  return 0;
}

Measured memory_bytes: 81788
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z)                                                        \
  cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z  \
       << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair< int, int >
#define ld long double
using namespace std;
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;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vec< int > a(2 * N);
  REP(i, 2 * N) cin >> a[i];
  sort(ALL(a));
  int ans = 0;
  REP(i, N) ans += a[i * 2];
  print(ans);
}

Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=5e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const double PI = acos(-1);
vi v;
void sieve() {
    vector<bool> isPrime(mxN + 1, true);
    isPrime[0] = isPrime[1] = 0;
    for (ll i = 2; i <= mxN; ++i) {
        if (isPrime[i]) {
            v.pb(i);
            for (int j = i * 2; j <= mxN; j += i)
                isPrime[j] = 0;
        }
    }
}
void solve(){
    //12
    string s;
    cin>>s;
    int res=1e9;
    loop(sz(s)-2,i,0){
        res=min(res,abs(753-((s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0'))));
    }
    cout<<res<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3580
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        while (true) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == 0 && b == 0) {
                break;
            }
            int n = sc.nextInt();
            HashMap<Integer, HashSet<Integer>> map = new HashMap<>();
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                int y = sc.nextInt();
                if (!map.containsKey(x)) {
                    map.put(x, new HashSet<>());
                }
                map.get(x).add(y);
            }
            long[][] result = new long[a + 1][b + 1];
            result[1][1] = 1;
            for (int i = 1; i <= a; i++) {
                for (int j = 1; j <= b; j++) {
                    if (map.containsKey(i) && map.get(i).contains(j)) {
                        continue;
                    }
                    result[i][j] += result[i - 1][j] + result[i][j - 1];
                }
            }
            sb.append(result[a][b]).append("\n");
        }
        System.out.print(sb);
    }
}



Measured memory_bytes: 26164
#include <stdio.h>
int main(void)
{
    int i,j,k,l,u;
    char sent[199];
    scanf("%s",sent);
    u=0;
    while(sent[u] != NULL)
       u++;
    int ans[100];
    l=0;
    ans[1]=0;
    int x=0;
    for(i=u-1;i>-1;i-=2)
    {
        j=(i+1)/2;
        for(k=0;k<j;k++)
        {
            x+=  (sent[k]==sent[k+j]) ? 0:1;
        }
        if(x==0)
        {
            ans[l]=i+1;
            l++;
        }
       x=0;
    }
    printf("%d",ans[1]);
}

Measured memory_bytes: 128
package main

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

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)

	return i
}

func main() {
	X := nextInt()
	A := nextInt()

	if X < A {
		fmt.Println(0)
	} else {
		fmt.Println(10)
	}
}


Measured memory_bytes: 640
import java.util.Scanner;

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

		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		int q = Integer.parseInt(sc.next());

		int[] a = new int[q];
		int[] an = new int[n];
		for (int i = 0; i < q; i++) {
			a[i] = Integer.parseInt(sc.next());
			an[a[i] - 1]++;
		}

		for (int i = 0; i < n; i++) {
//			System.out.print(an[i]);
			if (k - (q - an[i]) > 0) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}

		sc.close();
	}
}

Measured memory_bytes: 66556
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,m;
    cin>>n;
    map<ll,ll> mp;
    ll d,t;
    rep(i,n){
        cin>>d;
        mp[d]++;
    }
    cin>>m;
    rep(i,m){
        cin>>t;
        if(mp[t]>0) mp[t]--;
        else{
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";
}

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

signed main(void)
{
	int n, m;
	int ans;
	cin >> n >> m;
	
	ans = (n * (n - 1) / 2) + (m * (m - 1) / 2);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define pb push_back
#define fst first
#define snd second
#define INF 0x7fffffff
#define INFLL 0x7FFFFFFFFFFFFFFF
#define lenA(ar) sizeof(ar)/sizeof(*ar)
#define lenrows(mat) sizeof(mat)/sizeof(*mat)
#define lencols(mat) sizeof(*mat)/sizeof(**mat)
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define foreI(i,x,y) for(ll i=x-1;i>=y;i--)
#define max2(a,b) max(a, b)
#define max3(a,b,c) max2(max2(a,b),c)
#define min2(a,b) min(a, b)
#define min3(a,b,c) min2(min2(a,b),c)
#define MOD 1000000009
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 
typedef long long ll;
typedef unsigned long long ull;
 
using namespace std;
ll arr[100010][3];
ll dp[100010][3];
int n;
ll solve(int i, int j){
    if(i==n-1) return arr[i][j];
    ll &r = dp[i][j];
    if(r>-1) return r;
    ll a = 0; ll b = 0;ll c = 0; ll act=arr[i][j];
    if(j!=0) a=solve(i+1, 0)+act;
    if(j!=1) b=solve(i+1, 1)+act;
    if(j!=2) c=solve(i+1, 2)+act;
   return r=max3(a,b,c);
}
 
int main() {
     
    cin>>n;
    arr[n][3];
    memset(dp,-1,sizeof(dp));
    fore(i,0,n){
        fore(j,0,3){
            cin>>arr[i][j];
        }
    }
 
    cout<<max3(solve(0,0),solve(0,1),solve(0,2))<<"\n";
 
    return 0;
}

Measured memory_bytes: 16080
#include <bits/stdc++.h>
using namespace std;
int main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s;
	cin>>s;
	bool a = false, b = false;
	for (int i=0; i<=2; i++){
		if (s[i] == 'A'){
			a = true;
		}
		else if (s[i] == 'B'){
			b = true;
		}
	}
	if (a == true && b == true){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define FORR(i,a,b) for (int i = a; i > b; i--)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main(){
    string a, b, c;
    cin >> a >> b >> c;
    
    cout << "A"+b.substr(0,1)+"C" << endl;
    return 0;
}










Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
	int n, r , kq, kq1;
	cin >> n >> r;
	if (n <= 10)
	{
		kq = 100 * (10 - n);
		kq1 = r + kq;
		cout << kq1;
	}
	else
	{
		cout << r;
	}
}



Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
ll n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  if((n+m)%2==1) cout<<(n+m)/2+1<<endl;
  else cout<<(n+m)/2<<endl;
}

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


Measured memory_bytes: 256
import math

n=int(input())

if n==1:
    ans=0

else:
    #入力nは2以上でお願いします
    temp=n
    sqn=int(math.sqrt(temp))
    soinsu=[]
    #soinsu=[[素因数,指数],...]
    for i in range(2,sqn+1):
        count=0
        while temp%i==0:
            temp%i==0#iで割れるなら
            temp=temp//i
            count+=1
        if count!=0:
            soinsu.append([i,count])

    if temp!=1:#割り残した素数を回収
        soinsu.append([temp,1])
    if soinsu==[]:#素数ならば
        soinsu.append([n,1])

            
    ans=0
    for i in range(len(soinsu)):
        ans+=int((-1+math.sqrt(1+8*soinsu[i][1]))/2)



print(ans)

Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

ll n, u, v;
vector<vector<ll>> g;
vector<ll> du, dv;

void dfs(ll v, ll p, ll d, vector<ll> &dist) {
    dist[v] = d;
    rep(i, sz(g[v])) {
        if (g[v][i] == p) continue;
        dfs(g[v][i], v, d + 1, dist);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    cin >> n >> u >> v;
    u--; v--;
    g.resize(n);
    du.resize(n);
    dv.resize(n);
    rep(i, n - 1) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(u, -1, 0, du);
    dfs(v, -1, 0, dv);
    // rep(i, n) printf("%lld%s", du[i], (i == (n - 1)) ? "\n" : " ");
    // rep(i, n) printf("%lld%s", dv[i], (i == (n - 1)) ? "\n" : " ");
    ll mv = 0;
    rep(i, n) {
        if (du[i] < dv[i]) mv = max(mv, dv[i] - 1);
    }
    cout << mv << endl;
    return 0;
}


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

int main(void) {
	int A, B;
	cin >> A >> B;
	int ans = 0;
	int socketNum = 1;

	while (socketNum < B) {
		socketNum--;
		socketNum += A;
		ans++;
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  for(int i=0;4*i<=100;i++)
    for(int j=0; 4*i+7*j<=100;j++)
      if(4*i+7*j==N){
        cout<<"Yes"<<endl;
        return 0;
      }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256